FHIRPath is a domain-specific, path-based expression language designed to traverse and extract data from FHIR resources. It provides a standard, implementation-independent syntax for navigating the hierarchical structure of a resource, filtering collections, and computing scalar values. The language is formally defined as part of the FHIR specification and is used wherever a computable expression is required to reference a specific data element.
Glossary
FHIRPath

What is FHIRPath?
FHIRPath is a path-based navigation and extraction language used to query and compute expressions on FHIR data, for use in invariants, search parameters, and slicing.
Its primary applications include defining invariants in StructureDefinition profiles, constructing search parameter expressions, and specifying slicing discriminator paths. FHIRPath expressions evaluate against a resource instance to return a collection of matching nodes, enabling precise, programmatic validation and querying without relying on external scripting languages.
Key Features of FHIRPath
FHIRPath is a path-based navigation and extraction language used to query and compute expressions on FHIR data. It is essential for defining invariants, search parameters, and slicing logic within FHIR profiles and implementation guides.
Path-Based Navigation
FHIRPath uses a dot-notation syntax to traverse the hierarchical structure of FHIR resources. It allows developers to navigate from a root resource into nested elements, backbone elements, and data types.
- Navigate to
Patient.name.givento extract first names - Traverse collections using
Condition.stage.summary - Access deeply nested extensions with
.extension.where(url='...').value
The language treats all paths as collections, meaning a single path can return zero, one, or multiple values depending on cardinality.
Invariant Constraints
FHIRPath is the standard language for defining formal constraints (invariants) within FHIR profiles. These constraints enforce business rules that go beyond simple cardinality and terminology bindings.
- Define rules like
start <= endon a Period element - Enforce co-occurrence:
condition.exists() implies severity.exists() - Validate cross-element logic within a single resource
Invariants are expressed in the constraint element of a profile's ElementDefinition, providing machine-readable validation rules.
Collection Filtering and Projection
FHIRPath provides powerful functions for filtering and transforming collections of elements. The where() and select() functions enable SQL-like querying directly within FHIR expressions.
- Filter by criteria:
Patient.identifier.where(type.coding.code = 'MR') - Project specific properties:
Observation.component.select(code) - Combine with
exists(),all(), andcount()for cardinality checks
These functions are critical for slicing discriminators and search parameter expressions.
Type-Specific Operators
FHIRPath includes operators tailored to FHIR data types, enabling precise manipulation of clinical and administrative data without custom parsing logic.
- String operators:
startsWith(),contains(),matches(regex) - Quantity math:
(value + 10) > 50 'mg'for dose comparisons - Date arithmetic:
today() - birthDate > 18 yearsfor age checks - Coding equality:
code.memberOf('http://snomed.info/sct?fhir_vs=isa/404684003')
This type-awareness makes FHIRPath uniquely suited for healthcare data validation.
Search Parameter Definition
FHIRPath is used to define custom search parameters in FHIR profiles and implementation guides. The expression specifies exactly which element a search parameter indexes.
- Define a search on
Patient.extension.where(url='...').value.ofType(CodeableConcept) - Enable composite parameters by combining multiple paths
- Support chained and reverse chained searches through path expressions
This allows implementers to expose domain-specific query capabilities beyond the base FHIR search parameters.
Slicing Discriminators
FHIRPath expressions serve as discriminators for slicing, the mechanism that differentiates between repeated elements in a profile. The discriminator path tells validators which element value distinguishes one slice from another.
- Slice
Observation.componentbycodeusing pathcode - Differentiate
Patient.identifierslices bysystemandtype - Support multi-key slicing with compound discriminator paths
This is fundamental to profiling patterns like US Core Blood Pressure, where systolic and diastolic components are distinct slices.
Frequently Asked Questions
Clear, technical answers to the most common questions about navigating and extracting data from FHIR resources using the standard path-based expression language.
FHIRPath is a path-based navigation and extraction language designed specifically for traversing and computing expressions on FHIR data. It operates on the tree-structured object model of a FHIR resource, allowing developers to navigate from a root node down through nested elements, filter collections, and extract specific values. The language is evaluated against a context—typically a FHIR resource or a specific element within one—and returns a collection of values. FHIRPath is used extensively in invariants (constraints defined in StructureDefinition), search parameter expressions, and slicing discriminator paths to define rules that must be true for a resource to be valid. Its syntax is derived from XPath but adapted for the JSON-centric, strongly-typed world of FHIR, supporting functions like exists(), where(), select(), and aggregate() to manipulate collections of complex data types.
Common FHIRPath Use Cases
FHIRPath is a path-based navigation and extraction language used to query and compute expressions on FHIR data. It is essential for defining invariants, search parameters, and slicing logic within FHIR profiles and implementation guides.
FHIRPath vs. Similar Query Languages
A feature comparison of FHIRPath against other path-based and query languages used in healthcare and general-purpose data contexts.
| Feature | FHIRPath | XPath 3.1 | JSONPath |
|---|---|---|---|
Primary Design Purpose | Navigating and extracting data from FHIR resources; evaluating invariants and search parameters | Navigating and querying XML documents | Navigating and extracting data from JSON documents |
Native Data Model | FHIR tree of resources, elements, and data types | XML Infoset (elements, attributes, text nodes) | JSON object and array structures |
Expression Context | Rooted in a FHIR resource; context is a collection of nodes | Rooted in an XML document; context is a sequence of nodes | Rooted in a JSON value; context is a nodelist |
Collection Handling | Implicit flattening and collection-centric functions (e.g., where(), select()) | Explicit sequence manipulation; no implicit flattening | Limited collection operations; primarily array slicing and filtering |
Terminology Awareness | |||
Type System | FHIR primitive and complex data types (e.g., dateTime, Quantity, CodeableConcept) | XML Schema Definition types (e.g., xs:string, xs:integer) | JSON types (string, number, boolean, object, array, null) |
Invariant Evaluation | |||
Standardized by | HL7 International | W3C | IETF (proposed standard RFC 9535) |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Core concepts and specifications that interact with FHIRPath to enable querying, validation, and data extraction within FHIR-based systems.
FHIR Validator
A conformance checking tool that executes FHIRPath constraints against resource instances. The validator evaluates every invariant expression to determine if a resource is structurally and semantically valid.
- Constraint evaluation: Runs all
constraintelements with FHIRPath expressions - Terminology binding: Validates codes against bound ValueSets
- Profile conformance: Checks cardinality, slicing, and extension rules
- Error reporting: Returns
OperationOutcomewith line/column details - Integration: Embedded in HAPI FHIR, Firely .NET SDK, and validator CLI
SearchParameter Expressions
FHIRPath is the expression language used to define custom search parameters. The expression element specifies which resource elements are indexed for querying.
- Simple path:
Patient.nameindexes all name parts - Complex expression:
Encounter.participant.where(type.coding.code='ATND') - Chaining: Enables searches like
GET /Observation?patient.name=Smith - Composite parameters: Combine two paths for paired queries
- Compartment definitions: Use FHIRPath to define resource membership in patient compartments
StructureMap Transformations
While StructureMap uses its own mapping language, FHIRPath expressions are embedded within expression elements to source data from input resources during transformations.
- Source extraction:
source.extension('http://hl7.org/fhir/us/core/StructureDefinition/us-core-race') - Conditional logic: FHIRPath
where()andselect()for filtering - Type handling:
as(CodeableConcept)for safe type casting - Relationship: StructureMap handles the transformation logic; FHIRPath handles data access
- Alternative: FHIR Mapping Language uses a different syntax for the same purpose
Terminology Service Operations
FHIRPath provides functions that invoke the FHIR Terminology Service for code system operations directly within expressions.
memberOf('http://snomed.info/sct?fhir_vs=isa/404684003'): Tests code membership in a ValueSetsubsumes(code): Checks if a concept subsumes another in the hierarchyconformsTo('http://hl7.org/fhir/StructureDefinition/Patient'): Validates against a profileresolve(): Follows references to retrieve full resourcesextension(url): Accesses specific extensions by canonical URL

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us