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

OpenMRS pagination #1003

Open
josephjclark opened this issue Feb 18, 2025 · 5 comments · May be fixed by #1023
Open

OpenMRS pagination #1003

josephjclark opened this issue Feb 18, 2025 · 5 comments · May be fixed by #1023
Assignees

Comments

@josephjclark
Copy link
Collaborator

josephjclark commented Feb 18, 2025

We've hit on a couple of problems with OpenMRS pagination.

In 4.3.0, if you do searchPatient({ q: 'foo', limit: '100' } (does limit really have to be a string??) , it'll auto-page all data in pages of 100. It will not download 100 search results and return.

In other words, limit is actually working as pageSize, not limit, which is super misleading.

Against the new 5.0 branch, what we need to ensure is this:

  • The REST API should basically auto-page by default to download the desired number of records. It should provide limit pageSize and offset options. These do not map directly to url query parameters. pageSize controls how many are downloaded per page. limit controls how many in total are downloaded. The API needs to take care to not download more than the limit. I think by default we should download everything? Note that just 400 patient records seems to blow up the worker (although we're working on that)
  • The http.* namespace should not auto-page by default. It should do whatever you ask of it.If you pass query.limit, it'll just send that to the server and give you a page of data
  • later we can add either a autopage: true option to http.get? Or maybe we support options.limit and options.pageSize, and for http.get we'll honour them for you?. But if we disable autopage by default for http, we can add options to enable it as minor patches later.
@github-project-automation github-project-automation bot moved this to New Issues in v2 Feb 18, 2025
@theroinaochieng theroinaochieng moved this from New Issues to DevX Backlog in v2 Feb 25, 2025
@josephjclark
Copy link
Collaborator Author

@PiusKariuki I'd like you to look at this too please. Is the issue clear? Maybe we should talk it over?

@PiusKariuki
Copy link
Collaborator

Hi @josephjclark . Yeah I'd like to talk this over and see how we can solve this. Are you free for a call?

@josephjclark
Copy link
Collaborator Author

Great. I think it has to be tomorrow now, I need to get my head down on a few things. I'll propose a meeting time now

@PiusKariuki
Copy link
Collaborator

Awesome. I got the link. See you then.

@josephjclark
Copy link
Collaborator Author

josephjclark commented Feb 27, 2025

To util we'll add

request()
paginatedRequest()

We should log with query params every individual request (shows a heartbeat to users)

Ensure each request logs with query parameters

@PiusKariuki PiusKariuki self-assigned this Feb 28, 2025
@PiusKariuki PiusKariuki linked a pull request Feb 28, 2025 that will close this issue
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: DevX Backlog
Development

Successfully merging a pull request may close this issue.

2 participants