beda-software / fhir-py

FHIR Client for python
MIT License
174 stars 32 forks source link

Next URL - relative to hostname #83

Closed benispeti closed 2 years ago

benispeti commented 2 years ago

Hey! I'm trying to use fhirpy's fetch_all() function to collect all resources and iterate through all pages.

This is the Base URL of the FHIR server I'm using and the FHIR client configuration:

BASE_URL = "http://<hostname>/fhir/R4"
client = SyncFHIRClient(BASE_URL, ...)

Example request to get Observations using fetch_all():

resources = client.resources("Observation")
resources.search(patient=patient_id, ...).fetch_all()

From the FHIR server I get back the next URL in the following form. This is a relative URL to the host name, but not relative to the BASE_URL.

    "link": [
        {
            "relation": "self",
            "url": "/fhir/r4/Observation?patient=..."
        },
        {
            "relation": "next",
            "url": "/fhir/r4?_getpages=..."
        }
    ],

Is this form of next URL supported by fhirpy's fetch_all() somehow? I can't make it work and I'm getting an error during fetch_all(). Thanks!

mkizesov commented 2 years ago

hey, I think it's a bug which was done on purpose (previously our FHIR server used to return next links that were "relative" to base url, but not to hostname). I will try to fix it today.

benispeti commented 2 years ago

Hey @mkizesov! Do you have any update on this?

benispeti commented 2 years ago

I could get a configuration on our FHIR server to get back the next URLs relative to the base URL. I close this ticket.