Transaction Bundles with conditional create or update

48 views
Skip to first unread message

Sreenivasagopalan Ananthakrishna

unread,
Jan 15, 2021, 8:34:10 AM1/15/21
to HAPI FHIR
Happy New Year Everyone!

       I am trying to achieve the following using a transaction bundle approach and would like your valuable advice on how to resolve the issue I am facing:
1. Update an encounter to a specific status
2. Create a composition that points to the encounter
3. Add some additional resources like QuestionnaireResponse linked to the Encounter and also added as an entry in the above composition.

I want to ensure that all the three above operations happen as part of a single transaction  but if two concurrent requests are submitted then the second request should not go through. I tried to implement this using conditional create constraint against the Composition using ifNoneMatch:'Composition?status=preliminary&encounter=<encounter_id>
What I observed is that the second request ends up updating the Encounter and creating the QuestonnaireResponse, but the Composition does not get updated as the conditional create constraint comes in the way and the server returns a 200.

How do I ensure that all the operations fail in an atomic fashion.

thanks,
sreenivas
Reply all
Reply to author
Forward
0 new messages