google / android-fhir

The Android FHIR SDK is a set of Kotlin libraries for building offline-capable, mobile-first healthcare applications using the HL7® FHIR® standard on Android.
https://google.github.io/android-fhir/
Apache License 2.0
486 stars 287 forks source link

SDC : Answer being vanished for Quantity type item after packRepeatedGroups #2013

Closed khyativyasargus closed 1 year ago

khyativyasargus commented 1 year ago

Describe the bug For nested item of group type with enable expression, in some case, answer is getting vanished for the item after packRepeatedGroups method while processing QR

Component SDC library

To Reproduce Steps to reproduce the behavior:

  1. On Master branch apply the patch signs_complete_patch.txt
  2. Run the app, Go to new questionnaire (+ icon n patient list)
  3. Answer is not being rendered for the Respiratory rate
  4. Undo the patch changes and apply this patch: signs_questionnaire_patch_mvp.txt list)
  5. Now Re-run the app and again open the questionnaire, Interestingly it's working fine with MVP signs_questionnaire_patch_mvp.txt for the same item

Expected behavior Respiratory rate item answer should be rendered if it's given in QR, while debugging through SDC methods , we found that answer object for Respiratory Rate item is being vanished after packRepeatedGroups method with the Patch signs_complete_patch.txt

Screenshots Answer no being rendered for Respiratory rate image

Answer being rendered for Respiratory rate as standalone item image

Smartphone (please complete the following information):

Additional context After applying patch: Questionnaire is at file: assets/new-patient-registration-paginated.json & QuestionnaireResponse is on line: 83(AddPatientFragment.kt)

@jingtang10 @santosh-pingle

santosh-pingle commented 1 year ago

@khyativyasargus

Could you please remove any unnecessary characters from both the patch and attach separate questionnaire and questionnaire response files for the observed and not observed issues.

santosh-pingle commented 1 year ago

@khyativyasargus

Could you please remove any unnecessary characters from both the patch and attach separate questionnaire and questionnaire response files for the observed and not observed issues.

@khyativyasargus any updates on it? thanks!

ppanchal-argus commented 1 year ago

@khyativyasargus Could you please remove any unnecessary characters from both the patch and attach separate questionnaire and questionnaire response files for the observed and not observed issues.

@khyativyasargus any updates on it? thanks!

Thanks @santosh-pingle . Apologies for the delay. Here are the Questionnaires & QR (QR is same for both questionnaires) The only difference in both questionnaires is of enableWhenExpression signs_not_showing_respiratory_rate_questionnaire.txt signs_not_showing_respiratory_rate_questionnaire_response.txt signs_showing_respiratory_rate_questionnaire.txt

Patches: not_working_signs.txt working_signs.txt

santosh-pingle commented 1 year ago

@khyativyasargus

The description mentioned that it should work for one questionnaire.json file, but I am not seeing the quantity value in either case. Can you please confirm?

ppanchal-argus commented 1 year ago

@santosh-pingle Can you try applying the working_signs patch directly? Ideally it should show this screen. Let me know if it's still not showing up.

image

santosh-pingle commented 1 year ago

yes, issue is observed on signs_not_showing_respiratory_rate_questionnaire.json.

santosh-pingle commented 1 year ago

@khyativyasargus @ppanchal-argus https://hl7.org/fhir/extensions/StructureDefinition-questionnaire-unit.html This is for use on items of type integer and decimal

santosh-pingle commented 1 year ago

@khyativyasargus Is the calculatedExpression extension truly necessary in signs_not_showing_respiratory_rate_questionnaire.json?

{
              "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression",
              "valueExpression": {
                "language": "text/fhirpath",
                "expression": "iif(%resource.repeat(item).where(linkId='Respiratory Rate profile').answer.first().exists(), %resource.repeat(item).where(linkId='Respiratory Rate profile').answer.first().value,{})"
              }
            }
          ],
          "linkId": "EmCare.B22.DE01",
...
santosh-pingle commented 1 year ago

@khyativyasargus @ppanchal-argus

The questionnaire item in questionnaire.json has a calculated expression that returns an empty answer. This empty answer is then updated to the existing answer, which is why the text field shows nothing.

delcroip commented 1 year ago

I don't Think so

I will remove it.

Br

khyativyasargus commented 1 year ago

@khyativyasargus @ppanchal-argus

The questionnaire item in questionnaire.json has a calculated expression that returns an empty answer. This empty answer is then updated to the existing answer, which is why the text field shows nothing.

Thanks @santosh-pingle for looking up the cause. Really helpful!