Stream: implementers
Topic: Patients with labs and meds
Kalyani Yerra (Jul 28 2017 at 20:22):
If I want to return a bundle with a list of patients along with their labs and meds based on some search criteria in one request , How do I go about doing this in one request.
if I use [base]/Patient/_search{?[parameters]} I would get a list of patients, but would not be able to include observation and Med data.
Will a Group or List resource help?
Lloyd McKenzie (Jul 28 2017 at 20:25):
Look at the _revinclude search parameter. Note that you won't be able to filter the labs and meds that way. Another possibility is to submit a batch where you query on Patient, MedicationStatement (and maybe MedicationRequest) and Observation separately, but use chained parameters to specify the same filters on patient for each.
Kalyani Yerra (Jul 28 2017 at 20:32):
Thank you @Lloyd McKenzie . If I use _revInclude for example on Medication request how do I get the Observation resources also?
GET [base]/MedicationRequest?_revinclude=??????&criteria...
Lloyd McKenzie (Jul 28 2017 at 20:36):
You'd query on Patient and then do a _revinclude on both MedicationStatement and on Observation
Lloyd McKenzie (Jul 28 2017 at 20:36):
But the only filter criteria you could provide would be on Patient.
Kalyani Yerra (Jul 28 2017 at 20:38):
Thank you. Can I combine reverse chaining and _revinclude ?
Lloyd McKenzie (Jul 28 2017 at 20:41):
You can, but that still filters Patient, not the included resources. For example, if you search on Patient and use _has to filter for Observations that are hemoglobins, and then _revinclude Observation, you'll get a list of all patients that have hemoglobin Observations, as well as all Observations (of any type) that exist for that Patient.
Lloyd McKenzie (Jul 28 2017 at 20:42):
So the Batch mechanism is probably your better bet. All Observations for a patient can easily get into the 10k+ range. :)
Kalyani Yerra (Jul 28 2017 at 20:50):
Thank you.
https://www.hl7.org/fhir/http.html#transaction is this what you are referring to for the batch mechanism.
Since I would get a list of patients based on some criteria and need lab and med data for each of these patients, I would need to put this batch mechanism in a loop ?
Lloyd McKenzie (Jul 29 2017 at 19:06):
You would send a batch containing 3 queries. One would search for patient with a particular set of criteria. The second would search for observations whose patients met particular criteria (using chaining). The third would search for MedicationStatements whose patients met particular criteria (also using chaining)
Last updated: Apr 12 2022 at 19:14 UTC