FHIR Chat · Resource names in FHIRPath · fhirpath

Stream: fhirpath

Topic: Resource names in FHIRPath


view this post on Zulip Paul Lynch (Jul 20 2018 at 22:04):

If you have a patient resource, FHIRPath allows you to write either "Patient.name.given" or simply "name.given". In the first case, if I understand correctly, the FHIRPath interpreter checks to make sure the data object from which "name" is being pulled really is a Patient. My question is, what is special about the string "Patient" that signals the interpreter to assert that data.resourceType == Patient, as opposed to thinking that "Patient" is the name of a property of whichever resource is in the "data" object? Is it the fact that Patient starts with an uppercase letter? Or does a FHIRPath interpreter have a list of all the FHIR resource names?

view this post on Zulip Grahame Grieve (Jul 20 2018 at 22:19):

only at the root, and that the first name corresponds to the type

view this post on Zulip Paul Lynch (Jul 20 2018 at 22:44):

Then... what if someone has a resource type named "X", with a property named "Patient". If the root is of type "X", and the expression is "Patient.name.given", do you interpret that as "X.Patient.name.given", or do you return nothing because the type is X and the expression started with "Patient"?

view this post on Zulip Grahame Grieve (Jul 21 2018 at 11:16):

that's a good question

view this post on Zulip Grahame Grieve (Jul 21 2018 at 11:18):

there's nothing in the spec to address this.

view this post on Zulip Bryn Rhodes (Jul 21 2018 at 21:34):

Well, we do talk about models here: http://hl7.org/fhirpath/2018May/#models

view this post on Zulip Bryn Rhodes (Jul 21 2018 at 21:34):

We say the context provides the model.

view this post on Zulip Bryn Rhodes (Jul 21 2018 at 21:34):

And that type resolution is performed by searching through the model types first, then the system types.

view this post on Zulip Bryn Rhodes (Jul 21 2018 at 21:35):

So if you want to write FHIRPath expressions against something called X, then the context needs to define what X means.

view this post on Zulip Grahame Grieve (Jul 21 2018 at 21:35):

but it ambiguous if there's a property also called "X" on the base object. is "X" the type name or the property name?

view this post on Zulip Bryn Rhodes (Jul 21 2018 at 21:38):

Yes, that needs clarification. It's only in the special case of the root of an expression that we allow the reference to the type name though, so that's a proposed clarification.

view this post on Zulip Grahame Grieve (Jul 21 2018 at 21:39):

what would the clarification be?

view this post on Zulip Bryn Rhodes (Jul 21 2018 at 21:43):

That when resolving an identifier that is also the root of a FHIRPath expression, it is resolved as a type name first, and if it resolves to a type, it must resolve to the type of the context (or a supertype). Otherwise, it is resolved as a path on the context.

view this post on Zulip Bryn Rhodes (Jul 21 2018 at 21:45):

We something close to that already in the second paragraph here: http://hl7.org/fhirpath/2018May/#path-selection

view this post on Zulip Grahame Grieve (Jul 21 2018 at 21:53):

not close enough

view this post on Zulip Bryn Rhodes (Jul 21 2018 at 22:18):

Agreed: GF#17533

view this post on Zulip Bryn Rhodes (Jul 21 2018 at 22:20):

This is also related: GF#17271

view this post on Zulip Brian Postlethwaite (Jul 23 2018 at 06:35):

This also wouldn't be a problem in FHIR as the casing would prevent it.
Patient != patient

view this post on Zulip Brian Postlethwaite (Jul 23 2018 at 06:36):

The fhirpath spec says that case sensitivity depends on the models, however the fhirpath page doesn't say anything about it.
So I guess we haven't even covered that (I was expecting it to be case sensitive)

view this post on Zulip Grahame Grieve (Jul 23 2018 at 06:39):

yes not a problem in FHIR itself, but potentially a problem in other models that don't keep type and element names apart....

view this post on Zulip Grahame Grieve (Jul 23 2018 at 06:39):

except that we have the type 'code'...

view this post on Zulip Paul Lynch (Jul 23 2018 at 14:47):

I gather from this discussion and from http://hl7.org/fhirpath/2018May/#models that the context provides the FHIRPath interpreter with a list of known resource names (and perhaps a good bit more about resource). Is that correct?

view this post on Zulip Bryn Rhodes (Jul 23 2018 at 14:54):

Yes, the environment provides that information to the engine so that it knows what types are available, as well as what they look like.

view this post on Zulip Paul Lynch (Jul 23 2018 at 20:34):

Is there somewhere an XML or JSON list of the known FHIR resources? If that is supposed to be in the context, then I guess at least my test code will need to be passing that into the interpreter/engine. I suppose I could try to pull the information from the FHIR website (entering it by hand?) but I am guessing it must live somewhere in a format that can be processed.

view this post on Zulip Lloyd McKenzie (Jul 23 2018 at 20:52):

profiles-resources.json and profiles-types.json from whatever release you're implementing

view this post on Zulip nicola (RIO/SS) (Jul 24 2018 at 08:51):

@Paul Lynch FHIRpath is full of implicit references to FHIR meta-data, so we need compact representation of it in interpreter. I will add it to project.

view this post on Zulip Bryn Rhodes (Jul 24 2018 at 16:22):

CQL tooling uses this representation: https://github.com/cqframework/clinical_quality_language/blob/master/Src/java/quick/src/main/resources/org/hl7/fhir/fhir-modelinfo-3.0.0.xml


Last updated: Apr 12 2022 at 19:14 UTC