Characterizing Variability of EHR-Driven Phenotype Definitions

Pascal Brandt, Abel Kho, Yuan Luo, Jennifer A. Pacheco, Theresa L. Walunas, Håkon Håkonarson, George Hripcsak, Cong Liu, Ning Shang, Chunhua Weng, Nephi Walton, David Carrell, Paul K. Crane, Eric D. Larson, Christopher G. Chute, Iftikhar Kullo, Robert J. Carroll, Joshua C. Denny, Andrea H. Ramirez, Wei‐Qi Wei, Jyoti Pathak, Laura K. Wiley, Rachel Richesson, Justin Starren, Luke V. RasmussenmedRxiv 2022

Abstract

Objective: Analyze a publicly available sample of rule-based phenotype definitions to characterize and evaluate the types of logical constructs used. Materials & Methods: A sample of 33 phenotype definitions from the Phenotype KnowledgeBase (PheKB), represented using Fast Healthcare Interoperability Resources (FHIR) and Clinical Quality Language (CQL), was analyzed using automated analysis of the computable representation of the CQL libraries. Results: Most phenotype definitions include narrative descriptions and flowcharts, while few provide executable artifacts. Most use 4 or fewer medical terminologies. The number of codes used ranges from 5 to 6865, and value sets from 1 to 19. Common expressions include literal, data, and logical expressions; aggregate and arithmetic expressions are least common. Expression depth ranges from 4 to 27. Conclusion: Phenotypes show significant variation in specific operators but are composed of the same high-level components: tabular data and logical expressions. Standard representations should support these formats and be modular to facilitate localization and shared logic.

Introduction

Identifying a "phenotype"—a cohort of patients with a specific condition like Type 2 Diabetes—within Electronic Health Records (EHRs) is a foundational yet difficult task in medical informatics. Historically, these definitions were shared as narrative text, flowcharts, or custom SQL scripts, creating a bottleneck for reproducibility and scalability across different hospital systems. This study investigates whether standardized frameworks, specifically Fast Healthcare Interoperability Resources (FHIR) for data and Clinical Quality Language (CQL) for logic, can characterize the underlying complexity and variability of these definitions, ultimately leading to better sharing and reuse of research algorithms.

Methods

The researchers analyzed 33 "Final" phenotype definitions sourced from the Phenotype KnowledgeBase (PheKB). These definitions were translated into a computable format using FHIR and CQL. To perform a structural "autopsy" of the logic, the authors used an automated approach:

  • ELM Analysis: Examination of the Expression Logical Model (ELM), the machine-readable version of CQL logic (an Abstract Syntax Tree).
  • Visitor Pattern: Implementation of a software design pattern to traverse logic trees, programmatically counting operator types (e.g., "exists," "count," "and/or"), measuring nesting depth, and identifying referenced medical terminologies.
  • Metadata Curation: Manual extraction of metadata to categorize phenotype intent (e.g., disease identification vs. drug response).

Datasets

The primary dataset consisted of 33 phenotype definitions from PheKB, covering a diverse range of conditions:

  • Chronic Diseases: Type 2 Diabetes, Crohn’s Disease.
  • Acute Conditions: Herpes Zoster.
  • Traits/Lab-based: Red Blood Cell Indices, Height.
  • Drug Responses: Clopidogrel Poor Metabolizers.

Results and Key Insights

Terminology and Code Usage

The study revealed a conservative approach to terminology. Most phenotypes use four or fewer different medical terminologies. Despite the transition to ICD-10, nearly all phenotypes (30 out of 33) still rely on ICD-9 codes, highlighting the importance of historical data in longitudinal research.

Figure 4: Code system utilization across the 33 phenotypes, showing the high prevalence of ICD-9-CM and RxNorm.

Logical Complexity and Operators

The complexity of phenotypes is often topological rather than functional. Most definitions rely on a small subset of available logical operators, rarely using complex math or advanced aggregates. Instead, complexity arises from the nesting of simple "if-this-then-that" filters. The median phenotype used 59 expressions, with a range from 6 (Autism) to 228 (Familial Hypercholesterolemia). Total expression depth ranged from 4 to 27, with a median of 14.

Figure 6: Categories of logical operators and expressions used in the phenotype definitions.

The most frequent non-literal expressions were retrieve (fetching data) and exists (checking if a record is present). Arithmetic and aggregate operators were the least common.

Clinical vs. Operational Logic

A key distinction was found between clinical logic (the medical definition of a disease) and operational logic (data-specific constraints). For example, requiring a specific duration of continuous enrollment is an operational filter to ensure data completeness, rather than a medical symptom. Interestingly, there was no correlation between disease severity and definition complexity; the definition for "Height" was significantly more complex than "Multiple Sclerosis" due to the need to filter out erroneous data points.

Discussion and Limitations

While the study provides a robust framework for analyzing phenotype definitions, it is limited by a sample size of 33 phenotypes. Furthermore, the analysis purposefully excluded Natural Language Processing (NLP) directives. As many phenotypes rely on clinical notes, standardizing how NLP "keywords" and "negation logic" are represented is a critical area for future work.

The authors suggest that "operational logic" should be moved into shared, modular libraries. This would prevent researchers from reinventing the wheel for common tasks like defining enrollment periods or data quality checks.

Conclusion

The phenotypes analyzed show significant variation in specific logical and arithmetic operators but are fundamentally composed of the same high-level components: tabular data and logical expressions. A standard representation for phenotype definitions should support these formats and be modular to facilitate localization and shared logic across the research community.

Summary updated

BibTeX
@misc{brandt2022characterizing,
  author = {Pascal Brandt and Abel Kho and Yuan Luo and Jennifer A. Pacheco and Theresa L. Walunas and Håkon Håkonarson and George Hripcsak and Cong Liu and Ning Shang and Chunhua Weng and Nephi Walton and David Carrell and Paul K. Crane and Eric D. Larson and Christopher G. Chute and Iftikhar Kullo and Robert J. Carroll and Joshua C. Denny and Andrea H. Ramirez and Wei‐Qi Wei and Jyoti Pathak and Laura K. Wiley and Rachel Richesson and Justin Starren and Luke V. Rasmussen},
  title = {{Characterizing Variability of EHR-Driven Phenotype Definitions}},
  year = {2022},
  doi = {10.1101/2022.07.10.22277390},
  howpublished = {medRxiv},
}
Figure