Article Text

Download PDFPDF
Tracking persistent postoperative opioid use: a proof-of-concept study demonstrating a use case for natural language processing
  1. Eri C Seng1,
  2. Soraya Mehdipour1,
  3. Sierra Simpson1 and
  4. Rodney A Gabriel1,2
  1. 1 Division of Perioperative Informatics, Department of Anesthesiology, University of California San Diego, La Jolla, California, USA
  2. 2 Division of Regional Anesthesia, Department of Anesthesiology, University of California, San Diego, La Jolla, California, USA
  1. Correspondence to Dr Rodney A Gabriel, Department of Anesthesiology, University of California San Diego, La Jolla, CA 92037, USA; ragabriel{at}


Background Large language models have been gaining tremendous popularity since the introduction of ChatGPT in late 2022. Perioperative pain providers should leverage natural language processing (NLP) technology and explore pertinent use cases to improve patient care. One example is tracking persistent postoperative opioid use after surgery. Since much of the relevant data may be ‘hidden’ within unstructured clinical text, NLP models may prove to be advantageous. The primary objective of this proof-of-concept study was to demonstrate the ability of an NLP engine to review clinical notes and accurately identify patients who had persistent postoperative opioid use after major spine surgery.

Methods Clinical documents from all patients that underwent major spine surgery during July 2015–August 2021 were extracted from the electronic health record. The primary outcome was persistent postoperative opioid use, defined as continued use of opioids greater than or equal to 3 months after surgery. This outcome was ascertained via manual clinician review from outpatient spine surgery follow-up notes. An NLP engine was applied to these notes to ascertain the presence of persistent opioid use—this was then compared with results from clinician manual review.

Results The final study sample consisted of 965 patients, in which 705 (73.1%) were determined to have persistent opioid use following surgery. The NLP engine correctly determined the patients’ opioid use status in 92.9% of cases, in which it correctly identified persistent opioid use in 95.6% of cases and no persistent opioid use in 86.1% of cases.

Discussion Access to unstructured data within the perioperative history can contextualize patients’ opioid use and provide further insight into the opioid crisis, while at the same time improve care directly at the patient level. While these goals are in reach, future work is needed to evaluate how to best implement NLP within different healthcare systems for use in clinical decision support.

  • analgesics, opioid
  • pain management
  • chronic pain

Data availability statement

Data are available upon reasonable request. De-identified data is available with proper data use agreement.

Statistics from

Request Permissions

If you wish to reuse any or all of this article please use the link below which will take you to the Copyright Clearance Center’s RightsLink service. You will be able to get a quick price and instant permission to reuse the content in many different ways.

Data availability statement

Data are available upon reasonable request. De-identified data is available with proper data use agreement.

View Full Text


  • Contributors ECS and RG: helped lead the study design, data collection plan, data analysis, preparation of figures/tables, and composition of the initial and final manuscript. SM: helped with data collection and composition of final manuscript. SS: helped with study design, data analysis, preparation of figure, and composition of initial and final manuscript. RG is the guarantor.

  • Funding The authors have not declared a specific grant for this research from any funding agency in the public, commercial or not-for-profit sectors.

  • Competing interests RG’s institution has received funding and/or product for research purposes from Epimed, Infutronix, SPR Therapeutics, Merck, and Precision Genetics. RG is a consultant for Avanos. SS is Founder of BrilliantBiome. ECS was a paid intern at KAIDHealth from 2022 to 2023.

  • Provenance and peer review Not commissioned; externally peer reviewed.

  • Supplemental material This content has been supplied by the author(s). It has not been vetted by BMJ Publishing Group Limited (BMJ) and may not have been peer-reviewed. Any opinions or recommendations discussed are solely those of the author(s) and are not endorsed by BMJ. BMJ disclaims all liability and responsibility arising from any reliance placed on the content. Where the content includes any translated material, BMJ does not warrant the accuracy and reliability of the translations (including but not limited to local regulations, clinical guidelines, terminology, drug names and drug dosages), and is not responsible for any error and/or omissions arising from translation and adaptation or otherwise.