Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprint end pull request #40

Open
wants to merge 234 commits into
base: master
Choose a base branch
from
Open
Changes from 8 commits
Commits
Show all changes
234 commits
Select commit Hold shift + click to select a range
d53cec9
updated time tracking
javier-png Apr 28, 2018
4489154
update
Dammes May 1, 2018
ee77d42
Updated own timetracking.
Dansuf May 1, 2018
0982519
Timetracking updated
jsvdvis May 6, 2018
75d27ce
Added timetracking for previous period
alexandar1000 May 7, 2018
29b672b
Merge remote-tracking branch 'origin/timetracking' into timetracking
alexandar1000 May 7, 2018
38b7fb6
Updated timetracking
alexandar1000 May 8, 2018
6cfb46f
updated timetracking
javier-png May 8, 2018
b3fbc91
updated timetracking
javier-png May 9, 2018
3a86da2
Lots of changes
jsvdvis May 10, 2018
b62c1e4
Tiny layout fix
jsvdvis May 11, 2018
f083329
Removing user's name column and little fixes to previous migrations
Dansuf May 11, 2018
3736473
Fixing database tests according to last changes
Dansuf May 11, 2018
d1939f8
Added all registration form fields apart from language and photo
Dansuf May 11, 2018
a970bc7
Making nullable values in the registration form actually nullable
Dansuf May 11, 2018
f0ca375
Added multiple charts, depending on the card chosen, they change
alexandar1000 May 12, 2018
16aefa5
Previous bug fixed, issue that all result nodes receive the same chart
alexandar1000 May 13, 2018
5d45198
Layout changes, other functional changes
jsvdvis May 13, 2018
c5f3e27
Layout changes, other functional changes
jsvdvis May 13, 2018
7e8f783
Initial version of the users verification page
Dansuf May 13, 2018
3b1cbca
Fixed the bug, the designer pick chart type works good now
alexandar1000 May 14, 2018
4e2352a
Updated timetracking
alexandar1000 May 14, 2018
decfc66
Merge remote-tracking branch 'origin/timetracking' into timetracking
alexandar1000 May 14, 2018
d8d2c7a
Timetracking updated
alexandar1000 May 14, 2018
6acfd48
update for workflow and modelLoad
Dammes May 14, 2018
d0ceaa8
Merge branch 'Patient_User' into designer
Dammes May 14, 2018
3c22bd6
Saving and loading of rules/API-mapping
jsvdvis May 15, 2018
b024d71
Fixed some errors
jsvdvis May 15, 2018
32dc592
Changes that hopefully fix the wrong merge I did
jsvdvis May 15, 2018
dd34b85
Tiny changes
jsvdvis May 15, 2018
a49af19
Merge pull request #29 from RUGSoftEng/designer
Dansuf May 15, 2018
3395b45
Merge branch 'release' into accounts
alexandar1000 May 15, 2018
47ce265
Merge pull request #30 from RUGSoftEng/accounts
alexandar1000 May 15, 2018
bd969d8
Fixing crash in search due to using deleted User attribute
Dansuf May 16, 2018
aa117c1
Updated timetracking
Dansuf May 16, 2018
31bde11
Prepared the chart for inputting data
alexandar1000 May 16, 2018
a7943f6
Extracted the data from the chart to the step
alexandar1000 May 16, 2018
102715a
A bit of tweeking
alexandar1000 May 16, 2018
9ca5af8
Change because some code was deleted
alexandar1000 May 16, 2018
b897c76
Another tweak
alexandar1000 May 16, 2018
e91af80
Merge pull request #31 from RUGSoftEng/designer
jsvdvis May 16, 2018
86730fc
Add ordering of fields in steps into the database
Dansuf May 19, 2018
3442f00
Merge remote-tracking branch 'origin/database' into PDF
javier-png May 19, 2018
8297df3
updates
javier-png May 19, 2018
5846274
Merge remote-tracking branch 'origin/designer' into PDF
javier-png May 19, 2018
f740eac
update timetracking
javier-png May 19, 2018
b9d0366
Added touches properties to database models.
Dansuf May 20, 2018
7bfbcb6
Added a BIG code column to User table.
Dansuf May 20, 2018
88fcac8
Merge branch 'database' into accounts
Dansuf May 20, 2018
af32b4f
Added BIG code to the registration page.
Dansuf May 20, 2018
3d43dba
Merge branch 'accounts' of github.com:RUGSoftEng/2018-Evidencio into …
Dansuf May 20, 2018
0be79e4
Adding registration documents support
Dansuf May 21, 2018
9ddc859
Adding missing BIG code in User model and in the verification page
Dansuf May 21, 2018
03e4c1e
Verification page JS/CSS cleanup and registration attribute lang names
Dansuf May 21, 2018
ef70f21
Installation script
Dansuf May 22, 2018
03f1f2e
More descriptive registration page
Dansuf May 23, 2018
46c85e6
Split DesignerController, Blocked adding of rule at leafNode
jsvdvis May 23, 2018
36ef675
Merge remote-tracking branch 'origin/database' into designer
jsvdvis May 23, 2018
bd8b76a
Merge remote-tracking branch 'origin/designer' into accounts
Dansuf May 23, 2018
3abe743
update
javier-png May 23, 2018
f93a0eb
Merge remote-tracking branch 'origin/designer' into PDF
javier-png May 23, 2018
d0c5bf5
Rewrote Field-editing
jsvdvis May 24, 2018
c53ba6a
Merge remote-tracking branch 'origin/designer' into PDF
javier-png May 25, 2018
c7eeb9c
Merge branch 'designer' of github.com:RUGSoftEng/2017-Evidencio into …
gizemayydin May 25, 2018
f0176fa
My Workflow page finıshed
gizemayydin May 25, 2018
f123c4b
Merge pull request #32 from RUGSoftEng/init-script
Dansuf May 25, 2018
f29588f
Cleaned up code for graph, workflow and search. Edited PDF to store m…
javier-png May 26, 2018
b184bcb
My Workflows page finished
gizemayydin May 26, 2018
2e42b9f
Permissions for viewing specific subpages.
Dansuf May 26, 2018
b5ac2d1
Information page for users awaiting verification
Dansuf May 26, 2018
c17175a
Sending emails on accepting/rejecting accounts.
Dansuf May 26, 2018
6f7a0fa
Automatic mapping, save alert, max/min zoom
jsvdvis May 27, 2018
1895767
the graph now get the "friendly" representation/title from the DB, wi…
javier-png May 28, 2018
9a8aba7
Policies for accessing and modyfing Workflows.
Dansuf May 28, 2018
ae288e2
Compiled resources.
Dansuf May 28, 2018
8cd7ceb
Merge remote-tracking branch 'origin/designer' into PDF
javier-png May 29, 2018
8f60592
Basic email verification support.
Dansuf May 29, 2018
b86b5d6
Correcte redirection after resetting password.
Dansuf May 29, 2018
d0ec73c
Update MyworkflowsController.php
gizemayydin May 30, 2018
eaba0a5
Merge pull request #34 from RUGSoftEng/tempGizem
gizemayydin May 30, 2018
b013dda
Update Gizem (s3611523)
gizemayydin May 30, 2018
a6f66a7
Merge branch 'development' into accounts
Dansuf May 30, 2018
13bb522
Updated own timetracking
Dansuf May 30, 2018
a62e1ea
update timetracking
javier-png May 31, 2018
738d716
Final documents.
Dansuf May 31, 2018
f737631
Lots of changes + Rules-engine test file
jsvdvis May 31, 2018
8f73688
Forgot a file
jsvdvis May 31, 2018
61b082f
Several commits + merge
jsvdvis May 31, 2018
9b8082d
Wrong filename
jsvdvis May 31, 2018
038637b
Updated timetracking (not finished yet)
jsvdvis May 31, 2018
a90e990
Updated timetracking
jsvdvis May 31, 2018
0e6d4e3
Merge pull request #35 from RUGSoftEng/accounts
Dansuf May 31, 2018
a9592ba
Changes based on comments by Tomek
jsvdvis May 31, 2018
60e827b
Merge branch 'designer' into development
Dansuf May 31, 2018
bb8b7ad
Package.json file, hopes it fixes it
jsvdvis May 31, 2018
f7178df
Package.json file, hopes it fixes it
jsvdvis May 31, 2018
1ccc77d
Merge branch 'merge-fix' of github.com:RUGSoftEng/2018-Evidencio into…
Dansuf May 31, 2018
7310011
Fixing the merge after testing.
Dansuf May 31, 2018
54781ed
Merge pull request #38 from RUGSoftEng/merge-fix
Dansuf May 31, 2018
a3df487
Merge pull request #36 from RUGSoftEng/documents
Dansuf May 31, 2018
0b638c2
Merge pull request #39 from RUGSoftEng/timetracking
Dansuf May 31, 2018
865f355
Patient side now has sidebar, Logout button and designer under the dr…
javier-png Jun 2, 2018
8f1cc35
fixed the bug which made an issue at page loading
alexandar1000 Jun 3, 2018
8795fab
fixed a bug about 'mutating the prop'
alexandar1000 Jun 3, 2018
4e88da7
Pushed the value all the way to ModalStep
alexandar1000 Jun 3, 2018
c41603f
The update works
alexandar1000 Jun 4, 2018
991de00
Merge remote-tracking branch 'origin/designer' into designer
alexandar1000 Jun 4, 2018
1a86427
Corrected version after merge
alexandar1000 Jun 4, 2018
9bb1a1d
Finally fixed the graph in ModalStep; Everything works
alexandar1000 Jun 4, 2018
c6349ae
Commit with push
jsvdvis Jun 4, 2018
75fd8d6
Auto stash before merge of "designer" and "origin/designer"
alexandar1000 Jun 4, 2018
993e249
Database support for saving charts.
Dansuf Jun 4, 2018
ed84d31
Edited input for the graph
alexandar1000 Jun 4, 2018
4213f85
Merge remote-tracking branch 'origin/designer' into designer
alexandar1000 Jun 4, 2018
5ffadfa
Reuse the main label as chart options attribute.
Dansuf Jun 4, 2018
b5c951e
Database support for saving charts.
Dansuf Jun 4, 2018
0d5a06c
Reuse the main label as chart options attribute.
Dansuf Jun 4, 2018
cc09b66
Fixing errors in PDF
Dansuf Jun 4, 2018
f13313a
Fixed styling of the sidebar on the patient side.
Dansuf Jun 4, 2018
3dd78a7
Make chart-related columns nullable in the steps table.
Dansuf Jun 4, 2018
ecdde96
Chart and editing working
alexandar1000 Jun 4, 2018
a2b43a3
Merge remote-tracking branch 'origin/designer' into designer
alexandar1000 Jun 4, 2018
6caf74a
Chart working
alexandar1000 Jun 4, 2018
4836e92
hopefully fix
alexandar1000 Jun 4, 2018
78b3c09
v2 changes for Graph.php, results representation, labels, colors now …
javier-png Jun 4, 2018
b70bc80
updated timetracking
javier-png Jun 4, 2018
7782801
Changed initial number of documents to 1 in the registration form.
Dansuf Jun 5, 2018
2e266ad
changed modelsearch modal
Dammes Jun 5, 2018
59568e7
Update DesignerSaveController.php
jsvdvis Jun 5, 2018
d76c2ca
Fixed, BarChart not working
alexandar1000 Jun 5, 2018
ea01a76
Merge remote-tracking branch 'origin/designer' into designer
alexandar1000 Jun 5, 2018
17e2401
Fixed the chart
alexandar1000 Jun 5, 2018
2620af1
Rule removal, some bugs fixed
jsvdvis Jun 6, 2018
d2def73
Created a proper primary key column for API call field mapping in the DB
Dansuf Jun 6, 2018
2d5d91d
Commented recent DB migration
Dansuf Jun 6, 2018
229cfb7
Added variable negation support to the DB.
Dansuf Jun 6, 2018
5515980
Merge remote-tracking branch 'origin/database' into designer
jsvdvis Jun 6, 2018
2760428
Merged database, autofocus
jsvdvis Jun 6, 2018
6c954c0
Update Gizem (s3611523)
gizemayydin Jun 7, 2018
b807a04
More secure token generation for veryfing e-mails.
Dansuf Jun 7, 2018
e148880
Support for queues to send e-mails for faster response.
Dansuf Jun 7, 2018
23846cf
Removal of accounts with unverified e-mail address after 24hrs.
Dansuf Jun 7, 2018
3ded77f
Corrected README note about rerunning commands on new migration.
Dansuf Jun 7, 2018
20fbc05
Saving/loading of results
jsvdvis Jun 8, 2018
4d25ae4
Unique rule-destinations, label removal on api-removal, bug-fixes
jsvdvis Jun 8, 2018
3b3d9d1
Added User Guide, Terms and Conditions, Privacy Policy, Disclaimer, A…
gizemayydin Jun 9, 2018
6d4c115
Changed to Fontello
gizemayydin Jun 9, 2018
ca4458a
Lots of bugfixes, start to sidebar fixing
jsvdvis Jun 9, 2018
64c26a6
Merge pull request #44 from RUGSoftEng/temp3
gizemayydin Jun 9, 2018
f01a450
Modified User Guide
gizemayydin Jun 9, 2018
6194292
More bug-fixing
jsvdvis Jun 9, 2018
d5465a8
Merge remote-tracking branch 'origin/designer' into designer
jsvdvis Jun 9, 2018
19e7cf4
Merge and tiny mistake fixed in saving
jsvdvis Jun 9, 2018
4124b48
Update Gizem (s3611523)
gizemayydin Jun 9, 2018
eb28459
Merge pull request #43 from RUGSoftEng/temp
javier-png Jun 9, 2018
8890d16
Merge remote-tracking branch 'origin/database' into PDF
javier-png Jun 10, 2018
394137e
added default type for tests w/o result step in db.
javier-png Jun 10, 2018
8d04879
Fixed bug that could cause weird behaviour during saving/loading
jsvdvis Jun 10, 2018
d23c95f
Trying to solve PR-conflicts
jsvdvis Jun 11, 2018
aadf83f
viewDesigner -> view-designer
jsvdvis Jun 11, 2018
4f9deee
Fixed bugs, doubled notification-duration
jsvdvis Jun 11, 2018
2ddef07
Merge branch 'development' into accounts
Dansuf Jun 11, 2018
058a8ac
Added account editing page.
Dansuf Jun 11, 2018
c04169a
Improved styling of users verification page.
Dansuf Jun 11, 2018
a03d6e0
Workflows can now be published + including checks for correctness
jsvdvis Jun 12, 2018
cfdbf64
Updated timetracking (12-06)
jsvdvis Jun 12, 2018
38aa70b
I was on designer branch so, updating here
Dammes Jun 12, 2018
977b8f6
Merge branch 'designer' of https://github.com/RUGSoftEng/2018-Evidenc…
Dammes Jun 12, 2018
c1c89b5
added a color-picker to the chart
alexandar1000 Jun 12, 2018
76faffd
Fixed the variables box
alexandar1000 Jun 12, 2018
559ee68
update on workflow
Dammes Jun 12, 2018
6756b73
Merge remote-tracking branch 'origin/designer' into PDF
javier-png Jun 12, 2018
1ef4ebf
Added the trash can icon to the chart items
alexandar1000 Jun 12, 2018
3e593d7
Merge remote-tracking branch 'origin/designer' into designer
alexandar1000 Jun 12, 2018
5508ace
Work on patient side
jsvdvis Jun 12, 2018
1278830
Cleanup
javier-png Jun 12, 2018
2145552
Hid unpublished and/or unverified workflows from patient side.
Dansuf Jun 12, 2018
5fbc5ee
Work continued
jsvdvis Jun 12, 2018
b9ed19a
Rule engine implemented
jsvdvis Jun 12, 2018
152a216
edits to the result, step and graph.
javier-png Jun 12, 2018
e7c9818
Merge branch 'PDF' of https://github.com/RUGSoftEng/2018-Evidencio in…
javier-png Jun 12, 2018
360115c
Fixing commited files with unresolved conflicts.
Dansuf Jun 12, 2018
1ee9267
Fixing one more file with merge conflicts.
Dansuf Jun 12, 2018
fd85dd2
Updated own timetracking.
Dansuf Jun 12, 2018
726ffc6
Update timetracking
jsvdvis Jun 12, 2018
257f5c7
Merge remote-tracking branch 'origin/timetracking' into timetracking
jsvdvis Jun 12, 2018
c316c30
Merge pull request #46 from RUGSoftEng/accounts
Dansuf Jun 12, 2018
44cc934
fixed bugs for results, graph. Added negation functionalities to cont…
javier-png Jun 12, 2018
231c373
Merge branch 'PDF' of https://github.com/RUGSoftEng/2018-Evidencio in…
javier-png Jun 12, 2018
67dc20d
changed workflow radio buttons
Dammes Jun 5, 2018
3ba9021
Revert "changed workflow radio buttons"
Dansuf Jun 12, 2018
3a1d814
update
Dammes Jun 12, 2018
cc65032
Changing smiley faces style to better fit smaller screens.
Dansuf Jun 12, 2018
677356c
update
javier-png Jun 12, 2018
f5e13be
Tiny fixes, added comments, some refactoring
jsvdvis Jun 12, 2018
9eb30b4
Updated the user guide
alexandar1000 Jun 12, 2018
97180af
Merge remote-tracking branch 'origin/PDF' into PDF
alexandar1000 Jun 12, 2018
c32c02e
Code cleanup of graphs and sidebar.
Dansuf Jun 12, 2018
c586953
Updated timetracking
alexandar1000 Jun 12, 2018
f91f8e3
Merge branch 'PDF' of github.com:RUGSoftEng/2018-Evidencio into PDF
Dansuf Jun 12, 2018
2324d04
found new bugs and fixed it
javier-png Jun 12, 2018
4d2455b
Added section of tutorial regarding output
alexandar1000 Jun 12, 2018
0194c4c
Merge remote-tracking branch 'origin/PDF' into PDF
alexandar1000 Jun 12, 2018
dc7bc9b
last update
Dammes Jun 12, 2018
1cfd905
Merge branch 'designer' of https://github.com/RUGSoftEng/2018-Evidenc…
Dammes Jun 12, 2018
2067374
Merge branch 'PDF' into development
Dansuf Jun 12, 2018
a1b8cc7
change graph from post to get
Dammes Jun 12, 2018
7b1aa0d
Update graph.blade.php
Dammes Jun 12, 2018
1d3cb25
Merge branch 'designer' into development
Dansuf Jun 12, 2018
97917f1
Merge pull request #48 from RUGSoftEng/Dammes-patch-1
Dansuf Jun 12, 2018
3292db7
Merge pull request #49 from RUGSoftEng/Dammes-patch-2
Dansuf Jun 12, 2018
26a1646
Updated timetracking
Dansuf Jun 12, 2018
3c259dd
Merge branch 'timetracking' of github.com:RUGSoftEng/2018-Evidencio i…
Dansuf Jun 12, 2018
f017d01
Merge branch 'development' into timetracking
Dansuf Jun 12, 2018
7ba8708
Update WorkflowStep.vue
Dammes Jun 12, 2018
9e543d1
Merge pull request #52 from RUGSoftEng/Dammes-patch-3
Dansuf Jun 12, 2018
db61ab5
update
Dammes Jun 12, 2018
2df91cc
Updated timetracking
jsvdvis Jun 13, 2018
4bd4b88
update
Dammes Jun 14, 2018
297bdc6
Merge pull request #51 from RUGSoftEng/timetracking
Dammes Jun 14, 2018
7558e41
Fixed comments
jsvdvis Jun 24, 2018
fa1afcc
Small fixes mostly to rest-team-related code.
Dansuf Jun 24, 2018
b7a12e7
Moved Controller-methods to appropiate models
jsvdvis Jun 24, 2018
2ff0a48
Divided routes into several separate files.
Dansuf Jun 25, 2018
bfaaa1b
Removed rule engine test
Dansuf Jun 25, 2018
ea77503
Fixes to the final PR in "My Workflows"
Dansuf Jun 26, 2018
fd8ebc7
Added missing "My Workflows" doc.
Dansuf Jun 26, 2018
c368a60
Merge pull request #53 from RUGSoftEng/rest-pr-fixes
Daanra Jun 27, 2018
df6783d
Fixed but in controller + Aleksandar's changes
jsvdvis Jun 29, 2018
eca1202
Replaced Fontello with Fontawesome, fixed bugs
jsvdvis Jun 29, 2018
cd67285
Added typehinting (hopefully correctly)
jsvdvis Jun 30, 2018
c905739
Small mistake in typehinting
jsvdvis Jun 30, 2018
f8fc1b4
Merge branch 'development' into designer-pr-fixes
jsvdvis Jun 30, 2018
c15f14f
Merge pull request #54 from RUGSoftEng/designer-pr-fixes
Dansuf Jul 2, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions LICENSE.txt

This file was deleted.

116 changes: 116 additions & 0 deletions app/Field.php
Original file line number Diff line number Diff line change
@@ -54,4 +54,120 @@ public function usedInRunsInSteps()
{
return $this->belongsToMany('App\Step','model_run_field_mappings','field_id','step_id');
}


/**
* Updates the information of a single variable
*
* @param Array $field Array containing data of field (variable)
* @return void
*/
public function saveSingleField(Array $field) : void
{
$this->friendly_title = $field["title"];
$this->friendly_description = $field["description"];
$this->evidencio_variable_id = $field["id"];
if ($field["type"] == "continuous") {
$this->continuous_field_max = $field["options"]["max"];
$this->continuous_field_min = $field["options"]["min"];
$this->continuous_field_unit = $field["options"]["unit"];
$this->continuous_field_step_by = $field["options"]["step"];
}
$this->save();
}

/**
* Saves/updates the options belonging to a categorical variable.
*
* @param Array $options Array of options
* @return Array Array filled with the database IDs of the saved options.
*/
public function saveCategoricalOptions(Array $options) : Array
{
$optionIds = [];
$savedOptions = $this->options()->get();
foreach ($options as $option) {
if ($savedOptions->isNotEmpty() && ($opt = $savedOptions->where("id", $option["databaseId"]))->isNotEmpty()) {
$opt = $opt->first();
$opt->setInformation($option);
$opt->save();
$savedOptions = $savedOptions->reject(function ($value) use ($option) {
return ($value->id == $option["databaseId"]);
});
} else {
$opt = new Option;
$opt->setInformation($option);
$this->options()->save($opt);
}
$optionIds[] = $opt->id;
}
$savedOptions->map(function ($value) {
$value->delete();
});
return $optionIds;
}

/**
* Removes a field from the database. First detaches and deletes connected options.
*
* @return void
*/
public function removeField() : void
{
$stepsUsing = $this->usedInRunsInSteps()->get();
$stepsUsing->map(function ($value) {
$value->modelRunFields()->detach($this);
});
$options = $this->options()->get();
foreach ($options as $option) {
$option->delete();
}
$this->delete();
}

/**
* Loads a single variable. The variables are called `Fields` in the database.
*
* @return Array Array containing all the fields of the variable and the options, if available.
*/
public function loadField() : Array
{
$retObj = [];
$retObj["databaseId"] = $this->id;
$retObj["title"] = $this->friendly_title;
$retObj["description"] = $this->friendly_description;
$retObj["id"] = $this->evidencio_variable_id;
$options = $this->options()->get();
if ($options->isEmpty()) {
$retObj["type"] = "continuous";
$retObj["options"]["max"] = $this->continuous_field_max;
$retObj["options"]["min"] = $this->continuous_field_min;
$retObj["options"]["step"] = $this->continuous_field_step_by;
$retObj["options"]["unit"] = $this->continuous_field_unit;
} else {
$retObj["type"] = 'categorical';
$retObj["options"] = [];
foreach ($options as $key => $option) {
$retObj["options"][$key] = $option->loadOption();
}
}
return $retObj;
}

