weavehr 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- weavehr/__init__.py +91 -0
- weavehr/callbacks/__init__.py +73 -0
- weavehr/callbacks/_callbacks/__init__.py +0 -0
- weavehr/callbacks/_callbacks/algebra.py +170 -0
- weavehr/callbacks/_callbacks/comparison.py +64 -0
- weavehr/callbacks/_callbacks/conditional.py +34 -0
- weavehr/callbacks/_callbacks/filter.py +57 -0
- weavehr/callbacks/_callbacks/logical.py +33 -0
- weavehr/callbacks/_callbacks/reshape.py +28 -0
- weavehr/callbacks/_callbacks/selector.py +113 -0
- weavehr/callbacks/_callbacks/shortcuts.py +41 -0
- weavehr/callbacks/_callbacks/string.py +125 -0
- weavehr/callbacks/_callbacks/time.py +168 -0
- weavehr/callbacks/_callbacks/type.py +61 -0
- weavehr/callbacks/interpreter.py +143 -0
- weavehr/callbacks/proto.py +42 -0
- weavehr/callbacks/registry.py +103 -0
- weavehr/config/__init__.py +5 -0
- weavehr/config/base.py +198 -0
- weavehr/config/inheritance.py +161 -0
- weavehr/config/registry.py +313 -0
- weavehr/configs/concepts/blood_gas/CO2_partial_pressure.yml +6 -0
- weavehr/configs/concepts/blood_gas/O2_partial_pressure.yml +6 -0
- weavehr/configs/concepts/blood_gas/base_excess.yml +6 -0
- weavehr/configs/concepts/blood_gas/calcium_ionized.yml +6 -0
- weavehr/configs/concepts/blood_gas/carboxyhemoglobin.yml +6 -0
- weavehr/configs/concepts/blood_gas/fraction_of_inspired_oxygen.yml +6 -0
- weavehr/configs/concepts/blood_gas/lactate.yml +6 -0
- weavehr/configs/concepts/blood_gas/methemoglobin.yml +6 -0
- weavehr/configs/concepts/blood_gas/pH_of_blood.yml +6 -0
- weavehr/configs/concepts/blood_gas/totcal_CO2.yml +6 -0
- weavehr/configs/concepts/chemistry/C_reactive_protein.yml +6 -0
- weavehr/configs/concepts/chemistry/alanine_aminotransferase.yml +6 -0
- weavehr/configs/concepts/chemistry/albumin.yml +6 -0
- weavehr/configs/concepts/chemistry/alkaline_phosphatase.yml +6 -0
- weavehr/configs/concepts/chemistry/aspartate_aminotransferase.yml +6 -0
- weavehr/configs/concepts/chemistry/bicarbonate.yml +6 -0
- weavehr/configs/concepts/chemistry/bilirubin_direct.yml +6 -0
- weavehr/configs/concepts/chemistry/blood_urea_nitrogen.yml +6 -0
- weavehr/configs/concepts/chemistry/calcium.yml +6 -0
- weavehr/configs/concepts/chemistry/chloride.yml +6 -0
- weavehr/configs/concepts/chemistry/creatine_kinase.yml +6 -0
- weavehr/configs/concepts/chemistry/creatine_kinase_MB.yml +6 -0
- weavehr/configs/concepts/chemistry/creatinine.yml +6 -0
- weavehr/configs/concepts/chemistry/glucose.yml +6 -0
- weavehr/configs/concepts/chemistry/magnesium.yml +6 -0
- weavehr/configs/concepts/chemistry/phosphate.yml +6 -0
- weavehr/configs/concepts/chemistry/potassium.yml +6 -0
- weavehr/configs/concepts/chemistry/sodium.yml +6 -0
- weavehr/configs/concepts/chemistry/total_bilirubin.yml +6 -0
- weavehr/configs/concepts/chemistry/troponin_I.yml +6 -0
- weavehr/configs/concepts/chemistry/troponin_t.yml +6 -0
- weavehr/configs/concepts/demographics/patient_admission_type.yml +6 -0
- weavehr/configs/concepts/demographics/patient_age.yml +6 -0
- weavehr/configs/concepts/demographics/patient_height.yml +6 -0
- weavehr/configs/concepts/demographics/patient_sex.yml +6 -0
- weavehr/configs/concepts/demographics/patient_weight.yml +6 -0
- weavehr/configs/concepts/hematology/Hemoglobin_A1C.yml +6 -0
- weavehr/configs/concepts/hematology/band_form_neutrophils.yml +6 -0
- weavehr/configs/concepts/hematology/basophils.yml +6 -0
- weavehr/configs/concepts/hematology/eosinophils.yml +6 -0
- weavehr/configs/concepts/hematology/erythrocyte_distribution_width.yml +6 -0
- weavehr/configs/concepts/hematology/erythrocyte_sedimentation_rate.yml +6 -0
- weavehr/configs/concepts/hematology/fibrinogen.yml +6 -0
- weavehr/configs/concepts/hematology/hematocrit.yml +6 -0
- weavehr/configs/concepts/hematology/hemoglobin.yml +6 -0
- weavehr/configs/concepts/hematology/lymphocytes.yml +6 -0
- weavehr/configs/concepts/hematology/mean_corpuscular_hemoglobin.yml +6 -0
- weavehr/configs/concepts/hematology/mean_corpuscular_hemoglobin_concentration.yml +6 -0
- weavehr/configs/concepts/hematology/mean_corpuscular_volume.yml +6 -0
- weavehr/configs/concepts/hematology/neutrophils.yml +6 -0
- weavehr/configs/concepts/hematology/partial_thromboplastin_time.yml +6 -0
- weavehr/configs/concepts/hematology/platelet_count.yml +6 -0
- weavehr/configs/concepts/hematology/prothrombin_time_international_normalized_ratio.yml +6 -0
- weavehr/configs/concepts/hematology/prothrombine_time.yml +6 -0
- weavehr/configs/concepts/hematology/red_blood_cell_count.yml +6 -0
- weavehr/configs/concepts/hematology/white_blood_cell_count.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_atelectasis.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_cardiomegaly.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_consolidation.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_edema.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_enlarged_cardiomediastinum.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_fracture.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_lung_lesion.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_lung_opacity.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_no_finding.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_pleural_effusion.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_pleural_other.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_pneumonia.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_pneumothorax.yml +6 -0
- weavehr/configs/concepts/image_diagnostics/chest_xray_support_devices.yml +6 -0
- weavehr/configs/concepts/imaging/chest_xray_image.yml +6 -0
- weavehr/configs/concepts/imaging/chest_xray_letter.yml +6 -0
- weavehr/configs/concepts/imaging/chest_xray_position.yml +6 -0
- weavehr/configs/concepts/imaging/chest_xray_procedure.yml +6 -0
- weavehr/configs/concepts/medications/antibiotics.yml +6 -0
- weavehr/configs/concepts/medications/corticosteroids.yml +6 -0
- weavehr/configs/concepts/medications/dextrose_as_D10.yml +6 -0
- weavehr/configs/concepts/medications/dobutamine_duration.yml +6 -0
- weavehr/configs/concepts/medications/dobutamine_rate.yml +6 -0
- weavehr/configs/concepts/medications/dopamine_duration.yml +6 -0
- weavehr/configs/concepts/medications/dopamine_rate.yml +6 -0
- weavehr/configs/concepts/medications/epinephrine_duration.yml +6 -0
- weavehr/configs/concepts/medications/epinephrine_rate.yml +6 -0
- weavehr/configs/concepts/medications/insulin.yml +6 -0
- weavehr/configs/concepts/medications/norepinephrine_duration.yml +6 -0
- weavehr/configs/concepts/medications/norepinephrine_rate.yml +6 -0
- weavehr/configs/concepts/medications/phenylephrine_rate.yml +6 -0
- weavehr/configs/concepts/medications/vasopressin_rate.yml +6 -0
- weavehr/configs/concepts/microbiology/body_fluid_sampling.yml +6 -0
- weavehr/configs/concepts/neurological/Richmond_agitation_sedation_scale.yml +6 -0
- weavehr/configs/concepts/neurological/gcs_eye.yml +6 -0
- weavehr/configs/concepts/neurological/gcs_motor.yml +6 -0
- weavehr/configs/concepts/neurological/gcs_total.yml +6 -0
- weavehr/configs/concepts/neurological/gcs_verbal.yml +6 -0
- weavehr/configs/concepts/outcome/ICU_length_of_stay.yml +6 -0
- weavehr/configs/concepts/outcome/aki.yml +5 -0
- weavehr/configs/concepts/outcome/aki_creatinine.yml +5 -0
- weavehr/configs/concepts/outcome/aki_urine_output.yml +5 -0
- weavehr/configs/concepts/outcome/hospital_length_of_stay.yml +6 -0
- weavehr/configs/concepts/outcome/in_hospital_mortality.yml +6 -0
- weavehr/configs/concepts/outcome/sofa.yml +5 -0
- weavehr/configs/concepts/outcome/sofa_cardiovascular.yml +5 -0
- weavehr/configs/concepts/outcome/sofa_cns.yml +5 -0
- weavehr/configs/concepts/outcome/sofa_coagulation.yml +5 -0
- weavehr/configs/concepts/outcome/sofa_liver.yml +5 -0
- weavehr/configs/concepts/outcome/sofa_renal.yml +5 -0
- weavehr/configs/concepts/outcome/sofa_respiratory.yml +5 -0
- weavehr/configs/concepts/output/urine_output.yml +6 -0
- weavehr/configs/concepts/respiratory/arterial_oxygen_saturation.yml +6 -0
- weavehr/configs/concepts/respiratory/mechanical_ventilation_windows.yml +6 -0
- weavehr/configs/concepts/respiratory/oxygen_saturation.yml +6 -0
- weavehr/configs/concepts/respiratory/respiratory_rate.yml +6 -0
- weavehr/configs/concepts/respiratory/tracheostomy.yml +6 -0
- weavehr/configs/concepts/respiratory/ventilation_end.yml +6 -0
- weavehr/configs/concepts/respiratory/ventilation_start.yml +6 -0
- weavehr/configs/concepts/text/discharge_note.yml +6 -0
- weavehr/configs/concepts/text/radiology_note.yml +6 -0
- weavehr/configs/concepts/vitals/diastolic_blood_pressure.yml +6 -0
- weavehr/configs/concepts/vitals/endtidal_CO2.yml +6 -0
- weavehr/configs/concepts/vitals/heart_rate.yml +6 -0
- weavehr/configs/concepts/vitals/mean_arterial_pressure.yml +6 -0
- weavehr/configs/concepts/vitals/systolic_blood_pressure.yml +6 -0
- weavehr/configs/concepts/vitals/temperature.yml +6 -0
- weavehr/configs/datasets/aumc/1.5.0/extends.yml +6 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/CO2_partial_pressure.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/C_reactive_protein.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/Hemoglobin_A1C.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/O2_partial_pressure.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/Richmond_agitation_sedation_scale.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/alanine_aminotransferase.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/albumin.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/alkaline_phosphatase.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/aspartate_aminotransferase.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/band_form_neutrophils.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/base_excess.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/basophils.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/bicarbonate.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/bilirubin_direct.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/blood_urea_nitrogen.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/calcium.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/calcium_ionized.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/chloride.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/creatine_kinase.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/creatine_kinase_MB.yml +13 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/creatinine.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/diastolic_blood_pressure.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/endtidal_CO2.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/eosinophils.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/erythrocyte_sedimentation_rate.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/fibrinogen.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/fraction_of_inspired_oxygen.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/gcs_eye.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/gcs_motor.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/gcs_verbal.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/glucose.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/heart_rate.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/hematocrit.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/hemoglobin.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/lactate.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/lymphocytes.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/magnesium.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/mean_arterial_pressure.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/mean_corpuscular_hemoglobin.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/mean_corpuscular_hemoglobin_concentration.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/mean_corpuscular_volume.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/methemoglobin.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/neutrophils.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/oxygen_saturation.yml +21 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/pH_of_blood.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/partial_thromboplastin_time.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/phosphate.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/platelet_count.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/potassium.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/prothrombin_time_international_normalized_ratio.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/prothrombine_time.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/red_blood_cell_count.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/respiratory_rate.yml +13 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/sodium.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/systolic_blood_pressure.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/temperature.yml +17 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/total_bilirubin.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/troponin_t.yml +12 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/urine_output.yml +14 -0
- weavehr/configs/datasets/aumc/1.5.0/mappings/white_blood_cell_count.yml +11 -0
- weavehr/configs/datasets/aumc/1.5.0/tables/drug_exposure.yml +1 -0
- weavehr/configs/datasets/aumc/1.5.0/tables/measurement.yml +1 -0
- weavehr/configs/datasets/aumc/1.5.0/tables/observation.yml +1 -0
- weavehr/configs/datasets/aumc/1.5.0/tables/procedure_occurrence.yml +1 -0
- weavehr/configs/datasets/aumc/README.md +98 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/CO2_partial_pressure.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/C_reactive_protein.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/O2_partial_pressure.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/Richmond_agitation_sedation_scale.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/aki.yml +5 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/aki_creatinine.yml +4 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/aki_urine_output.yml +5 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/alanine_aminotransferase.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/albumin.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/alkaline_phosphatase.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/antibiotics.yml +16 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/arterial_oxygen_saturation.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/aspartate_aminotransferase.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/band_form_neutrophils.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/base_excess.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/basophils.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/bicarbonate.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/bilirubin_direct.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/blood_urea_nitrogen.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/calcium.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/calcium_ionized.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/carboxyhemoglobin.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/chloride.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/creatine_kinase.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/creatine_kinase_MB.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/creatinine.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/dextrose_as_D10.yml +16 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/diastolic_blood_pressure.yml +11 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/dobutamine_rate.yml +11 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/dopamine_rate.yml +11 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/eosinophils.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/epinephrine_rate.yml +11 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/erythrocyte_distribution_width.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/fibrinogen.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/fraction_of_inspired_oxygen.yml +16 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/gcs_eye.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/gcs_motor.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/gcs_total.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/gcs_verbal.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/glucose.yml +16 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/heart_rate.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/hematocrit.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/hemoglobin.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/in_hospital_mortality.yml +8 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/insulin.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/lactate.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/lymphocytes.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/magnesium.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/mean_arterial_pressure.yml +14 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/mean_corpuscular_hemoglobin.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/mean_corpuscular_hemoglobin_concentration.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/mean_corpuscular_volume.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/methemoglobin.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/neutrophils.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/norepinephrine_rate.yml +11 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/oxygen_saturation.yml +16 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/pH_of_blood.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/partial_thromboplastin_time.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/patient_admission_type.yml +8 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/patient_age.yml +10 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/patient_height.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/patient_sex.yml +8 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/patient_weight.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/phenylephrine_rate.yml +11 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/phosphate.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/platelet_count.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/potassium.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/prothrombin_time_international_normalized_ratio.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/prothrombine_time.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/red_blood_cell_count.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/respiratory_rate.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/sodium.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/sofa.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/sofa_cardiovascular.yml +8 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/sofa_cns.yml +4 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/sofa_coagulation.yml +4 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/sofa_liver.yml +4 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/sofa_renal.yml +5 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/sofa_respiratory.yml +6 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/systolic_blood_pressure.yml +11 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/temperature.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/total_bilirubin.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/totcal_CO2.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/troponin_I.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/troponin_t.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/urine_output.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/vasopressin_rate.yml +11 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/ventilation_end.yml +10 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/ventilation_start.yml +10 -0
- weavehr/configs/datasets/eicu-crd/2.0/mappings/white_blood_cell_count.yml +9 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/admissiondx.yml +58 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/diagnosis.yml +62 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/infusiondrug.yml +73 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/intakeoutput.yml +69 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/lab.yml +65 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/medication.yml +70 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/nursecharting.yml +61 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/patient.yml +181 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/respiratorycare.yml +81 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/respiratorycharting.yml +61 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/treatment.yml +46 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/vitalaperiodic.yml +154 -0
- weavehr/configs/datasets/eicu-crd/2.0/tables/vitalperiodic.yml +206 -0
- weavehr/configs/datasets/eicu-crd/README.md +26 -0
- weavehr/configs/datasets/eicu-demo/2.0/extends.yml +2 -0
- weavehr/configs/datasets/eicu-demo/2.0/tables/infusiondrug.yml +4 -0
- weavehr/configs/datasets/eicu-demo/README.md +23 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/CO2_partial_pressure.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/C_reactive_protein.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/O2_partial_pressure.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/Richmond_agitation_sedation_scale.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/alanine_aminotransferase.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/albumin.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/alkaline_phosphatase.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/arterial_oxygen_saturation.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/aspartate_aminotransferase.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/band_form_neutrophils.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/base_excess.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/bicarbonate.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/bilirubin_direct.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/blood_urea_nitrogen.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/calcium.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/calcium_ionized.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/carboxyhemoglobin.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/chloride.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/creatine_kinase.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/creatine_kinase_MB.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/creatinine.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/diastolic_blood_pressure.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/endtidal_CO2.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/erythrocyte_sedimentation_rate.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/fibrinogen.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/fraction_of_inspired_oxygen.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/gcs_eye.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/gcs_motor.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/gcs_verbal.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/glucose.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/heart_rate.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/hemoglobin.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/in_hospital_mortality.yml +9 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/lactate.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/magnesium.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/mean_arterial_pressure.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/mean_corpuscular_hemoglobin.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/mean_corpuscular_hemoglobin_concentration.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/mean_corpuscular_volume.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/methemoglobin.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/neutrophils.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/oxygen_saturation.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/pH_of_blood.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/partial_thromboplastin_time.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/patient_age.yml +9 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/patient_height.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/patient_sex.yml +9 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/patient_weight.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/phosphate.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/platelet_count.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/potassium.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/prothrombin_time_international_normalized_ratio.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/respiratory_rate.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/sodium.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/systolic_blood_pressure.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/temperature.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/total_bilirubin.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/troponin_t.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/mappings/white_blood_cell_count.yml +10 -0
- weavehr/configs/datasets/hirid/1.1.1/tables/general.yml +71 -0
- weavehr/configs/datasets/hirid/1.1.1/tables/observations.yml +79 -0
- weavehr/configs/datasets/hirid/1.1.1/tables/pharma.yml +75 -0
- weavehr/configs/datasets/hirid/README.md +98 -0
- weavehr/configs/datasets/mimic-cxr/2.0/mappings/chest_xray_image.yml +8 -0
- weavehr/configs/datasets/mimic-cxr/2.0/mappings/chest_xray_letter.yml +8 -0
- weavehr/configs/datasets/mimic-cxr/2.0/tables/cxr_record_list.yml +27 -0
- weavehr/configs/datasets/mimic-cxr/2.0/tables/cxr_study_list.yml +24 -0
- weavehr/configs/datasets/mimic-cxr/2.1/extends.yml +3 -0
- weavehr/configs/datasets/mimic-cxr/README.md +26 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_atelectasis.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_cardiomegaly.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_consolidation.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_edema.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_enlarged_cardiomediastinum.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_fracture.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_image.yml +8 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_lung_lesion.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_lung_opacity.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_no_finding.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_pleural_effusion.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_pleural_other.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_pneumonia.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_pneumothorax.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_position.yml +7 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_procedure.yml +7 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/mappings/chest_xray_support_devices.yml +14 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/tables/chexpert.yml +179 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/tables/metadata.yml +59 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.0/tables/negbio.yml +179 -0
- weavehr/configs/datasets/mimic-cxr-jpg/2.1/extends.yml +3 -0
- weavehr/configs/datasets/mimic-cxr-jpg/README.md +26 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/CO2_partial_pressure.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/C_reactive_protein.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/Hemoglobin_A1C.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/O2_partial_pressure.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/Richmond_agitation_sedation_scale.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/aki.yml +5 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/aki_creatinine.yml +4 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/aki_urine_output.yml +5 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/alanine_aminotransferase.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/albumin.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/alkaline_phosphatase.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/antibiotics.yml +21 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/arterial_oxygen_saturation.yml +23 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/aspartate_aminotransferase.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/band_form_neutrophils.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/base_excess.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/basophils.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/bicarbonate.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/bilirubin_direct.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/blood_urea_nitrogen.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/body_fluid_sampling.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/calcium.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/calcium_ionized.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/chloride.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/creatine_kinase.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/creatine_kinase_MB.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/creatinine.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/dextrose_as_D10.yml +23 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/diastolic_blood_pressure.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/dobutamine_duration.yml +12 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/dobutamine_rate.yml +31 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/dopamine_duration.yml +12 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/dopamine_rate.yml +31 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/endtidal_CO2.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/eosinophils.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/epinephrine_duration.yml +12 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/epinephrine_rate.yml +31 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/erythrocyte_distribution_width.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/erythrocyte_sedimentation_rate.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/fibrinogen.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/fraction_of_inspired_oxygen.yml +16 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/gcs_eye.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/gcs_motor.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/gcs_total.yml +29 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/gcs_verbal.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/glucose.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/heart_rate.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/hematocrit.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/hemoglobin.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/in_hospital_mortality.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/insulin.yml +12 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/lactate.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/lymphocytes.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/magnesium.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/mean_arterial_pressure.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/mean_corpuscular_hemoglobin.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/mean_corpuscular_hemoglobin_concentration.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/mean_corpuscular_volume.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/mechanical_ventilation_windows.yml +18 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/methemoglobin.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/neutrophils.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/norepinephrine_duration.yml +11 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/norepinephrine_rate.yml +31 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/oxygen_saturation.yml +12 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/pH_of_blood.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/partial_thromboplastin_time.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/patient_admission_type.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/patient_age.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/patient_height.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/patient_sex.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/patient_weight.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/phenylephrine_rate.yml +31 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/phosphate.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/platelet_count.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/potassium.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/prothrombin_time_international_normalized_ratio.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/prothrombine_time.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/red_blood_cell_count.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/respiratory_rate.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/sodium.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/sofa.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/sofa_cardiovascular.yml +8 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/sofa_cns.yml +4 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/sofa_coagulation.yml +4 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/sofa_liver.yml +4 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/sofa_renal.yml +5 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/sofa_respiratory.yml +6 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/systolic_blood_pressure.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/temperature.yml +18 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/total_bilirubin.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/totcal_CO2.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/tracheostomy.yml +19 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/troponin_I.yml +11 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/troponin_t.yml +11 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/urine_output.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/vasopressin_rate.yml +18 -0
- weavehr/configs/datasets/mimic-iv/2.2/mappings/white_blood_cell_count.yml +9 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/README.md +0 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/admissions.yml +135 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/chartevents.yml +68 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/datetimeevents.yml +66 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/diagnoses_icd.yml +66 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/drgcodes.yml +55 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/emar.yml +59 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/hcpcsevents.yml +69 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/icustay.yml +61 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/inputevents.yml +136 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/labevents.yml +86 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/microbiologyevents.yml +128 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/omr.yml +33 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/outputevents.yml +61 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/patients.yml +84 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/prescriptions.yml +99 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/procedureevents.yml +119 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/procedures_icd.yml +71 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/services.yml +32 -0
- weavehr/configs/datasets/mimic-iv/2.2/tables/transfers.yml +41 -0
- weavehr/configs/datasets/mimic-iv/3.1/extends.yml +5 -0
- weavehr/configs/datasets/mimic-iv/README.md +30 -0
- weavehr/configs/datasets/mimic-iv-demo/2.2/extends.yml +5 -0
- weavehr/configs/datasets/mimic-iv-demo/2.2/tables/procedureevents.yml +60 -0
- weavehr/configs/datasets/mimic-iv-demo/README.md +23 -0
- weavehr/configs/datasets/mimic-iv-note/2.2/mappings/discharge_note.yml +8 -0
- weavehr/configs/datasets/mimic-iv-note/2.2/mappings/radiology_note.yml +8 -0
- weavehr/configs/datasets/mimic-iv-note/2.2/tables/discharge.yml +36 -0
- weavehr/configs/datasets/mimic-iv-note/2.2/tables/radiology.yml +36 -0
- weavehr/configs/datasets/mimic-iv-note/README.md +24 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/C_reactive_protein.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/Hemoglobin_A1C.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/alanine_aminotransferase.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/albumin.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/alkaline_phosphatase.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/arterial_oxygen_saturation.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/aspartate_aminotransferase.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/basophils.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/bilirubin_direct.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/blood_urea_nitrogen.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/calcium.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/calcium_ionized.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/chloride.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/creatine_kinase.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/creatine_kinase_MB.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/creatinine.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/diastolic_blood_pressure.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/eosinophils.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/erythrocyte_distribution_width.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/fibrinogen.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/fraction_of_inspired_oxygen.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/glucose.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/heart_rate.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/hematocrit.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/hemoglobin.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/in_hospital_mortality.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/lactate.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/lymphocytes.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/magnesium.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/mean_corpuscular_hemoglobin.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/mean_corpuscular_hemoglobin_concentration.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/mean_corpuscular_volume.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/methemoglobin.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/neutrophils.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/oxygen_saturation.yml +17 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/pH_of_blood.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/partial_thromboplastin_time.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/patient_age.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/patient_height.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/patient_sex.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/patient_weight.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/phosphate.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/platelet_count.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/potassium.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/prothrombin_time_international_normalized_ratio.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/prothrombine_time.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/red_blood_cell_count.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/respiratory_rate.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/sodium.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/systolic_blood_pressure.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/temperature.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/total_bilirubin.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/totcal_CO2.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/troponin_I.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/troponin_t.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/mappings/white_blood_cell_count.yml +9 -0
- weavehr/configs/datasets/nwicu/0.1.0/tables/admissions.yml +133 -0
- weavehr/configs/datasets/nwicu/0.1.0/tables/chartevents.yml +63 -0
- weavehr/configs/datasets/nwicu/0.1.0/tables/diagnoses_icd.yml +62 -0
- weavehr/configs/datasets/nwicu/0.1.0/tables/emar.yml +61 -0
- weavehr/configs/datasets/nwicu/0.1.0/tables/icustay.yml +66 -0
- weavehr/configs/datasets/nwicu/0.1.0/tables/labevents.yml +85 -0
- weavehr/configs/datasets/nwicu/0.1.0/tables/patients.yml +58 -0
- weavehr/configs/datasets/nwicu/0.1.0/tables/prescriptions.yml +81 -0
- weavehr/configs/datasets/nwicu/0.1.0/tables/procedureevents.yml +109 -0
- weavehr/configs/datasets/nwicu/README.md +19 -0
- weavehr/configs/datasets/omop/5.4/tables/condition_occurrence.yml +72 -0
- weavehr/configs/datasets/omop/5.4/tables/death.yml +44 -0
- weavehr/configs/datasets/omop/5.4/tables/device_exposure.yml +84 -0
- weavehr/configs/datasets/omop/5.4/tables/drug_exposure.yml +90 -0
- weavehr/configs/datasets/omop/5.4/tables/measurement.yml +76 -0
- weavehr/configs/datasets/omop/5.4/tables/observation.yml +75 -0
- weavehr/configs/datasets/omop/5.4/tables/observation_period.yml +44 -0
- weavehr/configs/datasets/omop/5.4/tables/person.yml +70 -0
- weavehr/configs/datasets/omop/5.4/tables/procedure_occurrence.yml +73 -0
- weavehr/configs/datasets/omop/5.4/tables/specimen.yml +69 -0
- weavehr/configs/datasets/omop/5.4/tables/visit_occurrence.yml +85 -0
- weavehr/configs/datasets/omop/README.md +71 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/CO2_partial_pressure.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/O2_partial_pressure.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/alanine_aminotransferase.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/albumin.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/alkaline_phosphatase.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/arterial_oxygen_saturation.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/aspartate_aminotransferase.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/base_excess.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/basophils.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/bicarbonate.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/bilirubin_direct.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/blood_urea_nitrogen.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/calcium.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/calcium_ionized.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/chloride.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/creatine_kinase.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/creatine_kinase_MB.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/creatinine.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/diastolic_blood_pressure.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/eosinophils.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/erythrocyte_distribution_width.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/fibrinogen.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/fraction_of_inspired_oxygen.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/glucose.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/heart_rate.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/hematocrit.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/hemoglobin.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/lactate.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/lymphocytes.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/magnesium.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/mean_arterial_pressure.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/mean_corpuscular_hemoglobin.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/mean_corpuscular_hemoglobin_concentration.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/mean_corpuscular_volume.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/neutrophils.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/oxygen_saturation.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/pH_of_blood.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/partial_thromboplastin_time.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/patient_age.yml +9 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/patient_height.yml +9 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/patient_sex.yml +9 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/patient_weight.yml +9 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/phosphate.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/platelet_count.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/potassium.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/prothrombine_time.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/red_blood_cell_count.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/respiratory_rate.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/sodium.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/systolic_blood_pressure.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/temperature.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/total_bilirubin.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/troponin_t.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/urine_output.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/mappings/white_blood_cell_count.yml +10 -0
- weavehr/configs/datasets/sic/1.0.6/tables/cases.yml +104 -0
- weavehr/configs/datasets/sic/1.0.6/tables/data_float_h.yml +92 -0
- weavehr/configs/datasets/sic/1.0.6/tables/laboratory.yml +89 -0
- weavehr/configs/datasets/sic/1.0.6/tables/medication.yml +90 -0
- weavehr/configs/datasets/sic/1.0.7/extends.yml +7 -0
- weavehr/configs/datasets/sic/1.0.8/extends.yml +5 -0
- weavehr/configs/datasets/sic/README.md +95 -0
- weavehr/logging.py +129 -0
- weavehr/py.typed +0 -0
- weavehr/steps/__init__.py +5 -0
- weavehr/steps/base/__init__.py +5 -0
- weavehr/steps/base/config.py +51 -0
- weavehr/steps/base/step.py +223 -0
- weavehr/steps/concept/__init__.py +6 -0
- weavehr/steps/concept/config/__init__.py +5 -0
- weavehr/steps/concept/config/complex.py +56 -0
- weavehr/steps/concept/config/concept.py +145 -0
- weavehr/steps/concept/config/derived.py +103 -0
- weavehr/steps/concept/config/simple.py +59 -0
- weavehr/steps/concept/config/step.py +50 -0
- weavehr/steps/concept/registry.py +24 -0
- weavehr/steps/concept/step.py +710 -0
- weavehr/steps/concept/transformer/__init__.py +0 -0
- weavehr/steps/concept/transformer/aki.py +219 -0
- weavehr/steps/concept/transformer/base.py +225 -0
- weavehr/steps/concept/transformer/sofa.py +249 -0
- weavehr/steps/concept/transformer/windowed.py +572 -0
- weavehr/steps/extraction/__init__.py +6 -0
- weavehr/steps/extraction/config/__init__.py +6 -0
- weavehr/steps/extraction/config/column.py +37 -0
- weavehr/steps/extraction/config/dtype.py +29 -0
- weavehr/steps/extraction/config/event.py +206 -0
- weavehr/steps/extraction/config/step.py +70 -0
- weavehr/steps/extraction/config/table.py +249 -0
- weavehr/steps/extraction/registry.py +24 -0
- weavehr/steps/extraction/step.py +536 -0
- weavehr/steps/persistence/__init__.py +1 -0
- weavehr/steps/persistence/step.py +217 -0
- weavehr/steps/sharding/__init__.py +0 -0
- weavehr/steps/sharding/config/__init__.py +1 -0
- weavehr/steps/sharding/config/sharding.py +13 -0
- weavehr/steps/sharding/config/step.py +57 -0
- weavehr/steps/sharding/registry.py +23 -0
- weavehr/steps/sharding/step.py +151 -0
- weavehr/storage/__init__.py +5 -0
- weavehr/storage/base.py +68 -0
- weavehr/storage/meds.py +138 -0
- weavehr/storage/project.py +194 -0
- weavehr/storage/workspace.py +26 -0
- weavehr/utils/__init__.py +5 -0
- weavehr/utils/importer.py +44 -0
- weavehr/utils/loader.py +44 -0
- weavehr/utils/name.py +15 -0
- weavehr/utils/type.py +42 -0
- weavehr-0.0.1.dist-info/METADATA +322 -0
- weavehr-0.0.1.dist-info/RECORD +726 -0
- weavehr-0.0.1.dist-info/WHEEL +4 -0
- weavehr-0.0.1.dist-info/licenses/LICENSE +21 -0
weavehr/__init__.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""
|
|
2
|
+
WeavEHR: A Python framework for extracting and analyzing ICU time series data.
|
|
3
|
+
|
|
4
|
+
This package provides tools for extracting, preprocessing, and analyzing ICU time
|
|
5
|
+
series data from diverse datasets (MIMIC, eICU, etc.). It converts heterogeneous
|
|
6
|
+
ICU data into the standardized MEDS (Medical Event Data Standard) format, enabling
|
|
7
|
+
reproducible research workflows.
|
|
8
|
+
|
|
9
|
+
Key Features:
|
|
10
|
+
- Support for multiple ICU data sources (MIMIC, eICU, custom datasets)
|
|
11
|
+
- Declarative YAML-based configuration for data extraction
|
|
12
|
+
- Export to MEDS format for standardized analysis
|
|
13
|
+
- Fully offline operation for medical data privacy compliance
|
|
14
|
+
- Modular and extensible architecture
|
|
15
|
+
|
|
16
|
+
Main Modules:
|
|
17
|
+
- callbacks: Data transformation callbacks for LazyFrames
|
|
18
|
+
- config: Configuration management and registry system
|
|
19
|
+
- storage: Project, dataset, and workspace management
|
|
20
|
+
- steps: Processing steps (extraction, concept, sharding)
|
|
21
|
+
- utils: Utility functions and helpers
|
|
22
|
+
|
|
23
|
+
Usage:
|
|
24
|
+
```python
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
|
|
27
|
+
from weavehr import WeavEHRProject, ExtractionStep
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
config_path = Path.cwd() / "config"
|
|
31
|
+
project_path = Path.cwd() / "output" / "project"
|
|
32
|
+
|
|
33
|
+
# Create a new WeavEHR project
|
|
34
|
+
with WeavEHRProject(project_path) as project:
|
|
35
|
+
# Load and run an extraction step
|
|
36
|
+
extraction_step = ExtractionStep.load(project, config_path / "extraction.yml")
|
|
37
|
+
extraction_step.run()
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Author:
|
|
41
|
+
- Paul Brauckmann
|
|
42
|
+
- Tobias Laser
|
|
43
|
+
- Patrick Rockenschaub
|
|
44
|
+
- Christian Porschen
|
|
45
|
+
|
|
46
|
+
License:
|
|
47
|
+
```
|
|
48
|
+
MIT License
|
|
49
|
+
|
|
50
|
+
Copyright (c) 2023 AIDH MS
|
|
51
|
+
|
|
52
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
53
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
54
|
+
in the Software without restriction, including without limitation the rights
|
|
55
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
56
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
57
|
+
furnished to do so, subject to the following conditions:
|
|
58
|
+
|
|
59
|
+
The above copyright notice and this permission notice shall be included in all
|
|
60
|
+
copies or substantial portions of the Software.
|
|
61
|
+
|
|
62
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
63
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
64
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
65
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
66
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
67
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
68
|
+
SOFTWARE.
|
|
69
|
+
```
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
from weavehr.steps.concept.step import ConceptStep, concept_config_registry
|
|
73
|
+
from weavehr.steps.extraction.step import ExtractionStep, dataset_config_registry
|
|
74
|
+
from weavehr.steps.persistence.step import PersistenceStep
|
|
75
|
+
from weavehr.steps.sharding.step import ShardingStep, sharding_config_registry
|
|
76
|
+
from weavehr.storage.project import WeavEHRProject
|
|
77
|
+
from weavehr.utils.loader import auto_load_configs
|
|
78
|
+
|
|
79
|
+
auto_load_configs()
|
|
80
|
+
|
|
81
|
+
__all__ = [
|
|
82
|
+
"WeavEHRProject",
|
|
83
|
+
"PersistenceStep",
|
|
84
|
+
"ExtractionStep",
|
|
85
|
+
"ConceptStep",
|
|
86
|
+
"ShardingStep",
|
|
87
|
+
"auto_load_configs",
|
|
88
|
+
"dataset_config_registry",
|
|
89
|
+
"concept_config_registry",
|
|
90
|
+
"sharding_config_registry",
|
|
91
|
+
]
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from weavehr.callbacks._callbacks.algebra import (
|
|
2
|
+
Add,
|
|
3
|
+
Divide,
|
|
4
|
+
FloorDivide,
|
|
5
|
+
Modulo,
|
|
6
|
+
Multiply,
|
|
7
|
+
Pow,
|
|
8
|
+
Product,
|
|
9
|
+
Root,
|
|
10
|
+
Subtract,
|
|
11
|
+
Sum,
|
|
12
|
+
)
|
|
13
|
+
from weavehr.callbacks._callbacks.comparison import (
|
|
14
|
+
Equal,
|
|
15
|
+
GreaterEqual,
|
|
16
|
+
GreaterThan,
|
|
17
|
+
LessEqual,
|
|
18
|
+
LessThan,
|
|
19
|
+
NotEqual,
|
|
20
|
+
)
|
|
21
|
+
from weavehr.callbacks._callbacks.conditional import Replace
|
|
22
|
+
from weavehr.callbacks._callbacks.filter import DropIf, DropNa, FirstDistinct
|
|
23
|
+
from weavehr.callbacks._callbacks.logical import And, Not, Or
|
|
24
|
+
from weavehr.callbacks._callbacks.reshape import SplitExplode
|
|
25
|
+
from weavehr.callbacks._callbacks.selector import FirstNotNull, Max
|
|
26
|
+
from weavehr.callbacks._callbacks.shortcuts import Col, Const
|
|
27
|
+
from weavehr.callbacks._callbacks.string import ConcatStr, SliceStr, ZeroPadInt
|
|
28
|
+
from weavehr.callbacks._callbacks.time import AddOffset, ParseDateTime, SetTime, ToDatetime
|
|
29
|
+
from weavehr.callbacks._callbacks.type import Cast
|
|
30
|
+
from weavehr.callbacks.proto import CallbackProtocol
|
|
31
|
+
from weavehr.callbacks.registry import register_callback_cls, registry
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"registry",
|
|
35
|
+
"register_callback_cls",
|
|
36
|
+
"CallbackProtocol",
|
|
37
|
+
"DropNa",
|
|
38
|
+
"FirstDistinct",
|
|
39
|
+
"DropIf",
|
|
40
|
+
"ParseDateTime",
|
|
41
|
+
"ToDatetime",
|
|
42
|
+
"AddOffset",
|
|
43
|
+
"SetTime",
|
|
44
|
+
"FirstNotNull",
|
|
45
|
+
"Max",
|
|
46
|
+
"Add",
|
|
47
|
+
"Sum",
|
|
48
|
+
"Subtract",
|
|
49
|
+
"Multiply",
|
|
50
|
+
"Product",
|
|
51
|
+
"Divide",
|
|
52
|
+
"FloorDivide",
|
|
53
|
+
"Pow",
|
|
54
|
+
"Root",
|
|
55
|
+
"Modulo",
|
|
56
|
+
"GreaterThan",
|
|
57
|
+
"LessThan",
|
|
58
|
+
"GreaterEqual",
|
|
59
|
+
"LessEqual",
|
|
60
|
+
"Equal",
|
|
61
|
+
"NotEqual",
|
|
62
|
+
"And",
|
|
63
|
+
"Or",
|
|
64
|
+
"Not",
|
|
65
|
+
"Col",
|
|
66
|
+
"Const",
|
|
67
|
+
"Replace",
|
|
68
|
+
"Cast",
|
|
69
|
+
"SplitExplode",
|
|
70
|
+
"ZeroPadInt",
|
|
71
|
+
"SliceStr",
|
|
72
|
+
"ConcatStr",
|
|
73
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import operator
|
|
2
|
+
from typing import Optional, Sequence
|
|
3
|
+
|
|
4
|
+
import polars as pl
|
|
5
|
+
from polars import LazyFrame
|
|
6
|
+
|
|
7
|
+
from weavehr.callbacks.proto import AstValue, CallbackProtocol, CallbackResult, to_expr
|
|
8
|
+
from weavehr.callbacks.registry import register_callback_cls
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@register_callback_cls
|
|
12
|
+
class Add(CallbackProtocol):
|
|
13
|
+
def __init__(self, augend: AstValue, addend: AstValue, output: Optional[str] = None) -> None:
|
|
14
|
+
self.augend = augend
|
|
15
|
+
self.addend = addend
|
|
16
|
+
self.output = output
|
|
17
|
+
|
|
18
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
19
|
+
expr = to_expr(lf, self.augend) + to_expr(lf, self.addend)
|
|
20
|
+
if self.output is None:
|
|
21
|
+
return expr
|
|
22
|
+
return expr.alias(self.output)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@register_callback_cls
|
|
26
|
+
class Sum(CallbackProtocol):
|
|
27
|
+
def __init__(self, *summands: AstValue, output: Optional[str] = None) -> None:
|
|
28
|
+
if len(summands) == 1 and isinstance(summands[0], list):
|
|
29
|
+
self.summands: Sequence[AstValue] = summands[0]
|
|
30
|
+
else:
|
|
31
|
+
self.summands = summands
|
|
32
|
+
self.output = output
|
|
33
|
+
|
|
34
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
35
|
+
exprs = [to_expr(lf, s) for s in self.summands]
|
|
36
|
+
|
|
37
|
+
if not exprs:
|
|
38
|
+
expr = pl.lit(0)
|
|
39
|
+
if self.output is None:
|
|
40
|
+
return expr
|
|
41
|
+
return expr.alias(self.output)
|
|
42
|
+
|
|
43
|
+
expr = pl.sum_horizontal(exprs)
|
|
44
|
+
if self.output is None:
|
|
45
|
+
return expr
|
|
46
|
+
return expr.alias(self.output)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@register_callback_cls
|
|
50
|
+
class Subtract(CallbackProtocol):
|
|
51
|
+
def __init__(self, minuend: AstValue, subtrahend: AstValue, output: Optional[str] = None) -> None:
|
|
52
|
+
self.minuend = minuend
|
|
53
|
+
self.subtrahend = subtrahend
|
|
54
|
+
self.output = output
|
|
55
|
+
|
|
56
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
57
|
+
expr = to_expr(lf, self.minuend) - to_expr(lf, self.subtrahend)
|
|
58
|
+
if self.output is None:
|
|
59
|
+
return expr
|
|
60
|
+
return expr.alias(self.output)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@register_callback_cls
|
|
64
|
+
class Multiply(CallbackProtocol):
|
|
65
|
+
def __init__(self, multiplicand: AstValue, multiplier: AstValue, output: Optional[str] = None) -> None:
|
|
66
|
+
self.multiplicand = multiplicand
|
|
67
|
+
self.multiplier = multiplier
|
|
68
|
+
self.output = output
|
|
69
|
+
|
|
70
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
71
|
+
expr = to_expr(lf, self.multiplicand) * to_expr(lf, self.multiplier)
|
|
72
|
+
if self.output is None:
|
|
73
|
+
return expr
|
|
74
|
+
return expr.alias(self.output)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@register_callback_cls
|
|
78
|
+
class Product(CallbackProtocol):
|
|
79
|
+
def __init__(self, *factors: AstValue, output: Optional[str] = None) -> None:
|
|
80
|
+
if len(factors) == 1 and isinstance(factors[0], list):
|
|
81
|
+
self.factors: Sequence[AstValue] = factors[0]
|
|
82
|
+
else:
|
|
83
|
+
self.factors = factors
|
|
84
|
+
self.output = output
|
|
85
|
+
|
|
86
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
87
|
+
exprs = [to_expr(lf, f) for f in self.factors]
|
|
88
|
+
|
|
89
|
+
if not exprs:
|
|
90
|
+
expr = pl.lit(1)
|
|
91
|
+
if self.output is None:
|
|
92
|
+
return expr
|
|
93
|
+
return expr.alias(self.output)
|
|
94
|
+
|
|
95
|
+
expr = pl.fold(acc=pl.lit(1), function=operator.mul, exprs=exprs)
|
|
96
|
+
if self.output is None:
|
|
97
|
+
return expr
|
|
98
|
+
return expr.alias(self.output)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@register_callback_cls
|
|
102
|
+
class Divide(CallbackProtocol):
|
|
103
|
+
def __init__(self, dividend: AstValue, divisor: AstValue, output: Optional[str] = None) -> None:
|
|
104
|
+
self.dividend = dividend
|
|
105
|
+
self.divisor = divisor
|
|
106
|
+
self.output = output
|
|
107
|
+
|
|
108
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
109
|
+
expr = to_expr(lf, self.dividend) / to_expr(lf, self.divisor)
|
|
110
|
+
if self.output is None:
|
|
111
|
+
return expr
|
|
112
|
+
return expr.alias(self.output)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@register_callback_cls
|
|
116
|
+
class FloorDivide(CallbackProtocol):
|
|
117
|
+
def __init__(self, dividend: AstValue, divisor: AstValue, output: Optional[str] = None) -> None:
|
|
118
|
+
self.dividend = dividend
|
|
119
|
+
self.divisor = divisor
|
|
120
|
+
self.output = output
|
|
121
|
+
|
|
122
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
123
|
+
expr = to_expr(lf, self.dividend) // to_expr(lf, self.divisor)
|
|
124
|
+
if self.output is None:
|
|
125
|
+
return expr
|
|
126
|
+
return expr.alias(self.output)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@register_callback_cls
|
|
130
|
+
class Pow(CallbackProtocol):
|
|
131
|
+
def __init__(self, base: AstValue, exponent: AstValue, output: Optional[str] = None) -> None:
|
|
132
|
+
self.base = base
|
|
133
|
+
self.exponent = exponent
|
|
134
|
+
self.output = output
|
|
135
|
+
|
|
136
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
137
|
+
expr = to_expr(lf, self.base) ** to_expr(lf, self.exponent)
|
|
138
|
+
if self.output is None:
|
|
139
|
+
return expr
|
|
140
|
+
return expr.alias(self.output)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@register_callback_cls
|
|
144
|
+
class Root(CallbackProtocol):
|
|
145
|
+
def __init__(self, radicand: AstValue, index: AstValue, output: Optional[str] = None) -> None:
|
|
146
|
+
self.radicand = radicand
|
|
147
|
+
self.index = index
|
|
148
|
+
self.output = output
|
|
149
|
+
|
|
150
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
151
|
+
radicand_expr = to_expr(lf, self.radicand)
|
|
152
|
+
idx_expr = to_expr(lf, self.index)
|
|
153
|
+
expr = radicand_expr.sign() * radicand_expr.abs() ** (pl.lit(1) / idx_expr)
|
|
154
|
+
if self.output is None:
|
|
155
|
+
return expr
|
|
156
|
+
return expr.alias(self.output)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
@register_callback_cls
|
|
160
|
+
class Modulo(CallbackProtocol):
|
|
161
|
+
def __init__(self, dividend: AstValue, divisor: AstValue, output: Optional[str] = None) -> None:
|
|
162
|
+
self.dividend = dividend
|
|
163
|
+
self.divisor = divisor
|
|
164
|
+
self.output = output
|
|
165
|
+
|
|
166
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
167
|
+
expr = to_expr(lf, self.dividend) % to_expr(lf, self.divisor)
|
|
168
|
+
if self.output is None:
|
|
169
|
+
return expr
|
|
170
|
+
return expr.alias(self.output)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from polars import LazyFrame
|
|
2
|
+
|
|
3
|
+
from weavehr.callbacks.proto import AstValue, CallbackProtocol, CallbackResult, to_expr
|
|
4
|
+
from weavehr.callbacks.registry import register_callback_cls
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@register_callback_cls
|
|
8
|
+
class GreaterThan(CallbackProtocol):
|
|
9
|
+
def __init__(self, left: AstValue, right: AstValue) -> None:
|
|
10
|
+
self.left = left
|
|
11
|
+
self.right = right
|
|
12
|
+
|
|
13
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
14
|
+
return to_expr(lf, self.left) > to_expr(lf, self.right)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@register_callback_cls
|
|
18
|
+
class LessThan(CallbackProtocol):
|
|
19
|
+
def __init__(self, left: AstValue, right: AstValue) -> None:
|
|
20
|
+
self.left = left
|
|
21
|
+
self.right = right
|
|
22
|
+
|
|
23
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
24
|
+
return to_expr(lf, self.left) < to_expr(lf, self.right)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@register_callback_cls
|
|
28
|
+
class GreaterEqual(CallbackProtocol):
|
|
29
|
+
def __init__(self, left: AstValue, right: AstValue) -> None:
|
|
30
|
+
self.left = left
|
|
31
|
+
self.right = right
|
|
32
|
+
|
|
33
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
34
|
+
return to_expr(lf, self.left) >= to_expr(lf, self.right)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@register_callback_cls
|
|
38
|
+
class LessEqual(CallbackProtocol):
|
|
39
|
+
def __init__(self, left: AstValue, right: AstValue) -> None:
|
|
40
|
+
self.left = left
|
|
41
|
+
self.right = right
|
|
42
|
+
|
|
43
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
44
|
+
return to_expr(lf, self.left) <= to_expr(lf, self.right)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@register_callback_cls
|
|
48
|
+
class Equal(CallbackProtocol):
|
|
49
|
+
def __init__(self, left: AstValue, right: AstValue) -> None:
|
|
50
|
+
self.left = left
|
|
51
|
+
self.right = right
|
|
52
|
+
|
|
53
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
54
|
+
return to_expr(lf, self.left) == to_expr(lf, self.right)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@register_callback_cls
|
|
58
|
+
class NotEqual(CallbackProtocol):
|
|
59
|
+
def __init__(self, left: AstValue, right: AstValue) -> None:
|
|
60
|
+
self.left = left
|
|
61
|
+
self.right = right
|
|
62
|
+
|
|
63
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
64
|
+
return to_expr(lf, self.left) != to_expr(lf, self.right)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
import polars as pl
|
|
4
|
+
from polars import LazyFrame
|
|
5
|
+
|
|
6
|
+
from weavehr.callbacks.proto import AstValue, CallbackProtocol, CallbackResult, to_expr
|
|
7
|
+
from weavehr.callbacks.registry import register_callback_cls
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@register_callback_cls
|
|
11
|
+
class Replace(CallbackProtocol):
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
condition: AstValue,
|
|
15
|
+
then_value: AstValue,
|
|
16
|
+
else_value: AstValue,
|
|
17
|
+
output: Optional[str] = None,
|
|
18
|
+
) -> None:
|
|
19
|
+
self.condition = condition
|
|
20
|
+
self.then_value = then_value
|
|
21
|
+
self.else_value = else_value
|
|
22
|
+
self.output = output
|
|
23
|
+
|
|
24
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
25
|
+
expr = (
|
|
26
|
+
pl.when(to_expr(lf, self.condition))
|
|
27
|
+
.then(to_expr(lf, self.then_value))
|
|
28
|
+
.otherwise(to_expr(lf, self.else_value))
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
if self.output is None:
|
|
32
|
+
return expr
|
|
33
|
+
|
|
34
|
+
return expr.alias(self.output)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from typing import Sequence
|
|
2
|
+
|
|
3
|
+
import polars as pl
|
|
4
|
+
from polars import LazyFrame
|
|
5
|
+
|
|
6
|
+
from weavehr.callbacks.proto import AstValue, CallbackProtocol, CallbackResult, to_col_name, to_expr
|
|
7
|
+
from weavehr.callbacks.registry import register_callback_cls
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@register_callback_cls
|
|
11
|
+
class DropNa(CallbackProtocol):
|
|
12
|
+
def __init__(self, column: AstValue) -> None:
|
|
13
|
+
self.column = to_col_name(column)
|
|
14
|
+
|
|
15
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
16
|
+
return pl.col(self.column).is_not_null()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@register_callback_cls
|
|
20
|
+
class FirstDistinct(CallbackProtocol):
|
|
21
|
+
"""Keep the first row for each distinct combination of columns."""
|
|
22
|
+
|
|
23
|
+
def __init__(self, *columns: AstValue) -> None:
|
|
24
|
+
"""
|
|
25
|
+
Initialize the callback with the column names used to identify duplicates.
|
|
26
|
+
|
|
27
|
+
Column names can be passed as separate arguments, for example:
|
|
28
|
+
``first_distinct(subject_id, time)``.
|
|
29
|
+
"""
|
|
30
|
+
if len(columns) == 1 and isinstance(columns[0], list):
|
|
31
|
+
self.columns: Sequence[AstValue] = columns[0]
|
|
32
|
+
else:
|
|
33
|
+
self.columns = columns
|
|
34
|
+
|
|
35
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
36
|
+
"""Select the first row for each distinct combination of column values."""
|
|
37
|
+
column_names = [to_col_name(column) for column in self.columns]
|
|
38
|
+
return pl.struct(column_names).is_first_distinct()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@register_callback_cls
|
|
42
|
+
class DropIf(CallbackProtocol):
|
|
43
|
+
"""
|
|
44
|
+
Drops rows where the given boolean condition is True.
|
|
45
|
+
|
|
46
|
+
Example:
|
|
47
|
+
|
|
48
|
+
Meaning:
|
|
49
|
+
keep rows where is_invalid is False
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
def __init__(self, condition: AstValue) -> None:
|
|
53
|
+
self.condition = condition
|
|
54
|
+
|
|
55
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
56
|
+
condition_expr = to_expr(lf, self.condition)
|
|
57
|
+
return condition_expr.not_()
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from polars import LazyFrame
|
|
2
|
+
|
|
3
|
+
from weavehr.callbacks.proto import AstValue, CallbackProtocol, CallbackResult, to_expr
|
|
4
|
+
from weavehr.callbacks.registry import register_callback_cls
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@register_callback_cls
|
|
8
|
+
class And(CallbackProtocol):
|
|
9
|
+
def __init__(self, left: AstValue, right: AstValue) -> None:
|
|
10
|
+
self.left = left
|
|
11
|
+
self.right = right
|
|
12
|
+
|
|
13
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
14
|
+
return to_expr(lf, self.left) & to_expr(lf, self.right)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@register_callback_cls
|
|
18
|
+
class Or(CallbackProtocol):
|
|
19
|
+
def __init__(self, left: AstValue, right: AstValue) -> None:
|
|
20
|
+
self.left = left
|
|
21
|
+
self.right = right
|
|
22
|
+
|
|
23
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
24
|
+
return to_expr(lf, self.left) | to_expr(lf, self.right)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@register_callback_cls
|
|
28
|
+
class Not(CallbackProtocol):
|
|
29
|
+
def __init__(self, value: AstValue) -> None:
|
|
30
|
+
self.value = value
|
|
31
|
+
|
|
32
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
33
|
+
return ~to_expr(lf, self.value)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
import polars as pl
|
|
4
|
+
from polars import LazyFrame
|
|
5
|
+
|
|
6
|
+
from weavehr.callbacks.proto import AstValue, CallbackProtocol, to_col_name
|
|
7
|
+
from weavehr.callbacks.registry import register_callback_cls
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@register_callback_cls
|
|
11
|
+
class SplitExplode(CallbackProtocol):
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
column: AstValue,
|
|
15
|
+
separator: str = ",",
|
|
16
|
+
strip: bool = True,
|
|
17
|
+
) -> None:
|
|
18
|
+
self.column = to_col_name(column)
|
|
19
|
+
self.separator = separator
|
|
20
|
+
self.strip = strip
|
|
21
|
+
|
|
22
|
+
def __call__(self, lf: LazyFrame) -> Any:
|
|
23
|
+
lf = lf.with_columns(pl.col(self.column).str.split(self.separator).alias(self.column)).explode(self.column)
|
|
24
|
+
|
|
25
|
+
if self.strip:
|
|
26
|
+
lf = lf.with_columns(pl.col(self.column).str.strip_chars().alias(self.column))
|
|
27
|
+
|
|
28
|
+
return lf
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from typing import Optional, Sequence
|
|
2
|
+
|
|
3
|
+
import polars as pl
|
|
4
|
+
from polars import LazyFrame
|
|
5
|
+
|
|
6
|
+
from weavehr.callbacks.proto import AstValue, CallbackProtocol, CallbackResult, to_col_name
|
|
7
|
+
from weavehr.callbacks.registry import register_callback_cls
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@register_callback_cls
|
|
11
|
+
class FirstNotNull(CallbackProtocol):
|
|
12
|
+
"""Create a column by selecting the first non-null value across columns.
|
|
13
|
+
|
|
14
|
+
This callback evaluates a list of source columns row-wise and assigns the
|
|
15
|
+
first non-null value (in order) to a new result column. If all specified
|
|
16
|
+
fields are null for a row, the resulting value is null. It is commonly used
|
|
17
|
+
for schema harmonization.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, *fields: AstValue, output: Optional[str]) -> None:
|
|
21
|
+
"""Initialize the callback.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
fields: Ordered list of source column names. Earlier columns
|
|
25
|
+
take precedence over later ones.
|
|
26
|
+
output: Name of the output column to be created.
|
|
27
|
+
"""
|
|
28
|
+
if len(fields) == 1 and isinstance(fields[0], list):
|
|
29
|
+
self.fields: Sequence[AstValue] = fields[0]
|
|
30
|
+
else:
|
|
31
|
+
self.fields = fields
|
|
32
|
+
|
|
33
|
+
self.output = output
|
|
34
|
+
|
|
35
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
36
|
+
"""Apply the transformation to a Polars LazyFrame.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
lf: Input LazyFrame.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
A new LazyFrame with an additional column containing the first
|
|
43
|
+
non-null value per row across the specified fields.
|
|
44
|
+
"""
|
|
45
|
+
cols = [to_col_name(f) for f in self.fields]
|
|
46
|
+
|
|
47
|
+
# Optional: empty list handling
|
|
48
|
+
if not cols:
|
|
49
|
+
# With no inputs, output is always null.
|
|
50
|
+
expr = pl.lit(None)
|
|
51
|
+
if self.output is None:
|
|
52
|
+
return expr
|
|
53
|
+
return expr.alias(self.output)
|
|
54
|
+
|
|
55
|
+
expr = pl.coalesce([pl.col(c) for c in cols])
|
|
56
|
+
|
|
57
|
+
if self.output is None:
|
|
58
|
+
return expr
|
|
59
|
+
return expr.alias(self.output)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@register_callback_cls
|
|
63
|
+
class Max(CallbackProtocol):
|
|
64
|
+
"""Create a column containing the maximum value across multiple columns.
|
|
65
|
+
|
|
66
|
+
This callback evaluates the specified source columns row-wise and returns
|
|
67
|
+
the maximum value for each row. Null values are ignored when at least one
|
|
68
|
+
non-null value is present. If all specified fields are null for a row, the
|
|
69
|
+
resulting value is null.
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
def __init__(self, *fields: AstValue, output: Optional[str]) -> None:
|
|
73
|
+
"""Initialize the callback.
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
fields: Source column names whose row-wise maximum is selected.
|
|
77
|
+
output: Name of the output column. If `None`, the resulting
|
|
78
|
+
expression is returned without an alias.
|
|
79
|
+
"""
|
|
80
|
+
if len(fields) == 1 and isinstance(fields[0], list):
|
|
81
|
+
self.fields: Sequence[AstValue] = fields[0]
|
|
82
|
+
else:
|
|
83
|
+
self.fields = fields
|
|
84
|
+
|
|
85
|
+
self.output = output
|
|
86
|
+
|
|
87
|
+
def __call__(self, lf: LazyFrame) -> CallbackResult:
|
|
88
|
+
"""Create an expression for the row-wise maximum.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
lf: Input LazyFrame.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
An expression containing the maximum value across the specified
|
|
95
|
+
fields for each row, optionally aliased with the output column name.
|
|
96
|
+
If no fields are specified, an expression containing null values is
|
|
97
|
+
returned.
|
|
98
|
+
"""
|
|
99
|
+
cols = [to_col_name(f) for f in self.fields]
|
|
100
|
+
|
|
101
|
+
# Optional: empty list handling
|
|
102
|
+
if not cols:
|
|
103
|
+
# With no inputs, output is always null.
|
|
104
|
+
expr = pl.lit(None)
|
|
105
|
+
if self.output is None:
|
|
106
|
+
return expr
|
|
107
|
+
return expr.alias(self.output)
|
|
108
|
+
|
|
109
|
+
expr = pl.max_horizontal([pl.col(c) for c in cols])
|
|
110
|
+
|
|
111
|
+
if self.output is None:
|
|
112
|
+
return expr
|
|
113
|
+
return expr.alias(self.output)
|