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.
Describe the bug
there is a bug in createXFhirQueryFromExpression method.
in the case of having a launchContext in a questionnaire, where if we try to combine both fhirPathsEvaluatedPairs and variablesEvaluatedPairs, then fold the expression to replace the string template into the right evaluated value, the resulting xFhirQuery string gives the wrong result.
that happens because of the same variable name from both fhirPathsEvaluatedPairs and variablesEvaluatedPairs, and the variable from fhirPathsEvaluatedPairs are given first priority over the one from variablesEvaluatedPairs.
the one value from fhirPathsEvaluatedPairs are empty, while what we need was from variablesEvaluatedPairs.
the resulting xFhirQuery has a search parameter, but that search parameter value is empty because of this. This will cause the fhirEngine resolver to search all resources of that type mentioned in the xFhirQuery. This can be prevented by using the _count param.
Resulting xFhirQuery:
Patient?_id= The expected and correct xFhirQuery: Patient?_id=47626
Prevention 1:
xFhirQuery: Patient?_count =1&_id=
Prevention 2:
xFhirQuery: Patient?name=NOTHING
*assume NOTHING as a variable
Component
SDC library
To Reproduce
Steps to reproduce the behavior:
Go to '...'
Click on '....'
Scroll down to '....'
See error
Expected behavior
when launchContext exists in a questionnaire but not used in the X-FHIR-Query, fhirPathsEvaluatedPairs should return an empty sequence instead of a non empty sequence with a key and an empty value.
Screenshots
If applicable, add screenshots to help explain your problem.
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]
Describe the bug there is a bug in createXFhirQueryFromExpression method.
in the case of having a launchContext in a questionnaire, where if we try to combine both fhirPathsEvaluatedPairs and variablesEvaluatedPairs, then fold the expression to replace the string template into the right evaluated value, the resulting xFhirQuery string gives the wrong result.
that happens because of the same variable name from both fhirPathsEvaluatedPairs and variablesEvaluatedPairs, and the variable from fhirPathsEvaluatedPairs are given first priority over the one from variablesEvaluatedPairs.
the one value from fhirPathsEvaluatedPairs are empty, while what we need was from variablesEvaluatedPairs.
the resulting xFhirQuery has a search parameter, but that search parameter value is empty because of this. This will cause the fhirEngine resolver to search all resources of that type mentioned in the xFhirQuery. This can be prevented by using the _count param.
Example: fhirPathsEvaluatedPairs contains: [{a}, “”] variablesEvaluatedPairs contains: [{a}, “47626”]
Resulting xFhirQuery: Patient?_id= The expected and correct xFhirQuery: Patient?_id=47626
Prevention 1: xFhirQuery: Patient?_count =1&_id=
Prevention 2: xFhirQuery: Patient?name=NOTHING
*assume NOTHING as a variable
Component SDC library
To Reproduce Steps to reproduce the behavior:
Expected behavior when launchContext exists in a questionnaire but not used in the X-FHIR-Query, fhirPathsEvaluatedPairs should return an empty sequence instead of a non empty sequence with a key and an empty value.
Screenshots If applicable, add screenshots to help explain your problem.
Smartphone (please complete the following information):
Additional context original ticket
Would you like to work on the issue? Yes