Abstract
Objective The aim of this study was to investigate and compare different case definitions for chronic pain to provide estimates of possible misclassification when researchers are limited by available electronic health record and administrative claims data, allowing for greater precision in case definitions.
Methods We compared the prevalence of different case definitions for chronic pain (N = 3042) in patients with autoimmune rheumatic diseases. We estimated the prevalence of chronic pain based on 15 unique combinations of pain scores, diagnostic codes, analgesic medications, and pain interventions.
Results Chronic pain prevalence was lowest in unimodal pain phenotyping algorithms: 15% using analgesic medications, 18% using pain scores, 21% using pain diagnostic codes, and 22% using pain interventions. In comparison, the prevalence using a well-validated phenotyping algorithm was 37%. The prevalence of chronic pain also increased with the increasing number (bimodal to quadrimodal) of phenotyping algorithms that comprised the multimodal phenotyping algorithms. The highest estimated chronic pain prevalence (47%) was the multimodal phenotyping algorithm that combined pain scores, diagnostic codes, analgesic medications, and pain interventions. However, this quadrimodal phenotyping algorithm yielded a 10% overestimation of chronic pain compared to the well-validated algorithm.
Conclusion This is the first empirical study to our knowledge that shows that established common modes of phenotyping chronic pain can lead to substantially varying estimates of the number of patients with chronic pain. These findings can be a reference for biases in case definitions for chronic pain and could be used to estimate the extent of possible misclassifications or corrections in using datasets that cannot include specific data elements.
Up to 7% of adults in the United States live with autoimmune rheumatic diseases (ARDs), including systemic lupus erythematosus (SLE), Sjögren syndrome (SS), systemic sclerosis (SSc), ankylosing spondylitis (AS), and psoriatic arthritis (PsA).1 ARDs are heterogeneous conditions disproportionately affecting women and are hypothesized to be caused by a dysregulated immune system triggering organ dysfunction and damage.1 The American College of Rheumatology noted pain as the most salient patient-reported outcome in ARDs because it significantly affects health-related quality of life and disability.2 Despite treatment advances in rheumatology, including the advent of highly specific biologics and disease-modifying antirheumatic drugs (DMARDs), pain remains an undertreated problem.3 Depending on the ARD diagnosis, upwards of 65% of patients with ARDs are on long-term opioid therapies and have higher rates of opioid overdose hospitalizations than the general population.4
We need to understand the burden of chronic pain in ARDs. People with rheumatologic conditions experience moderate to severe pain associated with the condition itself, are likely to have medical comorbidities, and are likely to experience co-occurring chronic pain from nonrheumatologic conditions (eg, migraine or irritable bowel disease). Specifically, reliable and detailed estimates of the full burden of chronic pain in ARDs are needed to establish a basis for population-wide interventions and estimate trends. Electronic health records (EHRs) offer great potential to reduce the need for data gathering and thereby promote efficient calculation of estimates of disease burden. Although EHRs are a rich data resource, accurate case definitions and algorithms are needed to ensure precision in estimating the burden of chronic pain. Accordingly, computational phenotyping is a clinical data science method that leverages data-driven methods to subtype and characterize patient conditions from heterogeneous EHR data,5 and yield phenotyping algorithms that could be applied across datasets. Indeed, the potential uses of the chronic pain phenotyping algorithm include estimating incidence, prevalence, and trends in administrative databases/EHRs; providing baseline measures to characterize pain trajectories in administrative databases; understanding the epidemiology of other chronic overlapping pain conditions; facilitating cost modeling and health utilization projections; and characterizing treatment response and effectiveness.
Variability in case definitions can create error in estimations and inferences6 by affecting the number and type of cases identified. As such, accuracy and consistency in case definitions are crucial as downstream applications of results potentially affect direct patient care, research, and health policy. Chronic pain is often considered a subjective symptom and can be clinically complex. The lack of objective tests, biomarkers, and diagnostic criteria may complicate the use of EHR data for epidemiological inference. In 2012, Tian et al published a well-cited general chronic pain algorithm that applied 3 unimodal criteria from structured EHR data: pain scores, diagnostic codes, and prescription opioids.7,8 However, several limitations call into question the utility of this algorithm in rheumatology, including that (1) trends in the diagnosis and management of chronic pain have evolved since the 2011 to 2012 study period; (2) it was developed using data from primary care, thereby limiting its generalizability in the rheumatic specialty care context; (3) it was not externally validated outside of the derivation dataset; and (4) it included opioid medications only and omitted other prescription analgesics.
To create greater precision in case definitions for chronic pain in EHRs, the aims of this study are to (1) describe the extraction and prevalence of 4 unimodal pain criteria in EHRs using pain scores, diagnostic codes associated with chronic pain, analgesic medications, and pain interventions; (2) detail the correlation between the unimodal pain criteria; (3) determine the prevalence of distinct combinations of the pain criteria into algorithmic phenotyping and compare them to the Tian et al algorithms; and (4) quantify the strength of association between several variables (as exposures) and chronic pain (as outcomes) using different case definitions based on multimodal phenotyping algorithms. We also examined sex differences for each of the 4 study aims. We expect our comparison of several different chronic pain phenotyping algorithms will yield useful information for future researchers depending on their data availability and research questions. The next step in this line of research will be to conduct validation of these algorithms to estimate their accuracy.
METHODS
Stanford Health Care has approximately 1 million outpatient visits per year and uses Epic (Epic Systems) as its EHR vendor. EHR data fields available for analysis include demographics, diagnostic codes, problem list, medications, laboratory studies, procedures, and clinical encounter notes. EHR records are accessed using a backend relational database (Stanford Research Repository [STARR]) that can be queried. We retrospectively queried STARR to identify patients aged ≥ 18 years visiting any Stanford outpatient rheumatology clinic (including joint immunology–dermatology clinics) in 2019. Further, we identified patients with ≥ 2 visits with ARD diagnoses ≥ 3 months apart using the International Classification of Diseases, 10th revision, Clinical Modification (ICD-10-CM) codes (Supplementary Table S1, available from the authors upon request) for the following ARDs: AS, PsA, SS, SLE, and SSc. We chose to include at least 2 ARD diagnoses of the same ARD to ensure that these patients were being actively managed for each condition.
Pain scores. Current pain intensity scores are recorded at clinic visits using the 11-point numeric pain rating scale (ie, 0 = no pain, 10 = worst pain imaginable). The pain score is recorded as structured data in the EHR. Patients who had ≥ 2 pain scores rated as ≥ 4 points at least 3 months apart (Figure 1) were categorized as having met the unimodal chronic pain criterion.7
How unimodal chronic pain phenotypes were constructed from electronic health records. We identified patients with chronic pain using 4 unimodal pain phenotyping algorithms: pain scores, diagnosis codes, medications, and interventions. ICD: International Classification of Diseases, 10th revision, Clinical Modification; NSAID: nonsteroidal antiinflammatory drug.
Pain diagnostic codes. We defined a list of ICD-10-CM codes for general and nonrheumatic chronic pain conditions through an extensive literature review and expert input (Supplementary Table S1 and Supplementary Figure S1, available from the authors upon request). We extracted ICD-10-CM codes for the following painful conditions: abdominal pain, chest pain, pain in joints, pain in limbs, cervicalgia, fibromyalgia, irritable bowel syndrome, urologic chronic pelvic pain syndrome, vulvodynia, migraine, chronic tension-type headache, temporomandibular disorder, chronic low back pain, myalgic encephalomyelitis/chronic fatigue syndrome, and endometriosis. We labeled patients with chronic pain using the diagnosis codes phenotyping algorithm if they had ≥ 2 ICD-10-CM codes in Supplementary Table S1 recorded at visits separated by ≥ 3 months.
Pain medications. We extracted pain-related prescriptions, including opioids, nonsteroidal antiinflammatory drugs, acetaminophen, anticonvulsants, antidepressants, and muscle relaxants, using previously described definitions.9 We categorized patients as having chronic pain if they met the analgesic prescription criterion of ≥ 2 prescriptions of any of the pain medications listed in this section recorded at visits separated by ≥ 3 months (Supplementary Table S2 and Supplementary Figure S1, available from the authors upon request).
Pain interventions. We identified patients with the most common Current Procedural Terminology codes used in interventional pain management based on conversations with rheumatologists and pain clinicians (Figure 1; Supplementary Table S3, available from the authors upon request). These codes include, but are not limited to, physical therapy, acupuncture, and nerve blocks. We labeled patients as having chronic pain using the pain interventions phenotyping algorithm if they had any of the procedures in Supplementary Table S3.
Data analysis. We examined the baseline distribution of patients with each of the 5 rheumatic conditions by sociodemographic (sex, race, ethnicity, age at baseline, marital status, and insurance status) and lifestyle (smoking status and BMI) variables. We estimated the prevalence of each of the 4 unimodal phenotyping algorithms in patients with rheumatic diseases. We also determined the sociodemographic and lifestyle variables associated with the presence of each unimodal phenotyping algorithm. We reported the associations between the unimodal phenotyping algorithms using tetrachoric correlation coefficients, a measure of association between the binary variables. Tetrachoric correlation coefficients can range from −1 (indicating strong negative correlation between 2 unimodal phenotypes) to 1 (indicating a strong positive correlation between 2 unimodal phenotypes).10-12 A value of 0 indicates no correlation between 2 unimodal phenotypes. We also evaluated the prevalence of 11 combinations of the unimodal phenotyping algorithms and examined the extent of the overestimation or underestimation of chronic pain prevalence compared to the Tian et al chronic pain algorithm.7,8 Finally, we quantified the strength of association between sex, race, and disease status with chronic pain using different case definitions based on the multimodal pain phenotyping algorithms by estimating odds ratios (ORs).
Ethics. The institutional review board (IRB) at the Stanford University School of Medicine approved this study (IRB #53750).
RESULTS
The number of patients attending rheumatology clinics in 2019 ranged from 242 diagnosed with AS to 842 diagnosed with SS (Table 1). There was a preponderance of female patients (54.7-92.9%) in all conditions, except for AS. The proportion of non-White patients (ie, Asian/Pacific Islander, Black, and other) ranged from 50.1% in SLE to 29% in PsA, and Hispanics comprised 18.7% of patients with SLE and 7.9% of patients with AS. The average age at the first visit ranged from 41.7 years in SLE to 56.1 years in SS. The proportion of publicly/privately insured did not vary considerably by disease status: overall, it was 93%.
Distribution of patients attending a rheumatology clinic at an academic medical center in 2019.
Approximately 18% of patients attending the rheumatology clinics met the criteria for chronic pain using pain scores based on having ≥ 2 pain scores (≥ 4 points out of 10) at least 3 months apart. Pain scores were available for > 95% of patient records. The prevalence of the pain score phenotyping algorithm varied considerably by sex: 20% in female and 12% in male patients. Female patients had a higher prevalence of each unimodal pain phenotyping algorithm (Figure 2). The prevalence of pain ICD-10-CM phenotyping algorithm (ie, having ≥ 2 pain ICD-10-CM codes at least 3 months apart) was higher in female patients (23% compared to 15% in male patients). However, the prevalence of the pain prescription phenotyping algorithm (ie, having ≥ 2 pain medications at least 3 months apart) was slightly higher in female patients (16% compared to 13% in male patients). Similarly, the prevalence of the pain interventions phenotyping algorithm was slightly higher in female compared to male patients (23% vs 19%).
Prevalence (and 95% CI) of unimodal pain phenotypes among patients with rheumatic diseases managed at an academic medical center stratified by sex in 2019. The pain scores are ≥ 4 on the visual analog scale and the ICD codes are ≥ 3 months apart. ICD: International Classification of Diseases, 10th revision, Clinical Modification.
There was also considerable variability in the prevalence of each unimodal pain phenotyping algorithm by rheumatologic disease (Figure 3). The prevalence of the pain score phenotyping algorithm was highest among patients with SLE (22%) and SS (19%). The prevalence of the ICD-10-CM code pain phenotyping algorithm was highest among patients with SS (approximately 24%). Similarly, the prevalence of the pain prescription phenotyping algorithm was highest among patients with SS and lowest among patients with SLE. On the other hand, 17% of patients with AS had pain interventions compared with 26% of patients with SSc.
Prevalence (and 95% CI) of unimodal pain phenotypes among patients with rheumatic diseases managed at an academic medical center in 2019 by disease status. The pain scores are ≥ 4 on the visual analog scale and the ICD codes are ≥ 3 months apart. AS: ankylosing spondylitis; ICD: International Classification of Diseases, 10th revision, Clinical Modification; SLE: systemic lupus erythematosus; SS: Sjögren syndrome; SSc: systemic sclerosis.
The correlation coefficients between the unimodal pain phenotyping algorithms were generally low to medium in strength (Supplementary Table S4, available from the authors upon request). The lowest correlation was between pain ICD-10-CM codes and pain interventions (approximately 0.23), whereas the highest correlation was between pain scores and pain ICD-10-CM codes (approximately 0.46). There were also differences in the correlations by sex, with males tending to have lower correlation coefficients. However, male patients had the highest correlation between pain scores and analgesic prescriptions (0.50) and almost no correlation between analgesic prescriptions and pain interventions.
Table 2 shows the prevalence of chronic pain based on bimodal (combination of 2 phenotyping algorithms), trimodal (combination of 3 phenotyping algorithms), and quadrimodal phenotyping algorithms (combination of 4 phenotyping algorithms). Among the 11 possible combinations of the unimodal pain phenotyping algorithms, the highest estimated prevalence of chronic pain was the combination of all 4 unimodal algorithms into a multimodal phenotyping algorithm, #11 (46.98%). The lowest estimated prevalence of chronic pain was the combination comprising 2 unimodal phenotyping algorithms (pain scores and pain prescriptions), #2 (27.45%). The Tian et al chronic pain algorithm combined pain scores, ICD-10-CM codes, and prescription, and the prevalence of chronic pain based on this algorithm (#7) was 36.65%. Using the Tian et al algorithm, the prevalence of chronic pain was slightly higher among female patients (38.91% compared to 28.57%). The prevalence of chronic pain was also highest among Black patients (approximately 42.17%) compared with Asian patients (27.29%). The prevalence of chronic pain was also highest among the publicly insured across multiple combinations. The prevalence of chronic pain using these multimodal definitions was again highest in patients with SS and lowest in SSc.
Prevalence of chronic pain according to different combinations of unimodal pain phenotypes based on 2019 data.
When estimating the extent of the overestimation or underestimation of chronic pain by the multimodal pain phenotyping algorithms compared with the Tian et al algorithm, we found substantial variation overall and within key population subgroups (Figure 4). The combination that was closest in prevalence to the Tian et al algorithm was the ICD-10-CM codes and pain interventions (overall difference was −0.4%), with the differences in estimates of chronic pain varying from −11.2% to 4.7% in various subgroups. The combination that was furthest in prevalence from the Tian et al algorithm was pain scores, ICD-10-CM codes, prescriptions, and interventions (overall difference was 10.3%), with overestimation as high as 14% in subgroups.
The extent of the overestimation or underestimation of chronic pain by various combinations of unimodal pain phenotypes. There are 15 different ways to measure chronic pain. The 4 unimodal phenotypes are in Figure 2. This figure shows the prevalence of chronic pain based on 11 multimodal phenotypes. Numbers 1-6 are bimodal phenotypes (ie, combinations of 2 unimodal phenotypes). Numbers 7-10 are trimodal phenotypes. The Tian phenotype that combines pain scores, diagnoses, and prescriptions is no. 7. AS: ankylosing spondylitis; ICD: International Classification of Diseases, 10th revision, Clinical Modification; PI: Pacific Islander; PSA: psoriatic arthritis; SjS: Sjögren syndrome; SLE: systemic lupus erythematosus; SSc: systemic sclerosis.
We quantified the strength of association between sex, race, and disease status and chronic pain using different case definitions according to the multimodal pain phenotyping algorithms (Supplementary Figures S1 and S2, available from the authors upon request). When estimating ORs comparing female to male patients, we found that female patients had > 50% higher odds of chronic pain using the Tian et al algorithm (highlighted in red).7 Although this point estimate varied by the multimodal pain phenotyping algorithm, the CIs overlapped for the 11 multimodal phenotyping algorithms. Similarly, across multiple case definitions, Asian patients had 50% lower odds of chronic pain compared with White patients based on the Tian et al pain algorithm; this point estimate did not vary considerably using other case definitions. However, there were more variations in point estimates by disease status, although most CIs overlapped considerably.
DISCUSSION
This study used records from approximately 3000 patients seen at rheumatology clinics to create unimodal and multimodal chronic pain phenotyping algorithms. The aim was to investigate and compare different case definitions for chronic pain to provide estimates of possible misclassification when researchers are limited by available EHR data. We did not determine the accuracy of each pain phenotyping algorithm; this is the subject of future research. As expected, the prevalence of chronic pain using unimodal phenotyping algorithms was lower than that using multimodal pain phenotyping algorithms. The prevalence of chronic pain also increased with the increasing number (bimodal to quadrimodal) of phenotyping algorithms that comprised the multimodal phenotyping algorithms. We applied the 2012 Tian et al multimodal phenotyping algorithm that combines pain scores, ICD-10-CM codes, and prescription to our current data to yield a chronic pain prevalence estimate of 37%, which exceeded the 19% chronic pain prevalence estimate that the algorithm authors reported in their 2012 study.7 Moreover, we improved on the Tian et al general chronic pain phenotyping algorithm by better aligning with rheumatology clinics and patients in the following ways. First, the Tian study setting was in a multisite community center, whereas we used academic rheumatology clinics in Northern California and a patient population with significant burden of chronic pain. Second, the Tian et al phenotyping algorithm restricted their examination of analgesic medications to opioids only. In contrast, we added other analgesic medications that better align with contemporary changes in the management of chronic pain, and are commonly prescribed for inflammatory pain conditions. When we limited our case definition to opioids only, the prevalence of chronic pain was approximately 31%.
The Tian et al multimodal phenotyping algorithm showed good to excellent accuracy during derivation and validation. The positive predictive value of the Tian et al multimodal phenotyping algorithm was 98% in the derivation dataset and 91% upon validation, the sensitivity was 85%, and the specificity was 98%.7 These accuracy metrics were superior to those of unimodal phenotyping algorithms (ie, pain interventions, pain scores, opioids, and ICD-10-CM codes). The Tian et al multimodal phenotyping algorithm, or variations of it, has been adapted for myriad purposes including characterizing the demographics of patients with chronic pain in the state of Maine,8 estimating the costs and sex differences in the use of a complementary and integrative health intervention for chronic pain in veterans,13,14 predicting pain intensity improvements,15 and evaluating the burden of neuropathic pain in Canada.16
The choice of which unimodal or multimodal pain phenotyping algorithm to use depends on the availability of the data elements in EHRs, claims or registry data, and the research question or hypothesis. For example, most administrative claims databases such as Truven Health (IBM) MarketScan, Optum Insight, Medicare, and Medicaid may only have ICD-10-CM codes, medications, and interventions, but may not have pain scores. However, a trimodal phenotyping algorithm with that combination would yield a chronic pain estimate that is 5% higher than the one estimated by the Tian et al phenotyping algorithm. An alternative would be the bimodal phenotyping algorithm that combines ICD-10-CM codes and interventions where the chronic pain estimate was only 0.4% less than the Tian et al phenotyping algorithm. One caveat to bear in mind is that one cannot study the effects of elements that comprise a particular phenotyping algorithm. If a chronic pain phenotyping algorithm includes prescriptions, researchers cannot study the effect or trends of prescriptions using that phenotyping algorithm. One study that adapted the Tian et al algorithm for estimating the cost of complementary and integrative health approaches for chronic musculoskeletal pain in younger US veterans did not include the use of medications in the case definition for pain because they were evaluating the use of pain interventions.13 Researchers in that study elected to use ICD-10-CM codes and pain scores, a phenotyping algorithm that yielded a 6% underestimate of chronic pain prevalence in the present study.13 This phenotyping algorithm has been shown to have a predictive value of 82%.7 In another study, improvements in pain intensity were evaluated and the chronic pain definition used only ICD-10-CM codes.15 In this study, the unimodal phenotyping algorithm consisting of ICD-10-CM codes yielded a chronic pain prevalence of 21%, a potential 18% underestimate. This phenotyping algorithm has been shown to have a predictive value of 89% to 95%, but the sensitivity ranged between 20% to 71%.7
As expected, the prevalence of chronic pain was higher among female patients in each case definition. Female patients had a higher prevalence of high pain scores and pain ICD-10-CM codes. A female preponderance in the burden and intensity of chronic pain is well documented in the literature.17,18 For example, several studies have reported a higher prevalence of temporomandibular disorders, neuropathic pain in diabetes, and postoperative pain in female patients.19-22 In a study of 72,000 patients using the EHR from Stanford Hospital and Clinics, Ruau et al found that, on average, women reported higher pain scores in 72% of diagnoses, including rheumatoid arthritis (RA), osteoarthritis, and diabetes.23 Other studies have also shown the higher use of pain medications and therapies in female compared to male individuals, including opioid use and complementary/integrative health.24-26 To our knowledge, this study is the first to highlight sex differences across 4 chronic pain phenotyping algorithms. Consistent with previous research, we found higher prescriptions of pain medications and intervention in female than male individuals, but these differences were not significant.
This study has a few limitations. We did not include patients with RA in this study because patients with this condition are selectively given the Routine Assessment of Patient Index Data 3 questionnaire at every visit in our clinics, which includes the visual analog pain scale (VAS). Thus, the inclusion of patients with RA has an artificially higher prevalence of pain relative to the other groups because of the systematic collection of VAS pain scores in RA (Supplementary Figure S3, available from the authors upon request). We included only medications that are prescribed nationally to ensure generalizability, thus excluding pain treatment modalities such as cannabis. We were unable to measure social determinants of health such as educational attainment, income, and employment status—factors known to affect chronic pain and disability. We also did not include comorbidities such as diabetes, heart disease, and mood disorders. We did not include information on healthcare utilization metrics such as emergency department visits and surgeries. There are numerous other lifestyle factors that could potentially influence pain levels and the accuracy of pain classifications, including diet, physical activity, alcohol consumption, and sleep quality. However, we were only able to extract smoking status and BMI from the EHR system. We also did not include information on the prescribers of the pain medications and did not include the status of specific conditions such as duration of disease, severity, and rheumatologic medications such as DMARDs.
We found that effect estimates of associations between key demographic variables and chronic pain based on the different case definitions did not vary considerably. It is impossible to tell which directions the effect sizes will go during multivariable regression modeling. In addition, these findings may not generalize beyond rheumatology clinics and these clinics’ geographical/sociodemographic contexts. However, chronic pain remains the most salient source of disability in rheumatology and the sociodemographic composition of the study participants is racially diverse (approximately 40% Asian/Pacific Islander, Black, or other). We expect this phenomenon is true in other contexts; however, future studies should include validation of these findings in other specialties. We speculate that error would be on the side of underestimating. In addition, misclassification bias in case ascertainment may have profound implications for estimation of disease burden, thus affecting risk estimations, patient care, cost estimations, and health policy decisions. However, perfect case definitions do not exist and there needs to be careful consideration of the costs of overestimation or underestimation of chronic pain cases (eg, overscreening and missed cases). We did not estimate the accuracy of the case definitions in ascertaining chronic pain; this is the subject of a future study. In addition, the current study gives a general overview of the prevalence of chronic pain in patients with ARD; however, it does not address the nuances of the pain experience in individual patients, which are influenced not only by disease status, but also contextual determinants. This study is foundational as an early exploration of the epidemiological use of EHRs, with need of future refinement.
In conclusion, this was, to our knowledge, the first empirical study to show that established common modes of phenotyping chronic pain can lead to substantially varying estimates of the number of patients with chronic pain. As a consequence, we created a reference for biases in case definitions for chronic pain in EHR. These findings could be used to estimate the extent of possible misclassifications or corrections in using datasets that cannot include specific data elements.
Footnotes
SM (K24-NS-126781 and R61-NS-11865), TF (T32-DA-035165), and BDD (K24-DA-053564) received funding from the National Institutes of Health (NIH) National Institute on Drug Abuse. SM also acknowledges support from the Redlich Pain Research Endowment. TF (K01-AR-079039) received funding from the NIH National Institute of Arthritis and Musculoskeletal and Skin Diseases.
The authors declare no conflicts of interest relevant to this article.
- Accepted for publication November 6, 2023.
- Copyright © 2024 by the Journal of Rheumatology
REFERENCES
DATA AVAILABILITY
The data that support the findings of this study are available on reasonable request from the corresponding author, TF. The data are not publicly available because they contain information that could compromise the privacy of patient populations.










