fhirclient
A flexible client for FHIR servers supporting the SMART on FHIR protocol
What it is and what it does
fhirclient is a Python library that connects your code to FHIR (Fast Healthcare Interoperability Resources) servers—the standard format for electronic health records. It handles both the network communication and the data model, so you can read patient records, search for encounters or procedures, and work with healthcare data in a Pythonic way. The library supports SMART on FHIR, which means it can manage OAuth login flows for protected servers, and it includes pre-built classes for common FHIR resources like Patient, Encounter, and Procedure.
You use it by creating a FHIRClient with your server URL, then calling methods on resource classes to fetch or search for data. The library validates data structure as you build or deserialize FHIR objects, catching schema errors early. It's actively maintained, requires only requests as a dependency, and supports current Python versions.
Use it for:
- Fetch a patient's demographics and medical history from a SMART-enabled EHR for display in a web or mobile app.
- Search for all encounters or procedures for a patient within a given date range and process the results.
- Build a Flask or Django app that logs users in via SMART OAuth and displays their own health data.
- Validate and serialize FHIR data objects when building healthcare integrations or data pipelines.
- Query a public FHIR sandbox server for research or testing without authentication setup.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Python client library for connecting to FHIR servers and working with FHIR healthcare data, supporting the SMART on FHIR protocol for OAuth-based authentication and resource queries.
Yes. The library is actively maintained, has no known vulnerabilities, installs with minimal friction, and is the standard choice for FHIR + SMART integration in Python. Use it if you need to connect to FHIR servers or work with FHIR data models in Python.
Install
fhirclient on PyPI
pip
pip install fhirclientuv
uv add fhirclientpoetry
poetry add fhirclientInstalling fhirclient
Before you install
Low friction: pure Python wheel with only requests as a runtime dependency. Actively maintained with recent commits and stable production status.
License in practice
Permissive license allows use in both open-source and proprietary projects without significant restrictions.
Quickstart
pip install fhirclient
from fhirclient import client
from fhirclient.models.patient import Patient
settings = {'app_id': 'my_app', 'api_base': 'https://r4.smarthealthit.org'}
smart = client.FHIRClient(settings=settings)
patient = Patient.read('patient-id', smart.server)
print(patient.birthDate.isostring)
Requires Python 3.10 or later.
Verify before relying
- Whether the library handles FHIR versions beyond R4 (4.0.1) in current releases.
- Performance characteristics when querying large result sets or performing bulk operations.
- Specific OAuth flow support details and limitations for different SMART server implementations.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — requests |
| Maintenance | actively maintained — 185 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 330,970/month — #7,523 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fhirclient-4.4.0-py3-none-any.whl
Keywords: smart, fhir, healthcare, medical-informatics, clinical-informatics, biomedical-informatics
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
fhir.resourcesProvides Python classes and validation for all…
permissive · top 5,000 on PyPI
fhirpyAsync/sync FHIR client for Python that provides…
unclear · top 5,000 on PyPI
fhir-coreProvides Pydantic V2-based abstract base…
permissive · top 5,000 on PyPI
carelyticsCarelytics provides healthcare data cleaning,…
permissive · top 15,000 on PyPI
oauth2-clientHandles OAuth2 authentication flows…
unclear · top 15,000 on PyPI
requests-oauth2clientAn OAuth 2.x client for Python that obtains,…
permissive · top 5,000 on PyPI
oauth2clientoauth2client is a deprecated OAuth 2.0 client…
permissive · top 1,000 on PyPI
Flask-OAuthlibFlask-OAuthlib adds OAuth 1.0a and OAuth 2.0…
permissive · top 15,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
oauth2Implements OAuth 1.0 authentication for Python…
permissive · top 15,000 on PyPI