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

Date picker widget not working w calculated expression #2157

Closed
FikriMilano opened this issue Sep 8, 2023 · 2 comments · Fixed by #2395
Closed

Date picker widget not working w calculated expression #2157

FikriMilano opened this issue Sep 8, 2023 · 2 comments · Fixed by #2395
Assignees
Labels
P1 High priority issue type:bug Something isn't working

Comments

@FikriMilano
Copy link
Collaborator

Describe the bug
There is 2 issue to this:

  1. The behavior_calculated_expression.json is not complete, missing unitOptions and the initial.valueQuantity.value, please use the JSON below to solve this first point
  2. The Date picker widget in behavior_calculated_expression.json doesn't show the right value after it's calculated-expression was evaluated

After investigation, this code is the problem for point 2, it involves date formatting:
https://github.com/google/android-fhir/pull/1897/files#r1319542076

Component
SDC library and catalog app

To Reproduce
Steps to reproduce the behavior:

  1. Catalog app
  2. Click behavior tab
  3. Click calculated expression
  4. Fill in the Age years quantity widget
  5. The date picker widget won't get updated

Expected behavior
The Date picker widget should be updated if the Age years quantity widget is filled

Demo

Screen_recording_20230908_160436.webm

Smartphone (please complete the following information):

  • Device: [e.g. Pixel4a emulator]
  • Android version: [e.g. Settings -> About phone -> Android version]
  • Build number: [e.g. Settings -> About phone -> Build number]
  • Version [e.g. 22]

Additional context

{
  "resourceType": "Questionnaire",
  "item": [
    {
      "linkId": "a-birthdate",
      "text": "Birth Date",
      "type": "date",
      "extension": [
        {
          "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression",
          "valueExpression": {
            "language": "text/fhirpath",
            "expression": "%resource.repeat(item).where(linkId='a-age-years' and answer.empty().not()).select(today() - answer.value)"
          }
        }
      ]
    },
    {
      "linkId": "a-age-years",
      "text": "Age years",
      "type": "quantity",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-unitOption",
          "valueCoding": {
            "system": "http://unitsofmeasure.org",
            "code": "years",
            "display": "years"
          }
        }
      ],
      "initial": [
        {
          "valueQuantity": {
            "value": 0,
            "unit": "years",
            "system": "http://unitsofmeasure.org",
            "code": "years"
          }
        }
      ]
    }
  ]
}

Would you like to work on the issue?
I think @PallaviGanorkar is the right person for this

@santosh-pingle santosh-pingle added P1 High priority issue type:bug Something isn't working labels Sep 11, 2023
@jingtang10
Copy link
Collaborator

Can we also fix this questionnaire so that we're calculating age from date of birth? that seems like a much more reasonable use case.

@f-odhiambo
Copy link
Collaborator

@maimoonak Is working on this and will raise a PR soon

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.

5 participants