skillfed

fhir-core

FHIR Core library

fhir-core v1.1.10 2.0M downloads/30d#3,378 on PyPI20
Permissive license BSD license Active released

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-core

uv

uv add fhir-core

poetry

poetry add fhir-core

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersIntended Audience :: EducationIntended Audience :: Healthcare IndustryIntended Audience :: Information TechnologyIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Typing :: Typed

Tags

fhir resource model builderhealthcare data validation pydanticfhir xml json serializationhl7 fhir python libraryfhir primitive datatypesfhir abstract model base classhealthcare interoperability resources
healthcare-itfhir-hl7data-validation

More Application Frameworks packages