Considerations for observational study design: Comparing the evidence of opioid use between electronic health records and insurance claims

Pharmacoepidemiol Drug Saf. 2022 Aug;31(8):913-920. doi: 10.1002/pds.5452. Epub 2022 May 23.


Purpose: Pharmacoepidemiology studies often use insurance claims and/or electronic health records (EHR) to capture information about medication exposure. The choice between these data sources has important implications.

Methods: We linked EHR from a large academic health system (2015-2017) to Medicare insurance claims for patients undergoing surgery. Drug utilization was characterized based on medication order dates in the EHR, and prescription fill dates in Medicare claims. We compared opioid use documented in EHR orders to prescription claims in four time periods: 1) Baseline (182 days before surgery); 2) Perioperative period; 3) Discharge date; 4) Follow-up (90 days after surgery).

Results: We identified 11 128 patients undergoing surgery. During baseline, 34.4% (EHR) versus 44.1% (claims) had evidence of opioid use, and 56.9% of all baseline use was reflected only in one data source. During the perioperative period, 78.8% (EHR) versus 47.6% (claims) had evidence of use. On the day of discharge, 59.6% (EHR) versus 45.5% (claims) had evidence of use, and 51.8% of all discharge use was reflected only in one data source. During follow-up, 4.3% (EHR) versus 10.4% (claims) were identified with prolonged opioid use following surgery with 81.4% of all prolonged use reflected only in one data source.

Conclusions: When characterizing opioid exposure, we found substantial discrepancies between EHR medication orders and prescription claims data. In all time periods assessed, most patients' use was reflected only in the EHR, or only in the claims, not both. The potential for misclassification of drug utilization must be evaluated carefully, and choice of data source may have large impacts on key study design elements.

Keywords: EHR; data linkage; insurance claims; opioids; pharmacoepidemiology.

Publication types

  • Research Support, N.I.H., Extramural
  • Research Support, Non-U.S. Gov't
  • Research Support, U.S. Gov't, P.H.S.

MeSH terms

  • Aged
  • Analgesics, Opioid / therapeutic use
  • Electronic Health Records
  • Humans
  • Information Storage and Retrieval
  • Medicare
  • Observational Studies as Topic*
  • Opioid-Related Disorders / drug therapy
  • Opioid-Related Disorders / epidemiology
  • Research Design*
  • Retrospective Studies
  • United States


  • Analgesics, Opioid