ReproNim / reproschema-ui

UI to render ReproSchema based protocols and assessments.
https://www.repronim.org/reproschema-ui/
Other
3 stars 18 forks source link

Prior completion not enforced correctly #336

Open ibevers opened 2 months ago

ibevers commented 2 months ago

@satra example with allowSkip not used:

test protocol:

{
    "@context": [
        "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema"
    ],
    "@type": "reproschema:Protocol",
    "@id": "test_protocol_schema",
    "prefLabel": "Test protocol",
    "description": "A test protocol",
    "schemaVersion": "1.0.0",
    "version": "0.0.1",
    "ui": {
        "addProperties": [
            {
                "isAbout": "generic/activities/q_generic_demographics/activities/required/activities/gender/gender_schema",
                "variableName": "gender_schema",
                "prefLabel": {
                    "en": "gender"
                }
            },
            {
                "isAbout": "generic/activities/glides/glides_schema",
                "variableName": "glides_schema",
                "prefLabel": {
                    "en": "glides"
                }
            },
            {
                "isAbout": "generic/activities/free_speech/free_speech_schema",
                "variableName": "free_speech_schema",
                "prefLabel": {
                    "en": "free_speech"
                }
            },
            {
                "isAbout": "generic/activities/diadochokinesis/diadochokinesis_schema",
                "variableName": "generic_schema",
                "prefLabel": {
                    "en": "Diadocho"
                }
            },
            {
                "isAbout": "generic/activities/audio_check/audio_check_schema",
                "variableName": "generic_schema",
                "prefLabel": {
                    "en": "Audio Check"
                }
            },
            {
                "isAbout": "generic/activities/loudness/loudness_schema",
                "variableName": "loudness_schema",
                "prefLabel": {
                    "en": "loudness"
                }
            },
            {
                "isAbout": "generic/activities/maximum_phonation_time/maximum_phonation_time_schema",
                "variableName": "maximum_phonation_time_schema",
                "prefLabel": {
                    "en": "maximum phonation time"
                }
            },
            {
                "isAbout": "generic/activities/q_generic_confounders/q_generic_confounders_schema",
                "variableName": "q_generic_confounders_schema",
                "prefLabel": {
                    "en": "q_generic_confounders"
                }
            },
            {
                "isAbout": "generic/activities/rainbow_passage/rainbow_passage_schema",
                "variableName": "rainbow_passage_schema",
                "prefLabel": {
                    "en": "rainbow_passage"
                }
            },
            {
                "isAbout": "generic/activities/picture_description/picture_description_schema",
                "variableName": "picture_description_schema",
                "prefLabel": {
                    "en": "picture_description"
                }
            },
            {
                "isAbout": "generic/activities/q_generic_demographics/q_generic_demographics_schema",
                "variableName": "q_generic_demographics_schema",
                "prefLabel": {
                    "en": "q_generic_demographics"
                }
            },
            {
                "isAbout": "generic/activities/respiration_and_cough/respiration_and_cough_schema",
                "variableName": "respiration_and_cough_schema",
                "prefLabel": {
                    "en": "respiration and cough"
                }
            },
            {
                "isAbout": "generic/activities/story_recall/story_recall_schema",
                "variableName": "story_recall_schema",
                "prefLabel": {
                    "en": "story recall"
                }
            },
            {
                "isAbout": "generic/activities/prolonged_vowel/prolonged_vowel_schema",
                "variableName": "prolonged_vowel_schema",
                "prefLabel": {
                    "en": "prolonged vowel"
                }
            },
            {
                "isAbout": "generic/activities/q_generic_voice_handicap_index_vhi10/q_generic_voice_handicap_index_vhi10_schema",
                "variableName": "q_generic_voice_handicap_index_vhi10_schema",
                "prefLabel": {
                    "en": "q_generic_voice_handicap_index_vhi10"
                }
            },
            {
                "isAbout": "generic/activities/q_generic_voice_perception/q_generic_voice_perception_schema",
                "variableName": "q_generic_voice_perception_schema",
                "prefLabel": {
                    "en": "q_generic_voice_perception"
                }
            }
        ],
        "order": [
            "generic/activities/q_generic_demographics/activities/required/activities/gender/gender_schema",
            "generic/activities/glides/glides_schema",
            "generic/activities/free_speech/free_speech_schema",
            "generic/activities/diadochokinesis/diadochokinesis_schema",
            "generic/activities/audio_check/audio_check_schema",
            "generic/activities/loudness/loudness_schema",
            "generic/activities/maximum_phonation_time/maximum_phonation_time_schema",
            "generic/activities/q_generic_confounders/q_generic_confounders_schema",
            "generic/activities/rainbow_passage/rainbow_passage_schema",
            "generic/activities/picture_description/picture_description_schema",
            "generic/activities/q_generic_demographics/q_generic_demographics_schema",
            "generic/activities/respiration_and_cough/respiration_and_cough_schema",
            "generic/activities/story_recall/story_recall_schema",
            "generic/activities/prolonged_vowel/prolonged_vowel_schema",
            "generic/activities/q_generic_voice_handicap_index_vhi10/q_generic_voice_handicap_index_vhi10_schema",
            "generic/activities/q_generic_voice_perception/q_generic_voice_perception_schema"
        ],
        "shuffle": false,
        "allow": [
            "reproschema:AllowExport",
            "reproschema:AutoAdvance"
        ]
    }
}

