#!/usr/bin/env python # coding: utf-8 # # Quickstart # We download some test data for the 32 tables from the address below and populate the Concept registry. # In[ ]: get_ipython().system('wget -nc https://physionet.org/static/published-projects/mimic-iv-demo-omop/mimic-iv-demo-data-in-the-omop-common-data-model-0.9.zip') get_ipython().system('unzip -n mimic-iv-demo-data-in-the-omop-common-data-model-0.9.zip') # Create a test instance: # In[ ]: get_ipython().system('lamin init --storage ./test-omop --name test-omop --schema omop') # Import `omop`: # In[ ]: import lamindb as ln import omop as op import pandas as pd # Load the data into a Pandas DataFrame: # In[ ]: df = pd.read_csv("./mimic-iv-demo-data-in-the-omop-common-data-model-0.9/1_omop_data_csv/2b_concept.csv") df.columns = df.columns.str.lower() df.rename(columns={"concept_class_id": "concept_class"}, inplace=True) df.head() # Populate the Concept registry: # In[ ]: concepts = [op.Concept(**row.to_dict()) for _, row in df.iterrows()] for concept in concepts: concept.save() op.Concept.df() # Perform validation of new data. # In[ ]: op.Concept.validate(["Stroke Volume Variation", "this concept does not exist"], field=op.Concept.concept_name)