FHIR Chat · Resource id stability · implementers

Stream: implementers

Topic: Resource id stability


view this post on Zulip Paul Lynch (Jun 24 2020 at 19:04):

For a particular FHIR server, is there an expectation that the id of a particular resource will remain the same over time? Or might the administrator of the server reload their data and (intentionally or not) assign the resource a new id?

view this post on Zulip Lloyd McKenzie (Jun 24 2020 at 19:50):

The expectation is that the id will remain the same. Furthermore, the id must always resolve to the same instance. If the id changes, then any links to the resource from external systems will break. If the id changes to another id that used to exist, then external references will resolve to the same thing. It's the same principle as "should web pages keep the same name" - if you rename your web pages you'll at best create broken links and at worst, have external links that now take you to the wrong page.

view this post on Zulip Grahame Grieve (Jun 24 2020 at 20:21):

by definition, the Id and type are immutable. you cannot 'change' them - you create a new resource when you do. It's a definitional question

view this post on Zulip Paul Lynch (Jun 25 2020 at 00:12):

Okay, I can see the importance of that, but then I am not sure why the ability to PUT a resource with a particular id is optional. I don't see how a FHIR server that doesn't allow you to set the id, but just generates them on its own, would be able to preserve the meaning of ids if you have upgrade to a new version and reload your data.

view this post on Zulip Grahame Grieve (Jun 25 2020 at 00:22):

indeed, it wouldn't. But some FHIR servers wouldn't let you do that anyway.

view this post on Zulip Grahame Grieve (Jun 25 2020 at 00:22):

lots of them, in fact

view this post on Zulip Lloyd McKenzie (Jun 25 2020 at 01:20):

Allowing assignment of id by a client means that you trust clients to do that appropriately - and generally means the ids would need to be GUIDs.

view this post on Zulip Lloyd McKenzie (Jun 25 2020 at 01:21):

Given that many repositories are legacy databases, that's not necessarily always reasonable.

view this post on Zulip Venkat (Jul 09 2020 at 05:42):

Hi Team,

In one of the scenario, I need ti generate ID of a resource dynamically which I was able to achieve. But I need to have a static prefix in the ID field (so id of a resource might look patient1), is it possible? if yes, could you please let me know how.

view this post on Zulip Lloyd McKenzie (Jul 09 2020 at 14:03):

You're in charge of what resource ids you assign based on your internal persistence model. FHIR cares about the format - it has to match the constraints of the 'id' type in terms of characters and length, but what algorithm you use to assign it for data stored on your system is up to you. You have no ability to control what ids look like on other systems though.


Last updated: Apr 12 2022 at 19:14 UTC