FHIR Chat · FHIRPath id or extension reference expression · implementers

Stream: implementers

Topic: FHIRPath id or extension reference expression


view this post on Zulip Sean McIlvenna (Jan 10 2022 at 19:35):

Anyone know how to construct FHIRPath that returns either
extension[url = "some-extension-url"].valueReference.reference
or
id
if the extension is not found?

view this post on Zulip Sean McIlvenna (Jan 10 2022 at 19:36):

in XPath it might be something like:
fhir:extension[@url = 'some-extension-url']/fhir:valueReference/fhir:reference/@value | fhir:id/@value

view this post on Zulip Sean McIlvenna (Jan 10 2022 at 19:44):

actually, this is more like it:

if (fhir:extension[@url = '...']) then fhir:extension[@url = '...']/fhir:valueReference/fhir:reference/@value else fhir:id/@value

view this post on Zulip Brian Postlethwaite (Jan 10 2022 at 20:52):

https://sqlonfhir-r4.azurewebsites.net/fhir/Patient/example/$extract?expression=Patient.birthDate.select(iif(extension(%27http://hl7.org/fhir/StructureDefinition/patient-birthTime%27).exists(),%20extension,id))

view this post on Zulip Sean McIlvenna (Jan 10 2022 at 21:24):

@Brian Postlethwaite this is great. this will get me most of the way there.
Can you tell me, how did you efficiently test this FHIRPath? With XPath, I would open up OxygenXML and pull up the XPath Builder... but, not sure of a good/efficient way to test FHIRPath like this against a HAPI server\

view this post on Zulip Brian Postlethwaite (Jan 10 2022 at 21:27):

HAPI also has a similar operation too.
James pointed that out in a topic only in the last few days...
http://hapi.fhir.org/baseR4/Observation/1574881?_fhirpath=Observation.component.where(code.coding.code%20=%20%278462-4%27).value

view this post on Zulip Brian Postlethwaite (Jan 10 2022 at 21:27):

And I also use my fhirpath tester tool which is in the windows app store.

view this post on Zulip Sean McIlvenna (Jan 11 2022 at 15:00):

Between the HAPI _fhirpath, the FHIRPath Tester tool, and your example @Brian Postlethwaite... I got what I needed. Thanks so much!


Last updated: Apr 12 2022 at 19:14 UTC