Many FHIR servers put their own parameters in the next and previous links of a search Bundle. Developers then use those parameters to build pagination in code and in UIs.
Two I’ve come across are _offset and _page. Neither is in the FHIR spec.
The problem is that code built on these parameters only works with one FHIR server provider.
It usually starts small. A developer looks at the next link, sees _offset=20 and combines this with a page count pulled from Bundle.total. They use this to build numbered page buttons in their UI, each with a URL built in code. Everything works as expected.
Connect to a different FHIR server and the parameter names change or the parameters disappear.
The spec defines four links for paging: first, previous, next and last. Most server providers populate the first three. They’re sufficient for pagination when the server implements them correctly. What goes inside each URL is up to the server.
Here’s an example: a platform splits its data across two FHIR servers. Master data – Patient, Practitioner and Organization – is stored in a commercial server. Documents are stored in an open-source server as DocumentReference resources.
The pagination code was written early, against the commercial server, and reads _offset from each next link. The documents screen reuses the same code. The open-source server’s next links use their own parameters, with no _offset. The code defaults to zero and requests the first page again. A clinician scrolling through a patient’s documents sees the same 20 documents every time, and is left thinking that’s all there is. A discharge summary that should have been on page two never appears.
Once code depends on custom parameters, pagination breaks when a second server from a different provider is connected or when the vendor changes.
Signs to look for:
- Page URLs built in code
- Code that reads the query string of Bundle.link.url
- Server-specific parameter names such as _offset in pagination code
- “Jump to page 7” controls
---
I work with teams on a project, retainer or fractional basis. Learn more →