FHIR Chat · How does a FHIR server respond to canonical link? · implementers

Stream: implementers

Topic: How does a FHIR server respond to canonical link?


view this post on Zulip Donn Relacion (Feb 15 2022 at 09:57):

According to the FHIR documentation regarding Canonical URLs (https://www.hl7.org/fhir/references.html#canonical) references using the url element should be used when referencing conformance resources. According to the docs, a link such as http://hl7.org/fhir/ValueSet/my-valueset|1.0 should be translated into a fhir search as in fhir/ValueSet?url=http://hl7.org/fhir/ValueSet/my-valueset&version=1.0. Does this mean that a FHIR server should return a bundle when encountering ValueSet/my-valueset or just the resource? The docs mention about a result bundle if there is no match. Should the fhir server supposed handle this link at all? I'm working with a microsoft fhir server, and this type of interaction is not supported.

view this post on Zulip René Spronk (Feb 15 2022 at 10:11):

It's a search like any other, so the result will always be a Bundle, regardless of the number of matches.

view this post on Zulip Donn Relacion (Feb 15 2022 at 10:20):

My concern is that the link ValueSet/my-valueset doesn't really look like a search interaction, it looks like a read interaction.

view this post on Zulip Lloyd McKenzie (Feb 15 2022 at 15:24):

There is no expectation that [base]/ValueSet/my-valueset|someVersion will necessarily resolve. Instead, you parse and do a search wherever you typically store valuesets. As a last resort, you can do a search on [base]/ValueSet?url=...&version=someVersion. (There's no expectation you can necessarily do a 'read' because there could be multiple instances of the same value set on the server, though it's super-convenient if doing a read gives you the 'current' value set.

view this post on Zulip Donn Relacion (Feb 16 2022 at 02:17):

Our project is currently working with Questionnaire resources, and we want it to be easier for the front-end to easily get the Questionnaire without using the autogenerated id created by the server. Initially, we decided with controlling the resource Id by using PUT instead of POST. But then the topic of versioning came up, I found that the same Id cannot be used, and that's when I looked into adding support for the canonical link.

Returning a bundle may not be very convenient with the end users though, but since this behavior is not expected of FHIR servers, I guess we could get away with returning only the best matching resource. Another option would be to continue using the custom resource Id but adding the version in the Id and avoid this change altogether.

view this post on Zulip Lloyd McKenzie (Feb 16 2022 at 03:02):

We're looking at defining an operation that will retrieve a canonical - it'll grab the "most recent" if no version is specified, using the version comparison mechanism defined by the resource. That would give you a singleton. Otherwise, yes, you'll be dealing with a Bundle - presumably with one instance if you specify url + version.


Last updated: Apr 12 2022 at 19:14 UTC