Skip to content

Support limited resolve() function for reference type checking #2522

Open

Description

@johngrimes

Spec link: https://hl7.org/fhirpath/#additional-functions

This issue proposes a limited implementation of the resolve() function that supports type checking without actually resolving references.

Background

The FHIR search parameter expressions frequently use resolve() in combination with the is type operator to filter references by their target type. For example:

Appointment.participant.actor.where(resolve() is Location)
Person.link.target.where(resolve() is Practitioner)
DeviceAssociation.subject.where(resolve() is Patient)

These expressions are used to identify references that point to specific resource types, without needing to traverse into the referenced resource.

Proposed implementation

Implement a limited resolve() function with the following characteristics:

  1. Returns type information only - The function returns a collection that exposes the type of the referenced resource, derived from:

    • The explicit Reference.type element (if present)
    • The type from the logical reference string
  2. Supports is operator for type checking - The result can be used with the is operator to check if the reference targets a specific resource type.

  3. Does not support traversal - Attempting to traverse into child elements of the resolved reference throws an UnsupportedFhirPathFeatureError. This avoids the complexity of joining across resources.

  4. Does not perform actual resolution - The function does not join to or load the referenced resource.

Example behaviour

// Supported - returns references that target Location resources
Appointment.participant.actor.where(resolve() is Location)

// Supported - type check returns boolean  
Appointment.participant.actor.resolve() is Patient

// NOT supported - throws UnsupportedFhirPathFeatureError
Appointment.participant.actor.resolve().name

Scope

This implementation would enable 16 search parameter expressions that use the pattern reference.where(resolve() is TypeName). Note that these tests also require #2383 (type operators) and #2398 (union operator) to fully pass, as the search parameter expressions combine multiple features.

Activity

  1. added
    new feature
    fhirpath
    on Dec 12, 2025
  2. moved this from Backlog to Planned in Pathlingon Dec 12, 2025
  3. moved this from Planned to In progress in Pathlingon Dec 22, 2025
  4. moved this from In progress to Done in Pathlingon Feb 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

fhirpathnew feature

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions