Metadata-Version: 1.1
Name: dmsa
Version: 0.3
Summary: SQLAlchemy models and DDL and ERD generation from chop-dbhi/data-models style JSON endpoints.
Home-page: https://github.com/chop-dbhi/data-models-sqlalchemy
Author: The Children's Hospital of Philadelphia
Author-email: cbmisupport@email.chop.edu
License: Copyright (c) 2011-2013 The Children's Hospital of Philadelphia
and individual contributors.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Download-URL: https://github.com/chop-dbhi/data-models-sqlalchemy/tarball/v0.3
Description: # Data Models SQLAlchemy
        
        SQLAlchemy models and DDL and ERD generation for chop-dbhi/data-models style JSON endpoints.
        
        ## SQLAlchemy Models
        
        In your shell, hopefully within a virtualenv:
        
        ```sh
        pip install dmsa
        ```
        
        In python:
        
        ```python
        from dmsa.omop.v5.models import Base
        
        for tbl in Base.metadata.sorted_tables():
            print tbl.name
        ```
        
        Or:
        
        ```python
        from dmsa.pedsnet.v2.models import Person, VisitPayer
        
        print VisitPayer.columns
        ```
        
        These models are dynamically generated at runtime from JSON endpoints provided by chop-dbhi/data-models-service, which reads data stored in chop-dbhi/data-models. It should be simple to add modules for any additional data models that become available, but the currently provided ones are:
        
        - **OMOP V4** at `omop.v4.models`
        - **OMOP V5** at `omop.v5.models`
        - **PEDSnet V1** at `pedsnet.v1.models`
        - **PEDSnet V2** at `pedsnet.v2.models`
        - **i2b2 V1.7** at `i2b2.v1_7.models`
        - **i2b2 PEDSnet V2** at `i2b2.pedsnet.v2.models`
        - **PCORnet V1** at `pcornet.v1.models`
        - **PCORnet V2** at `pcornet.v2.models`
        - **PCORnet V3** at `pcornet.v3.models`
        
        ## DDL and ERD Generation
        
        Use of the included Dockerfile is highly recommended to avoid installing DBMS and graphing specific system requirements.
        
        The following DBMS dialects are supported when generating DDL:
        
        - **PostgreSQL** called as `postgresql`
        - **MySQL** called as `mysql`
        - **MS SQL Server** called as `mssql`
        - **Oracle** called as `oracle`
        
        ### With Docker:
        
        Retrieve the image:
        
        ```sh
        docker pull dbhi/data-models-sqlalchemy
        ```
        
        Usage for DDL generation:
        
        ```sh
        docker run --rm dbhi/data-models-sqlalchemy ddl -h
        ```
        
        Generate OMOP V5 DDL for Oracle:
        
        ```sh
        docker run --rm dbhi/data-models-sqlalchemy ddl omop v5 oracle
        ```
        
        Usage for ERD generation:
        
        ```sh
        docker run --rm dbhi/data-models-sqlalchemy erd -h
        ```
        
        Generate i2b2 PEDSnet V2 ERD (the image will land at `./erd/i2b2_pedsnet_v2_erd.png`):
        
        ```sh
        docker run --rm -v $(pwd)/erd:/erd dbhi/data-models-sqlalchemy erd i2b2_pedsnet v2 /erd/i2b2_pedsnet_v2_erd.png
        ```
        
        The `graphviz` graphing package supports a number of other output formats, listed here (link pending), which are interpreted from the passed extension.
        
        ### Without Docker:
        
        Install the system requirements (see Dockerfile for details):
        
        - **Python 2.7**
        - `graphviz` for ERD generation
        - Oracle `instantclient-basic` and `-sdk` and `libaio1` for Oracle DDL generation
        - `libpq-dev` for PostgreSQL DDL generation
        - `unixodbc-dev` for MS SQL Server DDL generation
        
        Install the python requirements, hopefully within a virtualenv (see Dockerfile for details):
        
        ```sh
        pip install cx-Oracle            # for Oracle DDL generation
        pip install psycopg2             # for PostgreSQL DDL generation
        pip install PyMySQL              # for MySQL DDL generation
        pip install pyodbc               # for MS SQL Server DDL generation
        ```
        
        Install the data-models-sqlalchemy python package:
        
        ```sh
        pip install dmsa
        ```
        
        Usage for DDL generation:
        
        ```sh
        dmsa ddl -h
        ```
        
        Generate OMOP V5 DDL for Oracle:
        
        ```sh
        dmsa ddl omop v5 oracle
        ```
        
        Usage for ERD generation:
        
        ```sh
        dmsa erd -h
        ```
        
        Generate i2b2 PEDSnet V2 ERD (the image will land at `./erd/i2b2_pedsnet_v2_erd.png`):
        
        ```sh
        mkdir erd
        dmsa erd i2b2_pedsnet v2 ./erd/i2b2_pedsnet_v2_erd.png
        ```
        
        ## Web Service
        
        The web service uses a simple Flask debug server for now. It exposes the following endpoints:
        
        - DDL at `/<model>/<version>/ddl/<dialect>/`
        - DDL for only `table`, `constraint`, or `index` elements at `/<model>/<version>/ddl/<dialect>/<elements>`
        - ERDs at `/<model>/<version>/erd/`
        
        ### With Docker:
        
        Usage:
        
        ```sh
        docker run  dbhi/data-models-sqlalchemy start -h
        ```
        
        Run:
        
        ```sh
        docker run dbhi/data-models-sqlalchemy  # Uses Dockerfile defaults of 0.0.0.0:80
        ```
        
        ### Without Docker:
        
        Install Flask:
        
        ```sh
        pip install Flask
        ```
        
        Usage:
        
        ```sh
        dmsa start -h
        ```
        
        Run:
        
        ```sh
        dmsa start                              # Uses Flask defaults of 127.0.0.1:5000
        ```
        
Keywords: healthcare,data models,SQLAlchemy,DDL,ERD
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Healthcare Industry
Classifier: License :: Other/Proprietary License
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Code Generators
Classifier: Natural Language :: English
