Cohort Design and Natural Language Processing to Reduce Bias in Electronic Health Records Research: The Community Care Cohort Project

Shaan Khurshid, Christopher Reeder, Lia X. Harrington, Pulkit Singh, Gopal Sarma, Sam Friedman, Paolo Di Achille, Nathaniel Diamant, Jonathan W. Cunningham, Ashby C. Turner, Emily S. Lau, Julian S. Haimovich, Mostafa A. Al‐Alusi, Xin Wang, Marcus D. R. Klarqvist, Jeffrey M. Ashburner, Christian Diedrich, Mercedeh Ghadessi, Johanna Mielke, Hanna M. Eilken, Alice McElhinney, Andrea Derix, Steven J. Atlas, Patrick T. Ellinor, Anthony Philippakis, Christopher D. Anderson, Jennifer E. Ho, Puneet Batra, Steven A. LubitzmedRxiv 2021

Abstract

Electronic health records (EHRs) offer a scale for medical discovery that exceeds traditional research cohorts, yet they are frequently plagued by selection bias and missing data. We present the Community Care Cohort Project (C3PO), a cohort of 520,868 individuals from the Mass General Brigham (MGB) network. By implementing an intentional sampling strategy focused on longitudinal primary care and utilizing deep natural language processing (NLP) to recover missing vital signs, we demonstrate a significant reduction in bias compared to standard EHR convenience samples. Our results show that C3PO improves the calibration of cardiovascular risk models and provides a high-fidelity framework for generalizable clinical research.

Introduction

The transition to Electronic Health Records (EHRs) has created a massive repository of "found data"—information collected during the routine course of clinical care. While these datasets offer unprecedented scale, they are not designed for research. Two primary obstacles hinder their utility: selection bias and missingness. Selection bias occurs when the patients included in a study (often "convenience samples" of anyone with available data) do not represent the broader population, frequently over-representing the acutely ill. Missingness occurs when critical data points, such as vital signs, are documented in unstructured clinical notes rather than structured tabular fields.

The Community Care Cohort Project (C3PO) was designed to address these challenges by approximating a community-based prospective cohort study within a large-scale healthcare network.

Methodology

The C3PO framework relies on three core pillars: intentional cohort design, NLP-driven data recovery, and a scalable data infrastructure.

1. The C3PO Sampling Strategy

To mitigate selection bias, the researchers moved away from broad convenience sampling. Instead, they restricted the cohort to individuals within the Mass General Brigham (MGB) system who demonstrated longitudinal engagement with primary care. Specifically, inclusion required at least two primary care visits occurring 1–3 years apart between 2001 and 2018. This "primary care first" heuristic ensures that the cohort consists of individuals receiving regular follow-up, filtering out "medical tourists" who may only appear in the system for a single specialized procedure.

2. NLP Data Recovery

To combat missing data, the team employed Bio+Discharge Summary BERT, a deep learning model pre-trained on medical text. This model was fine-tuned to extract height, weight, and blood pressure from over 75 million unstructured narrative notes. This process allowed the recovery of vital signs for patients who lacked this information in the structured tabular database.

3. The JEDI Pipeline

Managing this volume of data required the development of the Joint Extractive Data Infrastructure (JEDI). JEDI is a standardized pipeline designed to aggregate structured data, text, and imaging reports into a unified, high-performance HDF5 file system, facilitating regular updates and efficient analysis.

Results

The resulting C3PO cohort includes 520,868 individuals with a median follow-up of 7.2 years and a median of 13 primary care visits per person. The dataset is exceptionally rich, containing over 2.9 million electrocardiograms and 75 million narrative notes.

Missingness and Fidelity

The application of NLP led to a 31% reduction in missingness for vital signs, recovering data for over 80,000 individuals who would have otherwise been excluded from risk modeling. The accuracy of this recovery was high; for individuals with both tabular and NLP-extracted data, the correlation was nearly perfect (Pearson r range 0.95–0.99, p<0.01 for all).

Model Validation and Calibration

The cohort was validated using the Pooled Cohort Equations (PCE) for cardiovascular risk and the CHARGE-AF score for atrial fibrillation.

  • Discrimination: Both models showed strong performance (PCE c-index: 0.724–0.770; CHARGE-AF c-index: 0.782).
  • Calibration: C3PO demonstrated superior calibration compared to convenience samples. The Integrated Calibration Index (ICI) for C3PO (0.012–0.030) was significantly lower than that of convenience samples (0.028–0.046), indicating that predicted risks in C3PO more closely matched actual clinical outcomes.

Discussion

A key insight from this project is that longitudinality acts as a filter for data quality. Convenience samples often suffer from an "initial inflection" trap—a spike in new diagnoses immediately following study entry. This suggests that many "new" cases in convenience samples are actually pre-existing conditions discovered during a specialized visit. C3PO avoids this artifact, capturing true incident disease more effectively.

