Stream: finnish PHR
Topic: Observation sorting?
Sulka Haro (Apr 03 2019 at 11:47):
Hi! I noticed that i f I load Observation resources with the REST API, specifying _sort=date and _sort=-date produce the same results, even though one should return the results in chronological order and the other in inverse chronological order. Searching the date using the HAPI server, it looks like the _sort parameter is ignored for all fields - sorting by date and identifier produces the same results for the data I've uploaded. Is sorting disabled, or is something going on with the indexing?
Sulka Haro (Apr 04 2019 at 16:35):
Any news on this? Not being able to sort query results is blocking our development.
Sulka Haro (Apr 09 2019 at 13:53):
Here's a screenshot. AFAIK the results should be sorted by the updated field but are actually listed in seemingly random order. The same order is reproduced for all values of _sort. Screen-Shot-2019-04-09-at-16.42.04.png
Anna Korpela (Apr 11 2019 at 11:05):
We discussed this briefly yesterday during the HL7 Finland PH SIG Kanta PHR support meeting, Kanta PHR doesn't currently have suppport for _sort-parameter. But we are designing support for it as we speak, I'll get back to you with the timetable hopefully soon.
Sulka Haro (Apr 15 2019 at 06:29):
Ok great! So just to confirm, am I right there is no way currently to query for the last n inserted / updated records? If not, is there a way to query for any metadata (like dates) that'd allow querying for the data for a user with more targeted queries than doing something like walking back dates from current date, until data is found? The number of records I'll be pushing in with the blood glucose data is sadly such that it's not practical to just load all the records and sort programmatically after loading.
Eeva Turkka (Apr 18 2019 at 08:44):
Currently no, there is no way to ask "give me 50 latest results". We have the conformance statement available in Simplifier (https://simplifier.net/FinnishPHR/capabilitystatement3/) and there is the search parameter that works for the field "last updated" from meta element in the resource. The "date" parameter works on the Observation.effective[x] date if it is more approriate for the use case. Downloading (or looking, but it doesn't always show everything, there is something in weird in Simplifier with the json-presentation) the statement's json representation will give the paths in resources where the search parameters point to.
Limiting query by either parameter for example to last week or last month will give the results from that period.
Grahame Grieve (Apr 18 2019 at 09:57):
$lastN ?
Eeva Turkka (Apr 18 2019 at 10:44):
Could be, but the Finnish PHR server doesn't support searches like that yet, we haven't implemented everything fhir describes. Sorting query results is in plans and then you could just fetch the first page of results.
Grahame Grieve (Apr 18 2019 at 11:05):
well, I appreciate the difficulty, but $lastN is a little more sophisticated than just sorting :-(
Last updated: Apr 12 2022 at 19:14 UTC