Skip to main content

Pure-Python openEHR AM toolkit (ADL2/AOM2/ODIN/BMM/OPT2).

Project description

pyopenehr-am

CI PyPI Python License: MIT Ruff Pyright

Pure-Python (Python 3.14+ only) openEHR ADL2 / AOM2 / ODIN / BMM / OPT2 toolkit. Parse and validate archetypes/templates, and compile templates to OPT2.

This project is intended as a developer SDK: teams can embed it in their own codebases to build migration pipelines from legacy formats into openEHR, while relying on this library for standards-based artefact handling (archetypes/templates) and validation.


Why this exists

When building migration tooling, you usually want openEHR artefact handling to be: predictable, standards-driven, and easy to embed. This repo focuses on that core plumbing (parsing, semantic model building, validation, and OPT compilation).

What it provides

Core capabilities:

  • Parse ADL2 archetypes and templates
  • Parse ODIN (embedded sections and BMM persistence)
  • Build an in-memory AOM2 semantic model
  • Validate syntax + semantics, and (optionally) RM conformance via BMM
  • Compile templates to OPT2 (Operational Template)

Internal architecture: Parse → Build AOM → Validate → Compile OPT → (Optional) Validate Instances


Non-goals

  • Not a “one-click database migrator”
  • Not mapping logic for any specific vendor/hospital schema
  • Not a wrapper around existing non-Python reference implementations (this repo is pure Python only)

Project status

Alpha / under active development. Expect breaking changes until the first stable release.

If you need something to be stable long-term, pin versions and treat the public API as the contract.

Documentation entry points:

Planned milestones and tasks live in:


Install

pip install pyopenehr-am

Verify the CLI:

openehr-am --help

For local development:

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest
ruff check .

Quickstart

The quickest way to see behavior is via the CLI. The Quickstart includes:

  • openehr-am lint (syntax parsing, JSON Issue output)
  • openehr-am validate (semantic + optional RM checks)
  • openehr-am compile-opt (template → OPT2 JSON)

Start here: docs/quickstart.md


Python API (minimal example)

The stable public API is exposed from the top-level package.

from openehr_am import parse_archetype, validate

archetype, parse_issues = parse_archetype(path="demo.archetype.adl")
if archetype is None:
    # parse_issues contains structured diagnostics
    raise SystemExit(1)

issues = validate(archetype, level="all")

More examples: docs/quickstart.md


Diagnostics and Issue Codes

All recoverable problems are returned as structured Issue objects, with:

  • stable code (e.g., ADL001, AOM200, BMM500, OPT700)
  • severity (INFO|WARN|ERROR)
  • best-effort file/line/col and optional path/node_id

See:

  • docs/issue-codes.md — canonical registry
  • docs/validation-rule-template.md — how to add rules

Specs and references

This repo is standards-driven. Pin the exact spec releases you implement in:

Curated links live in:


Security

This project parses untrusted artefacts and treats invalid input as data: most errors are returned as Issue objects (not exceptions).

Security policy / reporting: SECURITY.md

Engineering notes: docs/security.md


Contributing

Contributions are welcome.

Guidelines:

  • Keep diffs small and test-backed
  • Use stable Issue codes (update docs/issue-codes.md)
  • Add a short # Spec: URL comment for new validation rules
  • Do not edit generated parser code under openehr_am/_generated/

License

MIT


Acknowledgements

  • openEHR specifications and community resources (see openehr_am_resources.md)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyopenehr_am-0.0.3.tar.gz (143.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyopenehr_am-0.0.3-py3-none-any.whl (153.9 kB view details)

Uploaded Python 3

File details

Details for the file pyopenehr_am-0.0.3.tar.gz.

File metadata

  • Download URL: pyopenehr_am-0.0.3.tar.gz
  • Upload date:
  • Size: 143.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyopenehr_am-0.0.3.tar.gz
Algorithm Hash digest
SHA256 baf381b28565f79d4d159d2a2020e63450c3045a94a140fd52d8a9ac8b251153
MD5 7b519fee7b7da693f2adfed53cae7978
BLAKE2b-256 185466c9a339e27a8a24afc12221c9ad1d9ae2c55c1e3208ff670fa4aab91a71

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopenehr_am-0.0.3.tar.gz:

Publisher: release-package-check.yml on rubentalstra/pyopenehr-am

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyopenehr_am-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: pyopenehr_am-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 153.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyopenehr_am-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 db36d6cde4012c484a651cd009271576408e804926cc57dacb82bfc6164e7522
MD5 f4b7622c6b35004c641d4046232d47c8
BLAKE2b-256 474fe0d7f4cbc011e4c84e94a5202dcb33b5631ab4ee129e370829629d6f24ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyopenehr_am-0.0.3-py3-none-any.whl:

Publisher: release-package-check.yml on rubentalstra/pyopenehr-am

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page