fhirclient is a flexible Python client for interacting with FHIR (Fast Healthcare Interoperability Resources) servers, supporting the SMART on FHIR protocol. It provides data model classes for FHIR resources and utilities for API interactions like reading, searching, and authorization. Currently at version 4.4.0, the library is actively maintained with regular releases addressing Python compatibility, FHIR specification updates, and feature enhancements.
pip install fhirclientVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to initialize the `FHIRClient`, fetch a specific patient resource by ID, and perform a basic search query. It uses environment variables for configuration to ensure security and flexibility, falling back to a public SMART Health IT sandbox for demonstration. The example also shows the use of `perform_resources_iter` for handling search results, which is recommended for robust pagination.
Upgrade your Python environment to 3.10 or newer, or pin `fhirclient` to an older compatible version (e.g., `<4.3.0` for Python 3.8).
Update type checks from `field_type is FHIRDate` to `issubclass(field_type, FHIRDate)` to correctly identify all FHIR date/time types.
Review existing uses of `FHIRSearch.perform_resources` to ensure the new pagination behavior is intended. For explicit control over pagination or to avoid loading all results into memory at once, switch to `perform_iter` or `perform_resources_iter`.
Ensure your authorization flow incorporates PKCE if interacting with servers that require it. Refer to the `fhirclient` documentation or the SMART on FHIR specification for details on implementing PKCE with the library.
Before using `fhirclient`, verify its compatibility with your target FHIR server's specification version by checking the official client-py documentation.
Upgrade to `fhirclient` v4.3.1 or newer to avoid spurious deprecation warnings when using `perform_iter` or `perform_resources_iter`.