/**
* Load a field for an API-call variable mapping.
* Unfortunately some required information for the designer is unknown at this point.
* The localVariable & evidencioTitle are set at the client side.
*
* @return Array Array containing variable information required for api-call variable mapping
*/
public function loadFieldForApiVariableMapping() : Array
{
return [
"evidencioVariableId" => $this->pivot->evidencio_field_id,
"fieldId" => $this->id,
"localVariable" => -1,
"evidencioTitle" => ""
];
}
}
6 changes: 3 additions & 3 deletions app/Http/Controllers/DesignerController.php
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ public function index()
/**
* Fetch model from Evidencio based on its id, used for designer to retrieve variables.
*
* @param HTTP|Request $request Post request containing a Evidencio modelId
* @param Request $request Post request containing a Evidencio modelId
* @return JSON Evidencio model data
*/
public function fetchVariables(Request $request)
@@ -50,8 +50,8 @@ public function fetchVariables(Request $request)
/**
* Fetch models from Evidencio based on their search result, used for designer to search for models.
*
* @param HTTP|Request $request Post request containing a Evidencio Model Search
* @return JSON Evidencio models
* @param Request $request Post request containing a Evidencio Model Search
* @return String Evidencio models (Stringified JSON)
*/
public function fetchSearch(Request $request)
{
178 changes: 3 additions & 175 deletions app/Http/Controllers/DesignerLoadController.php
Original file line number Diff line number Diff line change
@@ -7,11 +7,6 @@
use Illuminate\Support\Facades\Auth;
use App\Workflow;
use App\User;
use App\LoadedEvidencioModel;
use App\Step;
use App\Field;
use App\Option;
use App\Result;

/**
* DesignerController class, handles database- and API-calls for Designerpage.
@@ -27,10 +22,10 @@ public function __construct()
/**
* Loads a workflow from the database based on the workflowId
*
* @param Number $workflowId
* @param Int $workflowId
* @return Array
*/
public function loadWorkflow($workflowId)
public function loadWorkflow(Int $workflowId) : Array
{
$retObj = [];
$usedVariables = [];
@@ -39,175 +34,8 @@ public function loadWorkflow($workflowId)
$retObj["success"] = false;
return $retObj;
}
$retObj = $workflow->loadWorkflow();
$retObj["success"] = true;
$retObj["title"] = $workflow->title;
$retObj["description"] = $workflow->description;
$retObj["languageCode"] = $workflow->language_code;
$retObj["evidencioModels"] = $this->getLoadedEvidencioModels($workflow);
$retObj["isDraft"] = $workflow->is_draft;
$retObj["steps"] = [];
$counter = 0;
$steps = $workflow->steps()->get();
foreach ($steps as $step) {
$stepLoaded = $this->loadStep($step, $counter, $usedVariables);
$retObj["steps"][$counter] = $stepLoaded["step"];
$usedVariables = array_merge($usedVariables, $stepLoaded["usedVariables"]);
$counter++;
}

$retObj["usedVariables"] = $usedVariables;
return $retObj;
}

