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

Add support for all Questionnaire enableWhen operators #2683

Closed
rahul1 opened this issue Aug 17, 2023 · 1 comment · Fixed by #2714
Closed

Add support for all Questionnaire enableWhen operators #2683

rahul1 opened this issue Aug 17, 2023 · 1 comment · Fixed by #2714
Assignees
Labels
good first issue Good for newcomers questionnaires FHIR questionnaires related features and fixes react Features, fixes and enhancements to react component library

Comments

@rahul1
Copy link
Member

rahul1 commented Aug 17, 2023

Right now, when evaluating the Questionnaire.item.enableWhen logic, we assume that the user is checking for equality. In the example below, I'd also like to check for existence, which is not currently handled.

Would also be nice to for booleans to default eval to "false" if they don't exist, so two conditions are not needed

{
  "resourceType": "Questionnaire",
  "name": "Merge Duplicate Patients",
  "status": "active",
  "item": [
    {
      "id": "id-15",
      "linkId": "g3",
      "type": "group",
      "text": "Disable Merge ",
      "item": [
        {
          "id": "id-23",
          "linkId": "q1",
          "type": "display",
          "text": "Check this box is the Patient records ARE NOT a match. This will add each Patient to the other's \"Do Not Match\" list"
        },
        {
          "id": "id-16",
          "linkId": "disableMerge",
          "type": "boolean",
          "text": "*Do not Merge these records*"
        }
      ]
    },
    {
      "id": "id-17",
      "linkId": "g5",
      "type": "group",
      "text": "Merging Patients",
      "item": [
        {
          "id": "id-18",
          "linkId": "replaceName",
          "type": "boolean",
          "text": "Merge names?\nIf selected, this will add the source patient's name to the target's list of names"
        },
        {
          "id": "id-19",
          "linkId": "replaceAddress",
          "type": "boolean",
          "text": "Merge Addresses?\nIf selected, this will add the source patient's address to the target's list of addresses"
        },
        {
          "id": "id-20",
          "linkId": "replaceData",
          "type": "boolean",
          "text": "Replace birthdate?\nIf selected, this will REPLACE the target patient's birthdate with the source patient's birthdate"
        }
      ],
      "enableWhen": [
        {
          "question": "disableMerge",
          "operator": "=",
          "answerBoolean": false
        },
        {
          "question": "disableMerge",
          "operator": "exists",
          "answerBoolean": false
        }
      ],
      "enableBehavior": "any"
    },
    {
      "id": "id-21",
      "linkId": "g9",
      "type": "group",
      "text": "Deleting Source Patient",
      "item": [
        {
          "id": "id-22",
          "linkId": "deleteSource",
          "type": "boolean",
          "text": "Would you like to delete the source patient after merging?"
        }
      ],
      "enableWhen": [
        {
          "question": "disableMerge",
          "operator": "=",
          "answerBoolean": false
        },
        {
          "question": "disableMerge",
          "operator": "exists",
          "answerBoolean": false
        }
      ],
      "enableBehavior": "any"
    }
  ],
  "subjectType": [
    "RiskAssessment"
  ],
  "title": "Merge Duplicate Patients",
  "id": "02055bc0-d0c9-4441-a6c4-94e490336f99",
  "meta": {
    "versionId": "68bbe973-2ca8-48c8-9ee7-7e57e3446485",
    "lastUpdated": "2023-08-17T17:37:12.410Z",
    "author": {
      "reference": "Practitioner/bda1c932-8e56-4c10-92fa-bbbb3fbe4b03",
      "display": "Rahul Agarwwal"
    },
    "project": "b65c0057-5926-4d59-9486-1039125784ac",
    "compartment": [
      {
        "reference": "Project/b65c0057-5926-4d59-9486-1039125784ac"
      }
    ]
  }
}
@rahul1 rahul1 added good first issue Good for newcomers react Features, fixes and enhancements to react component library and removed good first issue Good for newcomers labels Aug 17, 2023
@lazyfuhrer
Copy link

Hey I'd like to work in this @rahul1

@rahul1 rahul1 added good first issue Good for newcomers questionnaires FHIR questionnaires related features and fixes labels Aug 23, 2023
@ThatOneBro ThatOneBro self-assigned this Aug 24, 2023
@ThatOneBro ThatOneBro added this to the August 31, 2023 milestone Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers questionnaires FHIR questionnaires related features and fixes react Features, fixes and enhancements to react component library
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants