Below I summarized what I have tried so far for handling partial update in HL7 FHIR.
1) Syntax
URL: http://[server]/[resource]/[logical id]/_delta
method: POST
I did not use PATCH method since some of older browser does not support this method, also not sure whether PATCH method has been supported in all javascript library
2) Extension element to specify update mode
For each element to be added/replaced/deleted, added the following extension
<extension url="http://hl7.org/fhir/Profile/iso-21090#updateMode" >
<valueCode value="A or R or D" />
</extension>
As an example, below is the XML snippet for updating birthDate
<birthDate value="1970-03-13">
<extension url="http://hl7.org/fhir/Profile/iso-21090#updateMode" >
<valueCode value="R" />
</extension>
</birthDate>
3) Handling collection
For collection data elements such as name, address and contact in Patient resource, server needs to know which element within the collection is to be replaced/deleted. So I decided to pull collection element's internal id as part of the query response, and then use the same id when submitting the payload to server
- Added collection element internal id in query response as part of element extension
<telecom>
<extension url="http://hl7.org/fhir/metadata#id">
<valueString value="1308"/>
</extension>
<system value="phone"/>
<value value="68181256"/>
<use value="home"/>
</telecom>
- Payload for partial update
<telecom>
<extension url="http://hl7.org/fhir/metadata#id">
<valueString value="1308"/>
</extension>
<extension url="http://hl7.org/fhir/Profile/iso-21090#updateMode" >
<valueCode value="R" />
</extension>
<system value="phone"/>
<value value="68181256"/>
<use value="office"/>
</telecom>
4) Suggestion
The above approach works okay so far, however I'd like to make one suggestion here. As we can see from the above XML snippet, the content is very verbose after adding extension elements.Can we add the two attributes (id and updateMode) in FHIR resource as part of Element built-in attributes? In this way, the content will be very compact as the following snippet shows,
<telecom id="1308" updateMode="R">
<system value="phone"/>
<value value="68181256"/>
<use value="office"/>
</telecom>
Subscribe to:
Post Comments (Atom)
Public Sector Day Singapore 2024
I was delighted to be invited by AWS to share how we designed and implemented robust tech foundation for Singapore Healthier SG and Age Well...
-
Below is the some of the slides from the recent sharing at FHIR DevDays 2024 ( https://www.devdays.com/ ) on Singapore's National Healt...
-
During recent Ken Rubin's trip to Singapore in May 28, I shared my views and suggestions on how to effectively adopt/develop healthcare...
-
I am involved in HL7 Singapore technical committee, during one of the discussions about the topic for technical sharing, we discussed within...
Hi Victor,
ReplyDeleteA couple of comments on your post:
1) You are using the http://hl7.org/fhir/ namespace. I believe the agreement is that extensions are placed in a namespace of your own.
2) What you describe as partial update is not a true partial update, since you still always have to send all mandatory field in the resource.
3) Extensions are intended to modify resource content permanently, and be returned the next time. What you have done with updateMode is used fields in the resource to extend the protocol. That is a bad practice. What is even worse is to use the iso-21090 namespace, sicne it doesn;t contain an updateMode extension.
4) I do understand what you have done with the #id extension in telecom, and it makes senses, we had a similar requirement for CarePlan.activity. However, if your id is just numeric, there is already an id property on any element, so you do not need an extension.
Summing it up, I think this is not the way to go ahead.
Best regards,
Theo
Theo is correct that you should be using your own namespace. Also, extension definitions should generally be StructureDefinitions.
DeleteIt's fine to experiment with partial updates if you wish, but this wouldn't be a long-term solution.