RTI uses cookies to offer you the best experience online. By clicking “accept” on this website, you opt in and you agree to the use of cookies. If you would like to know more about how RTI uses cookies and how to manage them please view our Privacy Policy here. You can “opt out” or change your mind by visiting: http://optout.aboutads.info/. Click “accept” to agree.


Using Real-Time Twitter Data to Track Trends in the Opioid Crisis

Understanding the evolving nature of the opioid epidemic and opioid overdose deaths


Mortality data, the main source used to track and monitor opioid overdose deaths, has a 12 to 18-month lag, which can be problematic when trying to understand trends in the opioid epidemic. With this study, RTI identified a way to use easily accessible and near-real-time social media data to improve public health surveillance efforts.


The study examined tweets from North Carolina over a nine-year period from 2009 to 2017 and compared the content of the posts to opioid overdose deaths figures in the state.


This study demonstrated that Twitter posts mentioning heroin and synthetic opioids correlate with and can predict opioid overdose deaths, thereby giving researchers access to more timely surveillance data related to the opioid epidemic.

Over the last two decades, opioid overdose deaths (OODs) have escalated across the country, impacting more individuals, families, and communities. OODs have also evolved through three different phases over the last 20 years. Beginning in 2000, most opioid overdose deaths were related to prescription opioids for pain, but they became connected to heroin starting in 2010 and then to synthetic opioids in 2013.

Currently, the monitoring of OODs relies primarily on mortality data, which often has a 12 to 18-month reporting lag. Given the rapidly shifting nature of OODs, timelier surveillance data are critical to inform strategies that combat the opioid crisis. By leveraging data integration capabilities, RTI determined a way to use easily accessible and near-real-time social media data to improve public health surveillance efforts related to the opioid crisis.

To explore this emerging area, a team of researchers from RTI and NC A&T State University examined Twitter data and investigated the extent to which opioid-related tweets corresponded with the three phases of the opioid crisis and correlated with OODs in North Carolina between 2009 and 2017.

Surveilling the Opioid Epidemic Using Twitter Data

The researchers gathered 100,777 opioid-related Twitter posts, including tweets, retweets, mentions, and replies, using Brandwatch (formerly known as Crimson Hexagon), an AI-powered consumer insights company. Queries with a set of search terms were then created to include both commercial labels (e.g. oxycodone, codeine, and morphine) as well as “street” names (e.g. white, syrup, and tar) of drugs. A list of common slang words referring to opioids were compiled using the Drug Enforcement Administration’s (DEA) Intelligence Report titled “Slang Terms and Code Words: A Reference for Law Enforcement Personnel.”

After accumulating the Twitter posts, natural language processing was used to classify them as related to prescription opioids, heroin, or synthetic opioids. Using a random sample of 10,000 posts, the team identified opioid-related terms and used least squares regression and Granger tests to compare patterns of opioid-related posts with OODs in North Carolina over nine years. Opioid overdose death information was obtained from the Multiple Cause of Death database from the Centers for Disease Control and prevention Wide-ranging Online Data for Epidemiologic Research (CDC WONDER).

Results demonstrated that the content of tweets related to prescription opioids, heroin, and synthetic opioids correlated with OODs according to the three distinct phases of the opioid epidemic. In other words, tweets containing keywords related to prescription opioids emerged first, followed by tweets related to heroin and concluding with a surge in tweets related to synthetic opioids starting in 2016. Though no significant relationship existed between the number of Twitter posts and prescription opioid OODs, tweets mentioning heroin and synthetic opioids were significantly associated with heroin OODs and synthetic OODs in the same year (p = .01 and p<.001 respectively) and in the following year (p = .03 and p = .01 respectively).

On average, each additional tweet related to heroin corresponded to an additional 0.13 heroin OODs in the following year (p = .03), and each tweet mentioning synthetic opioids corresponded to an additional 2.68 synthetic opioid OODs that year, and an additional 9.24 additional synthetic opioid OODs the following year. Moreover, heroin tweets significantly predicted heroin deaths better than lagged heroin overdose deaths alone.

Informing Future Responses to the Opioid Epidemic to Combat Opioid Overdose Deaths

This study demonstrated that the pattern of opioid-related Twitter posts in North Carolina resembled the three phases of the opioid epidemic and highlighted that tweets mentioning heroin and synthetic opioids correlated with and can predict opioid overdose deaths. Though novel, Twitter data is timelier and more widely available than traditional mortality data, providing a potential alternative data source that could serve as an indicator of opioid overdose mortality and inform future public health responses.