Skip to main content
FHIRPath is a small expression language for navigating and querying FHIR resources. You’ll most often encounter it inside:
  • StructureDefinition constraints (“invariants”)
  • SearchParameter.expression definitions
  • mapping/transform tools and IG artifacts
It’s not a replacement for FHIR Search; it’s a way to talk about a resource’s contents in a precise, computable way.

A quick mental model

  • FHIRPath evaluates to a collection (even when there’s one item).
  • . navigates elements.
  • Arrays “just work” (expressions apply across repeated elements).

Basic navigation examples

Given a Patient:
  • All family names: name.family
  • Official family name: name.where(use = 'official').family.first()
  • All given names: name.given
Filters use where(...):
identifier.where(system = 'http://hospital.example/mrn').value

Common functions

Useful functions you’ll see in constraints:
  • exists() / empty()
  • count()
  • first() / last()
  • matches(<regex>)
  • startsWith() / contains()
Example:
telecom.where(system = 'email').value.exists()

Invariants (constraints) in profiles

Profiles can declare rules like “if X is present, Y must be present”:
gender.exists() implies birthDate.exists()
When a validator evaluates this, violations show up in an OperationOutcome, often with an issue.expression[] pointing at the offending element.

Next