Pure-Python openEHR AM toolkit (ADL2/AOM2/ODIN/BMM/OPT2).
Project description
pyopenehr-am
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 registrydocs/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
Acknowledgements
- openEHR specifications and community resources (see
openehr_am_resources.md)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyopenehr_am-0.0.2.tar.gz.
File metadata
- Download URL: pyopenehr_am-0.0.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6db33ae0bd07ce44540cbcf47a3351bd09c351cfcc7bd91469e4c2205a8ff45
|
|
| MD5 |
14fd4795da1436879c5786ef059570b1
|
|
| BLAKE2b-256 |
461de4c98524b82a151ba9aa3ca92bee8f4149d078c7c706684ee3a7078acd46
|
Provenance
The following attestation bundles were made for pyopenehr_am-0.0.2.tar.gz:
Publisher:
release-package-check.yml on rubentalstra/pyopenehr-am
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyopenehr_am-0.0.2.tar.gz -
Subject digest:
d6db33ae0bd07ce44540cbcf47a3351bd09c351cfcc7bd91469e4c2205a8ff45 - Sigstore transparency entry: 771666682
- Sigstore integration time:
-
Permalink:
rubentalstra/pyopenehr-am@bbf9cb11d5b7175d5376896429ce798dbb948e2f -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/rubentalstra
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-package-check.yml@bbf9cb11d5b7175d5376896429ce798dbb948e2f -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyopenehr_am-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pyopenehr_am-0.0.2-py3-none-any.whl
- Upload date:
- Size: 153.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15dd17af4bae2e3f877fdbf7e11c3fdc75291c23fb3207a8b9781516323356fe
|
|
| MD5 |
dab178acdadda20930904bc82fa1baa9
|
|
| BLAKE2b-256 |
5b2b52405a1d44fd389f249444c1045204709a6d5ec6f024907555632200a109
|
Provenance
The following attestation bundles were made for pyopenehr_am-0.0.2-py3-none-any.whl:
Publisher:
release-package-check.yml on rubentalstra/pyopenehr-am
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyopenehr_am-0.0.2-py3-none-any.whl -
Subject digest:
15dd17af4bae2e3f877fdbf7e11c3fdc75291c23fb3207a8b9781516323356fe - Sigstore transparency entry: 771666684
- Sigstore integration time:
-
Permalink:
rubentalstra/pyopenehr-am@bbf9cb11d5b7175d5376896429ce798dbb948e2f -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/rubentalstra
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-package-check.yml@bbf9cb11d5b7175d5376896429ce798dbb948e2f -
Trigger Event:
release
-
Statement type: