FHIRPath is a path-based navigation and extraction language for FHIR data. Modeled on XPath, it provides a concise, composable syntax for traversing the hierarchical structure of FHIR resources, evaluating invariants, and extracting specific values. It is the standard expression language used within FHIR profiles, StructureDefinition invariants, and Questionnaire logic to define constraints and calculated fields.
Glossary
FHIRPath

What is FHIRPath?
FHIRPath is a path-based navigation and extraction language, analogous to XPath for XML, specifically designed to evaluate expressions and extract data from FHIR (Fast Healthcare Interoperability Resources) structures.
The language operates on a tree model of a FHIR instance, returning a collection of values. It supports boolean logic, string manipulation, collection filtering, and type conversion. FHIRPath is integral to FHIR validation, enabling implementers to express complex cross-field constraints that cannot be defined by simple cardinality or data type rules, ensuring semantic conformance.
Key Features of FHIRPath
A path-based navigation and extraction language, analogous to XPath for XML, designed to evaluate expressions against FHIR data structures for clinical decision support, data validation, and quality measurement.
Path-Based Navigation
FHIRPath uses a dot-notation syntax to traverse nested FHIR resources and elements, similar to XPath for XML documents.
- Navigate complex hierarchies:
Patient.name.given - Access list indices:
Patient.name[0].family - Use wildcards:
Bundle.entry.resource.* - Filter with predicates:
Observation.component.where(code.coding.code = '8480-6')
This enables precise extraction of specific clinical data points from deeply nested FHIR structures without custom parsing code.
Rich Function Library
FHIRPath includes a comprehensive set of built-in functions for data manipulation and evaluation.
- String operations:
startsWith(),contains(),replace(),substring() - Aggregation:
count(),sum(),avg(),min(),max() - Logical operators:
exists(),allTrue(),anyTrue(),all() - Type conversion:
toString(),toInteger(),toDecimal(),toBoolean() - Date/time math:
today(),now(),yearsBetween(),monthsBetween()
Example: Observation.valueQuantity.value > 140 evaluates a blood pressure threshold.
FHIR-Specific Operators
FHIRPath extends standard expression languages with healthcare-specific operators designed for clinical data types.
asoperator: Safe type casting, e.g.,Observation.value as Quantityisoperator: Type checking, e.g.,Observation.value is CodeableConcept~equivalence: Compares coded concepts semantically, not just string equality$thiskeyword: References the current context node in nested expressions- Extension access:
Patient.extension('http://hl7.org/fhir/us/core/StructureDefinition/us-core-race').value
These operators handle the nuances of medical terminologies and FHIR's polymorphic data types.
Invariant Validation
FHIRPath is the primary language for defining constraints in FHIR profiles and implementation guides using the constraint element.
- Define co-occurrence rules:
name.given.exists() or name.family.exists() - Enforce value ranges:
value >= 0 and value <= 100 - Validate cross-field logic:
onsetDateTime.empty() or onsetAge.empty() - Check terminology bindings:
code.memberOf('http://hl7.org/fhir/ValueSet/observation-codes')
These invariants are evaluated by the FHIR Validator to ensure resource conformance against profiles like US Core.
Context-Aware Evaluation
FHIRPath expressions execute against a dynamic evaluation context that includes the focus resource, root resource, and environment variables.
%context: Access the current focus node being evaluated%resource: Reference the root resource containing the focus%rootResource: Access the top-level resource in a Bundle%ucum: Access UCUM unit conversion services%terminologies: Access terminology service for code validation
This context model enables expressions that navigate both downward into nested elements and upward to parent structures, critical for complex clinical rules.
Integration with CDS Hooks
FHIRPath serves as the expression language for CDS Hooks card rules and prefetch templates, enabling dynamic clinical decision support.
- Define trigger conditions:
Patient.birthDate < today() - 65 years - Construct prefetch queries:
Observation?patient={{context.patientId}}&code=4548-4 - Evaluate response cards:
MedicationRequest.status = 'active' - Link to SMART on FHIR apps for interactive decision support
This integration allows EHR systems to invoke context-aware clinical guidance at specific points in the clinician workflow.
Frequently Asked Questions
Clear, technical answers to the most common questions about navigating and extracting data from FHIR resources using the FHIRPath expression language.
FHIRPath is a path-based navigation and extraction language, analogous to XPath for XML, designed specifically to evaluate and traverse FHIR (Fast Healthcare Interoperability Resources) data structures. It operates on the logical tree of a FHIR resource, not its serialized JSON or XML format. The language processes a sequence of expressions, where each expression takes a collection of items as input and produces a new collection as output. This functional, side-effect-free design ensures deterministic evaluation. FHIRPath is integral to the FHIR specification itself, used to define invariants in StructureDefinition profiles, express search parameter paths, and power Clinical Quality Language (CQL) logic. It provides a standardized way to write a single expression that works identically across all FHIR serialization formats, abstracting away the syntactic differences between JSON, XML, and RDF representations.
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
Explore the core standards and tools that FHIRPath relies on for data navigation, validation, and clinical knowledge extraction in interoperable healthcare systems.

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