oehrpy

Python openEHR SDK

Build modern healthcare applications with the power of openEHR

Get Started View on GitHub

Why oehrpy?

🐍

Pythonic API

Intuitive, idiomatic Python interfaces that feel natural to work with. Type hints, async support, and modern Python best practices throughout.

🏥

openEHR Native

Full support for openEHR archetypes, templates (OPT), and compositions. Auto-generate type-safe builders from OPT files.

High Performance

Optimized for speed with minimal overhead. Built to handle real-world healthcare workloads efficiently.

🔒

Type Safe

Comprehensive type hints and runtime validation ensure your healthcare data remains consistent and reliable.

📄

OPT Parser

Parse OPT 1.4 XML files and auto-generate type-safe Python builder classes. No manual FLAT path construction needed.

Validators

Validate FLAT compositions against Web Templates and OPT files against the RM specification. Catch errors before they hit your CDR, with "did you mean?" suggestions and actionable fix recommendations.

Quick Start

# Install oehrpy
pip install oehrpy

# Generate a builder from your OPT template
from openehr_sdk.templates import generate_builder_from_opt

code = generate_builder_from_opt("vital_signs.opt")

# Use the type-safe builder
from openehr_sdk.templates import VitalSignsBuilder

builder = VitalSignsBuilder(composer_name="Dr. Smith")
builder.add_blood_pressure(systolic=120, diastolic=80)
builder.add_pulse(rate=72)

# Get FLAT format ready for EHRBase
flat_data = builder.build()