generic/activities/q_generic_demographics/q_generic_demographics_schema

{
    "id": "q_generic_demographics_schema",
    "@type": "reproschema:Activity",
    "prefLabel": {
        "en": "q_generic_demographics"
    },
    "schemaVersion": "1.0.0",
    "ui": {
        "order": [
            "activities/completed_by/completed_by_schema",
            "activities/required/required_schema",
            "activities/optional/optional_schema"
        ],
        "addProperties": [
            {
                "isAbout": "activities/completed_by/completed_by_schema",
                "isVis": true,
                "variableName": "completed_by",
                "valueRequired": true
            },
            {
                "isAbout": "activities/required/required_schema",
                "isVis": true,
                "variableName": "required"
            },
            {
                "isAbout": "activities/optional/optional_schema",
                "isVis": true,
                "variableName": "optional"
            }
        ],
        "shuffle": false
    },
    "version": "3.8.0",
    "@context": [
        "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
        {
            "reproschema_library_activities": "https://raw.githubusercontent.com/ReproNim/reproschema-library/enh/rc4/a23a13875c7262c0bd0d77bd90c1ec296c6d1116/activities/",
            "b2ai_redcap2rs_activities": "https://raw.githubusercontent.com/sensein/b2ai-redcap2rs/main/activities/q_generic_demographics/items/"
        }
    ]
}

activities/completed_by/completed_by_schema

{
    "@context": [
        "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
        {
            "reproschema_library_activities": "https://raw.githubusercontent.com/ReproNim/reproschema-library/enh/rc4/a23a13875c7262c0bd0d77bd90c1ec296c6d1116/activities/",
            "b2ai_redcap2rs_activities": "https://raw.githubusercontent.com/sensein/b2ai-redcap2rs/main/activities/q_generic_demographics/items/"
        }
    ],
    "@type": "reproschema:Activity",
    "@id": "completed_by_schema",
    "preamble": {"en":"Who is completing this survey"},
    "prefLabel": {
        "en": "Bridge2AI completed by activity"
    },
    "description": {
        "en": "Identifies who is completing the study."
    },
    "schemaVersion": "1.0.0",
    "version": "0.0.1",
    "ui": {
        "addProperties": [
            {
                "isAbout": "items/demographics_completed_by",
                "variableName": "demographics_completed_by",
                "prefLabel": {
                    "en": "Demographics"
                },
                "isVis": true,
                "valueRequired": true
            }
        ],
        "order": [
            "items/demographics_completed_by"
        ],
        "shuffle": false,
        "allow": [
            "reproschema:AllowExport"
        ]
    }
}

items/demographics_completed_by

