hl7-fhirhapi-fhir

FHIR Search partOf-Organization by Practitioner


I need help with my FHIR search.

In my FHIR-data-store I have Organizations (Level 0), which have Organizations being part of them (Level 1) and again there are Organizations being part of them (Level 2). And I have Practitioners, who have PractitionerRoles with those Level 2 Organizations.

This is the Structure:


-Organization 1 (Level 0)

-----Organization 1.1 (Level 1)

---------Organization 1.1.1 (Level 2)

-------------Practitioner A

-------------Practitioner B

-------------Practitioner C

---------Organization 1.1.2

-------------Practitioner A

-------------Practitioner C

-------------Practitioner D

-----Organization 1.2

---------Organization 1.2.1

-------------Practitioner A

-------------Practitioner C

-Organization 2 (Level 0)

-----Organization 2.1 (Level 1)

---------Organization 2.1.1 (Level 2)

-------------Practitioner A


If I know the id of Practitioner A, how can I search for all of his related Organizations on Level 0 with one FHIR search request?

I already tried the following request: /Organization_include:iterate=Organization:partof&_has:PractitionerRole:organization:practitioner=Practitioner/

The Response of this search includes all Organizations of the Practitioner of all Levels. But I only want to have the Level 0 Organizations. How can I do that?

_filter does not lead to my desired result neither.


Solution

  • Short answer is, you can't using simple REST search. If you're using rescursive _includes, you get everything along the path. In fact, you have to have the intermediary organizations because without that, you wouldn't know which level 0 Org corresponds to which PractitionerRole.