Stream: fhirpath
Topic: filter by postal code
Tushar Nair (Aug 27 2021 at 02:20):
Hello,
I am trying to filter the resources by the zip code. The scenario is to extract from a FHIR bundle postal codes where value of the postalCode ='44124'. I tried different variations like PractitionerRole.healthcareService.resolve().location.resolve().address.postalCode('44124').value. It didnt work.Then I tried PractitionerRole.healthcareService.resolve().location.resolve().address.postalCode.where(postalCode='44124'). It didn't work.I also tried PractitionerRole.healthcareService.resolve().location.resolve().address.postalCode.(postalCode='44124') , didnt get result. Can somebody please suggest what would be the correct syntaxt to handle this. Thanks in advance. @Lloyd McKenzie @Grahame Grieve
Lloyd McKenzie (Aug 27 2021 at 02:26):
I think what you want is PractitionerRole.where(healthcareService.resolve().location.resolve().address.postalCode='44124')
?
Tushar Nair (Aug 27 2021 at 02:33):
@Lloyd McKenzie , it is bringing the entire PractitionerRole resource back, I simply want to extract the zip code. nothing else
Grahame Grieve (Aug 27 2021 at 02:33):
how do you mean, 'bringing the whole resource back'. How are you executing the FHIRPath?
Tushar Nair (Aug 27 2021 at 02:36):
Grahame Grieve like this:
{
"name": "result",
"resource": {
"resourceType": "PractitionerRole",
"id": "1912884",
"meta": {
"versionId": "1",
"lastUpdated": "2021-02-28T22:55:47.367+00:00",
"source": "#WjJ32gkJCVMoR6YU"
},
"active": true,
"practitioner": {
"reference": "Practitioner/1912759",
"type": "Practitioner"
},
"organization": {
"reference": "Organization/1912733",
"type": "Organization"
},
"code": [ {
"coding": [ {
"system": "http://terminology.hl7.org/CodeSystem/practitioner-role",
"code": "doctor"
} ]
} ],
"location": [ {
"reference": "Location/1912741",
"type": "Location"
} ],
"healthcareService": [ {
"reference": "HealthcareService/1863096",
"type": "HealthcareService"
} ]
}
}
Lloyd McKenzie (Aug 27 2021 at 02:37):
You want to bring back a zip code that is equal to a string you're passing in?
Tushar Nair (Aug 27 2021 at 02:38):
Lloyd McKenzie Yes please
Tushar Nair (Aug 27 2021 at 02:39):
example:
{
"name": "result",
"valueString": "94538"
}
Lloyd McKenzie (Aug 27 2021 at 02:39):
How does that help? You'll get back a collection of strings with the value '44124'
Tushar Nair (Aug 27 2021 at 02:40):
trying to extract and export as a report where i have Practioner name which would be a separate fhirpath, practitioner NPI-separate fhirpath and the zip code separate fhirpath
Lloyd McKenzie (Aug 27 2021 at 02:41):
But why return the zip code if you're matching for a specific zip code?
Lloyd McKenzie (Aug 27 2021 at 02:43):
Do you just want the zip code(s) regardless of value? (You'll probably get more than one as there will likely be multiple locations, healthcareservices and addresses)
Tushar Nair (Aug 27 2021 at 02:46):
I was trying to extract a report where the Practitioner name, NPI & zip code are presented to the user. To do so i used the query: PractitionerRole?_profile=http://hl7.org/fhir/us/davinci-pdex-plan-net/StructureDefinition/plannet-PractitionerRole&_include=PractitionerRole:practitioner&_include=PractitionerRole:service&_include:iterate=HealthcareService:location&service.location.address-postalcode=${PostalCode}
Tushar Nair (Aug 27 2021 at 02:47):
But as you pinted out - the PractitionerRole had multiple locations.Some of those locations had zip codes other than what was used as input in the query, so I was trying to extract the zip codes that really were used in the query. But I guess u have a point-i can do away with the zip code
Tushar Nair (Aug 27 2021 at 02:50):
Just one question though - do you think the query shall work correctly , I am not sure how to ascertain it is filtering only by the input zip code. I tried it on a small sample created by me and it seem to be working though
Lloyd McKenzie (Aug 27 2021 at 03:38):
First, I don't think you can rely on searching by _profile. There's no expectation that plan-net compliant PractitionerRole instances will actually declare that profile (or any profile) and _profile will only match on PractitionerRoles that declare the profile, not those that comply (unless you have a server that's pre-emptively testing that).
So you've got the PractitionerRole as well as the HealthCareService and Location, but you're choosing to extract the information using FHIRPath rather than code. Any particular reason why?
Tushar Nair (Sep 10 2021 at 18:23):
@Lloyd McKenzie apologies for the delayed response, was away for a while. The reason we chose to extract using FHIRPath is because users would like to have the full set of results in one go, rather than navigating through multiple pages. Another reason was scenarios like a Practitioner having multiple practicing location addresses. So basically we tried to extract the data using FHIRPath and then export it as a CSV file so that the user could further perform slide and dice analytics, like importing to excel using vlookup etc.
Lloyd McKenzie (Sep 10 2021 at 21:19):
I'm still not really understanding you're use-case. You're filtering by postal code and then trying to extract the postal code of other addresses for the same individual?
Last updated: Apr 12 2022 at 19:14 UTC