Clear Sky Science · en

A machine learning approach for opioid overdose risk prediction among Alabama Medicaid beneficiaries with opioid prescriptions

· Back to index

Why this matters to everyday people

The opioid crisis is often discussed in national headlines, but its impact is felt most sharply in specific communities. This study looks closely at people in Alabama who get their health care through Medicaid and have opioid prescriptions. By using modern computer methods to predict who is most likely to overdose, the researchers aim to help doctors, health plans, and policymakers step in earlier—before a tragedy occurs—while also revealing patterns that might surprise both patients and clinicians.

A closer look at opioid use in Alabama

Alabama has one of the highest rates of opioid prescribing in the United States, and overdose deaths have risen across all 67 counties. Medicaid, which covers about one in four Alabama residents, insures many people with limited income who are already at higher risk of health problems. The researchers used detailed billing records from Alabama Medicaid, covering doctor visits, hospital stays, and filled prescriptions, for adults aged 18 to 64 who received opioid pain medicines between 2016 and 2023. These records allowed them to follow hundreds of thousands of people over time, tracking who later experienced an opioid overdose that showed up in an emergency visit or hospital claim.

Figure 1
Figure 1.

How computers learn to flag overdose risk

The team built and tested several machine-learning models—computer programs that learn patterns from large amounts of data—to estimate each person’s chance of overdosing in the next three months. They trained the models on data from 2016–2018 and then checked how well the models worked on newer data from 2019–2023. Because overdoses were rare (about 0.5–0.6 percent of people with opioid prescriptions), they used a technique called SMOTE, which creates realistic synthetic examples of overdose cases so the models do not “ignore” them. Among the three approaches tested, a method called gradient boosting performed best at separating higher-risk from lower-risk patients, showing excellent accuracy when judged by standard measures used in predictive modeling.

Who is most at risk and what patterns stand out

The models pointed to several strong warning signs. People who had overdosed before—either from prescription opioids or heroin—were at much higher risk of overdosing again. Taking higher daily opioid doses and having a large total amount of opioids over time also raised risk. Age mattered too: those in their 40s and 50s were more likely to overdose than younger adults. Frequent outpatient visits, diagnoses of opioid use disorder or other substance use problems, and more trips to the emergency department were additional red flags. Strikingly, people who eventually overdosed had many more denied opioid prescription fills than other patients, suggesting a pattern of repeated attempts to obtain opioids that did not meet coverage or safety rules.

The impact of handling rare events in the data

Because overdose events are uncommon compared with the total number of patients, the researchers paid special attention to how well their model could correctly identify those rare but critical cases. When they used SMOTE to balance the data, the model became much better at catching true overdose cases (higher recall), even though this also led to more false alarms. Overall accuracy remained very high, and a combined score that weighs both correct detections and false alarms improved slightly. In practical terms, this means the model is more useful as an early warning system: it misses fewer people who are truly in danger, which is crucial when the cost of missing a case can be a life.

Figure 2
Figure 2.

What this means for prevention and policy

For a layperson, the takeaway is that overdose risk is not random. It can be estimated using information that health systems already collect, such as age, past overdoses, prescription history, and denied refill requests. This study shows that advanced computer models, when carefully designed to handle rare events, can reliably highlight which Alabama Medicaid patients are most vulnerable in the near future. Used responsibly, such tools could help doctors and public programs focus counseling, treatment for addiction, closer follow-up, and other supports where they are needed most—offering a chance to prevent overdoses before they happen, rather than simply responding after the fact.

Citation: Parton, J., Wang, Q., Wang, E.C. et al. A machine learning approach for opioid overdose risk prediction among Alabama Medicaid beneficiaries with opioid prescriptions. Sci Rep 16, 5171 (2026). https://doi.org/10.1038/s41598-026-36047-7

Keywords: opioid overdose, Medicaid, machine learning, risk prediction, prescription opioids