Skip to content

Implement terminology-service FHIRPath functions via pluggable interface #306

@luisfabib

Description

@luisfabib

Four FHIRPath functions defined in the FHIR supplement to the FHIRPath specification all raise
NotImplementedError unconditionally. These functions require either a TerminologyService
endpoint or access to the full StructureDefinition stack:

Function Use case
memberOf(valueset) Valueset membership check — appears in hundreds of built-in FHIR constraints
conformsTo(profile) Profile conformance check
subsumes(code) Terminology subsumption
subsumedBy(code) Terminology subsumption (inverse)

Additionally, the error message in subsumedBy() incorrectly reads "subsumes() is not supported".

Proposed solution

Introduce a TerminologyService abstract interface (protocol) that the FHIRPath engine can
delegate to. Users register an implementation (wrapping a local FHIR server or a custom adapter)
via fhircraft.configure(terminology_service=...). When no service is registered, functions
raise a clear FHIRPathNotSupportedError with an actionable message instead of a bare
NotImplementedError.

Also fix

Correct the error message in subsumedBy() (additional.py ~L997) to reference subsumedBy()
instead of subsumes().

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfhir.pathRelated to the FHIRPath module

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions