Refining chronic pain phenotypes: A comparative analysis of sociodemographic and disease-related determinants using electronic health records

J Pain. 2025 Jan 3:28:104775. doi: 10.1016/j.jpain.2025.104775. Online ahead of print.

Abstract

The use of electronic health records (EHR) for chronic pain phenotyping has gained significant attention in recent years, with various algorithms being developed to enhance accuracy. Structured data fields (e.g., pain intensity, treatment modalities, diagnosis codes, and interventions) offer standardized templates for capturing specific chronic pain phenotypes. This study aims to determine which chronic pain case definitions derived from structured data elements achieve the best accuracy, and how these validation metrics vary by sociodemographic and disease-related factors. We used EHR data from 802 randomly selected adults with autoimmune rheumatic diseases seen at a large academic center in 2019. We extracted structured data elements to derive multiple phenotyping algorithms. We confirmed chronic pain case definitions via manual chart review of clinical notes, and assessed the performance of derived algorithms, e.g., sensitivity/recall, specificity, positive predictive value (PPV). The highest sensitivity (67%) was observed when using ICD codes alone, while specificity peaked at 96% with a quadrimodal algorithm combining pain scores, ICD codes, prescriptions, and interventions. Specificity was generally higher in males and younger patients, particularly those aged 18-40 years, and highest among Asian/Pacific Islander and privately insured patients. PPV was highest among patients who were female, younger, or privately insured. PPV and sensitivity were lowest among males, Asian/Pacific Islander, and older patients. Variability of phenotyping results underscores the importance of refining chronic pain phenotyping algorithms within EHRs to enhance their accuracy and applicability. While our current algorithms provide valuable insights, enhancement is needed to ensure more reliable chronic pain identification across diverse patient populations. PERSPECTIVES: This study evaluates chronic pain phenotyping algorithms using electronic health records, highlighting variability in performance across sociodemographic and disease-related factors. By combining structured data elements, the findings advance chronic pain identification, promoting equitable healthcare practices and highlighting the need for tailored algorithms to address subgroup-specific biases and improve outcomes.

Keywords: Chronic Pain; Electronic Health Records; Heterogeneity; Phenotyping Algorithms; Validation.