Hi everyone,
I’m trying to query a FHIR server and have multiple “levels” of contained resources returned in the response.
For example:
{
“resourceType”: “Bundle”,
“id”: “bundle-request”,
“type”: “batch”,
“entry”: [{
“request”: {
“method”: “GET”,
“url”: /ServiceRequest?_include=ServiceRequest:requester”
}
}]
}
This request will return a ServiceRequest Resource with the resource used in ServiceRequest.requester. In this scenario, it will be a PractitionerRole resource.
This PractitionerRole resource will have a location reference (from PractitonerRple.location) that I also want to be included in the query response. The desired structure of the response would look something like this:
{
“resourceType”: “Bundle”,
“id”: “response-id”,
“type”: “searchset”,
“entry”: [
{
“resource”: {
“resourceType”: “ServiceRequest”,
“requester”: {
“reference”: “#1”
},
“contained”: [
{
“resourceType”: “PractitionerRole”,
“id”: “1”,
“location”: [
{
“reference”: “#2”
}
]
},
{
“resourceType”: “Location”,
“id”: “2”
}
]
}
}
]
}
Is there a way to request all of this from a FHIR server? We can use multiple queries, but the goal is for everything to be done in one searchset bundle (a single transaction). The example request above will return only the ServiceRequest and PractitionerRole, but not the referenced Location resource (from PractitionerRole.location)
I’ve looked into using _contained but I’m not sure if this will solve my problem. Any guidance is appreciated!