FHIR Chat · Ordering for the whole-system history interaction · implementers

Stream: implementers

Topic: Ordering for the whole-system history interaction


view this post on Zulip Lee Surprenant (Mar 16 2021 at 13:32):

http://build.fhir.org/http.html#history says

The return content is a Bundle with type set to history containing the specified version history, sorted with oldest versions last, and including deleted resources.

Does that sort ordering apply to just the resources on a single page, or also to the overall order of the pages?
Is a request like GET [base]/_history required to return the latest changes, or is it valid for that to return the oldest changes in the system?
Does the next link need to page backward in time, or is it valid for next to go forward in time?

view this post on Zulip Lloyd McKenzie (Mar 16 2021 at 13:53):

It applies to overall order of pages. 'next' would go backward in time.

view this post on Zulip Lloyd McKenzie (Mar 16 2021 at 13:55):

(It also applies within a page)

view this post on Zulip Robin Arnold (Mar 16 2021 at 14:13):

The spec states "The history interaction can be used to set up a subscription from one system to another, so that resources are synchronized between them". This is problematic using pages going back in time. To sync, systems need to roll forward in time order. Consider a scenario where there's an outage and a large gap appears between the state of two systems. In order to fill that gap, the client system would need to hit the last page (oldest change first) and walk the timeline forward. Paging like this is impractical when the ingestion rate is high and potentially continuous. It is particularly expensive on the server side.

view this post on Zulip Lloyd McKenzie (Mar 16 2021 at 14:49):

Hmm. That's a really good point. The needs for synchronization (oldest to newest) and the needs for a user who's browsing history (which typically is newest to oldest) aren't the same. Given that this is now normative, I guess the solution for synchronization is to run the query and use the 'last' link to get the oldest page and then navigate the result set using the 'previous' link. It's not ideal, but at this point, it's the best we can do for prior releases. For future releases, we could introduce the notion of allowing a sort parameter that would allow you to override the default behavior. Do you want to submit a change request?

view this post on Zulip Lee Surprenant (Mar 16 2021 at 14:55):

thanks Lloyd. FWIW, thats basically just what I had in mind (we are trying to support a "changes" feed that moves forward in time and I wanted to re-use the _history endpoint for it)

view this post on Zulip Lee Surprenant (Mar 16 2021 at 14:57):

either robin or I will open a change request for the introducing a _sort parameter (and I think we'll prototype this on our end as well)

view this post on Zulip Lee Surprenant (Apr 06 2021 at 17:06):

Finally got around to creating this one: https://jira.hl7.org/browse/FHIR-31709


Last updated: Apr 12 2022 at 19:14 UTC