Written and maintained by CASRAI Editorial Board
Published · Last updated
On this page
EHR phenotyping (also termed electronic phenotyping or computable phenotyping) is the biomedical informatics discipline of constructing executable algorithms that query longitudinal Electronic Health Record (EHR) databases to identify patient cohorts exhibiting a specific clinical disease, physiological trait, or treatment response. Because raw administrative billing codes (such as single ICD-9-CM or ICD-10-CM encounter diagnoses) suffer from upcoding, rule-out diagnostic testing, and institutional workflow variation, rigorous EHR phenotyping integrates multiple clinical data modalities—diagnoses, laboratory measurements, medication dispensing records, clinical procedures, and unstructured narrative notes—to achieve research-grade Positive Predictive Value (PPV) and sensitivity.
What Is EHR-Based Computable Phenotyping?
A computable phenotype is a formal, machine-executable clinical case definition expressed as deterministic Boolean logic, SQL/CQL queries, OMOP Common Data Model cohort definitions, or probabilistic machine learning weights. Rather than relying on a single billing code, a computable phenotype accounts for clinical longitudinality and exclusionary conditions:
- Multi-Modal Input Features: High-precision phenotypes combine structured diagnosis codes (SNOMED CT and ICD-10-CM), procedure codes (CPT / HCPCS / ICD-10-PCS), medication exposures (RxNorm / ATC ingredient concepts requiring repeat prescriptions to distinguish active therapy from single-dose trials), quantitative laboratory thresholds (LOINC-coded analyte values), and clinical natural language processing (cNLP) concept extractions from pathology, radiology, and progress notes.
- Case, Control, and ”Neither” Partitioning: In genetic epidemiology and observational comparative effectiveness studies, misclassifying mild or undiagnosed cases as ”healthy controls” severely degrades statistical power. Consequently, computable phenotypes define explicit criteria for Cases (high-certainty disease presence), Controls (strictly verified absence of the target disease and related differential diagnoses), and an excluded middle buffer of ambiguous patients assigned to neither group.
eMERGE Network Phenotyping, PheKB, and PheWAS Phecodes
Two landmark frameworks established by the National Human Genome Research Institute (NHGRI) and academic medical centers form the backbone of modern rule-based EHR phenotyping:
- The eMERGE Network and PheKB (Phenotype KnowledgeBase): Founded in 2007 by NHGRI, the Electronic Medical Records and Genomics (eMERGE) Network pioneered multi-institutional development and validation of rule-based electronic phenotypes linking biorepositories to clinical EHRs. Hosted at PheKB (`phekb.org`) (Kirby et al., JAMIA 2016), public eMERGE phenotype algorithms (such as Type 2 Diabetes Mellitus, Resistant Hypertension, Crohn’s Disease, and Atrial Fibrillation) publish flowcharts, KNIME workflows, and data dictionaries demonstrating that combining ICD codes with abnormal laboratory values (e.g., HbA1c ≥ 6.5% or fasting glucose ≥ 126 mg/dL), antihyperglycemic RxNorm prescriptions, and NLP negation filtering consistently achieves cross-site PPVs exceeding 95%–98%.
- PheWAS and the Phecode Hierarchy: Introduced by Denny et al. (Bioinformatics 2010; Nature Biotechnology 2013), Phenome-Wide Association Studies (PheWAS) invert the Genome-Wide Association Study (GWAS Catalog) paradigm by testing whether a single genetic variant (SNP) or clinical biomarker is associated with hundreds of clinical phenotypes across the human phenome. Because raw ICD-9-CM and ICD-10-CM trees contain tens of thousands of billing codes designed for reimbursement rather than biology, PheWAS maps ICD codes into roughly 1,860 hierarchical Phecodes. Under the standard ”Rule of Two,” a patient is classified as a Phecode case if they have ≥ 2 instances of the target Phecode on distinct calendar days, while patients with 1 instance or with related exclusionary Phecodes (e.g., excluding Type 1 Diabetes patients when selecting controls for Type 2 Diabetes) are removed from the control pool.
How Do Rule-Based PheKB Algorithms Compare with ML/NLP Phenotyping (PheMap, PheValuator)?
While expert-curated PheKB rules deliver exceptional precision, authoring and validating a single rule-based phenotype across multiple health systems can require months of clinician and informaticist effort. High-throughput machine learning and probabilistic frameworks address this scalability bottleneck:
| Phenotyping Methodology | Representative Tools & Frameworks | Core Algorithmic Mechanism | Strengths & Operational Tradeoffs |
|---|---|---|---|
| Expert Rule-Based Multimodal Algorithms | PheKB / eMERGE Network, OHDSI ATLAS Cohort Definitions | Clinician-authored Boolean decision trees combining ICD/SNOMED codes, LOINC lab cutoffs, RxNorm meds, and cNLP (e.g., Apache cTAKES). | Strengths: Fully interpretable, deterministic, Regulatory/FDA acceptable, PPV routinely > 95%. Tradeoffs: Labor-intensive to build (months per phenotype); brittle to local coding shifts. |
| High-Throughput Code Aggregation | Phecodes (PheWAS) | Hierarchical rollup of ICD-9-CM / ICD-10-CM codes with ”≥ 2 code dates” case thresholds and automated control-group exclusion ranges. | Strengths: Scales instantly across ~1,860 phenotypes for biobank discovery. Tradeoffs: Lower PPV/sensitivity for conditions defined primarily by labs, imaging, or pathology. |
| Knowledge-Driven High-Throughput NLP/ML | PheMap (Zheng et al., JAMIA 2020), XPRESS / APHRODITE | Mines biomedical literature and public knowledge resources (MedlinePlus, Mayo Clinic, UMLS) via TF-IDF and NLP to assign continuous phenotype probabilities (`0.0–1.0`) to patients without manual training labels. | Strengths: Scales across 1,400+ phenotypes simultaneously; outputs continuous phenotypic risk scores rather than binary labels. Tradeoffs: Less transparent decision boundaries than Boolean rules. |
| Probabilistic Gold-Standard Evaluation | PheValuator (Swerdel et al., JBI 2019 — OHDSI R package) | Trains a regularized logistic regression diagnostic predictive model on ”extremely specific” anchor cases (`xSpec`) to assign each patient in a CDM database a predicted probability of disease, then uses those probabilities as a synthetic gold standard to evaluate candidate phenotype algorithms. | Strengths: Estimates sensitivity, specificity, PPV, and NPV across millions of patients without costly manual chart abstraction. Tradeoffs: Depends on well-calibrated `xSpec` anchor cohorts. |
How Are PPV, Sensitivity, and Portability Evaluated Across Multi-Site EHR Networks?
Before deploying a computable phenotype in a multi-center genomic study or pragmatic clinical trial, investigators evaluate three core psychometric and operational metrics:
- Positive Predictive Value (PPV / Precision) and Sensitivity (Recall): In traditional eMERGE validation, an Developing Site executes the phenotype algorithm and selects a random sample of 50–100 algorithm-positive cases and 50–100 algorithm-negative controls for blinded dual-clinician manual chart abstraction (measuring inter-rater reliability via Cohen’s kappa, typically requiring $kappa ge 0.80$). $text{PPV} = text{TP} / (text{TP} + text{FP})$ measures the proportion of identified cases who truly have the condition, whereas $text{Sensitivity} = text{TP} / (text{TP} + text{FN})$ measures the proportion of true disease cases captured by the algorithm. When manual chart review is prohibited by privacy governance across distributed federated networks, researchers deploy PheValuator to compute probabilistic TP, FP, TN, and FN counts across the entire population.
- Algorithmic Portability (Transportability): A phenotype exhibits high portability when an External Validation Site can execute the algorithm against its local EHR data warehouse and achieve a PPV and sensitivity within a narrow tolerance (e.g., $Deltatext{PPV} < 5%$) of the originating site.
- Common Barriers to Multi-Site Portability and Mitigation:
- Local Terminology and EHR Build Drift: Unmapped local lab codes or custom EHR order sets cause SQL queries to miss cases. Standardizing site warehouses onto the OMOP CDM or HL7 FHIR with LOINC/SNOMED/RxNorm concept sets eliminates local code translation errors.
- NLP Pipeline Variance: Free-text expressions vary by regional clinical dialect and note templating. Pairing shared rule engines (medspaCy or cTAKES) with standardized UMLS Concept Unique Identifiers (CUIs) preserves cross-site NLP recall.
Frequently Asked Questions
What is EHR-based computable phenotyping?
EHR-based computable phenotyping is the process of creating machine-executable algorithms that combine structured Electronic Health Record data (ICD-10/SNOMED diagnosis codes, LOINC lab results, RxNorm medications, CPT procedures) and unstructured clinical notes (via NLP) to accurately classify whether patients have a specific medical condition or clinical trait for research and population health.
How do rule-based PheKB algorithms compare with ML/NLP phenotyping (PHEMAP, PheValuator)?
Rule-based PheKB and eMERGE algorithms use clinician-authored Boolean logic and thresholds to achieve high interpretability and PPVs above 95%, but require months of manual development per condition. High-throughput ML/NLP frameworks like PheMap automatically generate continuous phenotype probabilities across 1,400+ conditions from UMLS/EHR concepts, while OHDSI’s PheValuator uses ”extremely specific” (`xSpec`) machine learning models to estimate phenotype sensitivity and PPV across large databases without manual chart review.
How are PPV, sensitivity, and portability evaluated across multi-site EHR networks?
Multi-site networks evaluate Positive Predictive Value (PPV) and sensitivity either by performing blinded dual-clinician manual chart reviews on 50–100 randomly sampled cases and controls at both the development site and independent validation sites (checking Cohen’s kappa), or at scale using probabilistic gold-standard models like PheValuator. Portability is confirmed when external health systems execute the standardized OMOP or FHIR phenotype logic and reproduce the originating site’s PPV and sensitivity without manual rule rewriting.







