Stream: implementers
Topic: Searching References
ken masters (Mar 13 2017 at 16:36):
Hi, I'm new to FHIR and I'm trying to understand how I can do proper resource linked searches...
I expect a list of practitioners associated with ORGA that offers Service B.
GET [baseURL]/practitioner/practitionerRole:organization.name=ORG_A&practitionerRole:healthcareService.serviceName=SERVICE_B
Is this the only way of doing this? Not sure if I constructed the query correctly...
thank you
Lloyd McKenzie (Mar 13 2017 at 16:48):
I believe [baseURL]/practitioner?_has:PractitionerRole:practitioner:name=ORG_A&_has:PractitionerRole:practitioner:service=SERVICE_B
is the correct syntax. But be aware that each of the filters are independent. So you might get back a Practitioner that has one role that references ORG_A and a different role that references SERVICE_B. If you want them to both hold together, then you'll need to do your search on PractitionerRole and then do an _include to bring back the corresponding Practitioner for each satisfying PractitionerRole
ken masters (Mar 13 2017 at 17:04):
Ok thanks Lloyd. I now have this...using the _ has and _include
GET [baseURL]
practitioner?_has:PractitionerRole:organization:name=ORG_A&_include:PractitionerRole:healthcareService:name=SERVICE_B
Lloyd McKenzie (Mar 13 2017 at 17:20):
That's not legal syntax. _include isn't a filter, it's an instruction to return extra referenced resources
Lloyd McKenzie (Mar 13 2017 at 17:22):
The second approach I was referring to would look like this:
[baseURL]/PractitionerRole?name=ORG_A&service=SERVICE_B&_include=PractitionerRole.practitioner
Lloyd McKenzie (Mar 13 2017 at 17:22):
Also, typo in my first example. It should be [baseURL]/Practitioner not [baseURL]/practitioner. FHIR is case sensitive
Last updated: Apr 12 2022 at 19:14 UTC