Outcomes| Volume 172, ISSUE 1, P241-248, July 2022

Predicting persistent opioid use after surgery using electronic health record and patient-reported data

Published:February 15, 2022DOI:



      More than 100 million surgeries take place annually in the United States, and more than 90% of surgical patients receive an opioid prescription. A sizable minority of these patients will go on to use opioids long-term, contributing to the national opioid epidemic.


      The objective of this study was to develop and validate a model to predict persistent opioid use after surgery. Participants included surgical patients (≥18 years old) enrolled in a cohort study at an academic medical center between 2015 and 2018. Persistent opioid use was defined as filling opioid prescriptions in postdischarge days 4 to 90 and 91 to 180. Predictors included electronic health record data, state prescription drug monitoring data, and patient-reported measures. Three models were developed: a full, a restricted, and a minimal model using a derivation and validation cohort.


      Of 24,040 patients, 4,879 (20%) experienced persistent opioid use. In the validation cohort, the full, restricted, and minimal model had C-statistics of 0.87 (95% CI 0.86–0.88), 0.86 (0.85–0.88), and 0.85 (0.84–0.87), respectively. All models performed better among patients with preoperative opioid use compared to opioid-naive patients (P < .001). The models slightly overpredicted risk in the validation cohort. The net benefit of using the restricted model to refer patients for preoperative counseling was 0.072 to 0.092, which is superior to evaluating no patients (net benefit of 0) or all patients (net benefit of -0.22 to -0.63).


      This study developed and validated a prediction model for persistent opioid use using accessible data resources. The models achieved strong performance, outperforming prior published models.
      To read this article in full you will need to make a payment

      Purchase one-time access:

      Academic & Personal: 24 hour online accessCorporate R&D Professionals: 24 hour online access
      One-time access price info
      • For academic or personal research use, select 'Academic and Personal'
      • For corporate R&D use, select 'Corporate R&D Professionals'


      Subscribe to Surgery
      Already a print subscriber? Claim online access
      Already an online subscriber? Sign in
      Institutional Access: Sign in to ScienceDirect


        • National Quality Forum
        Surgery 2015–2017 final report.
        • Hill M.V.
        • McMahon M.L.
        • Stucke R.S.
        • Barth Jr., R.J.
        Wide variation and excessive dosage of opioid prescriptions for common general surgical procedures.
        Ann Surg. 2017; 265: 709-714
        • Brat G.A.
        • Agniel D.
        • Beam A.
        • et al.
        Postsurgical prescriptions for opioid naive patients and association with overdose and misuse: retrospective cohort study.
        BMJ. 2018; 360: j5790
        • Brummett C.M.
        • Waljee J.F.
        • Goesling J.
        • et al.
        New persistent opioid use after minor and major surgical procedures in US adults.
        JAMA Surg. 2017; 152e170504
        • Johnson S.P.
        • Chung K.C.
        • Zhong L.
        • et al.
        Risk of prolonged opioid use among opioid-naïve patients following common hand surgery procedures.
        J Hand Surg Am. 2016; 41: 947-957.e3
        • Vu J.V.
        • Cron D.C.
        • Lee J.S.
        • et al.
        Classifying preoperative opioid use for surgical care.
        Ann Surg. 2020; 271: 1080-1086
        • Goesling J.
        • Moser S.E.
        • Zaidi B.
        • et al.
        Trends and predictors of opioid use after total knee and total hip arthroplasty.
        Pain. 2016; 157: 1259-1265
        • Hah J.M.
        • Bateman B.T.
        • Ratliff J.
        • Curtin C.
        • Sun E.
        Chronic opioid use after surgery: implications for perioperative management in the face of the opioid epidemic.
        Anesth Analg. 2017; 125: 1733-1740
        • Inacio M.C.S.
        • Hansen C.
        • Pratt N.L.
        • Graves S.E.
        • Roughead E.E.
        Risk factors for persistent and new chronic opioid use in patients undergoing total hip arthroplasty: a retrospective cohort study.
        BMJ Open. 2016; 6e010664
        • Cron D.C.
        • Englesbe M.J.
        • Bolton C.J.
        • et al.
        Preoperative opioid use is independently associated with increased costs and worse outcomes after major abdominal surgery.
        Ann Surg. 2017;
        • Anderson M.
        • Hallway A.
        • Brummett C.
        • Waljee J.
        • Englesbe M.
        • Howard R.
        Patient-reported outcomes after opioid-sparing surgery compared with standard of care.
        JAMA Surg. 2021; 156: 286-287
        • Alter T.H.
        • Ilyas A.M.
        A prospective randomized study analyzing preoperative opioid counseling in pain management after carpal tunnel release surgery.
        J Hand Surg Am. 2017; 42: 810-815
        • Vincent S.
        • Paskey T.
        • Critchlow E.
        • et al.
        Prospective randomized study examining preoperative opioid counseling on postoperative opioid consumption after upper extremity surgery.
        Hand. 2020; 155894472091993
        • Ilyas A.M.
        • Chapman T.
        • Zmistowski B.
        • Sandrowski K.
        • Graham J.
        • Hammoud S.
        The effect of preoperative opioid education on opioid consumption after outpatient orthopedic surgery: a prospective randomized trial.
        Orthopedics. 2021;
        • Howard R.
        • Hallway A.
        • Santos-Parker J.
        • et al.
        Optimizing postoperative opioid prescribing through quality-based reimbursement.
        JAMA Network Open. 2019; 2
      1. Karhade AV, Cha TD, Fogel HA, et al. Predicting prolonged opioid prescriptions in opioid-naïve lumbar spine surgery patients. Spine J. 2019 Dec 31.

        • Karhade A.V.
        • Chaudhary M.A.
        • Bono C.M.
        • Kang J.D.
        • Schwab J.H.
        • Schoenfeld A.J.
        Validating the Stopping Opioids after Surgery (SOS) score for sustained postoperative prescription opioid use in spine surgical patients.
        Spine J. 2019; 19: 1666-1671
        • Karhade A.V.
        • Schwab J.H.
        • Bedair H.S.
        Development of machine learning algorithms for prediction of sustained postoperative opioid prescriptions after total hip arthroplasty.
        J Arthroplasty. 2019; 34: 2272-2277.e1
        • Karhade A.V.
        • Ogink P.T.
        • Thio Q.C.B.S.
        • et al.
        Machine learning for prediction of sustained opioid prescription after anterior cervical discectomy and fusion.
        Spine J. 2019; 19: 976-983
        • Karhade A.V.
        • Ogink P.T.
        • Thio Q.C.B.S.
        • et al.
        Development of machine learning algorithms for prediction of prolonged opioid prescription after surgery for lumbar disc herniation.
        Spine J. 2019; 19: 1764-1771
        • None J.H.
        • Gunaseelan V.
        • Vu J.
        • Brummett C.
        • Waljee J.F.
        • Wiens J.
        Predicting postoperative opioid prescription refills: a machine learning approach.
        J Am Coll Surg. 2019; 229: S109-S110
        • Chaudhary M.A.
        • Bhulani N.
        • de Jager E.C.
        • et al.
        Development and validation of a bedside risk assessment for sustained prescription opioid use after surgery.
        JAMA Netw Open. 2019; 2e196673
        • Harris A.H.S.
        Three critical questions that should be asked before using prediction models for clinical decision support.
        JAMA Netw Open. 2019; 2 (e196661–e196661)
        • Michigan Genomics Initiative
        About the Michigan Genomics Initiative.
        • Fritsche L.G.
        • Gruber S.B.
        • Wu Z.
        • et al.
        Association of polygenic risk scores for multiple cancers in a phenome-wide study: results from the Michigan Genomics Initiative.
        Am J Hum Genet. 2018; 102
      2. Howard R, Gunaseelan V, Brummett C, Waljee J, Englesbe M, Telem D. New persistent opioid use after inguinal hernia repair. Ann Surg. 2020 Oct 15;

        • Elixhauser A.
        • Steiner C.
        • Harris D.R.
        • Coffey R.M.
        Comorbidity measures for use with administrative data.
        Med Care. 1998; 36: 8-27
        • Paulus J.K.
        • Kent D.M.
        Race and ethnicity: a part of the equation for personalized clinical decision making?.
        Circ Cardiovasc Qual Outcomes. 2017; 10
        • Van Calster B.
        • McLernon D.J.
        • van Smeden M.
        • Wynants L.
        • Steyerberg E.W.
        • Topic Group
        Evaluating diagnostic tests and prediction models of the STRATOS initiative. Calibration: the Achilles heel of predictive analytics.
        BMC Med. 2019; 17: 230
        • Vickers A.J.
        • Van Calster B.
        • Steyerberg E.W.
        Net benefit approaches to the evaluation of prediction models, molecular markers, and diagnostic tests.
        BMJ. 2016; 352: i6
        • Kerr K.F.
        • Brown M.D.
        • Zhu K.
        • Janes H.
        Assessing the clinical impact of risk prediction models with decision curves: guidance for correct interpretation and appropriate use.
        J Clin Oncol. 2016; 34: 2534-2540
        • Wickham H.
        Easily install and load the “tidyverse” [R package tidyverse version 1.3.1].
        Date accessed: January 4, 2022
      3. R Interface for the “H2O” Scalable Machine Learning Platform [R package h2o version].
        Date accessed: January 4, 2022
        • ML4LHS
        GitHub - ML4LHS/runway: visualizing prediction model performance.
        Date accessed: January 4, 2022
        • Obermeyer Z.
        • Powers B.
        • Vogeli C.
        • Mullainathan S.
        Dissecting racial bias in an algorithm used to manage the health of populations.
        Science. 2019; 366: 447-453
        • Singh K.
        • Valley T.S.
        • Tang S.
        • et al.
        Evaluating a widely implemented proprietary deterioration index model among hospitalized COVID-19 patients.
        Ann Am Thorac Soc. 2020;
        • Alam A.
        Long-term analgesic use after low-risk surgery.
        Arch Intern Med. 2012; 172: 425
        • Clarke H.
        • Soneji N.
        • Ko D.T.
        • Yun L.
        • Wijeysundera D.N.
        Rates and risk factors for prolonged opioid use after major surgery: population based cohort study.
        BMJ. 2014; 348: g1251