Stream: implementers
Topic: Use Patch with extensions
Alexandr Shevchenko (Aug 18 2021 at 10:25):
Hi,
Is there a way to add extensions with FHIRPath Patch operation? I tried a couple of ways and all seems to be not working. Is this implementation issue or it is not possible by specification?
Lloyd McKenzie (Aug 18 2021 at 16:14):
It should. What are you sending?
Alexandr Shevchenko (Aug 19 2021 at 05:47):
Hi,
I am sending this patch for the Specimen:
<Parameters xmlns="http://hl7.org/fhir">
<parameter>
<name value="operation"/>
<part>
<name value="type"/>
<valueString value="add"/>
</part>
<part>
<name value="path"/>
<valueString value="Specimen"/>
</part>
<part>
<name value="name"/>
<valueString value="processing"/>
</part>
<part>
<name value="value" />
<part>
<name value="description" />
<valueString value="test" />
</part>
<part>
<name value="timeDateTime" />
<valueDateTime value="2021-08-13T07:44:38.342+00:00" />
</part>
</part>
</parameter>
</Parameters>
Ideally I would like to also add extension for the processing item with the reference for the Device.
I can do this through update and send the whole Specimen:
<Specimen xmlns="http://hl7.org/fhir">
<id value="2507723"/>
<meta>
<versionId value="14"/>
<lastUpdated value="2021-08-18T09:41:19.389+00:00"/>
<source value="#BamO8GltglzMPXDN"/>
</meta>
<processing>
<description value="test"/>
<timeDateTime value="2021-08-13T07:44:38.342+00:00"/>
<extension url="device">
<valueReference>
<reference value="Device/1"/>
</valueReference>
</extension>
</processing>
</Specimen>
But I tried a few different formats for the Patch on Spark and HAPI and none of them seems to work, though server returned no errors. So I wonder how it should look like, so I can try it and if it doesn't work for Spark - I could try to fix it. The documentation is quite vague for the complex scenarious and there is no such example in provided examples.
Lloyd McKenzie (Aug 19 2021 at 14:53):
Is the base patch without extension working? If yes, can you share the patch that isn't working?
Alexander Zautke (Aug 19 2021 at 18:00):
Have a look here: https://chat.fhir.org/#narrow/stream/179166-implementers/topic/How.20to.20PATCH.20an.20extension.3F
Alexandr Shevchenko (Aug 20 2021 at 07:21):
Thanks! I checked the link and it did help a bit.
@Lloyd McKenzie, could you please check this patch is correct then? HAPI is not adding extention and Spark gives bad request for it.
<Parameters xmlns="http://hl7.org/fhir">
<parameter>
<name value="operation"/>
<part>
<name value="type"/>
<valueString value="add"/>
</part>
<part>
<name value="path"/>
<valueString value="Specimen"/>
</part>
<part>
<name value="name"/>
<valueString value="processing"/>
</part>
<part>
<name value="value" />
<part>
<name value="description" />
<valueString value="test" />
</part>
<part>
<name value="time" />
<valueDateTime value="2021-08-13T07:44:38.342+00:00" />
</part>
<part>
<name value="extension" />
<part>
<name value="url" />
<valueUri value="ProcessingDevice" />
</part>
<part>
<name value="value" />
<valueReference reference="Device/1" />
</part>
</part>
</part>
</parameter>
</Parameters>
Lloyd McKenzie (Aug 20 2021 at 13:12):
The URL for the extension is definitely wrong - the base URL for an extension must be a full URL (i.e. http:....). Also "description" isn't a valid name for a FHIRPatch part name. Also, you should probably list the extension before you list description or time.
To me, the spec is somewhat unclear about whether the name for time should be "time", "time[x]" or "timeDateTime". You might try with any of those (and submit a change request for us to clarify). If none of those fixes address the issue, then raise on #hapi
Alexandr Shevchenko (Aug 23 2021 at 08:50):
@Lloyd McKenzie Thanks for the feedback. The description is the name of Specimen->processing->description field. Are you sure it is not good?
Regarding the url - I know it should be full, maybe I should have made it full even in example.
As for the time - I think it was already cleared here: https://chat.fhir.org/#narrow/stream/179166-implementers/topic/FHIR.20PATCH.20interaction .
I am more concern about the structure of the extension object that a content. Is that correct?
Lloyd McKenzie (Aug 23 2021 at 14:01):
I'm saying you can't have a URL of "PorcessingDevice". Thanks for the link to the other post - but we still need a change request to make it clear in the spec. The only piece of the extension structure I see that's incorrect is the value of the URL.
Kenneth Myhra (Aug 23 2021 at 19:41):
Not to steer away the current discussion on extensions, but I've submitted a change request to clarify how to use choice values and linked to it from: https://chat.fhir.org/#narrow/stream/179166-implementers/topic/FHIR.20PATCH.20interaction
Alexandr Shevchenko (Aug 24 2021 at 12:45):
@Lloyd McKenzie Thanks once more.
So considering everything being said this patch object looks good? I fixed url for example purposes only.
<Parameters xmlns="http://hl7.org/fhir">
<parameter>
<name value="operation"/>
<part>
<name value="type"/>
<valueString value="add"/>
</part>
<part>
<name value="path"/>
<valueString value="Specimen"/>
</part>
<part>
<name value="name"/>
<valueString value="processing"/>
</part>
<part>
<name value="value" />
<part>
<name value="description" />
<valueString value="test" />
</part>
<part>
<name value="time" />
<valueDateTime value="2021-08-13T07:44:38.342+00:00" />
</part>
<part>
<name value="extension" />
<part>
<name value="url" />
<valueUri value="http://example.org/fhir/DeviceExtension" />
</part>
<part>
<name value="value" />
<valueReference reference="Device/1" />
</part>
</part>
</part>
</parameter>
</Parameters>
Lloyd McKenzie (Aug 24 2021 at 13:40):
You should probably move the extension part before description & time. If that doesn't fix the issue, raise it on #hapi
Alexandr Shevchenko (Aug 25 2021 at 08:28):
@Lloyd McKenzie sorry to bother once more, but could the extension be used as a value or should we have it as a part objects?
See example for value (example for parts is above):
<Parameters xmlns="http://hl7.org/fhir">
<parameter>
<name value="operation"/>
<part>
<name value="type"/>
<valueString value="add"/>
</part>
<part>
<name value="path"/>
<valueString value="Specimen"/>
</part>
<part>
<name value="name"/>
<valueString value="processing"/>
</part>
<part>
<name value="value" />
<part>
<name value="extension" />
<extension url="http://example.org/fhir/DeviceExtension">
<valueReference reference="Device/1" />
</extension>
</part>
<part>
<name value="description" />
<valueString value="test" />
</part>
</part>
</parameter>
</Parameters>
Lloyd McKenzie (Aug 25 2021 at 13:51):
'extension' isn't defined for use with FHIRPath PATCH. If it was going to be used, I think it would be to extend the patch mechanism, not to define an extension. @Grahame Grieve ?
Grahame Grieve (Aug 26 2021 at 02:03):
wooo I don't know
Alexandr Shevchenko (Aug 26 2021 at 12:18):
Well... You probably right, since the extension is not on the list of DataTypes that could be used as values. (https://hl7.org/fhir/datatypes.html#open)
Lloyd McKenzie (Aug 26 2021 at 14:55):
@Alexandr Shevchenko Can you submit a change request for us to clarify?
Alexandr Shevchenko (Aug 27 2021 at 09:32):
@Lloyd McKenzie yes, sure. I submited the request for user account, so it might take a few days. If I can submit the change request without an account - I would be glad to have some instructions.
Lloyd McKenzie (Aug 27 2021 at 13:45):
Looks like your request has been approved @Alexandr Shevchenko
Alexandr Shevchenko (Aug 27 2021 at 14:02):
@Lloyd McKenzie Here it is: https://jira.hl7.org/browse/FHIR-33256. If you cloud check if any info is missing - I would very appreciate it.
Lloyd McKenzie (Aug 27 2021 at 17:07):
Looks good to me
Hank Lenzi (Sep 02 2021 at 12:11):
Hi --
I don't want to cross post but, for the register, I just posted a question on #students about how to do a PATCH request, but it wasn't about extensions. There should be more documentation on this particular issue out there.
Last updated: Apr 12 2022 at 19:14 UTC