Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination for List Entries #29

Closed
6 tasks done
lincmba opened this issue Jan 23, 2024 · 1 comment · Fixed by #32
Closed
6 tasks done

Pagination for List Entries #29

lincmba opened this issue Jan 23, 2024 · 1 comment · Fixed by #32
Assignees

Comments

@lincmba
Copy link
Contributor

lincmba commented Jan 23, 2024

succeeds #27

Problem:
When the FHIR gateway is used to fetch data from a FHIR server using the List endpoint with a specific ID ([GET] /List?_id=<some-id>), it currently fetches a bundle containing entry URLs. For certain resources, like Locations, with a large number of entries, the gateway faces timeout errors due to the volume of data.

Temporary Fix:
The temporary fix for the SID project was to increase the HTTP client timeout .

Proposed Solution:
Implement pagination consistent with the current FHIR responses. Introduce two parameters, _page (default set to 1) and _count (default set to 20), passed to the URL. These parameters will help limit the number of items fetched from the FHIR server.

Workflow:

  • Gateway receives an initial request: [GET] /List?_id=<some-id>&_count=<page-size>&_sort=<some-sort>&<others>.
  • Gateway receives subsequent requests: [GET] /List?_id=<some-id>&_page<page-number>&_count=<page-size>.
  • Gateway fetches all relevant entries.
  • Uses page number and offset to determine specific records to fetch from FHIR.
  • Computes start and end: start = (_page - 1) * _count, end = start + _count.
  • Generates previous and next page links.
  • Fetches only the entries within the start and end limits from the FHIR server.
  • Response is put in a bundle, including both previous and next page links and returned.
  • No previous page link if it is the first page, and no next page links if it is the last page.

Acceptance Criteria:

  • Pagination is implemented for the List endpoint.
  • Fetching entries is limited based on the specified page and offset.
  • Previous and next page links are generated appropriately.
  • No previous page link for the first page, and no next page links for the last page.
  • Tests
  • Documentation on List mode entries in Read Me
@lincmba lincmba self-assigned this Jan 23, 2024
lincmba added a commit that referenced this issue Jan 31, 2024
lincmba added a commit that referenced this issue Feb 1, 2024
lincmba added a commit that referenced this issue Feb 1, 2024
lincmba added a commit that referenced this issue Feb 1, 2024
@ndegwamartin
Copy link
Contributor

ndegwamartin commented Feb 2, 2024

We have to different handler methods for this functionality:

  • one for when the request is /List/12345
  • one for /List?_id=12345 - See line L251

The current implementation works for the first one. We need the second one to have the same implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants