FHIR Chat · Incorrect next/previous links? · hapi

Stream: hapi

Topic: Incorrect next/previous links?


view this post on Zulip Dexter (Jun 24 2021 at 09:11):

I'm searching for a resource something like this

baseurl/fhir/Practitioner?identifier=XAB|
&_has:PractitionerRole:practitioner:role=primary-physician

It returns data something like this. Basically, I have 22 items in the response, and default count is 20.
I navigate to page 2 from page 1, and the results look fine. But, when I try to navigate back to page 1 using the result from page-2's "previous" field, I get back only 2 items pre request. What's this behavior? Is it expected? What do I need to do to get the "expected" behavior?

Page 1

{
    "resourceType": "Bundle",
    "id": "99c57a17-3172-4a79-9aac-ddc827ed62c3",
    "type": "searchset",
    "total": 22,
    "link": [
        {
            "relation": "self",
            "url": "http://baseurl.com/fhir/Practitioner
                   ?_has%3APractitionerRole%3Apractitioner%3Arole=primary-physician
                   &identifier=XAB"
        },
        {
            "relation": "next",
            "url": "http://baseurl.com/fhir
                   ?_getpages=99c57a17-3172-4a79-9aac-ddc827ed62c3
                   &_getpagesoffset=20
                   &_count=20
                   &_bundletype=searchset"
        }
    ],
    "entry": [ /* 20 items */ ]
}

Page 2 on navigation from page 1 using "next" from above

{
    "resourceType": "Bundle",
    "id": "99c57a17-3172-4a79-9aac-ddc827ed62c3",
    "type": "searchset",
    "total": 22,
    "link": [
        {
            "relation": "self",
            "url": "http://baseurl.com/fhir
                   ?_getpages=99c57a17-3172-4a79-9aac-ddc827ed62c3
                   &_getpagesoffset=20
                   &_count=20
                   &_bundletype=searchset"
        },
        {
            "relation": "previous",
            "url": "http://baseurl.com/fhir
                   ?_getpages=99c57a17-3172-4a79-9aac-ddc827ed62c3
                   &_getpagesoffset=18
                   &_count=2
                   &_bundletype=searchset"
        }
    ],
    "entry": [ /* 2 items */ ]
}

On navigation back to page 1 using "previous" from above snippet

{
    "resourceType": "Bundle",
    "id": "99c57a17-3172-4a79-9aac-ddc827ed62c3",
    "meta": {
        "lastUpdated": "2021-06-24T09:04:10.051+00:00"
    },
    "type": "searchset",
    "total": 22,
    "link": [
        {
            "relation": "self",
            "url": "http://baseurl.com/fhir
                   ?_getpages=99c57a17-3172-4a79-9aac-ddc827ed62c3
                   &_getpagesoffset=18
                   &_count=2
                   &_bundletype=searchset"
        },
        {
            "relation": "next",
            "url": "http://baseurl.com/fhir
                   ?_getpages=99c57a17-3172-4a79-9aac-ddc827ed62c3
                   &_getpagesoffset=20
                   &_count=2
                   &_bundletype=searchset"
        },
        {
            "relation": "previous",
            "url": "http://baseurl.com/fhir
                   ?_getpages=99c57a17-3172-4a79-9aac-ddc827ed62c3
                   &_getpagesoffset=16
                   &_count=2
                   &_bundletype=searchset"
        }
    ],
    "entry": [ /* 2 items, I expect 20, a result similar to page 1 */ ]
}

view this post on Zulip Dexter (Jun 24 2021 at 09:17):

I'm really confused as to how to get the navigation to work properly

view this post on Zulip Dexter (Jun 28 2021 at 06:06):

Is this documented/expected behavior? Kindly help


Last updated: Apr 12 2022 at 19:14 UTC