Stream: implementers
Topic: Sorting by chained parameters
Krzysztof Kowalski (Apr 29 2016 at 10:15):
Hi, I'm wondering if Fhir supports sorting search results by chained parameters - this is not defined in specification.
Example of such sorting would be to get all Encounters for particular Practitioner with included Patient resources sorted by Patient.name.
Grahame Grieve (Apr 29 2016 at 10:17):
agree it is not defined. My server explicitly rejects attempts to do this, and I would find the joins difficult to pull off, I think.
Grahame Grieve (Apr 29 2016 at 10:17):
interested in comments from other server maintainers
Grahame Grieve (Apr 29 2016 at 10:21):
e.g. @Ewout Kramer @James Agnew @Daniel Loewenstein @Kevin Shekleton @Brian Postlethwaite @nicola @Richard Ettema - would you like to comment on this?
Kevin Shekleton (Apr 29 2016 at 10:43):
We wouldn't be able to support that either. The big issue is that this sort would have to be applied in the database query so that paging is still done properly. There is no way we'd be able to do that generically for any resources.
Grahame Grieve (Apr 29 2016 at 10:43):
could you do it specifically for some queries?
Kevin Shekleton (Apr 29 2016 at 10:44):
Probably not
Grahame Grieve (Apr 29 2016 at 10:46):
thx.
Ewout Kramer (Apr 29 2016 at 12:03):
@Martijn and @Christiaan Knaap - you're more up-to-date on our search subsystem. Would we be able to do that?
Martijn Harthoorn (Apr 29 2016 at 12:11):
We don't currently implement that no.
Grahame Grieve (Apr 29 2016 at 12:11):
could you?
Richard Ettema (Apr 29 2016 at 13:04):
My server doesn't support this either. Though, I might be able to this for a specific use case as you describe. Not sure if I'll have time to work on this until after Montreal.
Martijn Harthoorn (Apr 29 2016 at 14:25):
We do create a snapshot of our search/filter results. If we added the sort key to that snapshot, we might.
Brian Postlethwaite (Apr 29 2016 at 23:42):
sqlonfhir woudn't handle this either, due to the paging (we don;t keep history in the search indexes)
James Agnew (May 03 2016 at 22:19):
I'm a bit late to the party (soooo many things to keep tabs on) but I can't imaging many people would support this, or care to.
If you want "Patients and their encounters, sorted by patient" there is a way to do this in FHIR. Search for patients, sorted by patient, and then _revinclude
the encounters.
Christiaan Knaap (May 09 2016 at 12:40):
To add to @Martijn s answer about Spark: It would require us to traverse that chain for all the search results, with each hop being a separate query (since our MongoDb implementation does not support joins). So we might be able to implement it, but it would be a very expensive operation.
Last updated: Apr 12 2022 at 19:14 UTC