Aidbox / Issues

Issue tracker for Aidbox FHIR backend by Health Samurai
7 stars 0 forks source link

Pagination links should use the same URL encoding as the original request #483

Closed russgray closed 2 years ago

russgray commented 2 years ago

I need the following improvement

I am doing a lot of searches based on identifiers, and the system field is usually a url so my search criteria might be something like https://github.com/synthetichealth/synthea|f2babb60-f2f2-5b08-5e60-1950ba7e88d6

When I make the request I urlencode this as it contains various special characters, so my actual query might look like /fhir/Observation?subject:Patient.identifier=https%3A%2F%2Fgithub.com%2Fsynthetichealth%2Fsynthea%7Cf2babb60-f2f2-5b08-5e60-1950ba7e88d6.

In the response, however, the pagination links are not encoded. They look something like:

  "link": [
    {
      "relation": "first",
      "url": "/fhir/Observation?_elements=id&_count=2&subject:Patient.identifier=https://github.com/synthetichealth/synthea|f2babb60-f2f2-5b08-5e60-1950ba7e88d6&page=1"
    },
    {
      "relation": "self",
      "url": "/fhir/Observation?_elements=id&_count=2&subject:Patient.identifier=https://github.com/synthetichealth/synthea|f2babb60-f2f2-5b08-5e60-1950ba7e88d6&page=1"
    },
    {
      "relation": "next",
      "url": "/fhir/Observation?_elements=id&_count=2&subject:Patient.identifier=https://github.com/synthetichealth/synthea|f2babb60-f2f2-5b08-5e60-1950ba7e88d6&page=2"
    },
    {
      "relation": "last",
      "url": "/fhir/Observation?_elements=id&_count=2&subject:Patient.identifier=https://github.com/synthetichealth/synthea|f2babb60-f2f2-5b08-5e60-1950ba7e88d6&page=53"
    }
  ]

I have to do some processing on these urls before I can use them; it would be easier (and I think more consistent) if they retained the encoding from the original request.

The expected benefit

Pagination links will more closely mirror the original request rather than requiring re-encoding each time

rublag commented 2 years ago

Fixed.

Nesmeshnoy commented 2 years ago

@russgray сould you please check it on :edge and let us know if it works as expected on your side?