android-fhir
android-fhir copied to clipboard
Add support for fhirpath ".where" initialExpressions when populating values
Is your feature request related to a problem? Please describe.
We have patients who have more than one Observation, and when populating we'd like to be able to filter using, an example Observation.where(code.coding.code = 'art-client-viral-load-test-results-date-of-sample-collection').value
, as an initialExpression. Currently, the sdk doesn't support this and seems to pick the first resource it encounters of a given type, from here
Describe the solution you'd like Evaluate fhirpath expression for all valid resources encountered, and return the first non-null result
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
Would you like to work on the issue? Please state if this issue should be assigned to you or who you think could help to solve this issue.
cc @KhumboLihonga @Gental-Giant
@Tarun-Bhardwaj Picking this up. You can assign @maimoonak
@LZRS The FHIR does not suggest use of list of resources into fhirpath expressions. The tutorial also suggest where/select on properties of Resource under consideration like this http://hl7.org/fhirpath/#paths-and-polymorphic-items.
The launchContext also maps variables to one resource of a type.
The FHIR engine itself does not allow passing List of resources in any of expression evaluation methods. Hence, by FHIR specs expression on the list processing is not possible.
An option is to use Bundle for this purpose. i.e. pass your resources for population into Bundle and then run expression over Bundle.entry. An example is added as a test to ResourceMapper. https://github.com/google/android-fhir/pull/1577/files#diff-10d720fac2a4dd32fb1d66903fe911aa91229cf14d3bfff29807ffda5a8a995aR2382. Fhir also supports this http://hl7.org/fhirpath/#selectprojection-expression-collection
@f-odhiambo @jingtang10
@LZRS The FHIR does not suggest use of list of resources into fhirpath expressions. The tutorial also suggest where/select on properties of Resource under consideration like this http://hl7.org/fhirpath/#paths-and-polymorphic-items.
The launchContext also maps variables to one resource of a type.
The FHIR engine itself does not allow passing List of resources in any of expression evaluation methods. Hence, by FHIR specs expression on the list processing is not possible.
An option is to use Bundle for this purpose. i.e. pass your resources for population into Bundle and then run expression over Bundle.entry. An example is added as a test to ResourceMapper. https://github.com/google/android-fhir/pull/1577/files#diff-10d720fac2a4dd32fb1d66903fe911aa91229cf14d3bfff29807ffda5a8a995aR2382. Fhir also supports this http://hl7.org/fhirpath/#selectprojection-expression-collection
@f-odhiambo @jingtang10
@maimoonak , based on your inputs above , are changes required for this issue?
@LZRS Is this still an open issue OR does the comment / feedback provided address it? Thanks
@LZRS Is this still an open issue OR does the comment / feedback provided address it? Thanks
@fredhersch Yes, the feedback provided was sufficient enough to address the issue
Yes, the feedback provided was sufficient enough to address the issue
as per @LZRS 's comment closing this issue.