Stream: implementers
Topic: FHIRPath expression
Nikhil (May 19 2020 at 05:40):
Hi Everyone,
Needed a clarification regarding the FHIRPath expression defined in SearchParameter for value[x] fields.
The expression for searchparameter to search a value[x] field should have all possible variants allowed for search ?
for example, As of now the FHIRPath expression for the field CarePlan->activity->detail->scheduled
Which of the below expressions is the correct way of defining the FHIRPath expression ?
-
"CarePlan.activity.detail.scheduled"
-
"CarePlan.activity.detail.scheduled as Timing | CarePlan.activity.detail.scheduled as Period | CarePlan.activity.detail.scheduled as string"
Nikhil (May 19 2020 at 10:58):
@Lloyd McKenzie
It will be very helpful if you could help me with this query.
Lloyd McKenzie (May 19 2020 at 15:23):
What is the search type for your parameter? I don't think there's a single search type that would work for Timing, Period and string...
Nikhil (May 20 2020 at 12:09):
This is a standard SearchParameter defined in R5.
I am confused with the usage of FHIRPath expressions defined in SearchParameter.
For example,
Resource : "CarePlan" ,
searchparameter : "activity-date" ,
expression : "CarePlan.activity.detail.scheduled"
xpath : "f:CarePlan/f:activity/f:detail/f:scheduledTiming | f:CarePlan/f:activity/f:detail/f:scheduledPeriod | f:CarePlan/f:activity/f:detail/f:scheduledString"
similarly for another resource which has a searchparameter on value[x] kind of field,
Resource : "Condition" ,
searchparameter : "abatement-date" ,
expression : "Condition.abatement.as(dateTime) | Condition.abatement.as(Period)"
xpath : "f:Condition/f:abatementDateTime | f:Condition/f:abatementPeriod"
The expression for the "activity-date" searchparamter should have been,
"CarePlan.activity.detail.scheduled.as(Timing) | CarePlan.activity.detail.scheduled.as(Period) | CarePlan.activity.detail.scheduled.as(string)
Is my understanding right ?
Lloyd McKenzie (May 20 2020 at 15:11):
@Grahame Grieve
Nikhil (May 21 2020 at 09:03):
@Grahame Grieve
Could you please help me with this query ?
Bryn Rhodes (May 21 2020 at 23:21):
Yes, the FHIRPath should be using the as
operator or the .as(...)
syntax, not the named choice
Nikhil (May 22 2020 at 10:39):
Should I raise a ticket in Jira for this ?
@Grahame Grieve @Lloyd McKenzie @Bryn Rhodes
Bryn Rhodes (May 22 2020 at 14:32):
I don't see anything wrong with the SearchParameter as written, FHIRPath allows for expressions that reference choice types, and the date search type allows for searching on the possible types for the scheduled element, so I'm not clear what the actual question is here?
Vassil Peytchev (May 22 2020 at 15:11):
I think the questions is specifically, is
expression : "CarePlan.activity.detail.scheduled"
correct?
Lloyd McKenzie (May 22 2020 at 16:10):
@Bryn Rhodes, the question is how you can have a single search parameter that searches against timing, period and string
Bryn Rhodes (May 22 2020 at 16:24):
Ah, the string choice, I missed that one. So that should probably explicitly specify the date-valued choices. Which would be a tracker, yes.
Lee Surprenant (May 22 2020 at 16:52):
Is this the same as https://jira.hl7.org/browse/FHIR-25210 ?
Lee Surprenant (May 22 2020 at 16:52):
if so, that should have been fixed with https://github.com/HL7/fhir/pull/775/commits/6947f33720ee371e1b2ab3c29b350831ebaeb547
Lee Surprenant (May 22 2020 at 16:54):
and I don't see any activity-date
at http://build.fhir.org/careplan.html#search
Lee Surprenant (May 22 2020 at 16:55):
@Nikhil where are you seeing this SearchParameter?
Nikhil (May 22 2020 at 17:19):
@Lee Surprenant It is same as that you mentioned. I remember seeing few more such cases in the R5 searchparameter set.
I saw that here,
http://hl7.org/fhir/2020Feb/careplan.html.
Looks like its fixed here https://github.com/HL7/fhir/pull/775/commits/6947f33720ee371e1b2ab3c29b350831ebaeb547 .
Vassil Peytchev (May 22 2020 at 17:31):
Yes, it is fixed in the current build: http://build.fhir.org/careplan.html
Nikhil (Jun 02 2020 at 07:45):
Hi everyone,
As mentioned above, i found another searchparameter on "Specimen" resource having similar issue.
current defined expression : "Specimen.collection.collected"
Should it be modified to Specimen.collection.collected.as(dateTime) | Specimen.collection.collected.as(Period)
Reference:
http://build.fhir.org/specimen.html
Lee Surprenant (Jun 02 2020 at 12:58):
Hi Nikhil. In this particular case, both dateTime and Period will map to the same search parameter type: date
Lee Surprenant (Jun 02 2020 at 12:59):
Therefor, the "as" is not strictly required
Lee Surprenant (Jun 02 2020 at 12:59):
its only required when you have an expression that could resolve to a type which cannot be mapped to the given search parameter type
Lee Surprenant (Jun 02 2020 at 13:02):
see http://build.fhir.org/search.html#table for a summary of that and note that both dateTime and Period have a Y in the "date" column.
Lee Surprenant (Jun 02 2020 at 13:03):
I'm pretty sure I caught all potential mismatches in the base spec in the past and it seems that most of those have now been resolved
Lee Surprenant (Jun 02 2020 at 13:54):
hmm, actually I just went back and I see FHIR#24172 still needs to get applied and FHIR#25174 was closed as "Not Persuasive"
Nikhil (Jun 03 2020 at 07:58):
This is helpful. Thanks @Lee Surprenant
Harrison Tarr (Jun 22 2020 at 23:42):
Hi all, it looks like RiskAssessment-probability is another case of a typechoice missing the "as" preposition at the end of the FHIR path. There are some typechoice search params that are missing the "as" where the underlying types are both subtypes of the search param type (eg, MessageHeader-event can be either code or string, both of which can be token)
however, probability is either a decimal or a Range, which are number and Quantity search types respectively. Should we treat RiskAssessment-probability as a decimal or Range when doing the search?
Lloyd McKenzie (Jun 23 2020 at 03:04):
@Harrison Tarr Can you submit a change request? (Use the 'propose a change' link at the bottom of any page in the spec.)
Lee Surprenant (Jun 23 2020 at 12:10):
Thats exactly what FHIR#25174 was for. I'm gonna hop on the CDS conference call tomorrow to try convincing them to reopen it, but the fix will not be easy because what they want is a single search parameter that you can use to search either choice type
Last updated: Apr 12 2022 at 19:14 UTC