/**
* Returns the IDs of the loaded Evidencio Models of the Workflow
*
* @param App|Workflow $workflow Workflow to get loaded Evidencio Model IDs from.
* @return Array
*/
private function getLoadedEvidencioModels($workflow)
{
$array = [];
$models = $workflow->loadedEvidencioModels()->get();
foreach ($models as $model)
$array[] = $model->model_id;
return $array;
}

/**
* Loads the relevant information for a step (NOT including the variables)
*
* @param App|Step $dbStep Database Model of Step
* @param Number $stepNum Number that indicates what step in workflow it is.
* @return Array Array containing information of step and the used variables.
*/
private function loadStep($dbStep, $stepNum)
{
$retObj = [];
$retObj["id"] = $dbStep->id;
$retObj["title"] = $dbStep->title;
$retObj["description"] = $dbStep->description;
$retObj["colour"] = $dbStep->colour;
$retObj["level"] = $dbStep->workflow_step_level;
$variables = $this->loadVariablesOfStep($dbStep, $stepNum);
$retObj["variables"] = $variables["varIds"];
$retObj["rules"] = $this->loadStepRules($dbStep);
$retObj["apiCalls"] = $this->loadStepModelApiMapping($dbStep);
$retObj["chartItemReference"] = [];
$retObj["chartRenderingData"] = [
"labels" => [],
"datasets" => [[
"data" => [],
"backgroundColor" => []
]]
];
$retObj["chartTypeNumber"] = $dbStep->result_step_chart_type;
$savedLabels = $dbStep->resultStepChartItems()->get();
foreach ($savedLabels as $key => $label) {
$retObj["chartItemReference"][] = [
"reference" => $label->result_name,
"negation" => $label->pivot->item_is_negated == 1
];
$retObj["chartRenderingData"]["labels"][] = $label->pivot->item_label;
$retObj["chartRenderingData"]["datasets"][0]["data"][] = $label->pivot->item_data;
$retObj["chartRenderingData"]["datasets"][0]["backgroundColor"][] = $label->pivot->item_background_colour;
}
if ($savedLabels->isNotEmpty())
$retObj["type"] = "result";
else
$retObj["type"] = "input";
return ["step" => $retObj, "usedVariables" => $variables["usedVariables"]];
}

