Reputation: 3
I'm retrieving JSON objects from a FHIR server that use this template. They look like this:
"resourceType": "Appointment",
"id": "example",
"text": {
"status": "generated",
"div": "\u003cdiv xmlns\u003d\"http://www.w3.org/1999/xhtml\"\u003eBrian MRI results discussion\u003c/div\u003e"
},
"status": "booked",
"serviceCategory": [
{
"coding": [
{
"system": "http://example.org/service-category",
"code": "gp",
"display": "General Practice"
}
]
}
],
"serviceType": [
{
"coding": [
{
"code": "52",
"display": "General Discussion"
}
]
}
],
"specialty": [
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "394814009",
"display": "General practice"
}
]
}
],
"appointmentType": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0276",
"code": "FOLLOWUP",
"display": "A follow up visit from a previous appointment"
}
]
},
"reasonReference": [
{
"reference": "Condition/example",
"display": "Severe burn of left ear"
}
],
"priority": 5,
"description": "Discussion on the results of your recent MRI",
"start": "2013-12-10T09:00:00Z",
"end": "2013-12-10T11:00:00Z",
"created": "2013-10-10",
"comment": "Further expand on the results of the MRI and determine the next actions that may be appropriate.",
"basedOn": [
{
"reference": "ServiceRequest/myringotomy"
}
],
"participant": [
{
"actor": {
"reference": "Patient/example",
"display": "Peter James Chalmers"
},
"required": "required",
"status": "accepted"
},
{
"type": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
"code": "ATND"
}
]
}
],
"actor": {
"reference": "Practitioner/example",
"display": "Dr Adam Careful"
},
"required": "required",
"status": "accepted"
},
{
"actor": {
"reference": "Location/1",
"display": "South Wing, second floor"
},
"required": "required",
"status": "accepted"
}
],
"meta": {
"tag": [
{
"system": "http://terminology.hl7.org/CodeSystem/v3-ActReason",
"code": "HTEST",
"display": "test health data"
}
]
}
}
This resource is an appointment and I would like to get all the appointments that have a particular actor, all of a specific patient's or doctor's appointments. The individual participants are nested a few layers in the JSON object. I don't know how to do a GET request on these nested elements.
Can I do a GET request to get this subset of appointments? Or is the usual practice to get all the appointments and filter them myself?
Upvotes: 0
Views: 806
Reputation: 6793
You can use the search options to filter the results of your FHIR query. The parameters you can use to filter Appointment are listed here and the rules around crafting a search are found here
For example:
[base]/Appointment?actor=Patient/123&status=booked&date=ge2020-07-23
would give you all scheduled future appointments for the patient that are 'booked' (i.e. confirmed) from today onward. The result would be a Bundle resource with a bunch of entries. Each entry would contain an Appointment instance.
Upvotes: 5