fhir_path library
Model-independent FHIRPath engine. No FHIR dependency — data is navigated
through the FhirNode contract (package fhir_node) and version knowledge
is supplied at the boundary via the IWorkerContext /
IFhirValueFactory interfaces (FHIR bindings live in the fhir_r*_path
packages).
Typical use goes through a binding, but the engine surface is:
FHIRPathEngine.create → FHIRPathEngine.parse (once per expression —
parsed ExpressionNodes should be cached by the caller and are tied to
the IFhirValueFactory that parsed them) → evaluate*. All expression
failures extend PathEngineException; programming errors surface as
PathEngineError.
The implementation collaborators (FhirPathFunctions/Operations/Utilities, the equality kernel, string/number helpers) are internal and deliberately not exported.
Classes
- CachedCanonicalResource
- A cached canonical resource with the keys the cache files it under.
- CacheEntry
- A cached answer.
- CacheToken
- A validation request's key in the cache.
- CanonicalResourceCache
- A resource cache that holds what it is given, in memory.
- ClientLogger
- Logging Class for Client
- CodeInValueSetResult
- CodeInValueSetResult
- CodingValue
- A Coding's four fields, read out of any model's node or JSON. The terminology layer passes these around instead of a version's Coding class.
- ConceptDefinition
- A code system concept's definition, as a validation answers it: the code, its display and its definition text.
- ConceptValue
- A CodeableConcept's codings and text, read out of any model's node.
- ElementBinding
-
An
ElementDefinition.binding. - ElementConstraint
-
An
ElementDefinition.constraint. - ElementDefinitionMatch
-
One ElementDefinition found by path, with the concrete type a typed
choice name (
valueString) fixed, if it did. - ElementNode
- An ElementDefinition read by element name, as plain Dart values, whatever version the definition comes from: what a validator or a mapping engine asks of one.
- ElementType
-
One
ElementDefinition.type. - ExecutionContext
- ExecutionTypeContext
- ExpressionNode
- ExpressionNodeWithOffset
- FHIRConstant
-
Parse-time marker for an unresolved
%constant/@dateliteral in the expression tree. It is resolved (or an exception is thrown) before evaluation results are produced, so it never appears in engine output. Engine-owned: implementsFhirNodedirectly rather than extending any model class (mirrors Java, where FHIRConstant extends Base only because Base is the node contract there). - FHIRLexer
- FhirModelBinding
-
What one FHIR version supplies so the engine's worker context, caches
and terminology layer can run over any model: everything else in those
classes reads a resource by element name through
FhirNode. - FHIRPathConstant
- FhirPathContext
- Context object holding shared state and utilities for FHIRPath engine.
- FHIRPathEngine
- FhirToolingClient
- The two terminology-server calls the worker context makes, over plain JSON (the Parameters resource in and out as maps).
- FhirWorkerContext
-
The engine's worker: type metadata (StructureDefinitions and the
binding's type table), canonical resources, and terminology, over any
model. A binding package subclasses it to supply its FhirModelBinding
and keep its
WorkerContext()constructor. - FunctionDetails
- ICoding
- The coding-shaped fields of a value, when it has them: a Coding's four, or a Quantity's system and code.
- IEvaluationContext
- IFhirValueFactory
-
The engine's contract for constructing the FHIR-typed values it yields
as evaluation results. The engine logic never names concrete FHIR value
classes (
FhirBoolean,FhirString, …); every literal/result it constructs goes through this factory, whose implementation lives in the FHIR binding (reached viaIWorkerContext.valueFactory). - IValidationOutcome
-
The engine-facing outcome of a terminology validation. The engine's
memberOfplumbing reads only success/failure; the binding's richValidationResultimplements this (covariant return), the same pattern asFhirBase implements FhirNode. - IWorkerContext
-
The FHIRPath engine's contract for FHIR-version knowledge — type
metadata, terminology, and message formatting. Mirrors the Java
reference's
IWorkerContextseam: the engine reaches runtime values only through theFhirNodecontract, and reads ALL type metadata through these neutral queries, so one engine serves any FHIR version whose binding supplies an implementation (the R4 binding'sWorkerContextis one). No member of this interface names a FHIR model type: resources travel as opaqueFhirNodes and structure knowledge travels as data (names, URLs, ancestry pairs). - LoggingService
- LoggingService
- NamedCache
- One code system's cache.
- OnlineResourceCache
- A CanonicalResourceCache that fetches by HTTP GET what it does not hold, parses it with the model's parse, and keeps it.
- PackageVersion
- ProfiledType
- ResourceCache
- Where the worker context finds canonical resources (StructureDefinition, ValueSet, CodeSystem, ...). Every resource is a node of whatever model the binding uses; a caller that wants its typed class casts, because the binding's nodes ARE its typed objects.
- SourceLocation
- SystemDateTime
-
A model-independent FHIRPath
System.DateTime/System.Datevalue. - SystemTime
-
A model-independent FHIRPath
System.Timevalue. Time comparison is a component-wise comparison of the:-separated parts, yielding null when the two operands have a differing number of components. - TemporalDuration
- A plain carrier of calendar-unit amounts for date/time arithmetic.
- TerminologyCache
- A two-level cache of terminology answers: validations keyed by the request they answered, and expansions keyed by value set.
- TypeDetails
- TypeHierarchyEntry
-
One core FHIR type's place in the type hierarchy, as its
StructureDefinition states it: the per-version bindings generate a table
of these from profiles-types.json and profiles-resources.json, so the
engine can walk
is,ofTypeand the subtype chain with no definitions loaded (the approach fhirpath.js takes with its generated type2Parent). - Utilities
- String helpers used by the engine, ported from org.hl7.fhir.utilities (same semantics as the copies in Ucum-java). These previously leaked in through package:ucum's barrel; since ucum 0.9.0 curates its exports, the engine owns them.
- ValidationContextCarrier
-
Resources the caller has in hand that a value set may refer to by
contained reference (
#id): the checker looks for a contained CodeSystem in each of them. Held as nodes of any model. - ValidationOptions
- ValidationOptions
- ValidationResult
- The answer to "is this code valid (in this value set)?".
- ValidatorFetcher
- ValidatorFetcher
- ValueSetCacheToken
- ValueSetCacheToken
- ValueSetChecker
- Checks codes against a ValueSet, and against the CodeSystems the worker context can reach, reading every resource by element name.
- ValueSetExpander
- Expands a ValueSet.
- ValueSetExpanderSimple
- Expands a ValueSet from its compose, using the CodeSystems the worker context can reach. The expansion is built as JSON and handed back as a node of the binding's model.
- ValueSetExpansionOutcome
- The result of a ValueSet expansion.
- VersionUtilities
Enums
- CollectionStatus
- ExpressionNodeKind
- FhirPublication
- FpFunction
- FpOperation
- LogCategory
- LogCategory enum
- TemporalComparator
- The comparison kinds used by the FHIRPath relational/equality operators.
- TerminologyServiceErrorClass
- Why a terminology operation could not answer. Was a FHIR code type in the per-version bindings (TerminologyServiceErrorClass extends FhirCodeEnum, with a generated copyWith); it is never serialised as FHIR, so a Dart enum says the same thing.
- ValidationSeverity
- How loud a validation answer is. Mirrors OperationOutcome.issue.severity without a version's IssueSeverity type.
Constants
- coreStructureDefinitionBase → const String
- The base a relative type code is resolved against.
- NS_SYSTEM_TYPE → const String
Functions
-
isSystemVariable(
String name) → bool -
typeCodeCanonical(
String code) → String -
The canonical URL of the StructureDefinition that type
codenames.
Exceptions / Errors
- ETooCostly
- Exception for when a ValueSet is too costly to expand
- FHIRLexerException
- Represents an error that occurred during the lexing phase of FHIRPath parsing.
- FhirPathDeprecatedExpressionException
- The FHIRPath expression is using elements that have been deprecated.
- FhirPathEvaluationException
- The evaluation of the expression failed with the given parameters.
- FhirPathException
- Something went wrong while parsing or executing a FHIRPath expression.
- FhirPathInvalidExpressionException
- The overall syntax of the expression is incorrect.
- NoTerminologyServiceException
- Exception thrown when a terminology service is not available.
- PathEngineError
- An error that occurs during FHIRPath evaluation.
- PathEngineException
- An exception that occurs during FHIRPath evaluation.
- TerminologyServerException
- A terminology server call that did not answer.