Bundling FHIR resources
A FHIR Bundle
is a container for a collection of FHIR resources in
AWS HealthLake. Bundling is performed using a batch
-
FHIR resource changes are processed and logged as independent entities.
-
FHIR resource changes are processed and logged as a single entity.
You can bundle FHIR resources of the same or different types, and they can include a mix
of other FHIR interactions defined in this chapter (e.g. create
,
read
, update
, delete
, and search
).
For additional information, see Resource
Bundle
Bundling FHIR resources as independent entities
To bundle FHIR resources as independent entities
-
Collect HealthLake
region
anddatastoreId
values. For more information, see Getting data store properties. -
Construct a URL for the request using the collected values for HealthLake
region
anddatastoreId
. Do not specify a FHIR resource type in the URL. To view the entire URL path in the following example, scroll over the Copy button.POST https://healthlake.
region
.amazonaws.com/datastore/datastoreId
/r4/ -
Construct a JSON body for the request, specifying each HTTP verb as part of the
method
elements. The following example uses abatch
type interaction with theBundle
resource to create newPatient
andMedication
resources. All required sections are commented accordingly. For the purpose of this procedure, save the file asbatch-independent.json
.{ "resourceType": "Bundle", "id": "bundle-batch", "meta": { "lastUpdated": "2014-08-18T01:43:30Z" }, "type": "batch", "entry": [ { "resource": { "resourceType": "Patient", "meta": { "lastUpdated": "2022-06-03T17:53:36.724Z" }, "text": { "status": "generated", "div": "Some narrative" }, "active": true, "name": [ { "use": "official", "family": "Jackson", "given": [ "Mateo", "James" ] } ], "gender": "male", "birthDate": "1974-12-25" }, "request": { "method": "POST", "url": "Patient" } }, { "resource": { "resourceType": "Medication", "id": "med0310", "contained": [ { "resourceType": "Substance", "id": "sub03", "code": { "coding": [ { "system": "http://snomed.info/sct", "code": "55452001", "display": "Oxycodone (substance)" } ] } } ], "code": { "coding": [ { "system": "http://snomed.info/sct", "code": "430127000", "display": "Oral Form Oxycodone (product)" } ] }, "form": { "coding": [ { "system": "http://snomed.info/sct", "code": "385055001", "display": "Tablet dose form (qualifier value)" } ] }, "ingredient": [ { "itemReference": { "reference": "#sub03" }, "strength": { "numerator": { "value": 5, "system": "http://unitsofmeasure.org", "code": "mg" }, "denominator": { "value": 1, "system": "http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm", "code": "TAB" } } } ] }, "request": { "method": "POST", "url": "Medication" } } ] }
-
Send the request. The FHIR
Bundle
batch type uses aPOST
request with either AWS Signature Version 4 or SMART on FHIR authorization. The following code example uses thecurl
command line tool for demonstration purposes.The server returns a response showing the
Patient
andMedication
resources created as a result of theBundle
batch type request.
Bundling FHIR resources as a single entity
To bundle FHIR resources as a single entity
-
Collect HealthLake
region
anddatastoreId
values. For more information, see Getting data store properties. -
Construct a URL for the request using the collected values for HealthLake
region
anddatastoreId
. Include the FHIR resource typeBundle
as part of the URL. To view the entire URL path in the following example, scroll over the Copy button.POST https://healthlake.
region
.amazonaws.com/datastore/datastoreId
/r4/Bundle -
Construct a JSON body for the request, specifying the FHIR resources to group together. The following example groups two
Patient
resources in HealthLake. For the purpose of this procedure, save the file asbatch-single.json
.{ "resourceType": "Bundle", "id": "bundle-batch", "meta": { "lastUpdated": "2018-03-11T11:22:16Z" }, "type": "document", "entry": [ { "resource": { "resourceType": "Patient", "name": [ { "family": "Smith", "given": [ "Jane" ] } ], "gender": "female", "address": [ { "line": [ "123 Main St." ], "city": "Anycity", "state": "Any State", "postalCode": "12345" } ] } }, { "resource": { "resourceType": "Patient", "name": [ { "family": "Jackson", "given": [ "Mateo" ] } ], "gender": "male", "address": [ { "line": [ "1234 Main St." ], "city": "Anycity", "state": "Any State", "postalCode": "12345" } ] } } ] }
-
Send the request. The FHIR
Bundle
document type uses aPOST
request with AWS Signature Version 4 signing protocol. The following code example uses thecurl
command line tool for demonstration purposes.The server returns a response showing two
Patient
resources created as a result of theBundle
document type request.