private function loadVariablesOfStep($dbStep, $stepNum)
{
$usedVariables = [];
$variables = $dbStep->fields()->get();
$varIds = array_fill(0, $variables->count(), "varId");
foreach ($variables as $key => $value) {
$name = "var" . $stepNum . '_' . $key;
$varIds[$value->pivot->order] = $name;
$usedVariables[$name] = $this->loadVariable($value);
}
return ["varIds" => $varIds, "usedVariables" => $usedVariables];
}

private function loadVariable($dbVariable)
{
$retObj = [];
$retObj["databaseId"] = $dbVariable->id;
$retObj["title"] = $dbVariable->friendly_title;
$retObj["description"] = $dbVariable->friendly_description;
$retObj["id"] = $dbVariable->evidencio_variable_id;
$options = $dbVariable->options()->get();
if ($options->isEmpty()) {
$retObj["type"] = "continuous";
$retObj["options"]["max"] = $dbVariable->continuous_field_max;
$retObj["options"]["min"] = $dbVariable->continuous_field_min;
$retObj["options"]["step"] = $dbVariable->continuous_field_step_by;
$retObj["options"]["unit"] = $dbVariable->continuous_field_unit;
} else {
$retObj["type"] = 'categorical';

$retObj["options"] = [];
foreach ($options as $key => $option) {
$retObj["options"][$key] = [
"title" => $option->title,
"friendlyTitle" => $option->friendly_title,
"databaseId" => $option->id
];
}
}
return $retObj;
}

private function loadStepRules($dbStep)
{
$retObj = [];
$dbRules = $dbStep->nextSteps()->get();
foreach ($dbRules as $dbRule) {
$rule = [];
$rule["title"] = $dbRule->pivot->title;
$rule["description"] = $dbRule->pivot->desription;
$rule["jsonRule"] = json_decode(str_replace('"true"', 'true', $dbRule->pivot->condition));
$rule["target"] = [
"id" => $dbRule->id,
"title" => $dbRule->title,
"colour" => $dbRule->colour
];
$retObj[] = $rule;
}
return $retObj;
}

private function loadStepModelApiMapping($dbStep)
{
$retObj = [];
$dbRuns = $dbStep->modelRuns();
foreach ($dbRuns as $dbRun) {
$apiCall = [];
$apiCall["evidencioModelId"] = $dbRun;
$dbResults = $dbStep->modelRunResultsById($dbRun)->get();
$dbFields = $dbStep->modelRunFieldsById($dbRun)->get();
$apiCall["title"] = "";
$apiCall["results"] = [];
foreach ($dbResults as $dbResult) {
$result = [];
$result["name"] = $dbResult->result_name;
$result["databaseId"] = $dbResult->id;
$apiCall["results"][$dbResult->result_number] = $result;
}
$apiCall["variables"] = [];
foreach ($dbFields as $dbField) {
$field = [];
$field["evidencioVariableId"] = $dbField->pivot->evidencio_field_id;
$field["fieldId"] = $dbField->id;
$field["localVariable"] = -1;
$field["evidencioTitle"] = "";
$apiCall["variables"][] = $field;
}
$retObj[] = $apiCall;
}
return $retObj;
}
}
Loading