Furthermore, the use of NLP to recover missing data is a matter of equity as well as volume. Patients with missing tabular data are often systematically different from those with complete records. By recovering these "missing voices," NLP helps reduce the bias inherent in who gets their data structured and who does not.

Limitations and Future Directions

While C3PO represents a significant step forward, it is not without limitations. The cohort is predominantly White, which may limit generalizability to more diverse populations. Additionally, while the primary care filter reduces selection bias, "indication bias" (the reason a specific test was ordered) remains a factor in all observational EHR research.

Future work will expand the JEDI pipeline to extract laboratory values and social determinants of health from clinical notes. With its deep longitudinal records, C3PO is uniquely positioned for "trajectory modeling," allowing researchers to use AI to predict long-term health paths rather than isolated clinical events.

Conclusion

The Community Care Cohort Project demonstrates that through intentional sampling and the application of deep learning to unstructured text, EHR data can be transformed into a high-fidelity resource for clinical discovery. By mimicking the design of prospective studies, C3PO provides a blueprint for reducing bias and maximizing the generalizability of real-world evidence.

Summary updated

Abstract

ABSTRACT Background Electronic health records (EHRs) promise to enable broad-ranging discovery with power exceeding that of conventional research cohort studies. However, research using EHR datasets may be subject to selection bias, which can be compounded by missing data, limiting the generalizability of derived insights. Methods Mass General Brigham (MGB) is a large New England-based healthcare network comprising seven tertiary care and community hospitals with associated outpatient practices. Within an MGB-based EHR warehouse of &gt;3.5 million individuals with at least one ambulatory care visit, we approximated a community-based cohort study by selectively sampling individuals longitudinally attending primary care practices between 2001-2018 (n=520,868), which we named the Community Care Cohort Project (C3PO). We also utilized pre-trained deep natural language processing (NLP) models to recover vital signs (i.e., height, weight, and blood pressure) from unstructured notes in the EHR. We assessed the validity of C3PO by deploying established risk models including the Pooled Cohort Equations (PCE) and the Cohorts for Aging and Genomic Epidemiology Atrial Fibrillation (CHARGE-AF) score, and compared model performance in C3PO to that observed within typical EHR Convenience Samples which included all individuals from the same parent EHR with sufficient data to calculate each score but without a requirement for longitudinal primary care. All analyses were facilitated by the JEDI Extractive Data Infrastructure pipeline which we designed to efficiently aggregate EHR data within a unified framework conducive to regular updates. Results C3PO includes 520,868 individuals (mean age 48 years, 61% women, median follow-up 7.2 years, median primary care visits per individual 13). Estimated using reports, C3PO contains over 2.9 million electrocardiograms, 450,000 echocardiograms, 12,000 cardiac magnetic resonance images, and 75 million narrative notes. Using tabular data alone, 286,009 individuals (54.9%) had all vital signs available at baseline, which increased to 358,411 (68.8%) after NLP recovery (31% reduction in missingness). Among individuals with both NLP and tabular data available, NLP-extracted and tabular vital signs obtained on the same day were highly correlated (e.g., Pearson r range 0.95-0.99, p&lt;0.01 for all). Both the PCE models (c-index range 0.724-0.770) and CHARGE-AF (c-index 0.782, 95% 0.777-0.787) demonstrated good discrimination. As compared to the Convenience Samples, AF and MI/stroke incidence rates in C3PO were lower and calibration error was smaller for both PCE (integrated calibration index range 0.012-0.030 vs. 0.028-0.046) and CHARGE-AF (0.028 vs. 0.036). Conclusions Intentional sampling of individuals receiving regular ambulatory care and use of NLP to recover missing data have the potential to reduce bias in EHR research and maximize generalizability of insights.
BibTeX
@misc{khurshid2021cohort,
  author = {Shaan Khurshid and Christopher Reeder and Lia X. Harrington and Pulkit Singh and Gopal Sarma and Sam Friedman and Paolo Di Achille and Nathaniel Diamant and Jonathan W. Cunningham and Ashby C. Turner and Emily S. Lau and Julian S. Haimovich and Mostafa A. Al‐Alusi and Xin Wang and Marcus D. R. Klarqvist and Jeffrey M. Ashburner and Christian Diedrich and Mercedeh Ghadessi and Johanna Mielke and Hanna M. Eilken and Alice McElhinney and Andrea Derix and Steven J. Atlas and Patrick T. Ellinor and Anthony Philippakis and Christopher D. Anderson and Jennifer E. Ho and Puneet Batra and Steven A. Lubitz},
  title = {{Cohort Design and Natural Language Processing to Reduce Bias in Electronic Health Records Research: The Community Care Cohort Project}},
  year = {2021},
  doi = {10.1101/2021.05.26.21257872},
  howpublished = {medRxiv},
}
Figure