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

Update Pagination Response Format and URL Structure for get Requests #955

Open
konavivekramakrishna opened this issue Apr 2, 2024 · 1 comment

Comments

@konavivekramakrishna
Copy link
Contributor

konavivekramakrishna commented Apr 2, 2024

Currently, the pagination response format for the patientSearch endpoint in the backend is as follows:

{
    "paging": {
        "totalPages": 0,
        "currentPage": 0,
        "searchTermToPage": [{}]
    },
    "patientSearchResults": [{}]
}

expected Format :

{
    "count": 0,
    "results": [{}]
}

Before :

  • The pagination response structure is being modified for each different call in the backend. For instance, patientSearchResults is the key used by the frontend to access search results.
  • The searchTermToPage field is being sent from the backend to the frontend but is not utilized in the frontend logic.
https://oe3.openelis-global.org/api/OpenELIS-Global/rest/patient-search-results?lastName=&firstName=&STNumber=&subjectNumber=&nationalID=&labNumber=&guid=&dateOfBirth=&gender=M

image

After :

  • The count field from the backend should indicate the size of the results array based on the query parameters, allowing for more efficient handling of pagination.
  • Serialization of query parameters in the URL should exclude parameters with undefined or null values. For instance, if nationalID and labNumber are undefined or null, they should not be included in the URL query params.
  • The default offset should be set to 0. When the user interacts with the frontend (e.g., clicks next button), the offset should be updated accordingly in the URL.
  • If query parameters are applied, they should be serialized in the URL. For instance:
  • Base URL: https://oe3.openelis-global.org/api/OpenELIS-Global/rest/patient-search-results
  • Without query params: ?limit=12&offset=0
  • After user interaction: ?limit=12&offset=12
  • With applied query params: ?limit=12&offset=12&lastName=vivek&firstName=rama
    image

By implementing these changes, unnecessary buttons such as "load next bundle" and "load previous bundle" can be removed, resulting in a more streamlined UX.

@konavivekramakrishna
Copy link
Contributor Author

konavivekramakrishna commented Apr 2, 2024

@mozzy11

Could you please review the issue mentioned above, If the proposed approach seems appropriate, please assign it to me

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

No branches or pull requests

1 participant