Expression seems incorrect for reference search parameter that's only applicable to certain types


#1

Hi there,

I don’t think the expression is correctly defined in various reference search parameters when the search parameters are restricted to only certain types.

Take appointment as an example:

http://hl7.org/fhir/appointment.html

Appointment.location is a reference search parameter pointing to Appointment.participant.actor when actor is a Location resource (if I understood the spec correctly).

However, if you look at the expression of the search parameter (https://simplifier.net/CoreSearchParameters/Appointment-location/~json), the expression is defined as:

“expression”:“Appointment.participant.actor”,

which will return all actors regardless of the element type. Should the expression be defined as:

“expression”:“Appointment.participant.actor.ofType(Location)”

instead as specified by FHIR Path (http://hl7.org/fhirpath/) section 3.2 Paths and polymorphic items?

When I tried that expression with the .NET FHIR SDK, I got error Unknown symbol ‘ofType’. Looks like it hasn’t been implemented yet.

The definition file does contain “Target” resource type, so the workaround could be done by the caller by filtering out the elements returned by FHIR path by examining the reference but that’s cumbersome too since it needs to analyze and the reference string and supports both internal and external references.

Is this a spec issue or am I misunderstanding the spec?

Thanks


#2

thanks for picking this up - yes, they are being generated incorrectly. I’ve just fixed them in the R4 CI build version. Note, though, that is the correct form:

Appointment.participant.actor.where(resolve() is Location)


#3

Thanks Grahame. Do you want me to fine a tracking issue for this?


#4

no need, thanks - I’ve already fixed it in R4