Repo | URL |
---|---|
GitHub | https://github.com/edencehealth/sqlalchemy_omopcdm_modelgen |
Docker Hub | https://hub.docker.com/r/edence/sqlalchemy-omopcdm-modelgen |
This repo contains the source code for the tool we use to generate the model files in our edencehealth/sqlalchemy_omopcdm
repo.
The source code in this repo is a containerized Python program which:
- downloads the official OHDSI OMOP CDM DDL files
- applies the DDL files to a PostgreSQL database server
- applies edenceHealth custom DDL which adds composite primary keys to the tables that don't have a natural primary key
- uses the tool
sqlacodegen
to scan that database to generate a Declarative Mapping-based SQLAlchemy 2 model for each table in the OMOP CDM, including primary keys, indexes, and constraints - rewrites the generated model using
libcst
to:- add doc comments (from the official OMOP CDM documentation website),
- insert relevant pylint "disable" comments
- renames the generated base class
- formats the resulting python module with the PSF tools
black
andisort