How to search on FHIR

Here are the searches we will be executing,

  • All patients with name starting with ‘Joh’
  • All patients with family name ‘Doe’
  • All observations of patients with name ‘John’
  • All blood pressure observations of a particular patient ‘John Doe’

All patients with name starting with ‘Joh’

This is a very straightforward search, and all it requires is to append the FHIR server URL with resource type and ?name=Joh

The URL used in the below image is, http://hapi.fhir.org/baseR4/Patient?name=Joh 
Image search 1

All patients with family name ‘Doe’

All the search parameters associated with a Patient resource are listed here under Search Parameters.

From here, we can see that the parameter we need to use is family. So the URL becomes, http://hapi.fhir.org/baseR4/Patient?family=Doe

Image search 2

All Observations of patients with name John

Here, the Observation resource refers to the Patient resource as subject so the URL becomes, http://hapi.fhir.org/baseR4/Observation?subject.name=John

And has the following output Image

All Observations of a particular patient

Here you need to know the ID of the patient, in this case we created a patient with ID: 48193284

So the URL to retrieve all observations of this patient will look like, http://hapi.fhir.org/baseR4/Observation?patient=Patient/48193284

Now to specify a particular type of Observation, we need to also search by the code. The shorthand notation for this is system|code. And so, the URL will look like this, http://hapi.fhir.org/baseR4/Observation?patient=Patient/48193284&code=http://loinc.org|15074-8.