FHIR Query Examples

FHIR queries can be complicated, but they start simple.

These five queries demonstrate the basics of FHIR search. Building a query, filtering, sorting, and including connected resources.

Click the links to see the results straight away on the HAPI test server.

1. Get the 20 most recently updated Patients
/Patient/?_sort=-_lastUpdated&_count=20
Live query

2. Get a list of recently updated Procedures with a status of ‘in-progress’
/Procedure/?_sort=-_lastUpdated&_count=20&status=in-progress
Live query

3. Get the most recently written MedicationRequest (prescription) for Hydrocortisone
/MedicationRequest/?_sort=-authoredon&_count=1&code=106258
Live query

4. Include the Patient with that MedicationRequest
/MedicationRequest/?_sort=-authoredon&_count=1&code=106258&_include=MedicationRequest:subject
Live query

5. Get all FHIR resources related to that Patient
/Patient/9586235/$everything
Live query

You can build on these queries to add more parameters and return more resources.

And best of all, you can test your queries on the HAPI FHIR server for free. No signup required.

Discussion

---

Ways to Work With Me

Discover more from Darren Devitt

Subscribe now to keep reading and get access to the full archive.

Continue reading