Stream: implementers
Topic: Query latest Questionnaire by URI
Ivan Dubrov (Jun 30 2020 at 16:14):
When querying Questionnaire by canonical URI (https://www.hl7.org/fhir/search.html#versions), is there any way to specify "I want latest" rather than explicitly specify latest version?
Lloyd McKenzie (Jun 30 2020 at 16:20):
If you don't specify a desired version - i.e. you just specify the id, not _history/[version], you get the latest
Ivan Dubrov (Jun 30 2020 at 17:04):
By version I mean business version, as per:
For canonical references, servers SHOULD support searching by Canonical URLs, and SHOULD support automatically detecting a |[version] portion as part of the search parameter and interpreting that portion as a search on the business version of the target resource.
Not theResource.meta.versionId
.
Yunwei Wang (Jun 30 2020 at 17:10):
I believe it is the server's business rule to decide what is the "latest" version to return.
Ivan Dubrov (Jun 30 2020 at 17:42):
Right, but how would I express that in a query, is there a way?
I guess, server can support it via sorting by version, like Questionnaire?url=<url>&_sort=-version&_count=1
.
Yunwei Wang (Jun 30 2020 at 18:13):
I understand your question now. So the server has multiple Questionnaire resources with the same Questionnaire.version value but different Questionnaire.meta.versionId.
Is that correct?
But in which situation the resource with the latest versionId does not have the latest business version?
Lloyd McKenzie (Jun 30 2020 at 18:26):
There's no standard way to define business versions, so there's no standard way to determine what the 'latest' is. It's quite possible to update an 'older' business version more recently than the 'current' business version - so it really is going to have to be up to the server to decide what release to return if there are multiple business versions with the same canonical URL available on a server
Jim Steel (Jun 30 2020 at 23:39):
We do a similar thing for different resources (ValueSets, CodeSystems, ConceptMaps, StructureDefinitions). We resolve latest using x.y.z or yyyymmdd versions, provided that all resources with the canonical URL have the same versioning format, and there is a single latest.
Lloyd McKenzie (Jul 01 2020 at 14:44):
@Grahame Grieve The need to return the latest canonical is a real use-case, but it would require enforcing some consistency around [Resource].version. Do you think we could reasonably define a small number of syntaxes that would allow version order comparison and indicate that systems should use one of those - and that if they don't, they can't count on systems being able to determine latest? (Should also standardize what to do if a server can't figure out latest)
Grahame Grieve (Jul 03 2020 at 06:33):
sure we could document that. Though servers may make other arrangements that mean it could work.
Grahame Grieve (Jul 03 2020 at 06:33):
I do think that the semantics for referring to the current version of a canonical resource are clear in a canonical(X)
Grahame Grieve (Jul 03 2020 at 06:34):
but I also think that we haven't defined precisely how a client would ask for that resource, and we definitely should
Lloyd McKenzie (Jul 03 2020 at 13:36):
@Ivan Dubrov, would you be willing to submit a change request?
Ivan Dubrov (Jul 06 2020 at 16:28):
I didn't know what exactly to propose, so wrote some generic ticket: https://jira.hl7.org/browse/FHIR-27920. I generalized it for all resources which are commonly referenced by canonical since we have similar issue with conformance resources as well.
Last updated: Apr 12 2022 at 19:14 UTC