Closed akeshavan closed 5 years ago
Now that we have activity-level branching logic, we can copy that pattern to the activity set level:
"ui": {
"order": [
"nda_guid",
"phq9_schema",
"voice_task_schema"
],
"shuffle": false,
"visibility": [
"nda_guid": true,
"phq9_schema": "moment().diff(moment(nda_guid.birthDate), 'years') >= 18",
"voice_task_schema": {
"method": "POST",
"url": "/path/to/server/endpoint",
"payload": ["nda_guid", "phq9_schema"]
}
]
}
This says:
nda_guid
activityphq9_schema
if the user is 18 years or older (in this case its a JS string that needs to be eval'd with the moment.js library in scope)voice_task_schema
should be shown by POSTing the data from nda_guid
and phq9_schema
to a server endpointthese conditions can be tested after completion of each activity. So initially, only nda_guid
will show, and upon completion phq9_schema
and voice_task_schema
are evaluated. phq9_schema
will evaluate to true
, making it visible. After completion of that, all activities' visibilities are evaluated once more, and this server ping returns a true.
@sanuann @satra I've added:
"visibility": {
"phq9_schema": true,
"nda_guid": {
"method": "POST",
"url": "https://us-central1-dmriprep.cloudfunctions.net/mit_voice_pilot",
"payload": ["phq9_schema"]
}
}
but when jsonld parses this, I don't see the object as the value of "nda_guid"
(but I do see that true
is the value for "phq9_schema"
) -- where do I need to specify that the values of items in "visibility" can either be strings, booleans, or objects?
you need to define it in the corresponding context file
@akeshavan check this example http://tinyurl.com/y6hl8crm
got it! thanks!
As a first pass:
For the voice pilot case, lets encode that the
voice_task
activity should initially be "locked" and a spot for a URL to "unlock" it:the "unlock" endpoint will receive data from all activities and could be hit after completion of each activity. If it returns
["voice_task_schema"]
then that activity will be shown