5 FHIR Query Examples

Sort results, filter results and include connected resources.

Click the links to see the results straight away.

  1. Get the 20 most recently updated Patients
    /Patient/?_sort=-_lastUpdated&_count=20
    Live query 1.
  2. Get a list of recently updated Procedures with a status of ‘in-progress’
    /Procedure/?_sort=-_lastUpdated&_count=20&status=in-progress
    Live query 2.
  3. Get the most recently written MedicationRequest (prescription) for Hydrocortisone
    /MedicationRequest/?_sort=-authoredon&_count=1&code=106258
    Live query 3.
  4. Include the Patient with that MedicationRequest
    /MedicationRequest/?_sort=-authoredon&_count=1&code=106258&_include=MedicationRequest:subject
    Live query 4.
  5. Get all FHIR resources related to that Patient
    /Patient/1491889/$everything
    Live query 5.

FHIR queries can be complex, but they start simple. 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.

Postman collection for all the queries.

Discussion

---

Download my “FHIR Architecture Decisions” book

FHIR Weekly

Join 1,100+ business and technical leaders.

Discover more from Darren Devitt

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

Continue reading