Skip to main content

SQLAlchemy-based models, validation, and utilities for the OHDSI OMOP Common Data Model

Project description

OMOP Alchemy

OMOP Alchemy provides a canonical, typed, SQLAlchemy-first representation of the OHDSI OMOP Common Data Model (CDM).

It is designed to support research-ready analytics, validation, and exploration of OMOP data using modern Python tooling, without imposing ETL conventions or execution-time side effects.


Design goals

OMOP Alchemy is intentionally:

  • Declarative
    Defines tables, columns, relationships, and constraints

  • SQLAlchemy-native
    Built for SQLAlchemy 2.x ORM usage

  • Safe to import anywhere
    No implicit engine creation, no global state, no environment assumptions.

  • Typed and inspectable
    Models are fully typed and introspectable for validation, tooling, and IDE support.

  • Backend-agnostic
    Designed to work across PostgreSQL, SQLite, and other SQLAlchemy-supported databases.


What this package does not do

OMOP Alchemy deliberately avoids:

  • Enforcing ETL conventions or data pipelines
  • Auto-creating databases or loading vocabularies
  • Imposing analytics frameworks or dashboards
  • Making assumptions about deployment environments

These concerns are intentionally left to downstream tooling.


Core features

  • SQLAlchemy ORM models for OMOP CDM tables
  • Explicit foreign key and relationship definitions
  • Read-only View classes for safe navigation and analytics
  • Domain validation helpers for OMOP concept integrity
  • CSV loading utilities for controlled ingestion and testing
  • Lightweight schema and model validation against CDM specs

Example (concept navigation)

from omop_alchemy.model.vocabulary import ConceptView

concept = session.get(ConceptView, 320128)  # Lung cancer
concept.domain.domain_id        # "Condition"
concept.vocabulary.vocabulary_id  # "SNOMED"
concept.is_standard             # True

Status

This project is currently beta.

The API is stabilising, but some modules may change as real-world use cases expand. Feedback and issues are welcome.

Some additional background

This work builds on earlier research and tooling presented at the 2023 OHDSI APAC Symposium

see background paper.

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

omop_alchemy-0.2.1.tar.gz (57.2 kB view details)

Uploaded Source

Built Distribution

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

omop_alchemy-0.2.1-py3-none-any.whl (100.0 kB view details)

Uploaded Python 3

File details

Details for the file omop_alchemy-0.2.1.tar.gz.

File metadata

  • Download URL: omop_alchemy-0.2.1.tar.gz
  • Upload date:
  • Size: 57.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for omop_alchemy-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a03a6774f0f1d01cd8d4a93afcb50416fe034b614881a1c3ff3717f0f5e11eb5
MD5 25b3acf3b4ae995644dae7d5a20ab474
BLAKE2b-256 99cb1a277f0669a3c0374a011350b69b497583d5da8c6a88215bc9e6e7c1e1ec

See more details on using hashes here.

File details

Details for the file omop_alchemy-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: omop_alchemy-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 100.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for omop_alchemy-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9dbb6c4a4a9dacf0e6a44527070c6562ec3af8d69fe3c9c3e0120b31e27e2845
MD5 85e5001cd4d6c3aaaacff7cf85e55045
BLAKE2b-256 c04bcf7681036dc652f4f842c83b50f38e0a24ec089eb725a9adae844079feba

See more details on using hashes here.

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