Skip to main content

A Python ORM/data classes representation of the OMOP Common Data Model in different flavors powered by sqlacodegen

Project description

DZD - OMOP CDM Python ORM/Data Classes Representation

A Python ORM/data classes representation of the Observational Medical Outcomes Partnership (OMOP) Common Data Model (CDM) in different flavors powered by sqlacodegen

Author/Maintainer: Tim Bleimehl

For more background how this sausage is made have a look at the github repo at https://github.com/DZD-eV-Diabetes-Research/dzd-omop-cdm-python-models

This Readme is a "work in process". Come back later for a more complete manual.

Install

Just install the python module from pypi.org

python -m pip install --upgrade dzdomop

How to use

This tiny script demostrates how this module can help you to

  • Create a local dev database with the complete omop datamodel
  • insert some data based on our classes with some basic guardrails like type validation, typo prevention, ...
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from omopmodel import OMOP_5_3_declarative as omop

# Create a local SQLite database with all OMOP CDM tables+properties
engine = create_engine("sqlite:///cdm_source.db", echo=True)
omop.Base.metadata.create_all(engine)

# Create a some basic OMOP objects
care_site = omop.CareSite(care_site_id=5678, care_site_name="St. Local")
person = omop.Person(
    person_id=1234,
    year_of_birth=1985,
    care_site=care_site,
    gender_concept_id=1,
    race_concept_id=1,
    ethnicity_concept_id=1,
)

# Write the Object to the database
with Session(engine) as session:
    session.add(care_site)
    session.add(person)
    session.commit()

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

dzdomop-0.3.1.tar.gz (335.3 kB view details)

Uploaded Source

Built Distribution

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

dzdomop-0.3.1-py3-none-any.whl (341.7 kB view details)

Uploaded Python 3

File details

Details for the file dzdomop-0.3.1.tar.gz.

File metadata

  • Download URL: dzdomop-0.3.1.tar.gz
  • Upload date:
  • Size: 335.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for dzdomop-0.3.1.tar.gz
Algorithm Hash digest
SHA256 be5546a77b27c37227704bf13e195d6fe5cd2cace20fdbf2a5ef140524fa6b89
MD5 c0bd68d0c9a387f1bdf56dd9d9f5bf94
BLAKE2b-256 d1e51197a638746bbf8499991490b1d87bf4171008af8a4bfda1585dfd9dc05e

See more details on using hashes here.

File details

Details for the file dzdomop-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: dzdomop-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 341.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for dzdomop-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42864ad8b7c7b12a0a8af27f9f54b5a6e9925b8e1a643155ec5e7f1be5acb59c
MD5 cfc586dbf92645ee1d8063fec362e4d1
BLAKE2b-256 fae50664ff038ba74f0619eb16a0a7d8922d844e8ca9a779f974ab51aa27bf62

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