Stream: implementers
Topic: Find if _sort is supported through CapabilityStatement
Corey Wen (Jan 19 2022 at 16:28):
How does one check if a CapabilityStatement supports sort, for example sort by date for an Observation. Looking at Observation searchParams at hapi.fhir it has date as a searchParam but how can one check if sort is applicable?
Similarly trying to use _sort=-date for Observations with another fhir server results in the following OperationOutcome even though the CapabilityStatement also had date as a searchParam for Observation.
{
"resourceType": "OperationOutcome",
"issue": [
{
"severity": "information",
"code": "invalid",
"details": {
"coding": [
{
"system": "urn:oid",
"code": "",
"display": "Content invalid against the specification or a profile."
}
],
"text": "Content invalid against the specification or a profile."
},
"diagnostics": "Unknown parameter: _SORT. Parameter has been ignored."
}
]
}
Yunwei Wang (Jan 19 2022 at 16:48):
If supported, _sort would be listed under searchParam
Corey Wen (Jan 24 2022 at 16:50):
Currently I am working with Logica sandbox, and the CapabilityStatement does not have _sort listed anywhere. However, querying Observations with _sort=date still returns a sorted list of Observations by date, and without it, the list is unsorted. Is there something else that might indicate if _sort is supported, or did Logica sandbox just not put _'sort' under searchParam for Observations?
Craig McClendon (Jan 24 2022 at 17:09):
I don't see a place in the CapabilityStatement to indicate _sort support. I can tell you from experience that _sort can be difficult to implement and I would not be surprised if many systems have limited support outside of common Resource attributes such as Resource.id and Resource.meta.lastUpdated.
Eric Haas (Jan 24 2022 at 19:50):
CapabilityStatement.rest.resource.searchParam
-
Element Id: CapabilityStatement.rest.resource.searchParam
-
Definition:
Search parameters for implementations to support and/or make use of - either references to ones defined in the specification, or additional ones defined for/by the implementation. -
Cardinality: 0..*
- Summary: false
- Comments:
The search parameters should include the control search parameters such as _sort, _count, etc. that also apply to this resource (though many will be listed at CapabilityStatement.rest.searchParam). The behavior of some search parameters may be further described by other code or extension elements, or narrative within the capability statement or linked SearchParameter definitions.
Corey Wen (Jan 25 2022 at 20:02):
@Eric Haas Could you explain what you mean? It seems your post suggests that if "name" is listed under searchParams, then _sort should apply to that resource on the name field, but unfortunately I'm not sure I quite fully understand.
Eric Haas (Jan 25 2022 at 21:29):
This is taken directly from the FHIR specification here: http://build.fhir.org/structuredefinition-definitions.html
and what it says is put _sort
in CapabilityStatement.rest.resource.searchParam for each resource type that uses it.
for example like so:
rresourceType: CapabilityStatement
#....
rest:
- mode: server
resource:
type: Observation
searchParam:
name: _sort
definition: >-
http://hl7.org/fhir/SearchParameter/Resource-sort
type: token
documentation: >-
The server **SHALL** support `_sort` for Observation so The client can indicate which order to return the results by using this parameter which can contain a comma-separated list of sort rules in priority order. For example `GET [base]/Observation?_sort=status,-date,category` See http://build.fhir.org/search.html#sort
#....
Last updated: Apr 12 2022 at 19:14 UTC