FHIR Chat · FHIR Path question · implementers

Stream: implementers

Topic: FHIR Path question


view this post on Zulip Brian Reinhold (Jan 18 2022 at 14:00):

Trying to figure out how to get the value of something which is in a collection. IN my case I am thinking of getting the value of the Observation.component whose code.coding.code is equal to some value. As I play with the syntax using this test site https://hl7.github.io/fhirpath.js/
I can get single expressions to evaluate to true and get values but I cannot figure out the right syntax to get a value conditionally. In a program I could do it in multiple lines but I thought the idea here is that I can specify a single path to get the value I want out of the collection.

view this post on Zulip Lloyd McKenzie (Jan 18 2022 at 14:45):

Observation.component.where[code.coding.where(code='foo' and system='bar')).value

view this post on Zulip Brian Reinhold (Jan 18 2022 at 15:16):

@Lloyd McKenzie Thanks, I wasn't going down 'deep enough'. I needed the second 'where'. I tried directly with
Observation.component.where(code.coding.code='150021').value
and that just gave me an empty response.

view this post on Zulip Brian Postlethwaite (Jan 21 2022 at 23:45):

You may need a .exists() on the inner where in HAPI


Last updated: Apr 12 2022 at 19:14 UTC