Development and evaluation of machine learning models for the detection of emergency department patients with opioid misuse from clinical notes
Authors:
Open Access
- 6 March 2026
- journal article
- Published by Oxford University Press (OUP) in JAMIA Open
- Vol. 9 (2)
Abstract
Objectives: The accurate identification of Emergency Department (ED) encounters involving opioid misuse is critical for health services, research, and surveillance. We sought to develop natural language processing (NLP)-based models for the detection of ED encounters involving opioid misuse. Methods: A sample of ED encounters enriched for opioid misuse was manually annotated and clinical notes extracted. We evaluated classic machine learning (ML) methods, fine-tuning of publicly available pretrained language models, and a previously developed convolutional neural network opioid classifier for use on hospitalized patients (SMART-AI). Performance was benchmarked to opioid-related ICD-10-CM codes. Both raw text and text transformed to the Unified Medical Language System were evaluated. Face validity was evaluated by term feature importance. Results: There were 1123 encounters used for training, validation, and testing. Of the classic ML methods, XGBoost had the highest AU_PRC 0.9358 (95% CI 0.8945, 0.9681), accuracy 0.8874 (0.8402, 0.9349), and F1 score 0.8624 (0.7969, 0.9197) which performed comparably to ICD-10-CM codes [accuracy 0.8687 (0.8155, 0.9167); F1 0.8296 (0.7544, 0.8939)]. Excluding XGBoost, fine-tuned pre-trained language models generally outperformed classic ML methods. The best performing model by point estimate was the fine-tuned SMART-AI based model with domain adaptation [AU_PRC 0.9474 (0.9113, 0.9749); accuracy 0.8816 (0.8284, 0.9290); F1 0.8499 (0.7805, 0.9103)] but confidence intervals overlapped with other models. Explainability analyses showed the most predictive terms were “heroin,” “opioids,” “alcoholic intoxication, chronic,” “cocaine,” “opiates,” and “suboxone.” Conclusions: NLP-based models perform comparably to entry of ICD-10-CM diagnosis codes for the detection of ED encounters with opioid misuse. Fine tuning with domain adaptation for pre-trained language models resulted in improved performance.Keywords
Funding Information
- National Institute on Drug Abuse (K23DA055061)
- National Institute on Drug Abuse (R01DA051464)
- National Institute on Drug Abuse (R61DA057629)
- National Center for Advancing Translational Sciences (UL1TR002003)
- National Institutes of Health
This publication has 20 references indexed in Scilit:
- ICD-10-CM–Based Definitions for Emergency Department Opioid Poisoning Surveillance: Electronic Health Record Case Confirmation StudyPublic Health Reports®, 2020
- BioBERT: a pre-trained biomedical language representation model for biomedical text miningBioinformatics, 2019
- US ED Opioid-Related Visits Increase, While Use of Medication for Opioid Use Disorder Undetectable, 2011–2016Journal of General Internal Medicine, 2019
- Subtypes in patients with opioid misuse: A prognostic enrichment strategy using electronic health record data in hospitalized patientsPLOS ONE, 2019
- Screening Tools Validated in the Outpatient Pain Management Setting Poorly Predict Opioid Misuse in the Emergency Department: A Pilot StudyThe Journal of Emergency Medicine, 2019
- The REDCap consortium: Building an international community of software platform partnersJournal of Biomedical Informatics, 2019
- Emergency Departments — A 24/7/365 Option for Combating the Opioid CrisisNew England Journal of Medicine, 2018
- Comparison of MetaMap and cTAKES for entity extraction in clinical notesBMC Medical Informatics and Decision Making, 2018
- Mayo clinical Text Analysis and Knowledge Extraction System (cTAKES): architecture, component evaluation and applicationsJournal of the American Medical Informatics Association, 2010
- Research electronic data capture (REDCap)—A metadata-driven methodology and workflow process for providing translational research informatics supportJournal of Biomedical Informatics, 2009