Uploaded image for project: 'FHIR Specification Feedback'
  1. FHIR Specification Feedback
  2. FHIR-25380

Supporting "no to all" UX in Questionnaires

    XMLWordPrintableJSON

Details

    • Icon: Change Request Change Request
    • Resolution: Persuasive with Modification
    • Icon: Medium Medium
    • FHIR Core (FHIR)
    • R4
    • FHIR Infrastructure
    • Questionnaire
    • Hide

      https://jira.hl7.org/browse/FHIR-25960 agrees to allow properties such as 'readOnly' to be set by the value of an expression.  https://jira.hl7.org/browse/FHIR-23788 agrees to allow individual answer options to be enabled/disabled by an expression.  What we don't have is a mechanism to distinguish between whether disabled items should still be rendered, but 'locked' into a non-editable/selectable state or should be hidden.  We will add a new code element as a sibling to enableWhen called 'disabledDisplay'.  The values will be 'hidden' and 'protected', where 'hidden' will cause the disabled elements to be removed from view.  'protected' will cause the disabled elements to still be rendered but to be protected such that answers cannot be set or selected.

      Show
      https://jira.hl7.org/browse/FHIR-25960  agrees to allow properties such as 'readOnly' to be set by the value of an expression.  https://jira.hl7.org/browse/FHIR-23788  agrees to allow individual answer options to be enabled/disabled by an expression.  What we don't have is a mechanism to distinguish between whether disabled items should still be rendered, but 'locked' into a non-editable/selectable state or should be hidden.  We will add a new code element as a sibling to enableWhen called 'disabledDisplay'.  The values will be 'hidden' and 'protected', where 'hidden' will cause the disabled elements to be removed from view.  'protected' will cause the disabled elements to still be rendered but to be protected such that answers cannot be set or selected.
    • Paul Lynch/Brian Postlethwaite: 9-0-0
    • Enhancement
    • Compatible, substantive
    • R5

    Description

      This is a follow up to a brief discussion on FHIR Chat: https://chat.fhir.org/#narrow/stream/179255-questionnaire/topic/enableWhen.20for.20hiding.20items.3F

      In brief: we need a way to conditionally toggle the "readOnly" or "enabled" status of a question based on responses to other question(s).

      Description of my use case (from the FHIR Chat):

      Let's say I'm building a Questionnaire for patients to fill out when they arrive at a hospital.

      This Questionnaire would include questions about their background. Let's say one of those question is, "Do you have a legal guardian?". If yes, we want to ask questions about that guardian, like "First Name," "Last Name," etc.

      If the answer is not "yes", then I don't want to clutter the UI by rendering irrelevant "Guardian First Name"-like questions.

      This Questionnaire would also include questions about their medical history. There might be a whole section that is a long list of medical conditions, of which an individual is likely to have at most one or two.

      Because it is a long, mostly irrelevant list, I want to include a "No to all" option for UX purposes. If this option is selected, I want to lock all of the listed condition responses into being "No" (effectively making them readOnly, or disabled). I'd rather not hide them altogether, because I want to make it obvious that the patient is submitting the fact that they do not have any one of these conditions. And the inverse is also true: I'd like to disable, but not hide, the "No to all" option if any options are selected as "Yes".

      Here's what that a Questionnaire that comes close to this functionality would look like:

      {
        "resourceType": "Questionnaire",
        "item": [
          {
            "linkId": "patient-background",
            "type": "group",
            "text": "Background",
            "item": [
              {
                "linkId": "has-guardian",
                "text": "Do you have a legal guardian?",
                "type": "boolean"
              },
              {
                "linkId": "guardian-first-name",
                "text": "Guardian First Name",
                "type": "string",
                "enableWhen": [
                  {
                    "question": "has-guardian",
                    "operator": "=",
                    "answerBoolean": true
                  }
                ]
              },
              {
                "linkId": "guardian-last-name",
                "text": "Guardian Last Name",
                "type": "string",
                "enableWhen": [
                  {
                    "question": "has-guardian",
                    "operator": "=",
                    "answerBoolean": true
                  }
                ]
              }
            ]
          },
          {
            "linkId": "patient-conditions",
            "type": "group",
            "text": "Past Conditions",
            "item": [
              {
                "linkId": "no-past-conditions",
                "text": "No to all",
                "type": "boolean"
              },
              {
                "linkId": "condition-1",
                "text": "<condition 1 description>",
                "type": "boolean",
                "enableWhen": [
                  {
                    "question": "no-past-conditions",
                    "operator": "=",
                    "answerBoolean": false
                  }
                ]
              },
              {
                "linkId": "condition-2",
                "text": "<condition 2 description>",
                "type": "boolean",
                "enableWhen": [
                  {
                    "question": "no-past-conditions",
                    "operator": "=",
                    "answerBoolean": false
                  }
                ]
              },
              {
                "linkId": "condition-3",
                "text": "<condition 3 description>",
                "type": "boolean",
                "enableWhen": [
                  {
                    "question": "no-past-conditions",
                    "operator": "=",
                    "answerBoolean": false
                  }
                ]
              },
              ... more conditions
            ]
          }
        ]
      }
      

      As lloyd pointed out, that "disable" functionality is a little different from the intended use of `enableWhen`, so maybe this should be logically structured differently.

      Another line of thinking: maybe we could use some extension that augments calculatedExpression so that a "successful calculation" flips the question's status to "readOnly"?

      With that extension, each of the "conditions" questions above could have a `calculatedExpression` that evaluates to false if the "No to all" question is true; otherwise, it would not perform any calculation. This new extension would suggest that, when this `calculatedExpression` is successful, the question goes from "readOnly: false" "readOnly: true". Seems a little convoluted; anyone have more elegant ideas here?
       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            tadasant Tadas Antanavicius (Inactive)
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: