Stream: implementers
Topic: Validating Batch Bundles by FHIR server
Zohreh Jabbari (Jul 12 2018 at 15:19):
Hi,
I have a question regarding batch bundle execution on a FHIR server. I would appreciate some clarification on this:
(This is the part of spec I am referring to https://www.hl7.org/fhir/http.html#transaction & https://www.hl7.org/fhir/bundle.html#bundle-unique)
Can a batch bundle contain multiple request of the same type for the same resource, e.g. multiple updates for the same resource? and if the answer is no, then should the server:
- return an invalid bundle error
- or just execute the entries in the correct order and expect the user knows what they are doing
thanks
Lloyd McKenzie (Jul 12 2018 at 15:29):
From http://build.fhir.org/http.html#3.1.0.18.1: there SHALL be no interdependencies between the different entries in the Bundle that cause change on the server. The success or failure of one change SHOULD not alter the success or failure or resulting content of another change. Servers SHOULD validate that this is the case
Multiple updates on the same resource would violate the SHALL and the first SHOULD. However, the second SHOULD says you don't have to check. If you do check, you ought to reject the entire batch, but some systems won't bother doing the pre-processing to check and thus some changes will already have been applied. Some systems might quit processing the batch as soon as they find a problematic request. Others might reject the problematic request and keep processing the rest of the entries.
Zohreh Jabbari (Jul 12 2018 at 15:37):
The example for inter-dependencies in the spec was when an update refers to a resource yet to be created; that makes sense since that could cause a failure. where as multiple updates on the same resource doesn't cause a failure and only create a different outcome. Which is why I wasn't sure if this was considered a dependency
Lloyd McKenzie (Jul 12 2018 at 15:47):
Multiple updates on the same object create an ordering dependency - and the text indicates that order should not matter due to the no dependency rule.
Lloyd McKenzie (Jul 12 2018 at 15:48):
A server could choose to just apply the updates as it encounters them, but it would be allowed to yell. I presume the multiple updates in the batch were because you wanted to create mirrored history entries?
Zohreh Jabbari (Jul 12 2018 at 17:09):
makes sense. thanks for clarifying.
I don't have a specific case for multiple updates on a single record, but I assume that might be a common scenario if user creates a batch from different data sources or when running a migration on the data.
Lloyd McKenzie (Jul 12 2018 at 17:15):
Grabbing the latest update should generally be sufficient. The only thing that wouldn't give you is a history that mirrors the history on another system
Last updated: Apr 12 2022 at 19:14 UTC