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

error fetching HAPI open FHIR R4 server? #145

Open
DiTo97 opened this issue Feb 20, 2024 · 0 comments
Open

error fetching HAPI open FHIR R4 server? #145

DiTo97 opened this issue Feb 20, 2024 · 0 comments
Labels

Comments

@DiTo97
Copy link

DiTo97 commented Feb 20, 2024

Hello,

when I try to the fetch the HAPI open FHIR R4 server using the latest version of the library:

from fhirclient import client
from fhirclient.models import patient


settings = {
    "app_id": "fhir",
    "api_base": "https://hapi.fhir.org/baseR4"
}


smart = client.FHIRClient(settings=settings)

if not smart.prepare():
    # TODO: authorize
    pass

assert smart.ready is True

search_patients = patient.Patient.where(
      struct={"active": "true"}
)

patients = search_patients.perform_resources(smart.server)

if patients:
    print(patients[0].birthDate.isostring)
    print(smart.human_name(patients[0].name[0]))

I get the following error in the response due to the formatting of the FHIR resource itself:

FHIRValidationError: {root}:
  entry.5:
    resource:
      text:
        'Non-optional property "div" on <fhirclient.models.narrative.Narrative object at 0x7f11a1d31ff0> is missing'

I guess the error comes from the built-in pydantic validation, but is there a way to filter out all the responses matching the search pattern that violate the validation, while still letting all the others through, instead of blocking them all?

@mikix mikix added the question label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants