I am really new to fhir and i am wondering if it is possible to do an api call for a Bundle so that the response is more sorted/nested? So my request should be something like "give me all encounters for that organization with the associated patient":
[Base]/Encounter?service-provider=Organization/<id>&_include=Encounter:subject
Actually the response is a bundle like this (abbreviated version):
{
"resourceType": "Bundle",
"entry": [
{
"resource": {
"resourceType": "Encounter",
}
},
{
"resource": {
"resourceType": "Encounter",
}
},
{
"resource": {
"resourceType": "Patient",
}
},
{
"resource": {
"resourceType": "Patient",
}
}
],
[...]
}
But I want something like that, a more nested object where i don“t need to sort the patients to the encounters:
{
"resourceType": "Bundle",
"entry": [
{
"resource": {
"resourceType": "Encounter",
"subject": {
"resource": {
"resourceType": "Patient",
}
}
},
{
"resource": {
"resourceType": "Encounter",
"subject": {
"resource": {
"resourceType": "Patient",
}
}
},
],
[...]
}
Is there a way to do this? Or do I need to use something like fhirpath for sorting the result? I need a solution for client side, because there will be different fhir-servers using my app.