FHIR Bundle transactions and batches
Oracle FHIR includes a mechanism that can be used by a client to send multiple interactions to a server for processing. This mechanism uses the FHIR bundle resource as the transport, with a collection of one or more interactions grouped inside the bundle.
FHIR bundles are sent to the FHIR server using an HTTP POST to the base URL of the server. There are two modes of processing, as determined by the Bundle.type value.
- Transaction: All operations in the bundle are executed as a single atomic database transaction. If any failures occur, the entire transaction is rolled back.
- Batch: Each operation in the bundle is executed as an independent database transaction. Any processing failures may cause the specific interaction to be rolled back but will not affect other operations.
Mostly, transaction bundles are commonly used to post data to a server, since any HTTP REST operation is a process to be included in a transaction.
- Basic bundle transaction
Oracle FHIR transaction bundle has a few important elements. - Bundle multiple related resources
A common use for FHIR bundle transactions is to persist a collection of related resources to a server. For example, if you have a collection of Observation resources with the same patient as subject, you could place them inside a single FHIR bundle transaction and send them together to a server. - Placeholder IDs and references
Creating references between resources is easy if you know the ID of the reference target (such as in the example above with client-assigned IDs) but it is also possible to have references between resources in a single bundle even if you don't yet know the target resource ID. - Conditional Create
The FHIR Conditional Create mechanism allows the client to specify a FHIR search URL alongside a resource to create. When processing the create, the server will first check if any resource already exists matching the given search. If no resources match, the create proceeds. If a resource does match, no resource is created. - Conditional Update
The FHIR Conditional Update mechanism allows a resource to be transmitted to the server for updating, but instead of supplying an ID to update, the client supplies a search URL similar to the URL used for the Conditional Create example. - Delete
FHIR logical deletes can be performed as a part of a transaction, as well. In a transaction bundle, deletes will be applied as a group, meaning that if one fails, all will be rolled back. - Patch
The FHIR Patch operation can also be performed in a transaction bundle. When using the FHIR Patch mechanism for patching, the FHIR Patch document is placed in Bundle.entry.resource. In the case of JSON Patch the contents are placed in a Binary resource and then placed into Bundle.entry.resource. In all cases, the HTTP verb/method is PATCH.
Parent topic: FHIR Operations