fhir-core
FHIR Core library
What it is and what it does
fhir-core is a Pydantic V2-based toolkit for constructing FHIR resource models in Python. It provides FHIRAbstractModel as a base class for any FHIR resource, along with a library of FHIR primitive datatypes (IdType, BooleanType, StringType, etc.) and factories to construct complex datatypes. The package handles validation, serialization to and from JSON, XML, and YAML, and supports FHIR-specific features like the _summary filter for selective serialization.
The library was originally developed to support fhir.resources but is designed for standalone use. It integrates tightly with Pydantic's field validation and model configuration, allowing developers to define FHIR-compliant resource classes declaratively. Recent releases have focused on fixing precision issues with Decimal types, XML serialization edge cases, and multi-version FHIR support within a single process.
Use it for:
- Define custom FHIR resource classes (e.g., Organization, Patient, Encounter) with validated fields and type safety.
- Serialize FHIR models to JSON or XML for interoperability with healthcare systems and EHR platforms.
- Validate incoming FHIR data against schema constraints and FHIR-specific rules before processing.
- Build healthcare data pipelines that parse and transform FHIR resources across multiple formats.
- Integrate FHIR support into Python-based health IT applications without writing low-level validation logic.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Pydantic V2-based abstract base classes and primitive datatypes for building FHIR (Fast Healthcare Interoperability Resources) resource models, with support for JSON, XML, and YAML serialization.
Yes. Active maintenance, no security vulnerabilities, low install friction, and permissive licensing make it a solid foundation for FHIR work in Python. Install if you are building healthcare applications that need FHIR resource modeling and serialization; skip if you only need to parse pre-built FHIR libraries without defining custom models.
Install
fhir-core on PyPI
pip
pip install fhir-coreuv
uv add fhir-corepoetry
poetry add fhir-coreInstalling fhir-core
Before you install
Low friction: pure Python wheel with only pydantic as a runtime dependency. Actively maintained with a release 20 days ago and no known vulnerabilities. Supports Python 3.8 through 3.14.
License in practice
BSD license (permissive) allows use in commercial and private projects with minimal restrictions; attribution required but no copyleft obligations.
Quickstart
pip install fhir-core
from pydantic import Field
from fhir_core.fhirabstractmodel import FHIRAbstractModel
from fhir_core.types import IdType, StringType
class Organization(FHIRAbstractModel):
__resource_type__ = "Organization"
id: IdType = Field(None, alias="id", json_schema_extra={"element_property": True})
name: StringType = Field(None, alias="name", json_schema_extra={"element_property": True})
org = Organization.model_validate({"id": "org-1", "name": "Acme Corp"})
org_json = org.model_dump_json()
Verify before relying
- Whether XML/YAML serialization requires additional system dependencies beyond Python and pydantic.
- Performance characteristics when handling large FHIR resource hierarchies or batch operations.
- Compatibility guarantees with specific FHIR specification versions (R4, R5, etc.).
Package facts
| License | BSD license (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pydantic |
| Maintenance | actively maintained — 20 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,991,286/month — #3,378 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fhir_core-1.1.10-py2.py3-none-any.whl
Keywords: fhir, core, 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.resourcesProvides Python classes and validation for all…
permissive · top 5,000 on PyPI
fhirclientA Python client library for connecting to FHIR…
permissive · top 15,000 on PyPI
hl7apyHL7apy parses, creates, and validates HL7 v2.x…
permissive · top 15,000 on PyPI
fhirpyAsync/sync FHIR client for Python that provides…
unclear · top 5,000 on PyPI
hl7Parses HL7 version 2.x medical messages into…
permissive · top 15,000 on PyPI
carelyticsCarelytics provides healthcare data cleaning,…
permissive · top 15,000 on PyPI
xsdata-pydanticGenerates pydantic models from XML and JSON…
permissive · top 15,000 on PyPI
jsonschema-pydanticConverts JSON Schema definitions into Pydantic…
unclear · top 15,000 on PyPI
dydanticDynamically generates Pydantic models from JSON…
permissive · top 5,000 on PyPI
databind.coreDeserializes and serializes Python dataclasses…
permissive · top 15,000 on PyPI