fhirbase-plv8 icon indicating copy to clipboard operation
fhirbase-plv8 copied to clipboard

Pagination urls in search results are malformed

Open Andrzej-Pietrzak opened this issue 8 years ago • 1 comments

  1. I'm seeing some of the links in certain situations and not seeing them in others
  2. Links are malformed as page numbers are sometimes set to NaN or undefined
  3. Last page seems to be counted wrong for certain situations Examples:

SELECT fhir_create_resource('{"resource": {"resourceType": "Patient","name": [{"given": ["Jim"]}], "identifier": [{"use": "official", "value": "id-123", "system": "test"}]}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType": "Patient","name": [{"given": ["Tim"]}], "id": "2345"}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType": "Patient","name": [{"given": ["Tim"], "family": ["Second"]}], "id": "3456"}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType": "Patient","name": [{"given": ["Walt"]}], "id": "4567"}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType": "Patient","name": [{"given": ["Tim"], "family": ["Sed"]}], "id": "56778"}}'); SELECT fhir_create_resource('{"allowId": true, "resource": {"resourceType": "Patient","name": [{"given": ["Tim"], "family": ["Sad"]}], "id": "6789"}}');

-- default page: SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=0"}'); -- ?, visible: [self], all four seams a legit solution SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=1"}'); -- nok, visible: [self, next, last], next page: "Patient/_search?given=Tim&_sort=family&_count=1&_page=NaN" SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=2"}'); -- nok, visible: [self, next, last], next page: "Patient/_search?given=Tim&_sort=family&_count=2&_page=NaN" SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=3"}'); -- nok, visible: [self, next, last], next page: "Patient/_search?given=Tim&_sort=family&_count=3&_page=NaN" SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=4"}'); -- nok, visible: [self, last], last page: "Patient/_search?given=Tim&_sort=family&_count=4&_page=undefined" SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=5"}'); -- nok, visible: [last, self], last page: "Patient/_search?given=Tim&_sort=family&_count=5&_page=undefined"

--default count SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_page=0"}'); -- ?, visible [self] SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_page=1"}'); -- ok, but visible links include only: [self, previous] -- page and count SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=4&_page=0"}'); -- ok, but visible links include only: [self, last] SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=4&_page=1"}'); -- nok, visible: [self, previous, last] the last page is wrong, expected 0, got 1: Patient/_search?given=Tim&_sort=family&_count=4&_page=1"

SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=3&_page=0"}'); -- ok, visible: [self, next, last] SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=3&_page=1"}'); -- nok, visible: [self, next, previous, last], we know the last page is page 1 yet next page: "url": "Patient/_search?given=Tim&_sort=family&_count=3&_page=2" SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=3&_page=2"}'); -- ok, visible: [self, next, previous, last], still wrong next page link though

SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=2&_page=0"}'); -- ok, visible: [self, next, last] SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=2&_page=1"}'); -- nok, visible: [self, next, previous, last], wrong last page and wrong next page SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=2&_page=2"}'); -- nok, visible: [self, next, previous, last], wrong last page and wrong next page

SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=1&_page=0"}'); -- nok, visible: [self, next, last], expected last page to equal 3, got 4 SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=1&_page=1"}'); -- nok, visible: [self, next, previous, last], wrong last page SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=1&_page=2"}'); -- nok, visible: [self, next, previous, last], wrong last page SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=1&_page=3"}'); -- nok, visible: [self, next, previous, last], wrong last page SELECT fhir_search('{"resourceType": "Patient", "queryString": "given=Tim&_sort=family&_count=1&_page=4"}'); -- nok, visible: [self, next, previous, last], wrong last page and wrong next page

Andrzej-Pietrzak avatar May 04 '16 11:05 Andrzej-Pietrzak

What's the status on this issue ?

szymonp-kainos avatar Jun 06 '16 11:06 szymonp-kainos