FHIRPath Debugger & Playground
Free FHIRPath playground: evaluate expressions against FHIR R4, R4B and R5 resources with autocomplete, result types, timing and jump-to-source. Runs in your browser.
How to use the FHIRPath Debugger
- Choose the FHIR version (R4, R4B or R5). The expression is evaluated against that version's model, which affects choice types and type checks such as
ofType(). - Paste a resource or Bundle, or pick one from the Samples menu or your workspace.
- Type an expression. Autocomplete suggests element names for the resource type, using the selected version's definitions.
- Read the result: each item with its FHIR type, the number of results, and the evaluation time. Select a result to jump to where it came from in the JSON, or to see its element definition in the inspector.
Successful expressions are saved to Recent expressions in this browser only. The Example library has ready-made expressions for common tasks. Share an expression with a link: the URL carries the expression (?expression=), never the resource.
Expressions to start with
| Goal | Expression |
|---|---|
| Official given name | Patient.name.where(use = 'official').given.first() |
| Mobile phone | Patient.telecom.where(system = 'phone' and use = 'mobile').value |
| Is the patient an adult? | Patient.birthDate <= today() - 18 years |
A Quantity value from value[x] | Observation.value.ofType(Quantity).value |
| Systolic blood pressure | Observation.component.where(code.coding.code = '8480-6').value.ofType(Quantity).value |
| An extension's value | Patient.extension('http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex').value |
| Count Patients in a Bundle | Bundle.entry.resource.ofType(Patient).count() |
| Check an invariant (obs-6) | dataAbsentReason.empty() or value.empty() |
Reading the results
- An empty result isn't an error. FHIRPath returns an empty collection when nothing matches. If you expected values, check spelling (paths are case-sensitive) and the version: R5 renamed some elements, such as Encounter
period→actualPeriod. - Computed values (counts, comparisons, string concatenation) have no element definition, so there's nothing to inspect or jump to.
- "Expected singleton" errors mean a function such as
matches()orstartsWith()received several items. Filter withwhere()or takefirst()before calling it. =on a list compares the whole list.given = 'Amy'is false when there are two given names. Usegiven contains 'Amy'.
How it works
Expressions are evaluated by fhirpath.js, the reference JavaScript implementation of the HL7 FHIRPath specification. The engine and the version model load on demand in your browser. Your resource is evaluated locally and isn't uploaded.
Limitations
resolve()isn't available, so expressions can't follow references. To match a reference with its target inside a Bundle, filter on it instead:Bundle.entry.resource.ofType(Observation).where(subject.reference = 'Patient/p1'). Nothing is fetched from a server.- Terminology functions such as
memberOf()need a terminology server, which this page doesn't call. - Input must be JSON.
FAQ
Is this the same FHIRPath the validator uses?
The FHIRPath language is the same, and the specification's invariants are written in it. The official HL7 validator uses its own Java implementation. The two agree on the vast majority of expressions, but edge cases in date precision and type handling can differ between engines.
Where can I learn FHIRPath?
Start with the FHIRPath tutorial. Every example in it was tested with the same engine this page uses.
Which FHIR versions are supported?
R4 (4.0.1), R4B (4.3.0) and R5 (5.0.0). Pick the version that matches your data, because the model affects choice types and ofType() checks.
Is my resource uploaded?
No. fhirpath.js runs in this page. Only the expression is ever put in the URL, when you share it, and never the resource.
FHIR Toolbox is a free collection of HL7 FHIR tools by Omindra Labs. The tools process your data in your browser; it is not uploaded for normal tool operations.