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

Bug Report: Calculated Expression Fails to Update Beyond Initial Changes in Questionnaire #2354

Closed
qaziabubakar-vd opened this issue Dec 6, 2023 · 1 comment · Fixed by #2358
Labels
P1 High priority issue type:bug Something isn't working

Comments

@qaziabubakar-vd
Copy link

Describe the bug
I've encountered an issue where calculated expressions in a questionnaire are not consistently updating. Specifically, I have two questions related to a pregnancy registration form: one for the Last Menstrual Period (LMP) date and another for the Expected Date of Delivery (EDD). The expected behavior is that when the LMP date is updated, the EDD should also update accordingly. However, after the first two updates to the LMP date, the EDD stops updating, regardless of the subsequent updates.

Component
This looks like an issue with the datacapture module in android-fhir

To Reproduce
Steps to reproduce the behavior:

  1. Open the pregnancy registration form in the application. (I will attach the questionnaire snippet under question)
  2. Fill in the "Last Monthly Period (LMP) date" with a specific date (e.g., today's date).
  3. Verify that the "Expected date of delivery (EDD)" updates correctly based on the calculated expression (LMP + 280 days).
  4. Update the "Last Monthly Period (LMP) date" two more times with different dates.
  5. Observe that the "Expected date of delivery (EDD)" does not update after each LMP update.

Expected behavior
The EDD should dynamically update each time the LMP date is modified.

Screenshots

recording-emulator.mp4

Smartphone (please complete the following information):

  • Device: Pixel-7 emulator
  • Android version: 13

Additional context
This is the Questionnaire snippet under question

[
   {
      "extension": [
         {
            "url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
            "valueString": "d/M/y"
         },
         {
            "url": "http://ehelse.no/fhir/StructureDefinition/validationtext",
            "valueString": "Enter the correct date"
         },
         {
            "url": "http://hl7.org/fhir/StructureDefinition/minValue",
            "_valueDate": {
               "extension": [
                  {
                     "url": "http://hl7.org/fhir/StructureDefinition/cqf-calculatedValue",
                     "valueExpression": {
                        "language": "text/fhirpath",
                        "expression": "today() - 40 weeks"
                     }
                  }
               ]
            }
         },
         {
            "url": "http://hl7.org/fhir/StructureDefinition/maxValue",
            "_valueDate": {
               "extension": [
                  {
                     "url": "http://hl7.org/fhir/StructureDefinition/cqf-calculatedValue",
                     "valueExpression": {
                        "language": "text/fhirpath",
                        "expression": "today()"
                     }
                  }
               ]
            }
         }
      ],
      "linkId": "245679f2-6172-456e-8ff3-425f5cea3243",
      "text": "Last Monthly Period (LMP) date",
      "type": "date",
      "required": true
   },
   {
      "extension": [
         {
            "url": "http://hl7.org/fhir/StructureDefinition/entryFormat",
            "valueString": "d/M/y"
         },
         {
            "url": "http://ehelse.no/fhir/StructureDefinition/sdf-minvalue",
            "valueString": "today() - 280 'days'"
         },
         {
            "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression",
            "valueExpression": {
               "language": "text/fhirpath",
               "expression": "%resource.descendants().where(linkId='245679f2-6172-456e-8ff3-425f5cea3243').answer.value + 280 'days'"
            }
         }
      ],
      "enableWhen": [
         {
            "question": "245679f2-6172-456e-8ff3-425f5cea3243",
            "operator": "exists",
            "answerBoolean": true
         }
      ],
      "linkId": "4f04affb-22a8-4da5-88d8-78bc6d0454e7",
      "text": "Expected date of delivery (EDD)",
      "type": "date",
      "required": false,
      "readOnly": true
   }
]

Would you like to work on the issue?
Yes, I would like to work on this issue, I will appreciate any guidance on this as well.

@FikriMilano
Copy link
Collaborator

@f-odhiambo LOE less than a day

@santosh-pingle santosh-pingle added type:bug Something isn't working P1 High priority issue labels Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High priority issue type:bug Something isn't working
Projects
Status: Complete
Development

Successfully merging a pull request may close this issue.

3 participants