Related Experiment Video
Updated: Sep 16, 2025

Implementation of a Real-Time Psychosis Risk Detection and Alerting System Based on Electronic Health Records using CogStack
Published on: May 15, 2020
A web-based tool utilizing machine learning algorithms for predicting illicit drug use in emergency departments
Tsung-Chien Lu1, Chih-Chuan Lin2, Te-I Weng3
1Department of Emergency Medicine, National Taiwan University Hospital, Taipei City, Taiwan; Department of Emergency Medicine, College of Medicine, National Taiwan University, Taipei City, Taiwan.
Background:
Identifying illicit drug use through urine testing is time-consuming in the era of new psychoactive substances. This study aimed to develop a machine learning (ML) prediction model for early identification of illicit drug use in suspected emergency department (ED) patients.
Methods:
Data from the Taiwan Emergency Department Drug Abuse Surveillance (TEDAS) database (2020-2023) was used. Six feature categories-demographics, triage data, referral source, symptoms, physical findings, and clinical characteristics-were included. The primary outcome was positive urine results for illicit drugs, confirmed by liquid chromatography-tandem mass spectrometry. Data were divided chronologically into training/validation and testing sets. Three supervised ML algorithms, including random forest, CatBoost, and light gradient boosting machine, were tested using K-fold cross-validation, and performance was evaluated by the area under the receiver operating characteristic curve (AUC) in the test set.
Results:
The analysis included 13,615 urine test results from ED cases, identifying 3,185 positive cases (23.4%). A total of 9,529 cases (2020-2022) formed the training/validation cohort, and 4,086 (2023) were used for testing. Twenty features were used to construct the prediction model. The CatBoost classifier performed best, achieving an AUC of 0.846 (95% confidence interval [CI]: 0.831-0.859) in the testing cohort. A web-based tool and mobile apps were implemented to assist emergency physicians in predicting illicit drug use.
Conclusions:
The machine learning model effectively predicts illicit drug use in ED patients and has been successfully implemented for free access. Further analysis is needed to assess post-implementation performance and its potential for use in other countries.

