fhir.resources
FHIR Resources as Model Class
What it is and what it does
fhir.resources is a Python library that wraps the FHIR (Fast Healthcare Interoperability Resources) specification as pydantic V2 model classes. It provides type-safe, validated Python objects for all FHIR resource types—Patient, Organization, Observation, and many others—across multiple FHIR versions (R5 by default, with R4B and STU3 available as sub-packages). You use it to construct healthcare data structures in Python, validate them against FHIR rules, and serialize them to JSON or other formats.
The package is built on pydantic V2 for performance and includes automatic validation, ORM compatibility, and support for FHIR's extensibility model. It's designed for developers building FHIR-based APIs, integrating with healthcare systems, or working with FHIR data programmatically. The library handles the complexity of the FHIR specification so you can focus on your application logic rather than manually building and validating resource objects.
Use it for:
- Build a FHIR-compliant REST API that accepts and returns Patient, Observation, or other resource types with automatic validation.
- Parse and validate FHIR JSON from external healthcare systems to ensure data integrity before processing.
- Construct FHIR resources programmatically in Python and export them as JSON for integration with EHR systems.
- Migrate or transform healthcare data between different FHIR versions (R5, R4B, STU3) using version-specific sub-packages.
- Develop healthcare data pipelines that need type-safe, validated FHIR objects with ORM support for database storage.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python classes and validation for all FHIR resource types (R5, R4B, STU3), enabling you to construct, validate, and serialize healthcare data structures according to the FHIR specification.
Yes. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and solves a concrete problem—FHIR resource modeling and validation—with low install friction. It's well-positioned for production use in healthcare applications. Install it if you're building or integrating with FHIR-based systems.
Install
fhir-resources on PyPI
pip
pip install fhir-resourcesuv
uv add fhir-resourcespoetry
poetry add fhir-resourcesInstalling fhir.resources
Before you install
Low friction: pure-Python wheel with a single runtime dependency (fhir-core). Active maintenance—last release 42 days ago, repository not archived, 534 stars.
License in practice
BSD license (permissive): you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install fhir.resources
from fhir.resources.patient import Patient
json_obj = {"resourceType": "Patient", "id": "p001", "active": True, "name": [{"text": "Adam Smith"}], "birthDate": "1985-06-12"}
pat = Patient.model_validate(json_obj)
print(pat.get_resource_type())
Verify before relying
- Whether fhir-core is a lightweight dependency or introduces significant transitive requirements
- Performance characteristics of pydantic V2 validation for large batches of FHIR resources
- Completeness and stability of experimental XML/YAML serialization support
Package facts
| License | BSD license (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — fhir-core |
| Maintenance | actively maintained — 42 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,582,390/month — #2,986 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fhir_resources-8.3.0-py2.py3-none-any.whl
Keywords: fhir, resources, python, hl7, health IT, healthcare
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
fhir-coreProvides Pydantic V2-based abstract base…
permissive · top 5,000 on PyPI
fhirclientA Python client library for connecting to FHIR…
permissive · top 15,000 on PyPI
fhirpyAsync/sync FHIR client for Python that provides…
unclear · top 5,000 on PyPI
carelyticsCarelytics provides healthcare data cleaning,…
permissive · top 15,000 on PyPI
hl7apyHL7apy parses, creates, and validates HL7 v2.x…
permissive · top 15,000 on PyPI
hl7Parses HL7 version 2.x medical messages into…
permissive · top 15,000 on PyPI
emrvalidatorEMRValidator is a data validation library…
permissive · top 15,000 on PyPI
openmedExtracts medical entities and personally…
permissive · top 5,000 on PyPI
stac-pydanticProvides Pydantic models for validating and…
permissive · top 15,000 on PyPI
scim2-modelsProvides Pydantic models for SCIM2 (System for…
permissive · top 15,000 on PyPI