Stream: implementers
Topic: Sort on reference search param
John Calvin Young (Oct 17 2016 at 21:31):
I can't find anything in the standard about how to interpret sorting on a reference-type parameter. Like /Patient?_sort=practitioner
or /Appointment?_sort=location
. I'd like to retrieve a list of Patient resources sorted by their attached careProvider's name (i.e. by the fallback 'display' value for each reference) but I'm not sure how to structure that query under the standard. Patient sorted on practitioner seems like it could work, but the implementation of that seems somewhat undefined.
John Calvin Young (Oct 17 2016 at 21:32):
Anyone have any experience implementing reference parameters as sorts, or have thoughts on the intended semantics?
Grahame Grieve (Oct 17 2016 at 21:33):
this is not presently defined, I'm afraid.
John Calvin Young (Oct 17 2016 at 21:37):
That's unfortunate. Any alternate suggestions? I could query Practitioner, sort by name, and revInclude Patient:careProvider, but that feels rather painful when what I'm really curious about is patient.
Lloyd McKenzie (Oct 18 2016 at 02:11):
The obvious way to make this work would be to allow sorting on a chained parameter - so Patient?_sort=practitioner.name. But I don't think we support that at the moment.
John Calvin Young (Oct 18 2016 at 15:06):
@Lloyd McKenzie I agree. Chained sort parameters seem to be the obvious solution...but I saw a conversation from a while back about how bad that might be to support in a generalized approach. Maybe when formalizing it, require _include of a resource if chaining into it for sort purposes?
I'm managing a client application that badly needs this sort of thing (no pun intended) and coordinating with the server implementation team. Just trying to figure out how to formulate some very obvious queries for consumption over FHIR. The search api feels very constraining right now.
Grahame Grieve (Oct 18 2016 at 19:37):
search is an impossible problem - it's incredibly powerful and scary from a server perspective, but whatever we define, it's not enough from a client perspectice. You can certainly go ahead and do sort by chained parameter as a private agreement, and you can propose a task to allow it; I don't know how it will go as a proposal
Last updated: Apr 12 2022 at 19:14 UTC