OMOP CDM v5.4 SQLAlchemy Declarative Mapping Models
Project description
sqlalchemy-omopcdm
About
This package contains Declarative Mapping-based SQLAlchemy 2 models for each table in the OMOP CDM, including primary keys, indexes, and constraints. These models can be used to work with OMOP CDM databases - including the ability to initialize and query them.
The models in this repo are automatically created using the sqlacodegen-based sqlalchemy_omopcdm_modelgen container image.
Important Note: In order to use Declarative Mapping, each table needs at least one column with primary key behavior, to achieve this we have added 11 unofficial & unsupported composite primary keys on the following tables: cdm_source
, cohort_definition
, cohort
, concept_ancestor
, concept_relationship
, concept_synonym
, death
, drug_strength
, episode_event
, fact_relationship
, source_to_concept_map
Naming
Python naming can be complicated [^1][^2]. To make it clear for this repo, the distribution name is sqlalchemy-omopcdm
(with a dash) and the package name is sqlalchemy_omopcdm
(with an underscore).
When you install the package, use:
pip install sqlalchemy-omopcdm
When you access the package in code, use:
from sqlalchemy_omopcdm import CareSite
Model Generation
You can recreate the output file with the following command:
docker compose run --rm modelgen
This single command will bring up the database, load the DDL into it, build the modelgen container, and run it against the database. The result is written to the output dir.
[^1]: Python Packaging User Guide: Package name normalization [^2]: stackoverflow: Using hyphen/dash in python repository name and package name
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
File details
Details for the file sqlalchemy-omopcdm-0.1.0.tar.gz
.
File metadata
- Download URL: sqlalchemy-omopcdm-0.1.0.tar.gz
- Upload date:
- Size: 34.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a34947c5d67ae37a282b2c5635ac4ab3aba6017c49ea1d7c08850dac1dbba8d |
|
MD5 | e53a9aca1e9f6883b623281286d48787 |
|
BLAKE2b-256 | 07975147efdab3376c6469b7537d8b828aa139dbb7a73693d0056e3e036cc0c7 |
File details
Details for the file sqlalchemy_omopcdm-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: sqlalchemy_omopcdm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04f258f6e044cceef28c1926215dc1f94463e91b23ab3af20903993e02adbf88 |
|
MD5 | e20d0b21d4c52ef81cd1f58b517d870c |
|
BLAKE2b-256 | 42de17dcd55771e20b85a2ebe0e95349ee402b6f54fd8c37882e8c6ac671745f |