Temporal Drivers of Opioid‐Related
ED
Visits: An Ensemble Machine Learning Study With Consensus‐Based Feature Attribution
R. Jerome Dixon, Elvin T. Price ABSTRACT
Identification of modifiable risk factors for prescription opioid use disorder (OUD)‐related emergency department (ED) visits (ICD‐10 F11.xx) is a clinical priority; however, most published models remain cross‐sectional and lack pharmacogenomic (PGx) enrichment or dual‐method feature confirmation. Using Virginia All‐Payer Claims Database (APCD) data (2016–2019; 6,929,576 patients), we analyzed prescription OUD‐related ED visits ( = 1,505,138 cases; 5:1 matched controls) across seven age bands. CatBoost, XGBoost, and XGBoost‐RF ensembles were trained within four utilization‐density strata (25‐split MCCV; 2016–2018 training; 2019 holdout) using PGx burden and pre‐index temporal dynamics. Risk features were identified via a Consensus Filter (SHAP ∩ FFA) requiring SHAP values ≥ 75th percentile and FFA rule support ≥ 0.05. Dynamic Time Warping (DTW) characterized pre‐index trajectories. On the 2019 low‐density holdout, PR‐AUC lift over prevalence ranged from 2.3× to 3.4×; the 25–44 band achieved an AUROC of 0.800 and 3.3× lift ( = 4942 holdout cases). Top Consensus‐Risk features included gabapentin, long‐term opioid use (Z79.891), and pgx_num_drugs. DTW yielded three utilization archetypes in the 25–44 band ( = 59,813), with a mean pre‐index time‐to‐target of 6.8 months. While SHAP/FFA specify how to intervene (medication and care targets), DTW specifies when to act (surveillance window). These findings provide an observational risk‐attribution framework for Consensus‐Risk priority features and pre‐index trajectory windows in claims‐based prescription OUD‐related ED care rather than identified causal treatment effects. We maintain the association‐versus‐causation distinction to support safer clinical use and preserve a path to prospective causal validation.