Spec reference:
https://hl7.org/fhir/fhirpath.html
StructureDefinitionconstraints (“invariants”)SearchParameter.expressiondefinitions- mapping/transform tools and IG artifacts
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 aPatient:
- All family names:
name.family - Official family name:
name.where(use = 'official').family.first() - All given names:
name.given
where(...):
Common functions
Useful functions you’ll see in constraints:exists()/empty()count()first()/last()matches(<regex>)startsWith()/contains()
Invariants (constraints) in profiles
Profiles can declare rules like “if X is present, Y must be present”:OperationOutcome, often with an
issue.expression[] pointing at the offending element.
TLQ links
- FHIR core internals: FHIR Core: FHIRPath
- Related learning: Profiles, Validation
Next
- How constraints get authored: Profiles
- How they get enforced: Validation