Docs: Getting Started

Getting Started with oehrpy

oehrpy is a Python SDK for openEHR, the open standard for vendor-neutral electronic health records. It gives you type-safe Reference Model classes, template-based composition builders, canonical JSON and FLAT serialization, an async EHRBase client and an AQL query builder. New to openEHR? The openEHR workflow overview explains how templates, compositions and CDRs fit together.

Installation

Install oehrpy using pip:

pip install oehrpy

Or install from source for development:

git clone https://github.com/platzhersh/oehrpy.git
cd oehrpy
pip install -e ".[dev]"

Requirements: Python 3.10 or higher is required.

Quick Start

Here's a quick example to get you started with oehrpy:

from oehrpy.rm import DV_TEXT, DV_QUANTITY, CODE_PHRASE, TERMINOLOGY_ID

# Create a simple text value
text = DV_TEXT(value="Patient temperature recorded")

# Create a quantity with units
temperature = DV_QUANTITY(
    magnitude=37.2,
    units="°C",
    property=CODE_PHRASE(
        terminology_id=TERMINOLOGY_ID(value="openehr"),
        code_string="127"
    )
)

print(f"Temperature: {temperature.magnitude} {temperature.units}")

Overview

oehrpy is a comprehensive Python SDK for openEHR that provides:

Guides