diff --git a/.gitignore b/.gitignore index 7401e94..3b5a44d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.vscode /venv*/ /.venv*/ *.egg-info* diff --git a/tests/data/example_redcap_demo.redcap.csv b/data/example_redcap_demo.redcap.csv similarity index 100% rename from tests/data/example_redcap_demo.redcap.csv rename to data/example_redcap_demo.redcap.csv diff --git a/tests/data/test_frictionless_schema.yaml b/data/test_frictionless_schema.yaml similarity index 100% rename from tests/data/test_frictionless_schema.yaml rename to data/test_frictionless_schema.yaml diff --git a/tests/data/valid/errors/heal-csv-errors.json b/data/valid/errors/heal-csv-errors.json similarity index 100% rename from tests/data/valid/errors/heal-csv-errors.json rename to data/valid/errors/heal-csv-errors.json diff --git a/tests/data/valid/errors/heal-json-errors.json b/data/valid/errors/heal-json-errors.json similarity index 100% rename from tests/data/valid/errors/heal-json-errors.json rename to data/valid/errors/heal-json-errors.json diff --git a/tests/data/valid/input/redcap_dd_export.redcap.csv b/data/valid/input/redcap_dd_export.redcap.csv similarity index 100% rename from tests/data/valid/input/redcap_dd_export.redcap.csv rename to data/valid/input/redcap_dd_export.redcap.csv diff --git a/tests/data/valid/input/sas-nmhss-2019/data.csv b/data/valid/input/sas-nmhss-2019/data.csv similarity index 100% rename from tests/data/valid/input/sas-nmhss-2019/data.csv rename to data/valid/input/sas-nmhss-2019/data.csv diff --git a/tests/data/valid/input/sas-nmhss-2019/data.sas7bdat b/data/valid/input/sas-nmhss-2019/data.sas7bdat similarity index 100% rename from tests/data/valid/input/sas-nmhss-2019/data.sas7bdat rename to data/valid/input/sas-nmhss-2019/data.sas7bdat diff --git a/tests/data/valid/input/sas-nmhss-2019/formats.sas7bcat b/data/valid/input/sas-nmhss-2019/formats.sas7bcat similarity index 100% rename from tests/data/valid/input/sas-nmhss-2019/formats.sas7bcat rename to data/valid/input/sas-nmhss-2019/formats.sas7bcat diff --git a/tests/data/valid/input/spss_sav_dataset1.sav b/data/valid/input/spss_sav_dataset1.sav similarity index 100% rename from tests/data/valid/input/spss_sav_dataset1.sav rename to data/valid/input/spss_sav_dataset1.sav diff --git a/tests/data/valid/input/stata_dta_dataset1.dta b/data/valid/input/stata_dta_dataset1.dta similarity index 100% rename from tests/data/valid/input/stata_dta_dataset1.dta rename to data/valid/input/stata_dta_dataset1.dta diff --git a/data/valid/output/heal_dd_from_redcap_dd_export.csv b/data/valid/output/heal_dd_from_redcap_dd_export.csv new file mode 100644 index 0000000..234d86d --- /dev/null +++ b/data/valid/output/heal_dd_from_redcap_dd_export.csv @@ -0,0 +1,146 @@ +module,name,title,description,type,format,constraints.maxLength,constraints.enum,constraints.pattern,constraints.maximum,constraints.minimum,encodings,ordered,missingValues,trueValues,falseValues,repo_link,standardsMappings.type,standardsMappings.label,standardsMappings.url,standardsMappings.source,standardsMappings.id,relatedConcepts.type,relatedConcepts.label,relatedConcepts.url,relatedConcepts.source,relatedConcepts.id,univarStats.median,univarStats.mean,univarStats.std,univarStats.min,univarStats.max,univarStats.mode,univarStats.count,univarStats.twentyFifthPercentile,univarStats.seventyFifthPercentile,univarStats.categoricalMarginals.name,univarStats.categoricalMarginals.count +demographics,study_id,Study ID,Study ID,string,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,date_enrolled,Date subject signed consent,Demographic Characteristics: Date subject signed consent,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,first_name,First Name,Demographic Characteristics: First Name,string,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,last_name,Last Name,Demographic Characteristics: Last Name,string,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,address,"Street, City, State, ZIP","Contact Information: Street, City, State, ZIP",string,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,telephone_1,Phone number,Contact Information: Phone number,string,,,,^[0-9]{3}-[0-9]{3}-[0-9]{4}$,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,telephone_2,Second phone number,Contact Information: Second phone number,string,,,,^[0-9]{3}-[0-9]{3}-[0-9]{4}$,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,email,E-mail,Contact Information: E-mail,string,email,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,sex,Gender,Contact Information: Gender,integer,,,0|1,,,,0=Female|1=Male,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,given_birth,Has the subject given birth before?,Contact Information: Has the subject given birth before?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,num_children,How many times has the subject given birth?,Contact Information: How many times has the subject given birth?,integer,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,ethnicity,Ethnicity,Contact Information: Ethnicity,integer,,,0|1|2,,,,0=Hispanic or Latino|1=NOT Hispanic or Latino|2=Unknown / Not Reported,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,race___0,Race:American Indian/Alaska NativeRace,Contact Information: Race[choice=American Indian/Alaska Native],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,race___1,Race:AsianRace,Contact Information: Race[choice=Asian],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,race___2,Race:Native Hawaiian or Other Pacific IslanderRace,Contact Information: Race[choice=Native Hawaiian or Other Pacific Islander],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,race___3,Race:Black or African AmericanRace,Contact Information: Race[choice=Black or African American],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,race___4,Race:WhiteRace,Contact Information: Race[choice=White],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,race___5,Race:More Than One RaceRace,Contact Information: Race[choice=More Than One Race],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,race___6,Race:Unknown / Not ReportedRace,Contact Information: Race[choice=Unknown / Not Reported],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,dob,Date of birth,Contact Information: Date of birth,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,age,Age (years),"Contact Information: Age (years)[calculation: round(datediff([dob],'today','y'),0)]",number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,height,Height (cm),Contact Information: Height (cm),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,weight,Weight (kilograms),Contact Information: Weight (kilograms),integer,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,bmi,BMI,"Contact Information: BMI[calculation: round(([weight]*10000)/(([height])^(2)),1)]",number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,patient_document,Patient document,Contact Information: Patient document,string,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,comorbidities,Any comorbid condition,Contact Information: Any comorbid condition,string,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,diabetes,Patient has a diagnosis of diabetes mellitus?,Contact Information: Patient has a diagnosis of diabetes mellitus?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,diabetes_type,Type of Diabetes Mellitus,Contact Information: Type of Diabetes Mellitus,integer,,,0|1|2,,,,0=Type 1 insulin-dependent|1=Type 2 insulin-dependent|2=Type 2 non insulin-dependent,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,gym___0,Gym:MondayGym (Weight Training),Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Monday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,gym___1,Gym:TuesdayGym (Weight Training),Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Tuesday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,gym___2,Gym:WednesdayGym (Weight Training),Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Wednesday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,gym___3,Gym:ThursdayGym (Weight Training),Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Thursday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,gym___4,Gym:FridayGym (Weight Training),Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Friday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,aerobics___0,Aerobics:MondayAerobics,Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Monday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,aerobics___1,Aerobics:TuesdayAerobics,Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Tuesday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,aerobics___2,Aerobics:WednesdayAerobics,Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Wednesday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,aerobics___3,Aerobics:ThursdayAerobics,Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Thursday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,aerobics___4,Aerobics:FridayAerobics,Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Friday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,eat___0,Eat:MondayEat Out (Dinner/Lunch),Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Monday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,eat___1,Eat:TuesdayEat Out (Dinner/Lunch),Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Tuesday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,eat___2,Eat:WednesdayEat Out (Dinner/Lunch),Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Wednesday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,eat___3,Eat:ThursdayEat Out (Dinner/Lunch),Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Thursday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,eat___4,Eat:FridayEat Out (Dinner/Lunch),Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Friday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,drink___0,Drink:MondayDrink (Alcoholic Beverages),Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Monday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,drink___1,Drink:TuesdayDrink (Alcoholic Beverages),Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Tuesday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,drink___2,Drink:WednesdayDrink (Alcoholic Beverages),Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Wednesday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,drink___3,Drink:ThursdayDrink (Alcoholic Beverages),Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Thursday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,drink___4,Drink:FridayDrink (Alcoholic Beverages),Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Friday],boolean,,,0|1,,,,0=Unchecked|1=Checked,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,dialysis_initiation,Date of first outpatient dialysis treatment,Dialysis Information: Date of first outpatient dialysis treatment,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,access_type,Type of vascular access,Dialysis Information: Type of vascular access,integer,,,0|1|2|3,,,,0=Graft|1=Fistula|2=Catheter with maturing graft|3=Catheter with maturing fistula,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,access_location,Location of currently used vascular access,Dialysis Information: Location of currently used vascular access,integer,,,0|1|2|3|4,,,,0=Forearm|1=Upper arm|2=Internal jugular vein|3=Subclavian vein|4=Other,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,dialysis_unit_name,Name of dialysis unit,Dialysis Information: Name of dialysis unit,string,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,dialysis_unit_phone,Phone number,Dialysis Information: Phone number,string,,,,^[0-9]{3}-[0-9]{3}-[0-9]{4}$,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,dialysis_schedule_days,Days of the week patient is dialyzed,Dialysis Information: Days of the week patient is dialyzed,integer,,,0|1|2,,,,0=Monday-Wednesday-Friday|1=Tuesday-Thursday-Saturday|2=Other,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,dialysis_schedule_time,Shift patient is dialyzed,Dialysis Information: Shift patient is dialyzed,integer,,,0|1|2|3,,,,0=First shift|1=Second shift|2=Third shift|3=Fourth shift,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,etiology_esrd,Etiology of ESRD,Dialysis Information: Etiology of ESRD,integer,,,0|1|2|3|4|5|6,,,,0=Diabetes|1=Hypertension|2=Glomerulonephritis|3=Polycystic Kidney Disease|4=Interstitial Nephritis|5=Hereditary Nephritis|6=Other,,,,,,,,,,,,,,,,,,,,,,,,,, +demographics,subject_comments,Comments,General Comments: Comments,string,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,date_visit_b,Date of baseline visit,Baseline Measurements: Date of baseline visit,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,date_blood_b,Date blood was drawn,Baseline Measurements: Date blood was drawn,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,alb_b,Serum Albumin (g/dL),Baseline Measurements: Serum Albumin (g/dL),integer,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,prealb_b,Serum Prealbumin (mg/dL),Baseline Measurements: Serum Prealbumin (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,creat_b,Creatinine (mg/dL),Baseline Measurements: Creatinine (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,npcr_b,Normalized Protein Catabolic Rate (g/kg/d),Baseline Measurements: Normalized Protein Catabolic Rate (g/kg/d),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,chol_b,Cholesterol (mg/dL),Baseline Measurements: Cholesterol (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,transferrin_b,Transferrin (mg/dL),Baseline Measurements: Transferrin (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,kt_v_b,Kt/V,Baseline Measurements: Kt/V,number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,drywt_b,Dry weight (kilograms),Baseline Measurements: Dry weight (kilograms),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,plasma1_b,Collected Plasma 1?,Baseline Measurements: Collected Plasma 1?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,plasma2_b,Collected Plasma 2?,Baseline Measurements: Collected Plasma 2?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,plasma3_b,Collected Plasma 3?,Baseline Measurements: Collected Plasma 3?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,serum1_b,Collected Serum 1?,Baseline Measurements: Collected Serum 1?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,serum2_b,Collected Serum 2?,Baseline Measurements: Collected Serum 2?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,serum3_b,Collected Serum 3?,Baseline Measurements: Collected Serum 3?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,sga_b,Subject Global Assessment (score = 1-7),Baseline Measurements: Subject Global Assessment (score = 1-7),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +baseline_data,date_supplement_dispensed,Date patient begins supplement,Baseline Measurements: Date patient begins supplement,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,date_visit_1,Date of Month 1 visit,Month 1: Date of Month 1 visit,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,alb_1,Serum Albumin (g/dL),Month 1: Serum Albumin (g/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,prealb_1,Serum Prealbumin (mg/dL),Month 1: Serum Prealbumin (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,creat_1,Creatinine (mg/dL),Month 1: Creatinine (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,npcr_1,Normalized Protein Catabolic Rate (g/kg/d),Month 1: Normalized Protein Catabolic Rate (g/kg/d),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,chol_1,Cholesterol (mg/dL),Month 1: Cholesterol (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,transferrin_1,Transferrin (mg/dL),Month 1: Transferrin (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,kt_v_1,Kt/V,Month 1: Kt/V,number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,drywt_1,Dry weight (kilograms),Month 1: Dry weight (kilograms),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,no_show_1,Number of treatments missed,Month 1: Number of treatments missed,number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,compliance_1,How compliant was the patient in drinking the supplement?,Month 1: How compliant was the patient in drinking the supplement?,integer,,,0|1|2|3|4,,,,0=100 percent|1=99-75 percent|2=74-50 percent|3=49-25 percent|4=0-24 percent,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,hospit_1,Was patient hospitalized since last visit?,Hospitalization Data: Was patient hospitalized since last visit?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,cause_hosp_1,What was the cause of hospitalization?,Hospitalization Data: What was the cause of hospitalization?,integer,,,1|2|3,,,,1=Vascular access related events|2=CVD events|3=Other,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,admission_date_1,Date of hospital admission,Hospitalization Data: Date of hospital admission,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,discharge_date_1,Date of hospital discharge,Hospitalization Data: Date of hospital discharge,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,discharge_summary_1,Discharge summary in patients binder?,Hospitalization Data: Discharge summary in patients binder?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,death_1,Has patient died since last visit?,Mortality Data: Has patient died since last visit?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,date_death_1,Date of death,Mortality Data: Date of death,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_1_data,cause_death_1,What was the cause of death?,Mortality Data: What was the cause of death?,integer,,,1|2,,,,1=All-cause|2=Cardiovascular,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,date_visit_2,Date of Month 2 visit,Month 2: Date of Month 2 visit,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,alb_2,Serum Albumin (g/dL),Month 2: Serum Albumin (g/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,prealb_2,Serum Prealbumin (mg/dL),Month 2: Serum Prealbumin (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,creat_2,Creatinine (mg/dL),Month 2: Creatinine (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,npcr_2,Normalized Protein Catabolic Rate (g/kg/d),Month 2: Normalized Protein Catabolic Rate (g/kg/d),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,chol_2,Cholesterol (mg/dL),Month 2: Cholesterol (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,transferrin_2,Transferrin (mg/dL),Month 2: Transferrin (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,kt_v_2,Kt/V,Month 2: Kt/V,number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,drywt_2,Dry weight (kilograms),Month 2: Dry weight (kilograms),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,no_show_2,Number of treatments missed,Month 2: Number of treatments missed,number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,compliance_2,How compliant was the patient in drinking the supplement?,Month 2: How compliant was the patient in drinking the supplement?,integer,,,0|1|2|3|4,,,,0=100 percent|1=99-75 percent|2=74-50 percent|3=49-25 percent|4=0-24 percent,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,hospit_2,Was patient hospitalized since last visit?,Hospitalization Data: Was patient hospitalized since last visit?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,cause_hosp_2,What was the cause of hospitalization?,Hospitalization Data: What was the cause of hospitalization?,integer,,,1|2|3,,,,1=Vascular access related events|2=CVD events|3=Other,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,admission_date_2,Date of hospital admission,Hospitalization Data: Date of hospital admission,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,discharge_date_2,Date of hospital discharge,Hospitalization Data: Date of hospital discharge,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,discharge_summary_2,Discharge summary in patients binder?,Hospitalization Data: Discharge summary in patients binder?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,death_2,Has patient died since last visit?,Mortality Data: Has patient died since last visit?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,date_death_2,Date of death,Mortality Data: Date of death,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_2_data,cause_death_2,What was the cause of death?,Mortality Data: What was the cause of death?,integer,,,1|2,,,,1=All-cause|2=Cardiovascular,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,date_visit_3,Date of Month 3 visit,Month 3: Date of Month 3 visit,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,date_blood_3,Date blood was drawn,Month 3: Date blood was drawn,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,alb_3,Serum Albumin (g/dL),Month 3: Serum Albumin (g/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,prealb_3,Serum Prealbumin (mg/dL),Month 3: Serum Prealbumin (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,creat_3,Creatinine (mg/dL),Month 3: Creatinine (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,npcr_3,Normalized Protein Catabolic Rate (g/kg/d),Month 3: Normalized Protein Catabolic Rate (g/kg/d),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,chol_3,Cholesterol (mg/dL),Month 3: Cholesterol (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,transferrin_3,Transferrin (mg/dL),Month 3: Transferrin (mg/dL),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,kt_v_3,Kt/V,Month 3: Kt/V,number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,drywt_3,Dry weight (kilograms),Month 3: Dry weight (kilograms),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,plasma1_3,Collected Plasma 1?,Month 3: Collected Plasma 1?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,plasma2_3,Collected Plasma 2?,Month 3: Collected Plasma 2?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,plasma3_3,Collected Plasma 3?,Month 3: Collected Plasma 3?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,serum1_3,Collected Serum 1?,Month 3: Collected Serum 1?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,serum2_3,Collected Serum 2?,Month 3: Collected Serum 2?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,serum3_3,Collected Serum 3?,Month 3: Collected Serum 3?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,sga_3,Subject Global Assessment (score = 1-7),Month 3: Subject Global Assessment (score = 1-7),number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,no_show_3,Number of treatments missed,Month 3: Number of treatments missed,number,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,compliance_3,How compliant was the patient in drinking the supplement?,Month 3: How compliant was the patient in drinking the supplement?,integer,,,0|1|2|3|4,,,,0=100 percent|1=99-75 percent|2=74-50 percent|3=49-25 percent|4=0-24 percent,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,hospit_3,Was patient hospitalized since last visit?,Hospitalization Data: Was patient hospitalized since last visit?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,cause_hosp_3,What was the cause of hospitalization?,Hospitalization Data: What was the cause of hospitalization?,integer,,,1|2|3,,,,1=Vascular access related events|2=CVD events|3=Other,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,admission_date_3,Date of hospital admission,Hospitalization Data: Date of hospital admission,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,discharge_date_3,Date of hospital discharge,Hospitalization Data: Date of hospital discharge,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,discharge_summary_3,Discharge summary in patients binder?,Hospitalization Data: Discharge summary in patients binder?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,death_3,Has patient died since last visit?,Mortality Data: Has patient died since last visit?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,date_death_3,Date of death,Mortality Data: Date of death,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +month_3_data,cause_death_3,What was the cause of death?,Mortality Data: What was the cause of death?,integer,,,1|2,,,,1=All-cause|2=Cardiovascular,,,,,,,,,,,,,,,,,,,,,,,,,, +completion_data,complete_study,Has patient completed study?,Study Completion Information: Has patient completed study?,integer,,,0|1,,,,0=No|1=Yes,,,,,,,,,,,,,,,,,,,,,,,,,, +completion_data,withdraw_date,Put a date if patient withdrew study,Study Completion Information: Put a date if patient withdrew study,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +completion_data,withdraw_reason,Reason patient withdrew from study,Study Completion Information: Reason patient withdrew from study,integer,,,0|1|2|3|4,,,,0=Non-compliance|1=Did not wish to continue in study|2=Could not tolerate the supplement|3=Hospitalization|4=Other,,,,,,,,,,,,,,,,,,,,,,,,,, +completion_data,complete_study_date,Date of study completion,Study Completion Information: Date of study completion,date,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +completion_data,study_comments,Comments,General Comments: Comments,string,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/tests/data/valid/output/heal_dd_from_redcap_dd_export.json b/data/valid/output/heal_dd_from_redcap_dd_export.json similarity index 99% rename from tests/data/valid/output/heal_dd_from_redcap_dd_export.json rename to data/valid/output/heal_dd_from_redcap_dd_export.json index daad6e0..8e329a0 100644 --- a/tests/data/valid/output/heal_dd_from_redcap_dd_export.json +++ b/data/valid/output/heal_dd_from_redcap_dd_export.json @@ -1,6 +1,6 @@ { - "title": "Example Data Dictionary", - "description": "This is an example", + "description": "This is a proof of concept to demonstrate the healdata-utils functionality", + "title": "Healdata-utils Demonstration Data Dictionary", "data_dictionary": [ { "name": "study_id", diff --git a/data/valid/output/heal_dd_from_spss_sav_dataset1.csv b/data/valid/output/heal_dd_from_spss_sav_dataset1.csv new file mode 100644 index 0000000..782dae5 --- /dev/null +++ b/data/valid/output/heal_dd_from_spss_sav_dataset1.csv @@ -0,0 +1,8 @@ +module,name,title,description,type,format,constraints.maxLength,constraints.enum,constraints.pattern,constraints.maximum,constraints.minimum,encodings,ordered,missingValues,trueValues,falseValues,repo_link,standardsMappings.type,standardsMappings.label,standardsMappings.url,standardsMappings.source,standardsMappings.id,relatedConcepts.type,relatedConcepts.label,relatedConcepts.url,relatedConcepts.source,relatedConcepts.id,univarStats.median,univarStats.mean,univarStats.std,univarStats.min,univarStats.max,univarStats.mode,univarStats.count,univarStats.twentyFifthPercentile,univarStats.seventyFifthPercentile,univarStats.categoricalMarginals.name,univarStats.categoricalMarginals.count +,id,,Unique identifier for participant,integer,,,,,,,,,-99.0|-98.0,,,,,,,,,,,,,,,,,,,,,,,, +,visit_dt,,Date of the interview,any,,,,,,,,,1582-10-13 23:58:21|1582-10-13 23:58:22,,,,,,,,,,,,,,,,,,,,,,,, +,sex_at_birth,,The self-reported sex of the participant/subject at birth,integer,,,1.0|2.0|3.0|4.0,,,,1.0=Male|2.0=Female|3.0=Intersex|4.0=None of these describe me|-99.0=Not reported|-98.0=Prefer not to answer,,-99.0|-98.0,,,,,,,,,,,,,,,,,,,,,,,, +,race,,Self-reported race,integer,,,1.0|2.0|3.0|4.0|5.0|6.0|7.0|8.0,,,,1.0=White|2.0=Black or African American|3.0=American Indian or Alaska Native|4.0=Native|5.0=Hawaiian or Other Pacific Islander|6.0=Asian|7.0=Some other race|8.0=Multiracial|-99.0=Not reported|-98.0=Prefer not to answer,,-99.0|-98.0,,,,,,,,,,,,,,,,,,,,,,,, +,hispanic_ethnicity,,"Are you of Hispanic, Latino, or Spanish origin?",integer,,,1.0|0.0,,,,1.0=Yes|0.0=No|-99.0=Not reported|-98.0=Prefer not to answer,,-99.0|-98.0,,,,,,,,,,,,,,,,,,,,,,,, +,SU4,,Heroin Days Used in days,integer,,,,,,,-99.0=Not reported|-98.0=Prefer not to answer,,-99.0|-98.0,,,,,,,,,,,,,,,,,,,,,,,, +,age,,Age of participant in year,integer,,,,,,,-99.0=Not reported|-98.0=Prefer not to answer,,-99.0|-98.0,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/tests/data/valid/output/heal_dd_from_spss_sav_dataset1.json b/data/valid/output/heal_dd_from_spss_sav_dataset1.json similarity index 93% rename from tests/data/valid/output/heal_dd_from_spss_sav_dataset1.json rename to data/valid/output/heal_dd_from_spss_sav_dataset1.json index cb638e5..1768eaa 100644 --- a/tests/data/valid/output/heal_dd_from_spss_sav_dataset1.json +++ b/data/valid/output/heal_dd_from_spss_sav_dataset1.json @@ -1,6 +1,6 @@ { - "title": "Example Data Dictionary", - "description": "This is an example", + "description": "This is a proof of concept to demonstrate the healdata-utils functionality", + "title": "Healdata-utils Demonstration Data Dictionary", "data_dictionary": [ { "name": "id", @@ -13,7 +13,7 @@ }, { "name": "visit_dt", - "type": "datetime", + "type": "any", "missingValues": [ "1582-10-13 23:58:21", "1582-10-13 23:58:22" @@ -89,8 +89,8 @@ }, "constraints": { "enum": [ - "0.0", - "1.0" + "1.0", + "0.0" ] }, "missingValues": [ diff --git a/data/valid/output/heal_dd_from_stata_dta_dataset1.csv b/data/valid/output/heal_dd_from_stata_dta_dataset1.csv new file mode 100644 index 0000000..41bc0f2 --- /dev/null +++ b/data/valid/output/heal_dd_from_stata_dta_dataset1.csv @@ -0,0 +1,8 @@ +module,name,title,description,type,format,constraints.maxLength,constraints.enum,constraints.pattern,constraints.maximum,constraints.minimum,encodings,ordered,missingValues,trueValues,falseValues,repo_link,standardsMappings.type,standardsMappings.label,standardsMappings.url,standardsMappings.source,standardsMappings.id,relatedConcepts.type,relatedConcepts.label,relatedConcepts.url,relatedConcepts.source,relatedConcepts.id,univarStats.median,univarStats.mean,univarStats.std,univarStats.min,univarStats.max,univarStats.mode,univarStats.count,univarStats.twentyFifthPercentile,univarStats.seventyFifthPercentile,univarStats.categoricalMarginals.name,univarStats.categoricalMarginals.count +,id,,Unique identifier for participant,integer,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,visit_dt,,Date of the interview,any,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, +,sex_at_birth,,The self-reported sex of the participant/subject at birth,any,,,1|2|3|4,,,,1=Male|2=Female|3=Intersex|4=None of these describe me|a=Not reported|b=Prefer not to answer,,a|b,,,,,,,,,,,,,,,,,,,,,,,, +,race,,Self-reported race,any,,,1|2|3|4|5|6|7|8,,,,1=White|2=Black or African American|3=American Indian or Alaska Native|4=Native|5=Hawaiian or Other Pacific Islander|6=Asian|7=Some other race|8=Multiracial|a=Not reported|b=Prefer not to answer,,a|b,,,,,,,,,,,,,,,,,,,,,,,, +,hispanic_ethnicity,,"Are you of Hispanic, Latino, or Spanish origin?",boolean,,,0|1,,,,0=No|1=Yes|a=Not reported|b=Prefer not to answer,,a|b,,,,,,,,,,,,,,,,,,,,,,,, +,SU4,,Heroin Days Used in days,any,,,,,,,a=Not reported|b=Prefer not to answer,,a|b,,,,,,,,,,,,,,,,,,,,,,,, +,age,,Age of participant in year,integer,,,b|a,,,,a=Not reported|b=Prefer not to answer,,,,,,,,,,,,,,,,,,,,,,,,,, diff --git a/tests/data/valid/output/heal_dd_from_stata_dta_dataset1.json b/data/valid/output/heal_dd_from_stata_dta_dataset1.json similarity index 90% rename from tests/data/valid/output/heal_dd_from_stata_dta_dataset1.json rename to data/valid/output/heal_dd_from_stata_dta_dataset1.json index 5c06be6..604535d 100644 --- a/tests/data/valid/output/heal_dd_from_stata_dta_dataset1.json +++ b/data/valid/output/heal_dd_from_stata_dta_dataset1.json @@ -1,6 +1,6 @@ { - "title": "Example Data Dictionary", - "description": "This is an example", + "description": "This is a proof of concept to demonstrate the healdata-utils functionality", + "title": "Healdata-utils Demonstration Data Dictionary", "data_dictionary": [ { "name": "id", @@ -9,12 +9,12 @@ }, { "name": "visit_dt", - "type": "datetime", + "type": "any", "description": "Date of the interview" }, { "name": "sex_at_birth", - "type": "integer", + "type": "any", "encodings": { "1": "Male", "2": "Female", @@ -39,7 +39,7 @@ }, { "name": "race", - "type": "integer", + "type": "any", "encodings": { "1": "White", "2": "Black or African American", @@ -72,7 +72,7 @@ }, { "name": "hispanic_ethnicity", - "type": "integer", + "type": "boolean", "encodings": { "0": "No", "1": "Yes", @@ -93,7 +93,7 @@ }, { "name": "SU4", - "type": "integer", + "type": "any", "encodings": { "a": "Not reported", "b": "Prefer not to answer" @@ -116,8 +116,8 @@ }, "constraints": { "enum": [ - "b", - "a" + "a", + "b" ] }, "description": "Age of participant in year" diff --git a/errors/heal-csv-errors.json b/errors/heal-csv-errors.json new file mode 100644 index 0000000..42672d0 --- /dev/null +++ b/errors/heal-csv-errors.json @@ -0,0 +1,4 @@ +{ + "valid": true, + "errors": [] +} \ No newline at end of file diff --git a/errors/heal-json-errors.json b/errors/heal-json-errors.json new file mode 100644 index 0000000..42672d0 --- /dev/null +++ b/errors/heal-json-errors.json @@ -0,0 +1,4 @@ +{ + "valid": true, + "errors": [] +} \ No newline at end of file diff --git a/src/healdata_utils/transforms/readstat/conversion.py b/src/healdata_utils/transforms/readstat/conversion.py index ab6aad7..9e33c63 100644 --- a/src/healdata_utils/transforms/readstat/conversion.py +++ b/src/healdata_utils/transforms/readstat/conversion.py @@ -94,7 +94,7 @@ def convert_readstat(file_path, field['encodings'] = value_labels #NOTE: enums are assumed if labels represent entire set of values # this avoids value labels that are, for example, partials such as top/bottom encodings - enums = set(value_labels.keys()).difference(set(missing_values)) + enums = [val for val in value_labels.keys() if not val in missing_values] constraints_enums = {'constraints':{'enum':[str(v) for v in enums]}} field.update(constraints_enums) diff --git a/tests/compile_tests/compile_test_assertions.py b/tests/compile_tests/compile_test_assertions.py deleted file mode 100644 index fb035a9..0000000 --- a/tests/compile_tests/compile_test_assertions.py +++ /dev/null @@ -1,137 +0,0 @@ -""" -calling this file from /healdata-utils/. recompiles the -files test_cli.py and test_conversion.py with new assertion statements -""" - -from healdata_utils.transforms.readstat.conversion import convert_readstat -from healdata_utils.cli import convert_to_vlmd -import os - -def compile_assertions_test_conversion(): - # use to bulk generate assertions statements for testing - file_name="tests/test_conversion.py" - file_path = "tests/data/valid/input/sas-nmhss-2019/data.sas7bdat" - if os.path.isfile(file_path): - print('file exists: regex') - sas7bcat_file_path = "tests/data/valid/input/sas-nmhss-2019/formats.sas7bcat" - data_dictionaries = convert_readstat( - file_path=file_path, - data_dictionary_props={}, - sas7bcat_file_path=sas7bcat_file_path, - ) - json_template = data_dictionaries["templatejson"]["data_dictionary"] - csv_template = data_dictionaries["templatecsv"]["data_dictionary"] - # helper function to bulk generate assertion statements for data structures. - assertion_statements = "" - for i, item in enumerate([csv_template, json_template]): - if i == 0: - text = "csvtemplate_{}" - var = "csv_template" - else: - text = "jsontemplate_{}" - var = "json_template" - for j, component in enumerate(item): - assertion_statements += ( - "\n\n " + text.format(str(j)) + "= {}".format(str(component)) - ) - assertion_statements += ( - "\n\n try:" +\ - "\n assert {}[{}]".format(var, str(j)) + " == " + text.format(j) +\ - "\n except AssertionError:" +\ - "\n _, _, tb = sys.exc_info()" +\ - "\n tb_info = traceback.extract_tb(tb)" +\ - "\n filename, line, func, text = tb_info[-1]" +\ - "\n assertion_messages+='\\nfailure at line: '+ str(line) + ', text: ' + text" - ) - with open(file_name, "r") as cur_file: - test_file = cur_file.read() - cur_file.close() - lines = test_file.split("\n") - - for i, line in enumerate(lines): - if line.replace(" ", "") == "###regexflagstart###": - j = i - elif line.replace(" ", "") == "###regexflagend###": - n = i - for x in range(n - j - 1): - lines.pop(j + 1) - new_text = "" - for i, line in enumerate(lines): - preamb = "" if i == 0 else "\n" - if i == j + 1: - new_text += "\n" + assertion_statements + "\n" - new_text += preamb + line - - with open(file_name, "w") as cur_file: - cur_file.write(new_text) - # os.system('cmd /k " venv\\Scripts\\activate"'.format(__file__)) - # os.system('cmd /c "black {}"'.format(__file__)) - return - -def compile_assertions_test_cli(): - file_name="tests/test_cli.py" - data_dictionary_metadata = { - "description": ( - "This is a proof of concept to demonstrate" - " the healdata-utils functionality" - ), - "title": "Healdata-utils Demonstration Data Dictionary", - } - filepath = "tests/data/valid/input/redcap_dd_export.redcap.csv" - data_dictionaries = convert_to_vlmd( - filepath, data_dictionary_props=data_dictionary_metadata - ) - csvtemplate = data_dictionaries["csvtemplate"] - jsontemplate = data_dictionaries["jsontemplate"] - errors = data_dictionaries["errors"] - # helper function to bulk generate assertion statements for data structures. - assertion_statements = "" - for i, item in enumerate([csvtemplate, jsontemplate["data_dictionary"]]): - if i == 0: - text = "csvtemplate_{}" - var = "csvtemplate" - else: - text = "data_dictionary_{}" - var = 'jsontemplate["data_dictionary"]' - for j, component in enumerate(item): - assertion_statements += ( - "\n\n " + text.format(str(j)) + "= {}".format(str(component)) - ) - assertion_statements += ( - "\n\n try:" +\ - "\n assert {}[{}]".format(var, str(j)) + " == " + text.format(j) +\ - "\n except AssertionError:" +\ - "\n _, _, tb = sys.exc_info()" +\ - "\n traceback.print_tb(tb) # Fixed format" +\ - "\n tb_info = traceback.extract_tb(tb)" +\ - "\n filename, line, func, text = tb_info[-1]" +\ - "\n assertion_messages+='\\nfailure at line: '+ str(line) + ', text: ' + text" - ) - with open(file_name, "r") as cur_file: - test_file = cur_file.read() - cur_file.close() - lines = test_file.split("\n") - - for i, line in enumerate(lines): - if line.replace(" ", "") == "###regexflagstart###": - j = i - elif line.replace(" ", "") == "###regexflagend###": - n = i - for x in range(n - j - 1): - lines.pop(j + 1) - new_text = "" - for i, line in enumerate(lines): - preamb = "" if i == 0 else "\n" - if i == j + 1: - new_text += "\n" + assertion_statements + "\n" - new_text += preamb + line - - with open(file_name, "w") as cur_file: - cur_file.write(new_text) - - return - - -if __name__ == "__main__": - compile_assertions_test_conversion() - compile_assertions_test_cli() diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..de447de --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,62 @@ +import pytest +from pathlib import Path +from healdata_utils.cli import choice_fxn +import json + +@pytest.fixture(scope="module") +def fields_propname(): + return "data_dictionary" + +@pytest.fixture(scope="module") +def valid_input_params(): + inputdir = Path("data/valid/input") + data_dictionary_props = { + "description": ( + "This is a proof of concept to demonstrate" + " the healdata-utils functionality" + ), + "title": "Healdata-utils Demonstration Data Dictionary", + } + input_params = { + "dta":{"filepath":inputdir.joinpath("stata_dta_dataset1.dta"),"data_dictionary_props":data_dictionary_props}, + "sav":{"filepath":inputdir.joinpath("spss_sav_dataset1.sav"),"data_dictionary_props":data_dictionary_props}, + "redcap.csv":{"filepath":inputdir.joinpath("redcap_dd_export.redcap.csv"),"data_dictionary_props":data_dictionary_props}, + } + return input_params + +@pytest.fixture(scope="module") +def valid_output_json(): + path = Path("data/valid/output") + filenames = { + "dta":"heal_dd_from_stata_dta_dataset1.json", + "sav":"heal_dd_from_spss_sav_dataset1.json", + "redcap.csv":"heal_dd_from_redcap_dd_export.json", + } + jsons = {} + for inputtype,name in filenames.items(): + if inputtype in choice_fxn: + jsons[inputtype] = json.loads(path.joinpath(name).read_text()) + else: + raise Exception("Inputtype not in registered fxns") + + return jsons + +@pytest.fixture(scope="module") +def valid_output_csv(): + path = Path("data/valid/output") + filenames = { + "dta":"heal_dd_from_stata_dta_dataset1.csv", + "sav":"heal_dd_from_spss_sav_dataset1.csv", + "redcap.csv":"heal_dd_from_redcap_dd_export.csv", + } + csvs = {} + for inputtype,name in filenames.items(): + if inputtype in choice_fxn: + csvs[inputtype] = path.joinpath(name).read_text().split("\n") + else: + raise Exception("Inputtype not in registered fxns") + + return csvs + + + \ No newline at end of file diff --git a/tests/data/valid/output/heal_dd_from_redcap_dd_export.csv b/tests/data/valid/output/heal_dd_from_redcap_dd_export.csv deleted file mode 100644 index d3cc87c..0000000 --- a/tests/data/valid/output/heal_dd_from_redcap_dd_export.csv +++ /dev/null @@ -1,146 +0,0 @@ -"module","name","title","description","type","format","constraints.maxLength","constraints.enum","constraints.pattern","constraints.maximum","encodings","ordered","missingValues","trueValues","falseValues","repo_link","cde_id.source","cde_id.id","ontology_id.relation","ontology_id.source","ontology_id.id","standardsMappings.type","standardsMappings.label","standardsMappings.url","standardsMappings.source","standardsMappings.id","relatedConcepts.type","relatedConcepts.label","relatedConcepts.url","relatedConcepts.source","relatedConcepts.id","univarStats.median","univarStats.mean","univarStats.std","univarStats.min","univarStats.max","univarStats.mode","univarStats.count","univarStats.twentyFifthPercentile","univarStats.seventyFifthPercentile","univarStats.categoricalMarginals.name","univarStats.categoricalMarginals.count" -"demographics","study_id","Study ID","Study ID","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","date_enrolled","Date subject signed consent","Demographic Characteristics: Date subject signed consent","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","first_name","First Name","Demographic Characteristics: First Name","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","last_name","Last Name","Demographic Characteristics: Last Name","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","address","Street, City, State, ZIP","Contact Information: Street, City, State, ZIP","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","telephone_1","Phone number","Contact Information: Phone number","string","","","","^[0-9]{3}-[0-9]{3}-[0-9]{4}$","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","telephone_2","Second phone number","Contact Information: Second phone number","string","","","","^[0-9]{3}-[0-9]{3}-[0-9]{4}$","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","email","E-mail","Contact Information: E-mail","string","email","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","sex","Gender","Contact Information: Gender","integer","","","0|1","","","0=Female|1=Male","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","given_birth","Has the subject given birth before?","Contact Information: Has the subject given birth before?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","num_children","How many times has the subject given birth?","Contact Information: How many times has the subject given birth?","integer","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","ethnicity","Ethnicity","Contact Information: Ethnicity","integer","","","0|1|2","","","0=Hispanic or Latino|1=NOT Hispanic or Latino|2=Unknown / Not Reported","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___0","Race:American Indian/Alaska NativeRace","Contact Information: Race[choice=American Indian/Alaska Native]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___1","Race:AsianRace","Contact Information: Race[choice=Asian]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___2","Race:Native Hawaiian or Other Pacific IslanderRace","Contact Information: Race[choice=Native Hawaiian or Other Pacific Islander]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___3","Race:Black or African AmericanRace","Contact Information: Race[choice=Black or African American]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___4","Race:WhiteRace","Contact Information: Race[choice=White]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___5","Race:More Than One RaceRace","Contact Information: Race[choice=More Than One Race]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___6","Race:Unknown / Not ReportedRace","Contact Information: Race[choice=Unknown / Not Reported]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dob","Date of birth","Contact Information: Date of birth","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","age","Age (years)","Contact Information: Age (years)[calculation: round(datediff([dob],'today','y'),0)]","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","height","Height (cm)","Contact Information: Height (cm)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","weight","Weight (kilograms)","Contact Information: Weight (kilograms)","integer","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","bmi","BMI","Contact Information: BMI[calculation: round(([weight]*10000)/(([height])^(2)),1)]","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","patient_document","Patient document","Contact Information: Patient document","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","comorbidities","Any comorbid condition","Contact Information: Any comorbid condition","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","diabetes","Patient has a diagnosis of diabetes mellitus?","Contact Information: Patient has a diagnosis of diabetes mellitus?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","diabetes_type","Type of Diabetes Mellitus","Contact Information: Type of Diabetes Mellitus","integer","","","0|1|2","","","0=Type 1 insulin-dependent|1=Type 2 insulin-dependent|2=Type 2 non insulin-dependent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","gym___0","Gym:MondayGym (Weight Training)","Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Monday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","gym___1","Gym:TuesdayGym (Weight Training)","Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Tuesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","gym___2","Gym:WednesdayGym (Weight Training)","Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Wednesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","gym___3","Gym:ThursdayGym (Weight Training)","Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Thursday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","gym___4","Gym:FridayGym (Weight Training)","Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Friday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","aerobics___0","Aerobics:MondayAerobics","Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Monday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","aerobics___1","Aerobics:TuesdayAerobics","Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Tuesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","aerobics___2","Aerobics:WednesdayAerobics","Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Wednesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","aerobics___3","Aerobics:ThursdayAerobics","Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Thursday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","aerobics___4","Aerobics:FridayAerobics","Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Friday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","eat___0","Eat:MondayEat Out (Dinner/Lunch)","Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Monday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","eat___1","Eat:TuesdayEat Out (Dinner/Lunch)","Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Tuesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","eat___2","Eat:WednesdayEat Out (Dinner/Lunch)","Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Wednesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","eat___3","Eat:ThursdayEat Out (Dinner/Lunch)","Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Thursday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","eat___4","Eat:FridayEat Out (Dinner/Lunch)","Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Friday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","drink___0","Drink:MondayDrink (Alcoholic Beverages)","Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Monday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","drink___1","Drink:TuesdayDrink (Alcoholic Beverages)","Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Tuesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","drink___2","Drink:WednesdayDrink (Alcoholic Beverages)","Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Wednesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","drink___3","Drink:ThursdayDrink (Alcoholic Beverages)","Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Thursday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","drink___4","Drink:FridayDrink (Alcoholic Beverages)","Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Friday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dialysis_initiation","Date of first outpatient dialysis treatment","Dialysis Information: Date of first outpatient dialysis treatment","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","access_type","Type of vascular access","Dialysis Information: Type of vascular access","integer","","","0|1|2|3","","","0=Graft|1=Fistula|2=Catheter with maturing graft|3=Catheter with maturing fistula","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","access_location","Location of currently used vascular access","Dialysis Information: Location of currently used vascular access","integer","","","0|1|2|3|4","","","0=Forearm|1=Upper arm|2=Internal jugular vein|3=Subclavian vein|4=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dialysis_unit_name","Name of dialysis unit","Dialysis Information: Name of dialysis unit","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dialysis_unit_phone","Phone number","Dialysis Information: Phone number","string","","","","^[0-9]{3}-[0-9]{3}-[0-9]{4}$","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dialysis_schedule_days","Days of the week patient is dialyzed","Dialysis Information: Days of the week patient is dialyzed","integer","","","0|1|2","","","0=Monday-Wednesday-Friday|1=Tuesday-Thursday-Saturday|2=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dialysis_schedule_time","Shift patient is dialyzed","Dialysis Information: Shift patient is dialyzed","integer","","","0|1|2|3","","","0=First shift|1=Second shift|2=Third shift|3=Fourth shift","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","etiology_esrd","Etiology of ESRD","Dialysis Information: Etiology of ESRD","integer","","","0|1|2|3|4|5|6","","","0=Diabetes|1=Hypertension|2=Glomerulonephritis|3=Polycystic Kidney Disease|4=Interstitial Nephritis|5=Hereditary Nephritis|6=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","subject_comments","Comments","General Comments: Comments","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","date_visit_b","Date of baseline visit","Baseline Measurements: Date of baseline visit","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","date_blood_b","Date blood was drawn","Baseline Measurements: Date blood was drawn","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","alb_b","Serum Albumin (g/dL)","Baseline Measurements: Serum Albumin (g/dL)","integer","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","prealb_b","Serum Prealbumin (mg/dL)","Baseline Measurements: Serum Prealbumin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","creat_b","Creatinine (mg/dL)","Baseline Measurements: Creatinine (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","npcr_b","Normalized Protein Catabolic Rate (g/kg/d)","Baseline Measurements: Normalized Protein Catabolic Rate (g/kg/d)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","chol_b","Cholesterol (mg/dL)","Baseline Measurements: Cholesterol (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","transferrin_b","Transferrin (mg/dL)","Baseline Measurements: Transferrin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","kt_v_b","Kt/V","Baseline Measurements: Kt/V","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","drywt_b","Dry weight (kilograms)","Baseline Measurements: Dry weight (kilograms)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","plasma1_b","Collected Plasma 1?","Baseline Measurements: Collected Plasma 1?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","plasma2_b","Collected Plasma 2?","Baseline Measurements: Collected Plasma 2?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","plasma3_b","Collected Plasma 3?","Baseline Measurements: Collected Plasma 3?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","serum1_b","Collected Serum 1?","Baseline Measurements: Collected Serum 1?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","serum2_b","Collected Serum 2?","Baseline Measurements: Collected Serum 2?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","serum3_b","Collected Serum 3?","Baseline Measurements: Collected Serum 3?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","sga_b","Subject Global Assessment (score = 1-7)","Baseline Measurements: Subject Global Assessment (score = 1-7)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","date_supplement_dispensed","Date patient begins supplement","Baseline Measurements: Date patient begins supplement","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","date_visit_1","Date of Month 1 visit","Month 1: Date of Month 1 visit","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","alb_1","Serum Albumin (g/dL)","Month 1: Serum Albumin (g/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","prealb_1","Serum Prealbumin (mg/dL)","Month 1: Serum Prealbumin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","creat_1","Creatinine (mg/dL)","Month 1: Creatinine (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","npcr_1","Normalized Protein Catabolic Rate (g/kg/d)","Month 1: Normalized Protein Catabolic Rate (g/kg/d)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","chol_1","Cholesterol (mg/dL)","Month 1: Cholesterol (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","transferrin_1","Transferrin (mg/dL)","Month 1: Transferrin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","kt_v_1","Kt/V","Month 1: Kt/V","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","drywt_1","Dry weight (kilograms)","Month 1: Dry weight (kilograms)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","no_show_1","Number of treatments missed","Month 1: Number of treatments missed","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","compliance_1","How compliant was the patient in drinking the supplement?","Month 1: How compliant was the patient in drinking the supplement?","integer","","","0|1|2|3|4","","","0=100 percent|1=99-75 percent|2=74-50 percent|3=49-25 percent|4=0-24 percent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","hospit_1","Was patient hospitalized since last visit?","Hospitalization Data: Was patient hospitalized since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","cause_hosp_1","What was the cause of hospitalization?","Hospitalization Data: What was the cause of hospitalization?","integer","","","1|2|3","","","1=Vascular access related events|2=CVD events|3=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","admission_date_1","Date of hospital admission","Hospitalization Data: Date of hospital admission","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","discharge_date_1","Date of hospital discharge","Hospitalization Data: Date of hospital discharge","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","discharge_summary_1","Discharge summary in patients binder?","Hospitalization Data: Discharge summary in patients binder?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","death_1","Has patient died since last visit?","Mortality Data: Has patient died since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","date_death_1","Date of death","Mortality Data: Date of death","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","cause_death_1","What was the cause of death?","Mortality Data: What was the cause of death?","integer","","","1|2","","","1=All-cause|2=Cardiovascular","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","date_visit_2","Date of Month 2 visit","Month 2: Date of Month 2 visit","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","alb_2","Serum Albumin (g/dL)","Month 2: Serum Albumin (g/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","prealb_2","Serum Prealbumin (mg/dL)","Month 2: Serum Prealbumin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","creat_2","Creatinine (mg/dL)","Month 2: Creatinine (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","npcr_2","Normalized Protein Catabolic Rate (g/kg/d)","Month 2: Normalized Protein Catabolic Rate (g/kg/d)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","chol_2","Cholesterol (mg/dL)","Month 2: Cholesterol (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","transferrin_2","Transferrin (mg/dL)","Month 2: Transferrin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","kt_v_2","Kt/V","Month 2: Kt/V","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","drywt_2","Dry weight (kilograms)","Month 2: Dry weight (kilograms)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","no_show_2","Number of treatments missed","Month 2: Number of treatments missed","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","compliance_2","How compliant was the patient in drinking the supplement?","Month 2: How compliant was the patient in drinking the supplement?","integer","","","0|1|2|3|4","","","0=100 percent|1=99-75 percent|2=74-50 percent|3=49-25 percent|4=0-24 percent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","hospit_2","Was patient hospitalized since last visit?","Hospitalization Data: Was patient hospitalized since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","cause_hosp_2","What was the cause of hospitalization?","Hospitalization Data: What was the cause of hospitalization?","integer","","","1|2|3","","","1=Vascular access related events|2=CVD events|3=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","admission_date_2","Date of hospital admission","Hospitalization Data: Date of hospital admission","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","discharge_date_2","Date of hospital discharge","Hospitalization Data: Date of hospital discharge","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","discharge_summary_2","Discharge summary in patients binder?","Hospitalization Data: Discharge summary in patients binder?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","death_2","Has patient died since last visit?","Mortality Data: Has patient died since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","date_death_2","Date of death","Mortality Data: Date of death","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","cause_death_2","What was the cause of death?","Mortality Data: What was the cause of death?","integer","","","1|2","","","1=All-cause|2=Cardiovascular","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","date_visit_3","Date of Month 3 visit","Month 3: Date of Month 3 visit","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","date_blood_3","Date blood was drawn","Month 3: Date blood was drawn","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","alb_3","Serum Albumin (g/dL)","Month 3: Serum Albumin (g/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","prealb_3","Serum Prealbumin (mg/dL)","Month 3: Serum Prealbumin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","creat_3","Creatinine (mg/dL)","Month 3: Creatinine (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","npcr_3","Normalized Protein Catabolic Rate (g/kg/d)","Month 3: Normalized Protein Catabolic Rate (g/kg/d)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","chol_3","Cholesterol (mg/dL)","Month 3: Cholesterol (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","transferrin_3","Transferrin (mg/dL)","Month 3: Transferrin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","kt_v_3","Kt/V","Month 3: Kt/V","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","drywt_3","Dry weight (kilograms)","Month 3: Dry weight (kilograms)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","plasma1_3","Collected Plasma 1?","Month 3: Collected Plasma 1?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","plasma2_3","Collected Plasma 2?","Month 3: Collected Plasma 2?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","plasma3_3","Collected Plasma 3?","Month 3: Collected Plasma 3?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","serum1_3","Collected Serum 1?","Month 3: Collected Serum 1?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","serum2_3","Collected Serum 2?","Month 3: Collected Serum 2?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","serum3_3","Collected Serum 3?","Month 3: Collected Serum 3?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","sga_3","Subject Global Assessment (score = 1-7)","Month 3: Subject Global Assessment (score = 1-7)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","no_show_3","Number of treatments missed","Month 3: Number of treatments missed","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","compliance_3","How compliant was the patient in drinking the supplement?","Month 3: How compliant was the patient in drinking the supplement?","integer","","","0|1|2|3|4","","","0=100 percent|1=99-75 percent|2=74-50 percent|3=49-25 percent|4=0-24 percent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","hospit_3","Was patient hospitalized since last visit?","Hospitalization Data: Was patient hospitalized since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","cause_hosp_3","What was the cause of hospitalization?","Hospitalization Data: What was the cause of hospitalization?","integer","","","1|2|3","","","1=Vascular access related events|2=CVD events|3=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","admission_date_3","Date of hospital admission","Hospitalization Data: Date of hospital admission","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","discharge_date_3","Date of hospital discharge","Hospitalization Data: Date of hospital discharge","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","discharge_summary_3","Discharge summary in patients binder?","Hospitalization Data: Discharge summary in patients binder?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","death_3","Has patient died since last visit?","Mortality Data: Has patient died since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","date_death_3","Date of death","Mortality Data: Date of death","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","cause_death_3","What was the cause of death?","Mortality Data: What was the cause of death?","integer","","","1|2","","","1=All-cause|2=Cardiovascular","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"completion_data","complete_study","Has patient completed study?","Study Completion Information: Has patient completed study?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"completion_data","withdraw_date","Put a date if patient withdrew study","Study Completion Information: Put a date if patient withdrew study","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"completion_data","withdraw_reason","Reason patient withdrew from study","Study Completion Information: Reason patient withdrew from study","integer","","","0|1|2|3|4","","","0=Non-compliance|1=Did not wish to continue in study|2=Could not tolerate the supplement|3=Hospitalization|4=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"completion_data","complete_study_date","Date of study completion","Study Completion Information: Date of study completion","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"completion_data","study_comments","Comments","General Comments: Comments","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" diff --git a/tests/data/valid/output/heal_dd_from_redcap_export.csv b/tests/data/valid/output/heal_dd_from_redcap_export.csv deleted file mode 100644 index d3cc87c..0000000 --- a/tests/data/valid/output/heal_dd_from_redcap_export.csv +++ /dev/null @@ -1,146 +0,0 @@ -"module","name","title","description","type","format","constraints.maxLength","constraints.enum","constraints.pattern","constraints.maximum","encodings","ordered","missingValues","trueValues","falseValues","repo_link","cde_id.source","cde_id.id","ontology_id.relation","ontology_id.source","ontology_id.id","standardsMappings.type","standardsMappings.label","standardsMappings.url","standardsMappings.source","standardsMappings.id","relatedConcepts.type","relatedConcepts.label","relatedConcepts.url","relatedConcepts.source","relatedConcepts.id","univarStats.median","univarStats.mean","univarStats.std","univarStats.min","univarStats.max","univarStats.mode","univarStats.count","univarStats.twentyFifthPercentile","univarStats.seventyFifthPercentile","univarStats.categoricalMarginals.name","univarStats.categoricalMarginals.count" -"demographics","study_id","Study ID","Study ID","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","date_enrolled","Date subject signed consent","Demographic Characteristics: Date subject signed consent","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","first_name","First Name","Demographic Characteristics: First Name","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","last_name","Last Name","Demographic Characteristics: Last Name","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","address","Street, City, State, ZIP","Contact Information: Street, City, State, ZIP","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","telephone_1","Phone number","Contact Information: Phone number","string","","","","^[0-9]{3}-[0-9]{3}-[0-9]{4}$","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","telephone_2","Second phone number","Contact Information: Second phone number","string","","","","^[0-9]{3}-[0-9]{3}-[0-9]{4}$","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","email","E-mail","Contact Information: E-mail","string","email","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","sex","Gender","Contact Information: Gender","integer","","","0|1","","","0=Female|1=Male","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","given_birth","Has the subject given birth before?","Contact Information: Has the subject given birth before?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","num_children","How many times has the subject given birth?","Contact Information: How many times has the subject given birth?","integer","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","ethnicity","Ethnicity","Contact Information: Ethnicity","integer","","","0|1|2","","","0=Hispanic or Latino|1=NOT Hispanic or Latino|2=Unknown / Not Reported","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___0","Race:American Indian/Alaska NativeRace","Contact Information: Race[choice=American Indian/Alaska Native]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___1","Race:AsianRace","Contact Information: Race[choice=Asian]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___2","Race:Native Hawaiian or Other Pacific IslanderRace","Contact Information: Race[choice=Native Hawaiian or Other Pacific Islander]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___3","Race:Black or African AmericanRace","Contact Information: Race[choice=Black or African American]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___4","Race:WhiteRace","Contact Information: Race[choice=White]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___5","Race:More Than One RaceRace","Contact Information: Race[choice=More Than One Race]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","race___6","Race:Unknown / Not ReportedRace","Contact Information: Race[choice=Unknown / Not Reported]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dob","Date of birth","Contact Information: Date of birth","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","age","Age (years)","Contact Information: Age (years)[calculation: round(datediff([dob],'today','y'),0)]","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","height","Height (cm)","Contact Information: Height (cm)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","weight","Weight (kilograms)","Contact Information: Weight (kilograms)","integer","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","bmi","BMI","Contact Information: BMI[calculation: round(([weight]*10000)/(([height])^(2)),1)]","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","patient_document","Patient document","Contact Information: Patient document","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","comorbidities","Any comorbid condition","Contact Information: Any comorbid condition","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","diabetes","Patient has a diagnosis of diabetes mellitus?","Contact Information: Patient has a diagnosis of diabetes mellitus?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","diabetes_type","Type of Diabetes Mellitus","Contact Information: Type of Diabetes Mellitus","integer","","","0|1|2","","","0=Type 1 insulin-dependent|1=Type 2 insulin-dependent|2=Type 2 non insulin-dependent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","gym___0","Gym:MondayGym (Weight Training)","Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Monday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","gym___1","Gym:TuesdayGym (Weight Training)","Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Tuesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","gym___2","Gym:WednesdayGym (Weight Training)","Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Wednesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","gym___3","Gym:ThursdayGym (Weight Training)","Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Thursday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","gym___4","Gym:FridayGym (Weight Training)","Please provide the patient's weekly schedule for the activities below.: Gym (Weight Training)[choice=Friday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","aerobics___0","Aerobics:MondayAerobics","Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Monday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","aerobics___1","Aerobics:TuesdayAerobics","Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Tuesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","aerobics___2","Aerobics:WednesdayAerobics","Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Wednesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","aerobics___3","Aerobics:ThursdayAerobics","Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Thursday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","aerobics___4","Aerobics:FridayAerobics","Please provide the patient's weekly schedule for the activities below.: Aerobics[choice=Friday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","eat___0","Eat:MondayEat Out (Dinner/Lunch)","Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Monday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","eat___1","Eat:TuesdayEat Out (Dinner/Lunch)","Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Tuesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","eat___2","Eat:WednesdayEat Out (Dinner/Lunch)","Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Wednesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","eat___3","Eat:ThursdayEat Out (Dinner/Lunch)","Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Thursday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","eat___4","Eat:FridayEat Out (Dinner/Lunch)","Please provide the patient's weekly schedule for the activities below.: Eat Out (Dinner/Lunch)[choice=Friday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","drink___0","Drink:MondayDrink (Alcoholic Beverages)","Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Monday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","drink___1","Drink:TuesdayDrink (Alcoholic Beverages)","Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Tuesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","drink___2","Drink:WednesdayDrink (Alcoholic Beverages)","Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Wednesday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","drink___3","Drink:ThursdayDrink (Alcoholic Beverages)","Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Thursday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","drink___4","Drink:FridayDrink (Alcoholic Beverages)","Please provide the patient's weekly schedule for the activities below.: Drink (Alcoholic Beverages)[choice=Friday]","boolean","","","0|1","","","0=Unchecked|1=Checked","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dialysis_initiation","Date of first outpatient dialysis treatment","Dialysis Information: Date of first outpatient dialysis treatment","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","access_type","Type of vascular access","Dialysis Information: Type of vascular access","integer","","","0|1|2|3","","","0=Graft|1=Fistula|2=Catheter with maturing graft|3=Catheter with maturing fistula","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","access_location","Location of currently used vascular access","Dialysis Information: Location of currently used vascular access","integer","","","0|1|2|3|4","","","0=Forearm|1=Upper arm|2=Internal jugular vein|3=Subclavian vein|4=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dialysis_unit_name","Name of dialysis unit","Dialysis Information: Name of dialysis unit","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dialysis_unit_phone","Phone number","Dialysis Information: Phone number","string","","","","^[0-9]{3}-[0-9]{3}-[0-9]{4}$","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dialysis_schedule_days","Days of the week patient is dialyzed","Dialysis Information: Days of the week patient is dialyzed","integer","","","0|1|2","","","0=Monday-Wednesday-Friday|1=Tuesday-Thursday-Saturday|2=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","dialysis_schedule_time","Shift patient is dialyzed","Dialysis Information: Shift patient is dialyzed","integer","","","0|1|2|3","","","0=First shift|1=Second shift|2=Third shift|3=Fourth shift","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","etiology_esrd","Etiology of ESRD","Dialysis Information: Etiology of ESRD","integer","","","0|1|2|3|4|5|6","","","0=Diabetes|1=Hypertension|2=Glomerulonephritis|3=Polycystic Kidney Disease|4=Interstitial Nephritis|5=Hereditary Nephritis|6=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"demographics","subject_comments","Comments","General Comments: Comments","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","date_visit_b","Date of baseline visit","Baseline Measurements: Date of baseline visit","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","date_blood_b","Date blood was drawn","Baseline Measurements: Date blood was drawn","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","alb_b","Serum Albumin (g/dL)","Baseline Measurements: Serum Albumin (g/dL)","integer","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","prealb_b","Serum Prealbumin (mg/dL)","Baseline Measurements: Serum Prealbumin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","creat_b","Creatinine (mg/dL)","Baseline Measurements: Creatinine (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","npcr_b","Normalized Protein Catabolic Rate (g/kg/d)","Baseline Measurements: Normalized Protein Catabolic Rate (g/kg/d)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","chol_b","Cholesterol (mg/dL)","Baseline Measurements: Cholesterol (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","transferrin_b","Transferrin (mg/dL)","Baseline Measurements: Transferrin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","kt_v_b","Kt/V","Baseline Measurements: Kt/V","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","drywt_b","Dry weight (kilograms)","Baseline Measurements: Dry weight (kilograms)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","plasma1_b","Collected Plasma 1?","Baseline Measurements: Collected Plasma 1?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","plasma2_b","Collected Plasma 2?","Baseline Measurements: Collected Plasma 2?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","plasma3_b","Collected Plasma 3?","Baseline Measurements: Collected Plasma 3?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","serum1_b","Collected Serum 1?","Baseline Measurements: Collected Serum 1?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","serum2_b","Collected Serum 2?","Baseline Measurements: Collected Serum 2?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","serum3_b","Collected Serum 3?","Baseline Measurements: Collected Serum 3?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","sga_b","Subject Global Assessment (score = 1-7)","Baseline Measurements: Subject Global Assessment (score = 1-7)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"baseline_data","date_supplement_dispensed","Date patient begins supplement","Baseline Measurements: Date patient begins supplement","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","date_visit_1","Date of Month 1 visit","Month 1: Date of Month 1 visit","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","alb_1","Serum Albumin (g/dL)","Month 1: Serum Albumin (g/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","prealb_1","Serum Prealbumin (mg/dL)","Month 1: Serum Prealbumin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","creat_1","Creatinine (mg/dL)","Month 1: Creatinine (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","npcr_1","Normalized Protein Catabolic Rate (g/kg/d)","Month 1: Normalized Protein Catabolic Rate (g/kg/d)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","chol_1","Cholesterol (mg/dL)","Month 1: Cholesterol (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","transferrin_1","Transferrin (mg/dL)","Month 1: Transferrin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","kt_v_1","Kt/V","Month 1: Kt/V","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","drywt_1","Dry weight (kilograms)","Month 1: Dry weight (kilograms)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","no_show_1","Number of treatments missed","Month 1: Number of treatments missed","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","compliance_1","How compliant was the patient in drinking the supplement?","Month 1: How compliant was the patient in drinking the supplement?","integer","","","0|1|2|3|4","","","0=100 percent|1=99-75 percent|2=74-50 percent|3=49-25 percent|4=0-24 percent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","hospit_1","Was patient hospitalized since last visit?","Hospitalization Data: Was patient hospitalized since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","cause_hosp_1","What was the cause of hospitalization?","Hospitalization Data: What was the cause of hospitalization?","integer","","","1|2|3","","","1=Vascular access related events|2=CVD events|3=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","admission_date_1","Date of hospital admission","Hospitalization Data: Date of hospital admission","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","discharge_date_1","Date of hospital discharge","Hospitalization Data: Date of hospital discharge","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","discharge_summary_1","Discharge summary in patients binder?","Hospitalization Data: Discharge summary in patients binder?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","death_1","Has patient died since last visit?","Mortality Data: Has patient died since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","date_death_1","Date of death","Mortality Data: Date of death","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_1_data","cause_death_1","What was the cause of death?","Mortality Data: What was the cause of death?","integer","","","1|2","","","1=All-cause|2=Cardiovascular","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","date_visit_2","Date of Month 2 visit","Month 2: Date of Month 2 visit","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","alb_2","Serum Albumin (g/dL)","Month 2: Serum Albumin (g/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","prealb_2","Serum Prealbumin (mg/dL)","Month 2: Serum Prealbumin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","creat_2","Creatinine (mg/dL)","Month 2: Creatinine (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","npcr_2","Normalized Protein Catabolic Rate (g/kg/d)","Month 2: Normalized Protein Catabolic Rate (g/kg/d)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","chol_2","Cholesterol (mg/dL)","Month 2: Cholesterol (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","transferrin_2","Transferrin (mg/dL)","Month 2: Transferrin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","kt_v_2","Kt/V","Month 2: Kt/V","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","drywt_2","Dry weight (kilograms)","Month 2: Dry weight (kilograms)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","no_show_2","Number of treatments missed","Month 2: Number of treatments missed","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","compliance_2","How compliant was the patient in drinking the supplement?","Month 2: How compliant was the patient in drinking the supplement?","integer","","","0|1|2|3|4","","","0=100 percent|1=99-75 percent|2=74-50 percent|3=49-25 percent|4=0-24 percent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","hospit_2","Was patient hospitalized since last visit?","Hospitalization Data: Was patient hospitalized since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","cause_hosp_2","What was the cause of hospitalization?","Hospitalization Data: What was the cause of hospitalization?","integer","","","1|2|3","","","1=Vascular access related events|2=CVD events|3=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","admission_date_2","Date of hospital admission","Hospitalization Data: Date of hospital admission","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","discharge_date_2","Date of hospital discharge","Hospitalization Data: Date of hospital discharge","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","discharge_summary_2","Discharge summary in patients binder?","Hospitalization Data: Discharge summary in patients binder?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","death_2","Has patient died since last visit?","Mortality Data: Has patient died since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","date_death_2","Date of death","Mortality Data: Date of death","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_2_data","cause_death_2","What was the cause of death?","Mortality Data: What was the cause of death?","integer","","","1|2","","","1=All-cause|2=Cardiovascular","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","date_visit_3","Date of Month 3 visit","Month 3: Date of Month 3 visit","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","date_blood_3","Date blood was drawn","Month 3: Date blood was drawn","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","alb_3","Serum Albumin (g/dL)","Month 3: Serum Albumin (g/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","prealb_3","Serum Prealbumin (mg/dL)","Month 3: Serum Prealbumin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","creat_3","Creatinine (mg/dL)","Month 3: Creatinine (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","npcr_3","Normalized Protein Catabolic Rate (g/kg/d)","Month 3: Normalized Protein Catabolic Rate (g/kg/d)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","chol_3","Cholesterol (mg/dL)","Month 3: Cholesterol (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","transferrin_3","Transferrin (mg/dL)","Month 3: Transferrin (mg/dL)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","kt_v_3","Kt/V","Month 3: Kt/V","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","drywt_3","Dry weight (kilograms)","Month 3: Dry weight (kilograms)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","plasma1_3","Collected Plasma 1?","Month 3: Collected Plasma 1?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","plasma2_3","Collected Plasma 2?","Month 3: Collected Plasma 2?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","plasma3_3","Collected Plasma 3?","Month 3: Collected Plasma 3?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","serum1_3","Collected Serum 1?","Month 3: Collected Serum 1?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","serum2_3","Collected Serum 2?","Month 3: Collected Serum 2?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","serum3_3","Collected Serum 3?","Month 3: Collected Serum 3?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","sga_3","Subject Global Assessment (score = 1-7)","Month 3: Subject Global Assessment (score = 1-7)","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","no_show_3","Number of treatments missed","Month 3: Number of treatments missed","number","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","compliance_3","How compliant was the patient in drinking the supplement?","Month 3: How compliant was the patient in drinking the supplement?","integer","","","0|1|2|3|4","","","0=100 percent|1=99-75 percent|2=74-50 percent|3=49-25 percent|4=0-24 percent","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","hospit_3","Was patient hospitalized since last visit?","Hospitalization Data: Was patient hospitalized since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","cause_hosp_3","What was the cause of hospitalization?","Hospitalization Data: What was the cause of hospitalization?","integer","","","1|2|3","","","1=Vascular access related events|2=CVD events|3=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","admission_date_3","Date of hospital admission","Hospitalization Data: Date of hospital admission","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","discharge_date_3","Date of hospital discharge","Hospitalization Data: Date of hospital discharge","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","discharge_summary_3","Discharge summary in patients binder?","Hospitalization Data: Discharge summary in patients binder?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","death_3","Has patient died since last visit?","Mortality Data: Has patient died since last visit?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","date_death_3","Date of death","Mortality Data: Date of death","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"month_3_data","cause_death_3","What was the cause of death?","Mortality Data: What was the cause of death?","integer","","","1|2","","","1=All-cause|2=Cardiovascular","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"completion_data","complete_study","Has patient completed study?","Study Completion Information: Has patient completed study?","integer","","","0|1","","","0=No|1=Yes","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"completion_data","withdraw_date","Put a date if patient withdrew study","Study Completion Information: Put a date if patient withdrew study","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"completion_data","withdraw_reason","Reason patient withdrew from study","Study Completion Information: Reason patient withdrew from study","integer","","","0|1|2|3|4","","","0=Non-compliance|1=Did not wish to continue in study|2=Could not tolerate the supplement|3=Hospitalization|4=Other","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"completion_data","complete_study_date","Date of study completion","Study Completion Information: Date of study completion","date","any","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" -"completion_data","study_comments","Comments","General Comments: Comments","string","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","" diff --git a/tests/data/valid/output/heal_dd_from_spss_sav_dataset1.csv b/tests/data/valid/output/heal_dd_from_spss_sav_dataset1.csv deleted file mode 100644 index 243a9c1..0000000 --- a/tests/data/valid/output/heal_dd_from_spss_sav_dataset1.csv +++ /dev/null @@ -1,8 +0,0 @@ -name,type,missingValues,description,encodings,constraints.enum -id,integer,-99.0|-98.0,Unique identifier for participant,, -visit_dt,datetime,1582-10-13 23:58:21|1582-10-13 23:58:22,Date of the interview,, -sex_at_birth,integer,-99.0|-98.0,The self-reported sex of the participant/subject at birth,1.0=Male|2.0=Female|3.0=Intersex|4.0=None of these describe me|-99.0=Not reported|-98.0=Prefer not to answer,1.0|2.0|3.0|4.0 -race,integer,-99.0|-98.0,Self-reported race,1.0=White|2.0=Black or African American|3.0=American Indian or Alaska Native|4.0=Native|5.0=Hawaiian or Other Pacific Islander|6.0=Asian|7.0=Some other race|8.0=Multiracial|-99.0=Not reported|-98.0=Prefer not to answer,1.0|2.0|3.0|4.0|5.0|6.0|7.0|8.0 -hispanic_ethnicity,integer,-99.0|-98.0,"Are you of Hispanic, Latino, or Spanish origin?",1.0=Yes|0.0=No|-99.0=Not reported|-98.0=Prefer not to answer,0.0|1.0 -SU4,integer,-99.0|-98.0,Heroin Days Used in days,-99.0=Not reported|-98.0=Prefer not to answer, -age,integer,-99.0|-98.0,Age of participant in year,-99.0=Not reported|-98.0=Prefer not to answer, diff --git a/tests/data/valid/output/heal_dd_from_stata_dta_dataset1.csv b/tests/data/valid/output/heal_dd_from_stata_dta_dataset1.csv deleted file mode 100644 index 3fedcc6..0000000 --- a/tests/data/valid/output/heal_dd_from_stata_dta_dataset1.csv +++ /dev/null @@ -1,8 +0,0 @@ -name,type,description,encodings,constraints.enum,missingValues -id,integer,Unique identifier for participant,,, -visit_dt,datetime,Date of the interview,,, -sex_at_birth,integer,The self-reported sex of the participant/subject at birth,1=Male|2=Female|3=Intersex|4=None of these describe me|a=Not reported|b=Prefer not to answer,1|2|3|4,a|b -race,integer,Self-reported race,1=White|2=Black or African American|3=American Indian or Alaska Native|4=Native|5=Hawaiian or Other Pacific Islander|6=Asian|7=Some other race|8=Multiracial|a=Not reported|b=Prefer not to answer,1|2|3|4|5|6|7|8,a|b -hispanic_ethnicity,integer,"Are you of Hispanic, Latino, or Spanish origin?",0=No|1=Yes|a=Not reported|b=Prefer not to answer,0|1,a|b -SU4,integer,Heroin Days Used in days,a=Not reported|b=Prefer not to answer,,a|b -age,integer,Age of participant in year,a=Not reported|b=Prefer not to answer,b|a, diff --git a/tests/test_cli.py b/tests/test_cli.py index 4495956..932ecce 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,54 +1,62 @@ -import pprint -import os +import shutil from pathlib import Path -import sys -import traceback from healdata_utils.cli import convert_to_vlmd - - -# test convert vlmd with redcap csv - -def test_convert_to_vlmd_with_redcap_csv_no_output(compile_assertion=False): - data_dictionary_metadata = { - "description": ( - "This is a proof of concept to demonstrate" - " the healdata-utils functionality" - ), - "title": "Healdata-utils Demonstration Data Dictionary", - } - filepath = "tests/data/valid/input/redcap_dd_export.redcap.csv" - data_dictionaries = convert_to_vlmd( - filepath, data_dictionary_props=data_dictionary_metadata - ) - csvtemplate = data_dictionaries["csvtemplate"] - jsontemplate = data_dictionaries["jsontemplate"] - errors = data_dictionaries["errors"] - - assertion_messages='' - ###regexflagstart### - - - csvtemplate_0= {'module': 'demographics', 'name': 'study_id', 'title': 'Study ID', 'description': 'Study ID', 'type': 'string', 'format': '', 'constraints.maxLength': '', 'constraints.enum': '', 'constraints.pattern': '', 'constraints.maximum': '', 'constraints.minimum': '', 'encodings': '', 'ordered': '', 'missingValues': '', 'trueValues': '', 'falseValues': '', 'repo_link': '', 'standardsMappings.type': '', 'standardsMappings.label': '', 'standardsMappings.url': '', 'standardsMappings.source': '', 'standardsMappings.id': '', 'relatedConcepts.type': '', 'relatedConcepts.label': '', 'relatedConcepts.url': '', 'relatedConcepts.source': '', 'relatedConcepts.id': '', 'univarStats.median': '', 'univarStats.mean': '', 'univarStats.std': '', 'univarStats.min': '', 'univarStats.max': '', 'univarStats.mode': '', 'univarStats.count': '', 'univarStats.twentyFifthPercentile': '', 'univarStats.seventyFifthPercentile': '', 'univarStats.categoricalMarginals.name': '', 'univarStats.categoricalMarginals.count': ''} - - try: - assert csvtemplate[0] == csvtemplate_0 - except AssertionError: - _, _, tb = sys.exc_info() - traceback.print_tb(tb) # Fixed format - tb_info = traceback.extract_tb(tb) - filename, line, func, text = tb_info[-1] - assertion_messages+='\nfailure at line: '+ str(line) + ', text: ' + text - - csvtemplate_1= {'module': 'demographics', 'name': 'date_enrolled', 'title': 'Date subject signed consent', 'description': 'Demographic Characteristics: Date subject signed consent', 'type': 'date', 'format': 'any', 'constraints.maxLength': '', 'constraints.enum': '', 'constraints.pattern': '', 'constraints.maximum': '', 'constraints.minimum': '', 'encodings': '', 'ordered': '', 'missingValues': '', 'trueValues': '', 'falseValues': '', 'repo_link': '', 'standardsMappings.type': '', 'standardsMappings.label': '', 'standardsMappings.url': '', 'standardsMappings.source': '', 'standardsMappings.id': '', 'relatedConcepts.type': '', 'relatedConcepts.label': '', 'relatedConcepts.url': '', 'relatedConcepts.source': '', 'relatedConcepts.id': '', 'univarStats.median': '', 'univarStats.mean': '', 'univarStats.std': '', 'univarStats.min': '', 'univarStats.max': '', 'univarStats.mode': '', 'univarStats.count': '', 'univarStats.twentyFifthPercentile': '', 'univarStats.seventyFifthPercentile': '', 'univarStats.categoricalMarginals.name': '', 'univarStats.categoricalMarginals.count': ''} - - try: - assert csvtemplate[1] == csvtemplate_1 - except AssertionError: - _, _, tb = sys.exc_info() - traceback.print_tb(tb) # Fixed format - tb_info = traceback.extract_tb(tb) - filename, line, func, text = tb_info[-1] - assertion_messages+='\nfailure at line: '+ str(line) + ', text: ' + text - - csvtemplate_2= {'module': 'demographics', 'name': 'first_name', 'title': 'First Name', 'description': 'Demographic Characteristics: First Name', 'type': 'string', 'format': '', 'constraints.maxLength': '', 'constraints.enum': '', 'constraints.pattern': '', 'constraints.maximum': '', 'constraints.minimum': '', 'encodings': '', 'ordered': '', 'missingValues': '', 'trueValues': '', 'falseValues': '', 'repo_link': '', 'standardsMappings.type': '', 'standardsMappings.label': '', 'standardsMappings.url': '', 'standardsMappings.source': '', 'standardsMappings.id': '', 'relatedConcepts.type': '', 'relatedConcepts.label': '', 'relatedConcepts.url': '', 'relatedConcepts.source': '', 'relatedConcepts.id': '', 'univarStats.median': '', 'univarStats.mean': '', 'univarStats.std': '', 'univarStats.min': '', 'univarStats.max': '', 'univarStats.mode': '', 'univarStats.count': '', 'univarStats.twentyFifthPercentile': '', 'univarStats.seventyFifthPercentile': '', 'univarStats.categoricalMarginals.name': '', 'univarStats.categoricalMarginals.count': ''} - +import json + +def test_convert_to_vlmd_with_registered_formats( + valid_input_params,valid_output_json,valid_output_csv,fields_propname): + inputtypes = list(valid_input_params.keys()) + outputdir="tmp" + + for inputtype in inputtypes: + + # make an empty temporary output directory + try: + Path(outputdir).mkdir() + except FileExistsError: + shutil.rmtree(outputdir) + Path(outputdir).mkdir() + + _valid_input_params = valid_input_params[inputtype] + _valid_output_json = valid_output_json[inputtype] + _valid_output_csv = valid_output_csv[inputtype] + + data_dictionaries = convert_to_vlmd( + **_valid_input_params, + outputdir=outputdir + ) + + ddjson = json.loads(list(Path("tmp").glob("*.json"))[0].read_text()) + #NOTE: csv are just fields so no ddcsv + + # check for incorrect fields + csv_fields = list(Path("tmp").glob("*.csv"))[0].read_text().split("\n") + json_fields = ddjson.pop(fields_propname) #NOTE: testing individual fields + + valid_output_json_fields = _valid_output_json.pop(fields_propname) + valid_output_csv_fields = _valid_output_csv + + invalid_json_fields = [] + invalid_csv_fields = [] + indices = range(len(json_fields)) + for i in indices: + if json_fields[i]!=valid_output_json_fields[i]: + invalid_json_fields.append(i) + if csv_fields[i]!=valid_output_csv_fields[i]: + invalid_csv_fields.append(i) + + json_field_names = [f["name"] for f in json_fields] + csv_field_names = [f["name"] for f in json_fields] + + assert sorted(json_field_names)==sorted(csv_field_names),f"{inputtype} conversion: json fields must have the same field names as csv fields" + assert len(invalid_json_fields)==0,f"{inputtype} conversion: The following **json** dd fields are not valid: {str(invalid_json_fields)}" + assert len(invalid_csv_fields)==0,f"{inputtype} conversion: The following **csv** dd fields are not valid: {str(invalid_csv_fields)}" + + + # check if root level properties other than the fields are valid + for propname in ddjson: + assert ddjson[propname] == _valid_output_json[propname],f"{inputtype} conversion to json dd property '{propname}' assertion failed" + + + # clean up + shutil.rmtree(outputdir) diff --git a/tests/test_conversion.py b/tests/test_conversion.py deleted file mode 100644 index acf3c9d..0000000 --- a/tests/test_conversion.py +++ /dev/null @@ -1,48 +0,0 @@ -from healdata_utils.transforms.readstat.conversion import convert_readstat -import sys -import traceback -import os - -def test_convert_readstat_with_sas7bdat(): - # use to bulk generate assertions statements for testing - file_path = "tests/data/valid/input/sas-nmhss-2019/data.sas7bdat" - if os.path.isfile(file_path): - print('file exists: regex') - sas7bcat_file_path = "tests/data/valid/input/sas-nmhss-2019/formats.sas7bcat" - data_dictionaries = convert_readstat( - file_path=file_path, - data_dictionary_props={}, - sas7bcat_file_path=sas7bcat_file_path, - ) - json_template = data_dictionaries["templatejson"]["data_dictionary"] - csv_template = data_dictionaries["templatecsv"]["data_dictionary"] - - assertion_messages='' - - ###regexflagstart### - - - csvtemplate_0= {'name': 'CASEID', 'type': 'integer'} - - try: - assert csv_template[0] == csvtemplate_0 - except AssertionError: - _, _, tb = sys.exc_info() - tb_info = traceback.extract_tb(tb) - filename, line, func, text = tb_info[-1] - assertion_messages+='\nfailure at line: '+ str(line) + ', text: ' + text - - csvtemplate_1= {'name': 'LST', 'type': 'string', 'constraints.enum': 'AK'} - - try: - assert csv_template[1] == csvtemplate_1 - except AssertionError: - _, _, tb = sys.exc_info() - tb_info = traceback.extract_tb(tb) - filename, line, func, text = tb_info[-1] - assertion_messages+='\nfailure at line: '+ str(line) + ', text: ' + text - - csvtemplate_2= {'name': 'MHINTAKE', 'type': 'integer', 'constraints.enum': '0|1'} - - -test_convert_readstat_with_sas7bdat() \ No newline at end of file