Closed
Description
Background
- The JHE server should be able to support a large number of Observations
- Therefore it needs to support filtering and pagination options that are executed at the DB level (ie
LIMIT
andOFFSET
etc) - FHIR specifies the search param
_count
for the page size but does not specify a parameter for the page number (see https://www.hl7.org/fhir/search.html#table) - Various servers have their own params

- We will use
_page
- We also need to return the total number of results as
bundle.total
but we'll leave this for another ticket
TBD
- Use Postman to create >30 Observations for testing - update the ID to use a random string (using Postman
{{$randomPassword}}
or similar so you can click the SEND button repeatedly without having to change the payload each time - Accept the parameter
_count
so thatGET /fhir/r5/Observation?_count=10
displays only the first 10 results by addingLIMIT 10
to the end of the raw DB query - Accept the parameter
_page
so thatGET /fhir/r5/Observation?_count=10&_page=2
displays results 11-20 by addingOFFSET (page-1)*10)
- Lastly, add the
link
property to the response Bundle withself
,previous
andnext
as per FHIR spec - see example below.
// GET /fhir/r5/Observation?_count=1&_page=2
{
"resourceType": "Bundle",
"type": "searchset",
"link": [ {
"relation": "self",
"url": "http://localhost:8000/Observation?_count=1&_page=2"
}, {
"relation": "previous",
"url": "http://localhost:8000/Observation?_count=1&_page=1"
},
{
"relation": "next",
"url": "http://localhost:8000/Observation?_count=1&_page=3"
} ],
"entry": [
{
"resource": {
"resourceType": "Observation",
...
Note:
- I don't know if this is best implemented in Django using a custom paginator (see https://www.django-rest-framework.org/api-guide/pagination/?ref=thetldr.tech#custom-pagination-styles) or by just passing the vars through and have the default page size set to int.max
- we don't want to be using any kind of in-memory result set pagination because that won't scale
- given that we are using raw sql queries for the JSON transformation simply passing extra params might be the best option
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done