jorge54
jorge54

Reputation: 31

Is it possible to search multiple FHIR resources with a single GET Request

Hello I am working on an app to use the new FHIR standards. It is being designed to pull information from the EHR and organize it.

I was wondering if it is possible to search multiple FHIR resources with a single GET request. For instance can a single GET request search for single patient's latest blood pressure, heart rate, etc?

Upvotes: 3

Views: 3736

Answers (5)

Ford
Ford

Reputation: 1485

Have you looked into the batch/transaction interaction?

The batch and transaction interactions submit a set of actions to perform on a server in a single HTTP request/response. The actions may be performed independently as a "batch", or as a single atomic "transaction" where the entire set of changes succeed or fail as a single entity.

A batch or transaction interaction is performed by an HTTP POST command as shown: POST [base] {?_format=[mime-type]}

Here is an example of a POST request for meds and allergies:

{
  "resourceType": "Bundle",
  "id": "bundle-request-medsallergies",
  "type": "batch",
  "entry": [
    {
      "request": {
        "method": "GET",
        "url": "/Patient/example"
      }
    },
    {
      "request": {
        "method": "GET",
        "url": "/MedicationStatement?patient=example&_list=$current-medications"
      }
    },
    {
      "request": {
        "method": "GET",
        "url": "/AllergyIntolerance?patient=example&_list=$current-allergies"
      }
    },
    {
      "request": {
        "method": "GET",
        "url": "/Condition?patient=example&_list=$current-problems"
      }
    },
    {
      "request": {
        "method": "GET",
        "url": "/MedicationStatement?patient=example&notgiven:not=true"
      }
    }
  ]
}

Upvotes: 3

BlessedHIT
BlessedHIT

Reputation: 1971

You can also use the _type parameter as depicted in the FHIR wiki like this GET [base]/?_type=Observation,Condition&other params...

The caveat is that other params MUST be common to both resources that you are searching otherwise the server may thow an error.

Upvotes: 0

roboscott
roboscott

Reputation: 19

Yes, you can search for and retrieve multiple resources from a fhir server using a single GET request. Resources retrieved in this way are returned in a structure called a Resource Bundle. Assuming that the ‘etc.’ in your original question refers to additional clinical observations about the patient in question, the scenario you are describing could be implemented by retrieving Observation resources that contain a ‘subject’ (reference to a Patient resource) of the patient you are interested in. The specific fields and possible search parameters for the Observation resource are detailed here: https://www.hl7.org/fhir/observation.html . But for example, if you had a Patient resource with id 123 (note that this is the unique resource id on the fhir server, not a code-system specific ‘identifier’ value), you could retrieve Observations associated with this patient using:

[base]/Observation?subject=Patient/123

This will return (from a spec-compliant server) a Bundle containing all Observation resources which hold a reference to Patient resource 123 as their subject. You can also drill down further by specifying additional parameters to target only the Observation resources you are interested in retrieving. For example:

[base]/Observation?subject=Patient/123&code=8480-6

would retrieve a bundle containing the various SystolicBP Observations related to this patient (assuming they have been coded with the LOINC above). These examples are just the tip of the iceberg, as the fhir standard outlines pretty deep query functionality. You would be best served by reviewing the information on their Search page, which outlines the specifics of this functionality: https://www.hl7.org/fhir/search.html

Upvotes: 0

edandr555
edandr555

Reputation: 1

You can use the Composition resorce, within this resource can declare sections and containded resorces. the sections you can organize the resources but contined resource is a wrapper the resource, for example:

<Composition>
    <contained>
        <Patient>
            <id value="patient1"/>
            .....
        <Patient>
    </contained>
    <contained>
        <MedicationOrder>
            <id value="medicationOrder1"/>
        </MedicationOrder>
    </contained>
    <contained>
        <MedicationOrder>
            <id value="medicationOrder2"/>
        </MedicationOrder>
    </contained>
    <contained>
        <List>
          <id value="list-medicationOrder"/>
          .....
          <entry>
            <item>
              <reference value="#medicationOrder1"/>
            </item>
          </entry>
          <entry>
            <item>
              <reference value="#medicationOrder2"/>
            </item>
          </entry>        
        </List>
    </contained>
    <section>
        <title value="Section medication order list"/>
        ....
        <entry>
          <reference value="#list-medicationOrder"/>
        </entry>
    </section>
</Composition>

Upvotes: 0

Stef Heyenrath
Stef Heyenrath

Reputation: 9820

You need to use the _include functionality to retrieve related resources from a Patient. I'm not sure if all referenced resources can be retrieved, you need to check the Fhir spec for that.

Also see this url for an example Fhir server: https://fhirtest.uhn.ca/

Upvotes: 0

Related Questions