Stream: fhirpath
Topic: Resource names in FHIRPath
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?
Grahame Grieve (Jul 20 2018 at 22:19):
only at the root, and that the first name corresponds to the type
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"?
Grahame Grieve (Jul 21 2018 at 11:16):
that's a good question
Grahame Grieve (Jul 21 2018 at 11:18):
there's nothing in the spec to address this.
Bryn Rhodes (Jul 21 2018 at 21:34):
Well, we do talk about models here: http://hl7.org/fhirpath/2018May/#models
Bryn Rhodes (Jul 21 2018 at 21:34):
We say the context provides the model.
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.
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.
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?
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.
Grahame Grieve (Jul 21 2018 at 21:39):
what would the clarification be?
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.
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
Grahame Grieve (Jul 21 2018 at 21:53):
not close enough
Bryn Rhodes (Jul 21 2018 at 22:18):
Agreed: GF#17533
Bryn Rhodes (Jul 21 2018 at 22:20):
This is also related: GF#17271
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
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)
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....
Grahame Grieve (Jul 23 2018 at 06:39):
except that we have the type 'code'...
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?
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.
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.
Lloyd McKenzie (Jul 23 2018 at 20:52):
profiles-resources.json and profiles-types.json from whatever release you're implementing
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.
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