expandorg / worker-app

worker application
https://portal.expand.org/
Mozilla Public License 2.0
2 stars 0 forks source link

Nested JSON in verification form #188

Closed kieranoreilly closed 4 years ago

kieranoreilly commented 5 years ago

The response for the task looks like this:

{"clip": {"end": 49.92173295454536, "tag": "Preparatory", "start": 18.094460227272723}}

We need to access end and start in our verification form.

How would we do this @sslava ?

kieranoreilly commented 5 years ago
{"modules": [{"name": "title3", "type": "title", "title": "Identify the BDJ Movement"}, {"src": "$(video)", "name": "prep", "type": "tagVideo", "initial": "$(clip)", "readOnly": true, "playbackRate": 4}, {"name": "select1", "type": "select", "options": [{"id": "Preparatory", "value": 1, "caption": ""}, {"id": "Hands", "value": 0, "caption": ""}, {"id": "Left Right", "value": 2, "caption": ""}, {"id": "Wave", "value": 3, "caption": ""}, {"id": "Swim", "value": 4, "caption": ""}, {"id": "Squat and Stretch", "value": 5, "caption": ""}, {"id": "Forward Bow", "value": 6, "caption": ""}, {"id": "Wax on Wax Off", "value": 8, "caption": ""}, {"id": "End Move", "value": 9, "caption": ""}, {"id": "No more movements", "value": 7, "caption": ""}, {"id": "Wrong movement identified", "value": 8, "caption": ""}], "validation": {"isRequired": "An answer is required"}}, {"name": "next", "type": "submit", "caption": "Submit"}, {"name": "tips", "type": "instructionsItem", "title": "Tips", "action": "See Movements", "modules": [{"name": "instructions", "type": "article", "title": "Movements", "content": "Below are videos containing the 8 movements and their tags."}, {"name": "collapsable1", "type": "collapsable", "header": "Preparatory", "modules": {"src": "https://www.youtube.com/watch?v=RSrygA1y_Js&feature=youtu.be", "name": "prep", "type": "tagVideo", "initial": {"end": 105.918278, "tag": "Preparatory", "start": 82.123392}, "readOnly": true}}, {"name": "collapsable2", "type": "collapsable", "header": "Hands", "modules": {"src": "https://www.youtube.com/watch?v=RSrygA1y_Js&feature=youtu.be", "name": "hands", "type": "tagVideo", "initial": {"end": 148.694506, "tag": "Hands", "start": 105.918278}, "readOnly": true}}, {"name": "collapsable3", "type": "collapsable", "header": "Left Right", "modules": {"src": "https://www.youtube.com/watch?v=RSrygA1y_Js&feature=youtu.be", "name": "leftright", "type": "tagVideo", "initial": {"end": 183.331789, "tag": "Left Right", "start": 148.694506}, "readOnly": true}}, {"name": "collapsable4", "type": "collapsable", "header": "Wave", "modules": {"src": "https://www.youtube.com/watch?v=RSrygA1y_Js&feature=youtu.be", "name": "wave", "type": "tagVideo", "initial": {"end": 223.532924, "tag": "Wave", "start": 183.331789}, "readOnly": true}}, {"name": "collapsable5", "type": "collapsable", "header": "Swim", "modules": {"src": "https://www.youtube.com/watch?v=RSrygA1y_Js&feature=youtu.be", "name": "swim", "type": "tagVideo", "initial": {"end": 261.019341, "tag": "Swim", "start": 223.532924}, "readOnly": true}}, {"name": "collapsable6", "type": "collapsable", "header": "Squat and Stretch", "modules": {"src": "https://www.youtube.com/watch?v=RSrygA1y_Js&feature=youtu.be", "name": "squatandstretch", "type": "tagVideo", "initial": {"end": 315.73971, "tag": "Squat and Stretch", "start": 261.019341}, "readOnly": true}}, {"name": "collapsable7", "type": "collapsable", "header": "Forward Bow", "modules": {"src": "https://www.youtube.com/watch?v=RSrygA1y_Js&feature=youtu.be", "name": "forwardbow", "type": "tagVideo", "initial": {"end": 373.232041, "tag": "Forward Bow", "start": 315.73971}, "readOnly": true}}, {"name": "collapsable8", "type": "collapsable", "header": "Wax On Wax Off", "modules": {"src": "https://www.youtube.com/watch?v=RSrygA1y_Js&feature=youtu.be", "name": "waxonwaxoff", "type": "tagVideo", "initial": {"end": 404.326815, "tag": "Wax On Wax Off", "start": 373.232041}, "readOnly": true}}, {"name": "collapsable9", "type": "collapsable", "header": "End Move", "modules": {"src": "https://www.youtube.com/watch?v=RSrygA1y_Js", "name": "endmove", "type": "tagVideo", "initial": {"end": 423.19, "tag": "End Move", "start": 404.32}, "readOnly": true}}]}]}

Okay so the verification form looks like this and it seems the best way is to set initial to $(clip) However, I didn't want to put the tag in the initial in this case as it tells the verifier the answer. Any thoughts on how we could handle this edge case?

Edit: We will just make the verification question yes or no, for now, but what should we do in the future?

sslava commented 5 years ago

That's really tricky i mean, we can easily implement it on the frontend, but i have no idea how to create a good form builder UI for that. and also - variables substitution is a backend thing as far as i remember

sslava commented 5 years ago

let's discuss it today on meeting

kieranoreilly commented 5 years ago

hide controls also works :)

sslava commented 4 years ago

done