OMOP Alchemy provides a canonical, typed, SQLAlchemy-first representation of the OHDSI OMOP Common Data Model (CDM).
It is designed to support fluency for research-ready analytics, validation, and exploration of OMOP data using modern Python tooling, without imposing ETL conventions or execution-time side effects.
OMOP Alchemy is intentionally:
-
Declarative
Defines tables, columns, relationships, and constraints -
Typed and inspectable
Models are fully typed and introspectable for validation, tooling, and IDE support. -
Backend-agnostic
Layered abstractions for adding in new supported backend behaviours.
- SQLAlchemy ORM models for OMOP CDM tables
- Explicit foreign key and relationship definitions
- Lightweight mapper versions to provide simple model validation against CDM for use in ETL loops without side-effects or performance hit that can come from relationship instantiation within the runtime
- Read-only View classes for safe navigation and analytics that include complex multi-table objects such as conditions with their modifiers, episodes with their events
- Domain validation helpers for OMOP concept integrity
from omop_alchemy.cdm.model.vocabulary.concept import ConceptView
concept = session.get(ConceptView, 320128) # Lung cancer
concept.domain.domain_id # "Condition"
concept.vocabulary.vocabulary_id # "SNOMED"
concept.is_standard # TrueThe core API under cdm/ should be considered stable as of the 1.x release.
The toolkit API is experimental and carries no compatibility guarantees. Feedback and issues are welcome.
This work builds on earlier research and tooling presented at the 2023 OHDSI APAC Symposium
see background paper.
OMOP Alchemy reads all database connection and schema settings from oa-configurator. No .env files or ENGINE environment variables are needed.
Run once after installation:
omop-config init
omop-config configure omop_alchemySee Configuration for full details.