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

When using _total=none, a "next" link is generated when there isn't a "next" page #2607

Closed
csandersdev opened this issue Jul 13, 2021 · 3 comments
Assignees
Labels
bug Something isn't working P3 Priority 3 - Nice To Have

Comments

@csandersdev
Copy link
Contributor

csandersdev commented Jul 13, 2021

Describe the bug
When using _total=none, a "next" link is generated when there isn't a "next" page

Environment
Main (4.9.0-SNAPSHOT)

To Reproduce
Steps to reproduce the behavior:

$ curl -k -u 'fhiruser:change-password' 'https://localhost:9443/fhir-server/api/v4/Encounter?_count=1000&type:in=http://ibm.com/health/ValueSet/wh-cohorting-synthea-encounters&subject:Patient=17a5e657590-cfaa4225-b98a-4f84-9a67-a3aff9da8ca3'

{
    "resourceType": "Bundle",
    "id": "03f1a0f6-ce90-46c2-8d5c-5808913c5a95",
    "type": "searchset",
    "total": 61,
    "link": [
        {
            "relation": "self",
            "url": "https://localhost:9443/fhir-server/api/v4/Encounter?_count=1000&type:in=http://ibm.com/health/ValueSet/wh-cohorting-synthea-encounters&subject:Patient=17a5e657590-cfaa4225-b98a-4f84-9a67-a3aff9da8ca3&_page=1"
        }
    ]
}

$ curl -k -u 'fhiruser:change-password' 'https://localhost:9443/fhir-server/api/v4/Encounter?_count=1000&type:in=http://ibm.com/health/ValueSet/wh-cohorting-synthea-encounters&subject:Patient=17a5e657590-cfaa4225-b98a-4f84-9a67-a3aff9da8ca3&_total=none'

{
    "resourceType": "Bundle",
    "id": "10dcec7a-d6d7-4ec3-a47b-23bab7b5024a",
    "type": "searchset",
    "link": [
        {
            "relation": "self",
            "url": "https://localhost:9443/fhir-server/api/v4/Encounter?_count=1000&type:in=http://ibm.com/health/ValueSet/wh-cohorting-synthea-encounters&subject:Patient=17a5e657590-cfaa4225-b98a-4f84-9a67-a3aff9da8ca3&_total=none&_page=1"
        },
        {
            "relation": "next",
            "url": "https://localhost:9443/fhir-server/api/v4/Encounter?_count=1000&type:in=http://ibm.com/health/ValueSet/wh-cohorting-synthea-encounters&subject:Patient=17a5e657590-cfaa4225-b98a-4f84-9a67-a3aff9da8ca3&_total=none&_page=2"
        }
    ]
}

Expected behavior
When there isn't a next page, no next link should be generated. As-is, my implementation saves some CPU cycles by using _total=none, but then loses some CPU cycles by making an additional, unnecessary web request because it doesn't know we are done after the first call.

@csandersdev csandersdev added the bug Something isn't working label Jul 13, 2021
@lmsurpre lmsurpre added the P3 Priority 3 - Nice To Have label Aug 9, 2021
@lmsurpre
Copy link
Member

lmsurpre commented Aug 9, 2021

Proposal: in cases where total=none was passed, only include the next link when we have a full page of results. Otherwise, omit it.

@lmsurpre lmsurpre added this to the Sprint 2021-11 milestone Aug 9, 2021
@tbieste tbieste self-assigned this Aug 9, 2021
tbieste added a commit that referenced this issue Aug 9, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
tbieste added a commit that referenced this issue Aug 9, 2021
Signed-off-by: Troy Biesterfeld <tbieste@us.ibm.com>
@tbieste
Copy link
Contributor

tbieste commented Aug 9, 2021

Updated to only include the next link when we have a full page of results.

tbieste added a commit that referenced this issue Aug 9, 2021
Issue #2607 - Do not show next link when not necessary
@JohnTimm
Copy link
Collaborator

I verified this locally using the following search URL:

https://localhost:9443/fhir-server/api/v4/Patient?_count=1000&_total=none

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P3 Priority 3 - Nice To Have
Projects
None yet
Development

No branches or pull requests

4 participants