Stream: implementers
Topic: update only if something changed
Christoph Müller (Apr 10 2019 at 08:29):
On a communication server we transform some HL7v2 messages to FHIR and publish them on our Vonk.
Our problem is, that some messages require to PUT, i.e. to conditionally update some resources but on the other hand it may often happen, that there are no differences between the old and the new resource at all. Thus we would like to refrain from creating new versions of a resource without making any changes to it. I feel that the amount and data being created unnecessarily is not negligible.
Grahame Grieve (Apr 10 2019 at 11:12):
up to the server how much work that creates. But have you looked at patch?
Christoph Müller (Apr 10 2019 at 11:28):
Yes, I was looking at that as well. Thing is, we almost always get complete resource information from our subsystem and therefore do not have any problems with incomplete information about resources. And patch - as far as i understood it - has the same behaviour as update in the sense that after the update we will get a new version of the resource.
I'd like to ensure the following behaviour (when publishing a resource to the server - unique identifier allows identification):
1) perform the update and create a new version of the resource if any changes are implied by the PUT/PATCH/etc.
2) do not add a new version of the resource, if the resource provided by the PUT/PATCH/etc. ist just the same as the one on the server.
We will however be having an inhouse workshop with someone from Firely about our Vonk. Hopefully we can address this problem there. I just thought, there maybe was some "general" solution to it.
Grahame Grieve (Apr 10 2019 at 13:10):
there's some discussion about transactions with an update-only-if thing - some thread from last week. but I don't know whether that will get legs
René Spronk (Apr 10 2019 at 15:17):
@Christoph Müller v2 is snapshot in nature, so no need for Patch as long as you determine the source of the v2 message to be an authoritative source for a particular category of data (segment, resource). Your communication server needs to be smart enough to a) determine if the source is reliable/authoritative (don't use PIDs received from a lab system [unless patient unknown on FHIR server], do always use/convert PIDs received from the HIS/PAS system, b) use conditional updates [or: explicitly query first, before PUT/CREATE] to avoid duplicate creation of resources.
The latter is tricky if a v2 segment or resource doesn't have a business identifier. Patients and encounters are probably OK. Allergies (an example we've been using for years) don't have business identifiers so special care has to be taken to deal with them, transactions are a way of doing so.
Perhaps there is a need for PATCH if a v2-segment from a non-authoritative source contains a "". But that to me is an absolute edge use case.
These are general v2 to FHIR mapping issues, there's a separate channel on this chat related to that topic.
René Spronk (Apr 10 2019 at 16:48):
As for making a server-side decision to ignore certain updates (if the 'update' is the same as the existing data): the meta.lastupdated tag will have to be changed, but that doesn't lead to a new version. Have you done performance testing ? or what is the underlying reason to be concerned about (superfluous) updates to resources ?
René Spronk (Apr 11 2019 at 13:46):
Personally I'd use Cloverleaf to detect if (for example) a PID is string-equal to a previous PID, and don't do a translate/update to a Patient resource if they're equal. This does however mean you'd have to query the server to get hold of the logical id for the pre-existing Patient resource, so you can use it in the transaction bundle which contains the translations of other v2 segments.
Last updated: Apr 12 2022 at 19:14 UTC