Abstract
Human inborn errors of immunity include rare disorders entailing functional and quantitative antibody deficiencies due to impaired B cells called the common variable immunodeficiency (CVID) phenotype. Patients with CVID face delayed diagnoses and treatments for 5 to 15 years after symptom onset because the disorders are rare (prevalence of ~1/25,000), and there is extensive heterogeneity in CVID phenotypes, ranging from infections to autoimmunity to inflammatory conditions, overlapping with other more common disorders. The prolonged diagnostic odyssey drives excessive system-wide costs before diagnosis. Because there is no single causal mechanism, there are no genetic tests to definitively diagnose CVID. Here, we present PheNet, a machine learning algorithm that identifies patients with CVID from their electronic health records (EHRs). PheNet learns phenotypic patterns from verified CVID cases and uses this knowledge to rank patients by likelihood of having CVID. PheNet could have diagnosed more than half of our patients with CVID 1 or more years earlier than they had been diagnosed. When applied to a large EHR dataset, followed by blinded chart review of the top 100 patients ranked by PheNet, we found that 74% were highly probable to have CVID. We externally validated PheNet using >6 million records from disparate medical systems in California and Tennessee. As artificial intelligence and machine learning make their way into health care, we show that algorithms such as PheNet can offer clinical benefits by expediting the diagnosis of rare diseases.
Introduction
Common Variable Immunodeficiency (CVID) represents a significant clinical challenge. Characterized by impaired B cell function and antibody deficiency, it manifests through a heterogeneous array of symptoms including recurrent infections, autoimmunity, and inflammatory conditions. Due to its rarity (~1 in 25,000) and symptomatic overlap with common ailments, patients often endure a "diagnostic odyssey" lasting 5 to 15 years. This delay results in irreversible organ damage and substantial healthcare expenditures. With no single genetic marker for definitive diagnosis, there is an urgent need for tools that can identify high-risk patients using existing clinical data.
Methodology: The PheNet Framework
To address this gap, researchers developed PheNet, a supervised machine learning model designed to scan Electronic Health Records (EHRs) for "phenotypic signatures" of CVID.
Feature Engineering and Selection
PheNet utilizes "phecodes"—standardized groupings of ICD billing codes—to represent clinical phenotypes. The model incorporates a hybrid feature set:
- Expert-Driven Features: 34 phecodes derived from the Online Mendelian Inheritance in Man (OMIM) database.
- Data-Driven Features: 10 additional phecodes statistically enriched in known CVID cases (e.g., thrombocytopenia).
- Laboratory Data: Unlike previous models that rely solely on billing codes, PheNet integrates discretized immunoglobulin G (IgG) values, categorized as normal, low, or missing.
Model Architecture
The team evaluated several algorithms, ultimately selecting marginal logistic regression. This choice was driven by the model's high performance (AUC-ROC of 0.95) and its inherent interpretability. Clinicians can review the specific symptoms and lab results contributing to a patient's risk score, facilitating trust and clinical adoption.
Results
Superior Diagnostic Accuracy
In head-to-head comparisons, PheNet significantly outperformed the previous state-of-the-art method, PheRS. It achieved a 17% improvement in Area Under the Receiver Operating Characteristic (AUC-ROC) and a 42% improvement in Area Under the Precision-Recall curve (AUC-PR).
Expediting Diagnosis
Retrospective analysis revealed that PheNet could have flagged more than 50% of CVID patients at least one year prior to their actual clinical diagnosis, with a median lead time of 244 days. In a blinded prospective-style validation at UCLA Health, an immunologist reviewed the top 100 patients ranked by PheNet; 74% were deemed "highly probable" to have CVID, despite lacking a formal diagnosis in the system.
Multi-Institutional Validation
To ensure the model's generalizability, PheNet was tested on over 5.6 million records across six diverse medical systems, including UCSF, UC Davis, and Vanderbilt University Medical Center. The model maintained high performance across these disparate systems without retraining, achieving a ~434-fold enrichment for CVID diagnosis in top-ranked patients compared to random selection.
Discussion and Limitations
While PheNet shows immense promise, several challenges remain. Data fragmentation across different health systems can obscure a patient's full phenotypic signature. Additionally, the model currently does not account for the temporal frequency of symptoms (e.g., the density of infections over time). Future work will focus on incorporating longitudinal "trajectories" and optimizing clinical referral thresholds to balance sensitivity with specialist workload.
Conclusion
PheNet demonstrates that machine learning can effectively identify rare disease signatures within massive, noisy EHR datasets. By providing an interpretable ranking of high-risk patients, such algorithms can significantly shorten the diagnostic odyssey for CVID and potentially other rare immunological disorders, improving patient outcomes and reducing systemic healthcare costs.
Summary updated