#!/usr/bin/env python3 """ HC-ONC-007 Leukemia Synthetic Dataset File 5: Data Dictionary Generator XpertSystems.ai / XpertPlatform.ai Generates hc_onc_007_data_dictionary.csv with 200+ fields annotated with: - Data type, range/values, clinical units - ICD-10-CM, SNOMED CT, LOINC, NCI Thesaurus, CDISC CDASH codes Usage: python hc_onc_007_data_dictionary.py [--output_dir ./output] """ import csv import argparse import os import sys # --------------------------------------------------------------------------- # Data dictionary rows: (field_name, data_type, range_values, unit, # source_table, icd10_snomed, loinc, nci_code, cdisc_cdash, description) # --------------------------------------------------------------------------- FIELDS = [ # ── PATIENT IDENTIFIERS ───────────────────────────────────────────────── ("patient_id", "String", "HO007-00001 … HO007-99999", "", "primary", "", "", "C25364", "USUBJID", "Unique synthetic patient identifier"), ("dataset_version", "String", "1.0", "", "primary", "", "", "", "", "HC-ONC-007 dataset version tag"), ("generation_seed", "Integer", "Any integer", "", "primary", "", "", "", "", "NumPy random seed used to generate this record"), # ── DEMOGRAPHICS ──────────────────────────────────────────────────────── ("age_at_diagnosis", "Integer", "1 – 95", "Years", "primary", "C91-C95", "30525-0", "C25150", "AGE", "Patient age in whole years at leukemia diagnosis"), ("age_group", "String", "Pediatric/AYA/Adult/Elderly", "", "primary", "", "", "C25150", "AGEGR1", "Pediatric <18; AYA 18-39; Adult 40-64; Elderly 65+"), ("sex", "String", "Male/Female", "", "primary", "", "76689-9", "C28421", "SEX", "Biological sex at birth"), ("race_ethnicity", "String", "Non-Hispanic White/Black/Hispanic/Asian/Other", "", "primary", "", "72826-1", "C17049", "RACE", "Self-reported race/ethnicity per OMB categories"), ("bmi_kg_m2", "Float", "14.0 – 48.0", "kg/m²", "primary", "", "39156-5", "C16358", "BMI", "Body mass index at diagnosis"), ("ecog_ps", "Integer", "0 – 4", "ECOG score","primary", "", "", "C102404", "ECOGCD", "ECOG performance status (0=fully active; 4=bedridden)"), ("smoking_status", "String", "Never/Former/Current", "", "primary", "", "72166-2", "C19796", "SMOKESTAT", "Smoking status at diagnosis"), ("prior_malignancy", "Boolean", "True/False", "", "primary", "Z85", "", "C27993", "", "Prior history of any malignancy"), ("prior_chemo", "Boolean", "True/False", "", "primary", "Z79.899", "", "C15632", "", "Exposure to prior chemotherapy (therapy-related AML risk)"), ("prior_radiation", "Boolean", "True/False", "", "primary", "Z85.6", "", "C15313", "", "Prior radiation therapy exposure"), # ── DIAGNOSIS ─────────────────────────────────────────────────────────── ("diagnosis_date", "Date", "YYYY-MM-DD", "", "primary", "", "", "C68615", "DXDT", "Date of confirmed leukemia diagnosis"), ("leukemia_subtype", "String", "AML/ALL/CML/CLL/APL", "", "primary", "C91-C95", "", "C3171", "DXTESTCD", "Primary leukemia subtype"), ("icd10_code", "String", "C91.0-C95.9", "", "primary", "ICD-10-CM", "", "", "DXTERM", "ICD-10-CM code for leukemia subtype and phase"), ("diagnosis_method", "String", "BM_biopsy/PB_flow/cytogenetics","", "primary", "", "", "C17649", "", "Primary diagnostic method used"), ("who_2022_classification", "String", "See codebook", "", "primary", "", "", "C27966", "", "WHO 2022 leukemia classification string"), ("fab_classification", "String", "M0-M7/L1-L3/CML-CP/etc.", "", "primary", "", "", "C9105", "", "FAB morphological classification (legacy but retained)"), # ── AML-SPECIFIC ───────────────────────────────────────────────────────── ("aml_eln2022_risk", "String", "Favorable/Intermediate/Adverse","", "primary", "", "", "C168802", "AMLRISK", "ELN 2022 AML risk group based on cytogenetics+molecular"), ("aml_de_novo", "Boolean", "True/False", "", "primary", "C92.00", "", "", "", "De novo AML (vs. therapy-related or MDS-evolved)"), ("aml_secondary", "Boolean", "True/False", "", "primary", "C92.60", "", "", "", "AML evolved from prior MDS or MPN"), ("aml_cbf", "Boolean", "True/False", "", "primary", "", "", "", "", "Core-binding factor AML: inv(16) or t(8;21)"), # ── ALL-SPECIFIC ───────────────────────────────────────────────────────── ("all_immunophenotype", "String", "B-ALL/T-ALL", "", "primary", "C91.00", "", "C7539", "", "ALL immunophenotype: B-cell or T-cell lineage"), ("all_ph_positive", "Boolean", "True/False", "", "primary", "", "", "", "", "Philadelphia chromosome positive ALL (BCR-ABL1)"), ("all_ph_like", "Boolean", "True/False", "", "primary", "", "", "", "", "Ph-like ALL (CRLF2 rearrangement or other JAK/STAT)"), ("all_nci_risk", "String", "Standard/High", "", "primary", "", "", "C15195", "", "NCI risk classification: SR WBC<50K age<10; else HR"), ("all_cnb_involvement", "Boolean", "True/False", "", "primary", "C91.00", "", "", "", "CNS involvement at diagnosis (CNS1/2/3 status)"), # ── CML-SPECIFIC ───────────────────────────────────────────────────────── ("cml_phase", "String", "CP/AP/BC", "", "primary", "C92.10", "", "C3171", "", "CML phase: chronic/accelerated/blast crisis"), ("cml_sokal_score", "Float", "0.4 – 3.5", "", "primary", "", "", "", "", "Sokal prognostic score for CML at diagnosis"), ("cml_eutos_score", "Integer", "0 – 450", "", "primary", "", "", "", "", "EUTOS score (spleen size + basophil %)"), ("cml_hasford_score", "Float", "200 – 2000", "", "primary", "", "", "", "", "Hasford (Euro) score for CML risk stratification"), # ── CLL-SPECIFIC ───────────────────────────────────────────────────────── ("cll_rai_stage", "Integer", "0 – 4", "Rai stage", "primary", "C91.10", "", "C94032", "", "Rai staging: 0=lymphocytosis; 4=thrombocytopenia"), ("cll_binet_stage", "String", "A/B/C", "", "primary", "", "", "C94032", "", "Binet staging: A<3 areas; C=anemia or thrombocytopenia"), ("cll_watch_wait", "Boolean", "True/False", "", "primary", "", "", "", "", "Patient managed with watchful waiting (no active Rx)"), # ── APL-SPECIFIC ───────────────────────────────────────────────────────── ("apl_sanz_risk", "String", "Low/Intermediate/High", "", "primary", "C92.40", "", "", "", "Sanz APL risk: Low WBC<10K plt≥40K; High WBC≥10K"), ("apl_pml_rara_variant", "String", "Bcr1/Bcr2/Bcr3/Variant", "", "primary", "", "", "", "", "PML-RARA transcript variant (bcr1 most common ~55%)"), # ── CBC AT DIAGNOSIS ──────────────────────────────────────────────────── ("wbc_x10e9_l", "Float", "0.1 – 400.0", "×10⁹/L", "primary", "", "6690-2", "C51953", "WBC", "White blood cell count at diagnosis"), ("hemoglobin_g_dl", "Float", "3.5 – 16.5", "g/dL", "primary", "", "718-7", "C51948", "HGB", "Hemoglobin concentration at diagnosis"), ("platelets_x10e9_l", "Float", "5.0 – 500.0", "×10⁹/L", "primary", "", "777-3", "C51951", "PLAT", "Platelet count at diagnosis"), ("blasts_percent_pb", "Float", "0.0 – 99.0", "%", "primary", "", "26446-6", "C51952", "BLASTPCT", "Peripheral blood blast percentage at diagnosis"), ("blasts_percent_bm", "Float", "0.0 – 99.0", "%", "primary", "", "57027-3", "C51952", "BMBLAS", "Bone marrow blast percentage at diagnosis"), ("lactate_dehydrogenase", "Float", "100 – 5000", "U/L", "primary", "", "14804-9", "C64547", "LDH", "LDH at diagnosis; surrogate for tumor burden"), ("uric_acid_mg_dl", "Float", "2.0 – 18.0", "mg/dL", "primary", "", "3084-1", "C64547", "", "Uric acid; TLS risk marker"), ("creatinine_mg_dl", "Float", "0.4 – 8.0", "mg/dL", "primary", "", "2160-0", "C64548", "CREAT", "Serum creatinine at diagnosis"), ("bilirubin_total_mg_dl", "Float", "0.1 – 15.0", "mg/dL", "primary", "", "1975-2", "C64547", "BILI", "Total bilirubin at diagnosis"), ("spleen_size_cm", "Float", "8.0 – 30.0", "cm", "primary", "", "", "C12419", "", "Spleen size below costal margin (cm) for CML scoring"), # ── CYTOGENETICS ──────────────────────────────────────────────────────── ("karyotype_result", "String", "Normal/Complex/t(9;22)/etc.", "", "primary", "", "", "C16321", "CYTORES", "Conventional karyotype result (ISCN notation)"), ("cytogenetics_risk", "String", "Favorable/Intermediate/Adverse","", "primary", "", "", "C16321", "CYTORISK", "Cytogenetic risk group per ELN/NCCN/SWOG"), ("chromosome_count", "Integer", "40 – 92", "", "primary", "", "", "", "", "Modal chromosome number from karyotype"), ("complex_karyotype", "Boolean", "True/False", "", "primary", "", "", "", "", "≥3 unrelated chromosomal abnormalities; adverse"), ("monosomal_karyotype", "Boolean", "True/False", "", "primary", "", "", "", "", "≥2 monosomies or 1 monosomy + structural; adverse AML"), ("t_8_21", "Boolean", "True/False", "", "primary", "", "", "", "", "t(8;21)(q22;q22.1) RUNX1-RUNX1T1; CBF-AML favorable"), ("inv_16_t_16_16", "Boolean", "True/False", "", "primary", "", "", "", "", "inv(16)(p13.1q22)/t(16;16) CBF-MYH11; CBF-AML favorable"), ("t_15_17", "Boolean", "True/False", "", "primary", "", "", "", "", "t(15;17)(q24;q21) PML-RARA; diagnostic of APL"), ("t_9_22_bcr_abl1", "Boolean", "True/False", "", "primary", "", "", "", "", "t(9;22)(q34;q11.2) BCR-ABL1; CML/Ph+ ALL defining"), ("del_5q_monosomy5", "Boolean", "True/False", "", "primary", "", "", "", "", "del(5q) or -5; adverse AML cytogenetic marker"), ("del_7q_monosomy7", "Boolean", "True/False", "", "primary", "", "", "", "", "del(7q) or -7; adverse AML cytogenetic marker"), ("del_17p", "Boolean", "True/False", "", "primary", "", "", "", "", "del(17p) TP53 locus; adverse AML/CLL marker"), ("t_v_11q23_kmt2a", "Boolean", "True/False", "", "primary", "", "", "", "", "KMT2A (MLL) rearrangement; intermediate-adverse"), ("etv6_runx1", "Boolean", "True/False", "", "primary", "", "", "", "", "t(12;21) ETV6-RUNX1; favorable pediatric B-ALL"), ("hyperdiploidy_all", "Boolean", "True/False", "", "primary", "", "", "", "", "High hyperdiploidy (51-65 chr); favorable pediatric ALL"), ("cll_del13q", "Boolean", "True/False", "", "primary", "", "", "", "", "del(13q14) sole abnormality; favorable CLL"), ("cll_del11q", "Boolean", "True/False", "", "primary", "", "", "", "", "del(11q22) ATM; unfavorable CLL"), ("cll_trisomy12", "Boolean", "True/False", "", "primary", "", "", "", "", "Trisomy 12; intermediate CLL; NOTCH1 association"), # ── MOLECULAR PANEL ────────────────────────────────────────────────────── ("npm1_mutation", "Boolean", "True/False", "", "molecular", "", "81901-7", "C49136", "NPM1MUT", "NPM1 mutation (exon 12); favorable ELN if FLT3-ITD-low"), ("flt3_itd", "Boolean", "True/False", "", "molecular", "", "55201-2", "C49136", "FLT3ITD", "FLT3-ITD mutation; adverse if allelic ratio ≥0.5"), ("flt3_itd_allelic_ratio", "Float", "0.0 – 5.0", "", "molecular", "", "", "", "FLT3AR", "FLT3-ITD allelic ratio (ITD/WT peak ratio)"), ("flt3_tkd", "Boolean", "True/False", "", "molecular", "", "55201-2", "C49136", "FLT3TKD", "FLT3-TKD (D835/I836) point mutation"), ("idh1_mutation", "Boolean", "True/False", "", "molecular", "", "79429-1", "C49136", "IDH1MUT", "IDH1 R132 mutation; ivosidenib targetable; ~8% AML"), ("idh2_mutation", "Boolean", "True/False", "", "molecular", "", "79430-9", "C49136", "IDH2MUT", "IDH2 R140/R172 mutation; enasidenib targetable; ~10%"), ("dnmt3a_mutation", "Boolean", "True/False", "", "molecular", "", "", "C49136", "DNMT3AMUT", "DNMT3A mutation (R882 hotspot most common); ~20% AML"), ("tp53_mutation", "Boolean", "True/False", "", "molecular", "", "10198-7", "C49136", "TP53MUT", "TP53 biallelic mutation; highly adverse ELN 2022"), ("cebpa_biallelic", "Boolean", "True/False", "", "molecular", "", "", "C49136", "CEBPAMUT", "CEBPA biallelic mutation; favorable ELN 2022"), ("runx1_mutation", "Boolean", "True/False", "", "molecular", "", "", "C49136", "", "RUNX1 mutation (non-t(8;21)); adverse ELN 2022"), ("asxl1_mutation", "Boolean", "True/False", "", "molecular", "", "", "C49136", "", "ASXL1 mutation; adverse ELN 2022 marker"), ("bcr_abl1_transcript", "String", "p210/p190/p230/None", "", "molecular", "", "51358-7", "C49136", "BCRABL1", "BCR-ABL1 fusion transcript type (CML/Ph+ALL)"), ("bcr_abl1_is_baseline", "Float", "0.001 – 100.0", "% IS", "molecular", "", "51358-7", "", "BCRABL1IS", "BCR-ABL1 International Scale % at diagnosis"), ("ighv_mutation_status", "String", "Mutated/Unmutated/NA", "", "molecular", "", "", "C49136", "IGHVMUT", "IGHV somatic hypermutation status for CLL prognosis"), ("sf3b1_mutation", "Boolean", "True/False", "", "molecular", "", "", "C49136", "", "SF3B1 mutation; associated with MDS; favorable CLL"), ("notch1_mutation", "Boolean", "True/False", "", "molecular", "", "", "C49136", "", "NOTCH1 mutation in CLL; adverse; ibrutinib resistance"), ("btk_mutation", "Boolean", "True/False", "", "molecular", "", "", "C49136", "BTKMUT", "BTK C481S mutation; ibrutinib resistance marker"), # ── TREATMENT LINE 1 ──────────────────────────────────────────────────── ("l1_regimen", "String", "See treatment codebook", "", "primary", "", "", "C15326", "TRT01P", "First-line treatment regimen name"), ("l1_start_date", "Date", "YYYY-MM-DD", "", "primary", "", "", "C68615", "TRT01SDT", "First-line treatment start date"), ("l1_end_date", "Date", "YYYY-MM-DD", "", "primary", "", "", "C68615", "TRT01EDT", "First-line treatment end date"), ("l1_cycles_planned", "Integer", "1 – 12", "cycles", "primary", "", "", "", "", "Number of chemotherapy cycles planned for line 1"), ("l1_cycles_received", "Integer", "0 – 12", "cycles", "primary", "", "", "", "", "Actual cycles received (may differ due to toxicity)"), ("l1_dose_reduction", "Boolean", "True/False", "", "primary", "", "", "", "", "Any dose reduction applied during line 1 treatment"), ("l1_venetoclax", "Boolean", "True/False", "", "primary", "", "", "C105538","", "Venetoclax included in first-line regimen"), ("l1_intensive_chemo", "Boolean", "True/False", "", "primary", "", "", "C15632", "", "Intensive induction chemotherapy (7+3, HyperCVAD, BFM)"), ("l1_tki", "Boolean", "True/False", "", "primary", "", "", "C51033", "", "Tyrosine kinase inhibitor included in line 1"), ("l1_tki_agent", "String", "Imatinib/Dasatinib/Nilotinib/Ponatinib/Bosutinib/Asciminib/None","","primary","","", "C51033","TKI1AGNT", "Specific TKI agent used in first line"), ("l1_btki", "Boolean", "True/False", "", "primary", "", "", "C129785","", "BTK inhibitor (ibrutinib/acalabrutinib/zanubrutinib) used"), ("l1_atra", "Boolean", "True/False", "", "primary", "", "", "C538", "", "All-trans retinoic acid (ATRA) given; APL treatment"), ("l1_arsenic_trioxide", "Boolean", "True/False", "", "primary", "", "", "C947", "", "Arsenic trioxide (ATO) given; APL standard of care"), ("l1_car_t", "Boolean", "True/False", "", "primary", "", "", "C173420","", "CAR-T cell therapy administered in first line"), ("l1_blinatumomab", "Boolean", "True/False", "", "primary", "", "", "C116130","", "Blinatumomab (BiTE) administered; ALL MRD+ consolidation"), # ── RESPONSE / REMISSION ───────────────────────────────────────────────── ("best_response", "String", "CR/CRi/CRh/MLFS/PR/SD/PD/NR", "", "primary", "", "", "C49206", "BESTRESP", "Best overall response achieved during treatment"), ("cr_achieved", "Boolean", "True/False", "", "primary", "", "", "C49206", "CRFL", "Complete remission achieved (blasts <5%)"), ("cr_date", "Date", "YYYY-MM-DD", "", "primary", "", "", "", "CRDT", "Date of first documented complete remission"), ("time_to_cr_days", "Integer", "14 – 120", "Days", "primary", "", "", "", "CRDT", "Days from treatment start to first CR confirmation"), ("mrd_negativity_achieved", "Boolean", "True/False", "", "primary", "", "81901-7", "C173817","MRDFL", "MRD negativity achieved at any timepoint"), ("mrd_method", "String", "Flow_cytometry/NGS/PCR/ddPCR/None","", "primary", "", "", "C173817","MRDMETH", "MRD assessment method used"), ("mrd_sensitivity", "String", "1e-4/1e-5/1e-6/NA", "", "primary", "", "", "", "", "MRD assay sensitivity threshold"), ("ccyr_achieved", "Boolean", "True/False", "", "primary", "", "51360-3", "", "", "Complete cytogenetic response (0% Ph+ metaphases; CML)"), ("mmr_achieved", "Boolean", "True/False", "", "primary", "", "51360-3", "", "MMR", "Major molecular response BCR-ABL1 ≤0.1% IS (CML)"), ("dmr_cmr4_achieved", "Boolean", "True/False", "", "primary", "", "", "", "", "Deep MR: MR4.0 BCR-ABL1 ≤0.01% IS (TFR eligibility)"), ("relapse", "Boolean", "True/False", "", "primary", "", "", "C26766", "RELFL", "Disease relapse after achieving CR"), ("relapse_date", "Date", "YYYY-MM-DD", "", "primary", "", "", "", "RELDT", "Date of confirmed relapse"), ("refractory", "Boolean", "True/False", "", "primary", "", "", "C38155", "", "Primary refractory disease (no CR with induction)"), # ── MRD LONGITUDINAL (hc_onc_007_mrd_longitudinal.csv) ────────────────── ("mrd_assessment_month", "Integer", "0 – 60", "Month", "mrd_long", "", "", "", "", "Month of MRD assessment from treatment start"), ("mrd_value_percent", "Float", "0.00001 – 100.0", "% IS or %", "mrd_long", "", "81901-7", "", "MRDVAL", "Quantitative MRD value (BCR-ABL1 IS% or % blasts by NGS)"), ("mrd_log_reduction", "Float", "0.0 – 6.0", "log10", "mrd_long", "", "", "", "", "Log10 reduction from diagnostic baseline"), ("mrd_negative_flag", "Boolean", "True/False", "", "mrd_long", "", "", "", "MRDFL", "MRD below sensitivity threshold at this timepoint"), ("wbc_concurrent", "Float", "0.5 – 20.0", "×10⁹/L", "mrd_long", "", "6690-2", "", "WBC", "Concurrent WBC at MRD assessment timepoint"), ("hgb_concurrent", "Float", "6.0 – 17.0", "g/dL", "mrd_long", "", "718-7", "", "HGB", "Concurrent hemoglobin at MRD assessment timepoint"), ("plt_concurrent", "Float", "10.0 – 450.0", "×10⁹/L", "mrd_long", "", "777-3", "", "PLAT", "Concurrent platelets at MRD assessment timepoint"), # ── BMT / HSCT ──────────────────────────────────────────────────────────── ("bmt_performed", "Boolean", "True/False", "", "bmt", "", "", "C15342", "BMTFL", "Bone marrow / stem cell transplant performed"), ("bmt_type", "String", "Allogeneic/Autologous/None", "", "bmt", "", "57372-3", "C15342", "BMTTYPE", "Transplant type: allogeneic (donor) or autologous"), ("bmt_date", "Date", "YYYY-MM-DD", "", "bmt", "", "", "", "BMTDT", "Date of stem cell infusion (Day 0)"), ("bmt_donor_type", "String", "MRD_10/10/MUD_10/10/MUD_8/10/Haplo/UCB/Autologous","","bmt","","", "C15342","DONRTYPE", "Donor HLA match category"), ("hla_match_grade", "String", "10/10/9/10/8/10/Haplo", "", "bmt", "", "", "C25392", "HLAGRDE", "HLA allele match grade (high-res 8-loci)"), ("conditioning_regimen", "String", "Cy+TBI/Bu+Cy/Flu+Mel/Flu+Bu2/BEAM/Mel200","","bmt","", "", "C15326", "CONDREG", "Pre-transplant conditioning regimen"), ("conditioning_intensity", "String", "Myeloablative/RIC/NMA", "", "bmt", "", "", "", "CONDINT", "Conditioning intensity: MAC, RIC, or non-myeloablative"), ("gcsf_priming", "Boolean", "True/False", "", "bmt", "", "", "", "", "G-CSF used for stem cell mobilization"), ("cd34_x10e6_kg", "Float", "1.0 – 20.0", "×10⁶/kg", "bmt", "", "", "", "CD34DOSE", "CD34+ cell dose infused per kg body weight"), ("engraftment_day", "Integer", "10 – 45", "Days", "bmt", "", "", "", "ENGDAY", "Day of neutrophil engraftment (ANC ≥0.5×10⁹/L x2)"), ("plt_engraftment_day", "Integer", "12 – 60", "Days", "bmt", "", "", "", "PLTENGDAY", "Day of platelet engraftment (≥20×10⁹/L unsupported)"), ("chimerism_day30", "Float", "0.0 – 100.0", "%", "bmt", "", "", "", "CHIM30", "Donor chimerism % at Day +30 post-transplant"), ("chimerism_day100", "Float", "0.0 – 100.0", "%", "bmt", "", "", "", "CHIM100", "Donor chimerism % at Day +100 post-transplant"), ("chimerism_day180", "Float", "0.0 – 100.0", "%", "bmt", "", "", "", "CHIM180", "Donor chimerism % at Day +180 post-transplant"), ("chimerism_pattern", "String", "Full/Mixed/Split/Falling", "", "bmt", "", "", "", "", "Chimerism pattern interpretation"), ("acute_gvhd", "Boolean", "True/False", "", "bmt", "", "49874-9", "C26782", "AGVHDFL", "Acute GvHD of any grade occurred"), ("acute_gvhd_grade", "String", "I/II/III/IV/None", "", "bmt", "", "49874-9", "C26782", "AGVHDGRD", "Acute GvHD grade per MAGIC/modified Glucksberg criteria"), ("acute_gvhd_organs", "String", "Skin/GI/Liver/Multi", "", "bmt", "", "", "", "", "Organs involved in acute GvHD episode"), ("chronic_gvhd", "Boolean", "True/False", "", "bmt", "", "49874-9", "C26782", "CGVHDFL", "Chronic GvHD occurred (NIH 2014 criteria)"), ("chronic_gvhd_severity", "String", "Mild/Moderate/Severe/None", "", "bmt", "", "", "C26782", "CGVHDSEV", "Chronic GvHD severity per NIH 2014 global scoring"), ("gvhd_treatment", "String", "Steroids/Ruxolitinib/Ibrutinib/ECP/None","","bmt","", "", "", "GVHDTRT", "Primary GvHD treatment received"), ("vod_sos", "Boolean", "True/False", "", "bmt", "", "", "C26760", "VODSOSFL", "Veno-occlusive disease/sinusoidal obstruction syndrome"), ("vod_severity", "String", "Mild/Moderate/Severe/Very_Severe/None","", "bmt", "", "", "", "VODSEV", "VOD/SOS severity per EBMT 2016 criteria"), ("defibrotide_used", "Boolean", "True/False", "", "bmt", "", "", "", "", "Defibrotide administered for VOD/SOS treatment"), ("nrm_event", "Boolean", "True/False", "", "bmt", "", "", "C61357", "NRMFL", "Non-relapse mortality event occurred post-transplant"), ("nrm_cause", "String", "GvHD/Infection/Organ_failure/Other/None","","bmt","", "", "", "NRMCAUSE", "Cause of non-relapse mortality if applicable"), ("relapse_post_bmt", "Boolean", "True/False", "", "bmt", "", "", "C26766", "RELBTFL", "Disease relapse after BMT"), ("relapse_post_bmt_date", "Date", "YYYY-MM-DD", "", "bmt", "", "", "", "RELBTDT", "Date of post-BMT relapse confirmation"), ("dli_given", "Boolean", "True/False", "", "bmt", "", "", "", "", "Donor lymphocyte infusion given post-transplant"), # ── TOXICITY ───────────────────────────────────────────────────────────── ("tls_occurred", "Boolean", "True/False", "", "primary", "", "", "C26780", "TLSFL", "Tumor lysis syndrome occurred (Cairo-Bishop criteria)"), ("tls_severity", "String", "Laboratory/Clinical/None", "", "primary", "", "", "C26780", "TLSSEV", "TLS severity: lab (biochemical) or clinical (organ)"), ("differentiation_syndrome","Boolean", "True/False", "", "primary", "", "", "", "DIFSYNFL", "Differentiation syndrome (APL/IDH inhibitor therapy)"), ("diff_syndrome_grade", "String", "Mild/Moderate/Severe/None", "", "primary", "", "", "", "", "Differentiation syndrome grade per Montesinos 2009"), ("febrile_neutropenia", "Boolean", "True/False", "", "primary", "", "5905-5", "C26780", "FNFL", "Febrile neutropenia episode during treatment"), ("invasive_fungal_infection","Boolean","True/False", "", "primary", "", "", "C26780", "IFIFL", "Invasive fungal infection (aspergillosis/candida)"), ("cardiotoxicity", "Boolean", "True/False", "", "primary", "", "55133-7", "C62435", "CARDFL", "Cardiotoxicity: LVEF drop ≥10pts or symptomatic CHF"), ("lvef_baseline", "Float", "30.0 – 75.0", "%", "primary", "", "10230-8", "", "LVEF0", "Baseline LVEF by echocardiography before anthracycline"), ("lvef_nadir", "Float", "20.0 – 70.0", "%", "primary", "", "10230-8", "", "LVEFMIN", "LVEF nadir during or after chemotherapy"), ("peripheral_neuropathy", "String", "Grade 0/1/2/3/4 (CTCAE 5.0)", "", "primary", "", "", "C27992", "PERINPGRD", "Peripheral neuropathy grade (bortezomib/vincristine)"), ("fact_leu_score", "Float", "0.0 – 176.0", "points", "primary", "", "", "C21007", "FACTLEU", "FACT-Leu quality of life total score"), ("ctcae_grade_max", "Integer", "0 – 5", "CTCAE", "primary", "", "", "C41331", "CTCAEMAX", "Maximum CTCAE grade for any AE during treatment"), ("hospitalization_days_l1", "Integer", "0 – 365", "Days", "primary", "", "", "", "HOSPDAYS", "Total hospitalization days during first-line treatment"), # ── SURVIVAL ───────────────────────────────────────────────────────────── ("os_months", "Float", "0.1 – 240.0", "Months", "primary", "", "", "C61590", "OSMOS", "Overall survival in months from diagnosis"), ("os_event", "Boolean", "True/False", "", "primary", "", "", "C61590", "OSFLEVT", "OS event: True=death; False=censored"), ("efs_months", "Float", "0.1 – 240.0", "Months", "primary", "", "", "C61590", "EFSMOS", "Event-free survival (relapse, progression, or death)"), ("efs_event", "Boolean", "True/False", "", "primary", "", "", "C61590", "EFSFLEVT", "EFS event flag"), ("lfs_months", "Float", "0.1 – 240.0", "Months", "primary", "", "", "C61590", "LFSMOS", "Leukemia-free survival from CR date"), ("lfs_event", "Boolean", "True/False", "", "primary", "", "", "C61590", "LFSFLEVT", "LFS event flag (relapse or death in CR)"), ("grfs_months", "Float", "0.1 – 240.0", "Months", "bmt", "", "", "", "GRFSMOS", "GvHD-free relapse-free survival (post-BMT)"), ("grfs_event", "Boolean", "True/False", "", "bmt", "", "", "", "GRFSFLEVT", "GRFS event flag (severe cGvHD, relapse, or death)"), ("cause_of_death", "String", "Disease/NRM/Toxicity/Other/NA","", "primary", "", "", "C28554", "CODTERM", "Primary cause of death if OS event=True"), ("os_1yr", "Boolean", "True/False", "", "primary", "", "", "", "OS1YRFL", "Alive at 1 year from diagnosis (binary endpoint)"), ("os_2yr", "Boolean", "True/False", "", "primary", "", "", "", "OS2YRFL", "Alive at 2 years from diagnosis"), ("os_5yr", "Boolean", "True/False", "", "primary", "", "", "", "OS5YRFL", "Alive at 5 years from diagnosis"), ("efs_1yr", "Boolean", "True/False", "", "primary", "", "", "", "EFS1YRFL", "Event-free at 1 year from diagnosis"), ("efs_2yr", "Boolean", "True/False", "", "primary", "", "", "", "EFS2YRFL", "Event-free at 2 years from diagnosis"), ] # ── ML FEATURES (from hc_onc_007_ml_features.csv) ──────────────────────────── ML_FIELDS = [ ("f_subtype_aml", "Binary", "0/1", "", "ml_features", "","","","","One-hot: AML subtype"), ("f_subtype_all", "Binary", "0/1", "", "ml_features", "","","","","One-hot: ALL subtype"), ("f_subtype_cml", "Binary", "0/1", "", "ml_features", "","","","","One-hot: CML subtype"), ("f_subtype_cll", "Binary", "0/1", "", "ml_features", "","","","","One-hot: CLL subtype"), ("f_subtype_apl", "Binary", "0/1", "", "ml_features", "","","","","One-hot: APL subtype"), ("f_age_grp_pediatric", "Binary", "0/1", "", "ml_features", "","","","","Age group: pediatric <18"), ("f_age_grp_aya", "Binary", "0/1", "", "ml_features", "","","","","Age group: AYA 18-39"), ("f_age_grp_elderly", "Binary", "0/1", "", "ml_features", "","","","","Age group: elderly ≥65"), ("f_ecog_ordinal", "Integer", "0–4", "", "ml_features", "","","","","ECOG PS as ordinal integer"), ("f_eln2022_ordinal", "Integer", "0/1/2", "", "ml_features", "","","","","ELN 2022: 0=Favorable, 1=Int, 2=Adverse"), ("f_cbf_aml", "Binary", "0/1", "", "ml_features", "","","","","Core-binding factor AML flag"), ("f_apl_flag", "Binary", "0/1", "", "ml_features", "","","","","APL with PML-RARA flag"), ("f_ph_positive", "Binary", "0/1", "", "ml_features", "","","","","BCR-ABL1 positive (CML or Ph+ ALL)"), ("f_adverse_cyto_count", "Integer", "0–8", "", "ml_features", "","","","","Count of adverse cytogenetic markers present"), ("f_favorable_cyto_count", "Integer", "0–4", "", "ml_features", "","","","","Count of favorable cytogenetic markers present"), ("f_aml_adverse_composite", "Float", "0.0–1.0", "", "ml_features", "","","","","Composite adverse molecular score (AML)"), ("f_aml_favorable_composite","Float", "0.0–1.0", "", "ml_features", "","","","","Composite favorable molecular score (AML)"), ("f_cll_fish_risk_ordinal", "Integer", "0/1/2", "", "ml_features", "","","","","CLL FISH risk: 0=del13q/normal, 1=+12, 2=del11q/del17p"), ("f_bcr_abl1_log_baseline", "Float", "0.0–5.0", "log10","ml_features","","","","","Log10 BCR-ABL1 IS% at baseline"), ("f_hyperleukocytosis", "Binary", "0/1", "", "ml_features", "","","","","WBC ≥100×10⁹/L flag (TLS/leukapheresis risk)"), ("f_severe_anemia", "Binary", "0/1", "", "ml_features", "","","","","Hemoglobin <8.0 g/dL at diagnosis"), ("f_hematologic_burden", "Float", "0.0–10.0", "", "ml_features", "","","","","Composite hematologic burden score (WBC+blasts+LDH)"), ("f_venetoclax_used", "Binary", "0/1", "", "ml_features", "","","","","Venetoclax in treatment regimen"), ("f_intensive_chemo", "Binary", "0/1", "", "ml_features", "","","","","Intensive induction chemotherapy flag"), ("f_tki_generation", "Integer", "0/1/2/3", "", "ml_features", "","","","","TKI generation: 0=none, 1=imatinib, 2=dasatinib/nilotinib, 3=ponatinib+"), ("f_btki_used", "Binary", "0/1", "", "ml_features", "","","","","BTK inhibitor administered"), ("f_atra_ato_regimen", "Binary", "0/1", "", "ml_features", "","","","","ATRA+ATO regimen (APL standard of care)"), ("f_mrd_depth_score", "Integer", "0–4", "", "ml_features", "","","","","MRD response depth: 0=no CR, 1=CR/MRD+, 2=MRDneg flow, 3=MRDneg PCR, 4=MRDneg NGS"), ("f_early_cr", "Binary", "0/1", "", "ml_features", "","","","","CR achieved within 60 days of treatment start"), ("f_early_mrd_clearance", "Binary", "0/1", "", "ml_features", "","","","","MRD negativity within 3 months of treatment start"), ("f_bmt_performed", "Binary", "0/1", "", "ml_features", "","","","","Transplant performed flag"), ("f_donor_ordinal", "Integer", "0–4", "", "ml_features", "","","","","Donor type ordinal: 0=auto, 1=MRD10/10, 2=MUD10/10, 3=MUD8/10, 4=Haplo/UCB"), ("f_hla_match_score", "Float", "0.0–1.0", "", "ml_features", "","","","","HLA match fraction (e.g. 10/10=1.0, 8/10=0.8)"), ("f_mac_conditioning", "Binary", "0/1", "", "ml_features", "","","","","Myeloablative conditioning flag"), ("f_agvhd_severity", "Integer", "0–4", "", "ml_features", "","","","","Acute GvHD grade as integer (0=none, 4=life-threatening)"), ("f_cgvhd_severity", "Integer", "0–3", "", "ml_features", "","","","","Chronic GvHD: 0=none, 1=mild, 2=moderate, 3=severe"), ("f_vod_flag", "Binary", "0/1", "", "ml_features", "","","","","VOD/SOS occurred post-transplant"), ("f_nrm_flag", "Binary", "0/1", "", "ml_features", "","","","","Non-relapse mortality event"), ("f_full_chimerism", "Binary", "0/1", "", "ml_features", "","","","","Full donor chimerism at Day +100"), ("f_bmt_complication_score","Float", "0.0–10.0", "", "ml_features", "","","","","Composite BMT complication score (GvHD+NRM+VOD)"), ("f_toxicity_burden", "Float", "0.0–10.0", "", "ml_features", "","","","","Composite treatment toxicity burden score"), ("f_qol_delta", "Float", "-176.0–176.0", "", "ml_features", "","","","","FACT-Leu QoL change from baseline during treatment"), ] def main(): parser = argparse.ArgumentParser(description="HC-ONC-007 Data Dictionary Generator") parser.add_argument("--output_dir", default="./output", help="Output directory for CSV file") args = parser.parse_args() os.makedirs(args.output_dir, exist_ok=True) out_path = os.path.join(args.output_dir, "hc_onc_007_data_dictionary.csv") header = [ "field_name", "data_type", "range_values", "unit", "source_table", "icd10_snomed", "loinc_code", "nci_code", "cdisc_cdash", "description" ] all_rows = [] for row in FIELDS: all_rows.append(list(row)) for row in ML_FIELDS: all_rows.append(list(row)) with open(out_path, "w", newline="", encoding="utf-8") as f: writer = csv.writer(f, quoting=csv.QUOTE_ALL) writer.writerow(header) writer.writerows(all_rows) print(f"✅ HC-ONC-007 Data Dictionary → {out_path}") print(f" Total fields documented: {len(all_rows)}") print(f" Primary cohort fields: {sum(1 for r in all_rows if r[4]=='primary')}") print(f" BMT module fields: {sum(1 for r in all_rows if r[4]=='bmt')}") print(f" MRD longitudinal fields: {sum(1 for r in all_rows if r[4]=='mrd_long')}") print(f" ML feature fields: {sum(1 for r in all_rows if r[4]=='ml_features')}") print(f" Molecular panel fields: {sum(1 for r in all_rows if r[4]=='molecular')}") if __name__ == "__main__": main()