edencehealth / sqlalchemy_omopcdm_modelgen

code generator that powers sqlalchemy_omopcdm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sqlalchemy_omopcdm_modelgen

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:
  • formats the resulting python module with the PSF tools black and isort

About

code generator that powers sqlalchemy_omopcdm

License:GNU Lesser General Public License v2.1


Languages

Language:Python 97.8%Language:Dockerfile 2.2%