FHIR Chat · Implementing _sort · implementers

Stream: implementers

Topic: Implementing _sort


view this post on Zulip Richard Kavanagh (Jan 12 2020 at 23:01):

When implementing _sort (http://hl7.org/fhir/R4/search.html#_sort).

Is it expected that the server can sort on any element of a resource? Surely that would be quite expensive from the database perspective.

view this post on Zulip Lloyd McKenzie (Jan 12 2020 at 23:44):

You can sort on any search parameter supported by the server

view this post on Zulip Richard Kavanagh (Jan 12 2020 at 23:49):

Thanks @Lloyd McKenzie . I guess the client just has to ask for what they want and hope the server supports it. i.e. there is no provision to declare what is supported in the CapabilityStatement.

view this post on Zulip Lloyd McKenzie (Jan 12 2020 at 23:59):

I think the general expectation is that if you support _sort and you support a given search parameter, you should be able to sort on that search parameter (presumably if you can search by it, you'll have it indexed, so sorting by it shouldn't be a significant cost).

view this post on Zulip dsh (Jan 22 2020 at 05:02):

You can sort on any search parameter supported by the server

@Lloyd McKenzie is there an easy way to list search parameters supported by HAPI FHIR JPA Server ?

view this post on Zulip dsh (Jan 22 2020 at 05:04):

I am trying to user _sort on Observation like /hapi-fhir-jpaserver/fhir/Observation/?_count=10&_sort=effectiveDateTime'

but I get this error

{
  "resourceType": "OperationOutcome",
  "text": {
    "status": "generated",
    "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Operation Outcome</h1><table border=\"0\"><tr><td style=\"font-weight: bold;\">ERROR</td><td>[]</td><td><pre>Unknown sort parameter
'effectiveDateTime'</pre></td>\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t</tr>\n\t\t</table>\n\t</div>"
  },
  "issue": [
    {
      "severity": "error",
      "code": "processing",
      "diagnostics": "Unknown sort parameter 'effectiveDateTime'"
    }
  ]
}

view this post on Zulip Lloyd McKenzie (Jan 22 2020 at 05:16):

@Daya Sharma That's a good question to ask on the #hapi stream

view this post on Zulip Patrick Werner (Jan 22 2020 at 09:32):

@Daya Sharma the correct searchParameter is 'date':
http://hapi.fhir.org/baseR4/Observation/?_count=10&_sort=date
works

view this post on Zulip Yunwei Wang (Jan 22 2020 at 16:17):

@Daya Sharma You can find supported search parameters through server's CapabilityStatement: http://hapi.fhir.org/baseR4/metadata

view this post on Zulip Igor Sirkovich (Jan 23 2020 at 07:24):

(deleted)


Last updated: Apr 12 2022 at 19:14 UTC