We download some test data for the 32 tables from the address below and populate the Concept registry.
!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
!unzip -n mimic-iv-demo-data-in-the-omop-common-data-model-0.9.zip
Create a test instance:
!lamin init --storage ./test-omop --name test-omop --schema omop
Import omop
:
import lamindb as ln
import omop as op
import pandas as pd
Load the data into a Pandas DataFrame:
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:
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.
op.Concept.validate(["Stroke Volume Variation", "this concept does not exist"], field=op.Concept.concept_name)