Stream: implementers
Topic: transaction bundle
Jose Costa Teixeira (May 14 2020 at 07:03):
Can I use a transaction bundle to do "Delete all the observations about this patient first, then create this new observation" ?
Jose Costa Teixeira (May 14 2020 at 07:03):
the spec seems to say so...
René Spronk (May 14 2020 at 07:44):
yes. DELETEs will be processed before POSTs.
Jose Costa Teixeira (May 14 2020 at 07:57):
Cool. And do the servers support POSTing a transaction and watch magic happen?
Lloyd McKenzie (May 14 2020 at 13:30):
Some servers do. As always, depends on the server...
Jose Costa Teixeira (May 14 2020 at 14:21):
Should this work then?
Work= create a patient after trying to delete it
{
"resourceType": "Bundle",
"type": "transaction",
"entry": [
{
"fullUrl": "http://test.fhir.org/r4/Patient/159",
"resource": {
"resourceType": "Patient",
"id": "159",
"name": [
{
"use": "official",
"family": "Larssonsson",
"given": [
"Axel"
]
}
],
"gender": "male"
},
"request": {
"method": "PUT",
"url": "Patient/159"
}
},
{
"request": {
"method": "DELETE",
"url": "Patient/159"
}
}
]
}
Jose Costa Teixeira (May 14 2020 at 14:21):
Hapi is not hapi with it. test.fhir.org neither (but I am debugging that)
Paul Church (May 14 2020 at 14:26):
no, a resource identity (Patient/159 in this case) can only appear once in a transaction
Jose Costa Teixeira (May 14 2020 at 14:29):
ah great
Jose Costa Teixeira (May 14 2020 at 14:33):
one question: if you are talking about HAPI, can we do $expunge in a transaction? I want to really delete patient 159
Paul Church (May 14 2020 at 14:40):
that's a good question, I can't answer for hapi but the equivalent on Google doesn't allow that - does anyone allow extended $operations in transactions in general?
Jens Villadsen (May 14 2020 at 16:39):
wouldn't that require some sort of defined arbitrary order between execution of operations?
Jens Villadsen (May 14 2020 at 16:45):
Actually - @Grahame Grieve I can't seem to find any order for processing of operations on https://www.hl7.org/fhir/http.html#transaction. Couldn't/shouldn't such an order actually be defined in the capability statement - if needed that is? I Guess @Jose Costa Teixeira would like the $expunge executed deterministically
Jens Villadsen (May 14 2020 at 17:19):
And maybe there's a note somewhere missing that while there is a order, it can be manipulated for at least search given that the search is conducted using POST mode, which then in turn would let you process your search using POST which in turn means that you probably bypass the intended ordering. @René Spronk would you know something about that?
Grahame Grieve (May 14 2020 at 19:09):
I can't seem to find any order for processing of operations on https://www.hl7.org/fhir/http.html#transaction
by POST/GET - isn't that enough?
Jens Villadsen (May 14 2020 at 20:32):
Regarding search: maybe it is enough. I was just wondering if it could cause some trouble doing the search using POST in a transaction
Grahame Grieve (May 14 2020 at 20:32):
well, you get some confusing results - you could do the same search twice and get different results
Jens Villadsen (May 14 2020 at 20:33):
yes - that is definitely one outcome
Jens Villadsen (May 14 2020 at 20:35):
that also goes for idempotent operations I guess - since they can be executed as both POST and GET
Jens Villadsen (May 14 2020 at 20:42):
the other thing regarding operations would be if order should be defined across operations. I guess that is probably a bit out of scope since there's order between resources themselves: eg. no rule states that POST /Encounter should be executed before POST /Observation. But with operations it might be a bit more tricky: eg. it might be nice to always have $operationAAA executed before $operationXYZ within a transaction to have the operation execution run deterministically - but no such order or definition of it exists AFAIK.
Grahame Grieve (May 14 2020 at 20:43):
I think it'll have to be literal order
Jens Villadsen (May 14 2020 at 20:45):
that isn't stated anywhere is it?
Jens Villadsen (May 14 2020 at 20:46):
it could also have been a property on operationDefinition?
Grahame Grieve (May 14 2020 at 20:47):
no it's not stated and maybe but I don't know how it would work
Lloyd McKenzie (May 15 2020 at 02:54):
@Jose Costa Teixeira Operations are allowed as part of a transaction
Jens Villadsen (May 15 2020 at 07:35):
I guess literal will do for now - adding that piece of doc might be useful though it is not critical for me now ;)
Last updated: Apr 12 2022 at 19:14 UTC