{
    "id": "demographics_completed_by",
    "category": "reproschema:Item",
    "prefLabel": {
        "en": "demographics_completed_by"
    },
    "question": {
        "en": "Check all that apply"
    },
    "responseOptions": {
        "choices": [
            {
                "name": {
                    "en": "Self "
                },
                "value": 1
            },
            {
                "name": {
                    "en": "Assistant "
                },
                "value": 2
            },
            {
                "name": {
                    "en": "Parent/Caregiver"
                },
                "value": 3
            }
        ],
        "multipleChoice": true,
        "valueType": [
            "xsd:integer"
        ]
    },
    "ui": {
        "inputType": "radio"
    },
    "@context": "https://raw.githubusercontent.com/ReproNim/reproschema/main/releases/1.0.0/reproschema"
}

Initial UI state

Screenshot 2024-08-12 at 1 40 07 PM

UI state after hitting Submit

Screenshot 2024-08-12 at 1 40 53 PM
ibevers commented 2 months ago

@satra simpler case: Note: I get errors when I have a protocol with only one activity: https://github.com/ReproNim/reproschema-ui/issues/337

Protocol:

{
    "@context": [
        "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema"
    ],
    "@type": "reproschema:Protocol",
    "@id": "test_protocol_schema",
    "prefLabel": "Test protocol",
    "description": "A test protocol",
    "schemaVersion": "1.0.0",
    "version": "0.0.1",
    "ui": {
        "addProperties": [
            {
                "isAbout": "generic/activities/q_generic_demographics/activities/completed_by/completed_by_schema",
                "variableName": "completed_by_schema",
                "prefLabel": {
                    "en": "completed_by"
                }
            },
            {
                "isAbout": "generic/activities/audio_check/activities/breathing/breathing_schema",
                "variableName": "breathing_schema",
                "prefLabel": {
                    "en": "breathing"
                }
            }
        ],
        "order": [
            "generic/activities/q_generic_demographics/activities/completed_by/completed_by_schema",
            "generic/activities/audio_check/activities/breathing/breathing_schema"
        ],
        "shuffle": false,
        "allow": [
            "reproschema:AllowExport",
            "reproschema:AutoAdvance"
        ]
    }
}

activities/completed_by/completed_by_schema

{
    "@context": [
        "https://raw.githubusercontent.com/ReproNim/reproschema/1.0.0/contexts/reproschema",
        {
            "reproschema_library_activities": "https://raw.githubusercontent.com/ReproNim/reproschema-library/enh/rc4/a23a13875c7262c0bd0d77bd90c1ec296c6d1116/activities/",
            "b2ai_redcap2rs_activities": "https://raw.githubusercontent.com/sensein/b2ai-redcap2rs/main/activities/q_generic_demographics/items/"
        }
    ],
    "@type": "reproschema:Activity",
    "@id": "completed_by_schema",
    "preamble": {"en":"Who is completing this survey"},
    "prefLabel": {
        "en": "Bridge2AI completed by activity"
    },
    "description": {
        "en": "Identifies who is completing the study."
    },
    "schemaVersion": "1.0.0",
    "version": "0.0.1",
    "ui": {
        "addProperties": [
            {
                "isAbout": "items/demographics_completed_by",
                "variableName": "demographics_completed_by",
                "prefLabel": {
                    "en": "Demographics"
                },
                "isVis": true,
                "valueRequired": true
            }
        ],
        "order": [
            "items/demographics_completed_by"
        ],
        "shuffle": false,
        "allow": [
            "reproschema:AllowExport"
        ]
    }
}

items/demographics_completed_by

{
    "id": "demographics_completed_by",
    "category": "reproschema:Item",
    "prefLabel": {
        "en": "demographics_completed_by"
    },
    "question": {
        "en": "Check all that apply"
    },
    "responseOptions": {
        "choices": [
            {
                "name": {
                    "en": "Self "
                },
                "value": 1
            },
            {
                "name": {
                    "en": "Assistant "
                },
                "value": 2
            },
            {
                "name": {
                    "en": "Parent/Caregiver"
                },
                "value": 3
            }
        ],
        "multipleChoice": true,
        "valueType": [
            "xsd:integer"
        ]
    },
    "ui": {
        "inputType": "radio"
    },
    "@context": "https://raw.githubusercontent.com/ReproNim/reproschema/main/releases/1.0.0/reproschema"
}