Some examples of FHIR Path

Here are some examples I generated from a demo with the IBM FHIR Server

Extract the references from the first subject

Bundle.entry.resource.ofType(Observation).subject[0].reference.value

Output Patient/ebb16c62-cb06-4ff8-8ce8-ccb865e7a240

Extract the references from the first subject alternative

Bundle.entry.resource.ofType(Observation).subject.first().reference.value

Output Patient/ebb16c62-cb06-4ff8-8ce8-ccb865e7a240

Select the first Patient reference where the Diastolic is over 90

Bundle.entry.resource.ofType(Observation).where(component.where(code.coding.code = '8462-4').value.where( value > 90.0).exists()).subject.reference.value.first()

Output Patient/5fabfccd-254e-42af-bed2-84199a5c05f2

Select the Patient’s first name where the reference matches the logical id

Bundle.entry.resource.ofType(Patient).where(id = '" + v.split("/")[1] + "').name.given.value

Output John