android-fhir icon indicating copy to clipboard operation
android-fhir copied to clipboard

Add support for fhirpath ".where" initialExpressions when populating values

Open LZRS opened this issue 2 years ago • 5 comments

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

LZRS avatar Aug 24 '22 09:08 LZRS

@Tarun-Bhardwaj Picking this up. You can assign @maimoonak

f-odhiambo avatar Aug 31 '22 12:08 f-odhiambo

@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 avatar Sep 01 '22 13:09 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

@maimoonak , based on your inputs above , are changes required for this issue?

Tarun-Bhardwaj avatar Sep 14 '22 07:09 Tarun-Bhardwaj

@LZRS Is this still an open issue OR does the comment / feedback provided address it? Thanks

fredhersch avatar Sep 23 '22 12:09 fredhersch

@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

LZRS avatar Sep 23 '22 13:09 LZRS

Yes, the feedback provided was sufficient enough to address the issue

as per @LZRS 's comment closing this issue.

jingtang10 avatar Jan 30 '24 12:01 jingtang10