FHIR Chat · Server Sort Support? · implementers

Stream: implementers

Topic: Server Sort Support?


view this post on Zulip John Silva (Jun 11 2020 at 20:51):

How does FHIR server indicate which sort options it supports? Is this part of the metadata/CapabilityStatement? (I realize that the _sort options use the same names as the search options but how does a FHIR client know which sort options a server supports --- or is this even specified?)

view this post on Zulip Lloyd McKenzie (Jun 11 2020 at 22:14):

I think the answer is that there's no way to declare this right now. @Grahame Grieve @James Agnew ?

view this post on Zulip Grahame Grieve (Jun 11 2020 at 22:17):

I think so

view this post on Zulip John Silva (Jun 12 2020 at 02:04):

Also related to this is how can paging work if the sorting isn't known? I suppose that the FHIR server could (or must support _lastUpdated) as a sort mechanism so it has a consistent way to page through data. (even with _lastUpdated there could be data changes in between the time the client requests page 1, page 2, etc.)

view this post on Zulip Grahame Grieve (Jun 12 2020 at 02:05):

we've said that it's up to the server how to handle paging through data that might change

view this post on Zulip Grahame Grieve (Jun 12 2020 at 02:06):

if you really care about keeping up with out missing stuff, you can't depend on search - you have to use subscription or history

view this post on Zulip John Silva (Jun 12 2020 at 09:59):

So if there's no way for a FHIR server to "declare this" are the FHIR specs silent about how a server should (must?) support sort options? Is there a requirement to at least support _lastUpdated ?

I see now what Grahame was referring to w.r.t. paging:


"Note: It is at the discretion of the search engine as to how to handle ongoing updates to the resources while the search is proceeding.

Note: The combination of _sort and _count can be used to return only the latest resource that meets a particular criteria - set the criteria, and then sort by date in descending order, with _count=1. This way, the last matching resource will be returned."


I guess this leaves the sorting up to middleware or UI layers if sort order is important for business use cases.

view this post on Zulip Lloyd McKenzie (Jun 12 2020 at 14:03):

Servers don't have to support sort at all - any more than they have to support any search capabilities. We're looking at how to allow CapabilityStatement to support declaring all sorts of nuanced conformance expectations. I suspect this requirement will end up getting handled there.


Last updated: Apr 12 2022 at 19:14 UTC