Social Media Mining for Toxicovigilance: Automatic Monitoring of Prescription Medication Abuse from Twitter
- First Online:
- Cite this article as:
- Sarker, A., O’Connor, K., Ginn, R. et al. Drug Saf (2016) 39: 231. doi:10.1007/s40264-015-0379-4
Prescription medication overdose is the fastest growing drug-related problem in the USA. The growing nature of this problem necessitates the implementation of improved monitoring strategies for investigating the prevalence and patterns of abuse of specific medications.
Our primary aims were to assess the possibility of utilizing social media as a resource for automatic monitoring of prescription medication abuse and to devise an automatic classification technique that can identify potentially abuse-indicating user posts.
We collected Twitter user posts (tweets) associated with three commonly abused medications (Adderall®, oxycodone, and quetiapine). We manually annotated 6400 tweets mentioning these three medications and a control medication (metformin) that is not the subject of abuse due to its mechanism of action. We performed quantitative and qualitative analyses of the annotated data to determine whether posts on Twitter contain signals of prescription medication abuse. Finally, we designed an automatic supervised classification technique to distinguish posts containing signals of medication abuse from those that do not and assessed the utility of Twitter in investigating patterns of abuse over time.
Our analyses show that clear signals of medication abuse can be drawn from Twitter posts and the percentage of tweets containing abuse signals are significantly higher for the three case medications (Adderall®: 23 %, quetiapine: 5.0 %, oxycodone: 12 %) than the proportion for the control medication (metformin: 0.3 %). Our automatic classification approach achieves 82 % accuracy overall (medication abuse class recall: 0.51, precision: 0.41, F measure: 0.46). To illustrate the utility of automatic classification, we show how the classification data can be used to analyze abuse patterns over time.
Our study indicates that social media can be a crucial resource for obtaining abuse-related information for medications, and that automatic approaches involving supervised classification and natural language processing hold promises for essential future monitoring and intervention tasks.
Monitoring prescription medication abuse, which is a rapidly growing medication-related problem in the USA, is of paramount importance to public health.
Social media postings can be used to detect patterns and intents of abuse and also to estimate the prevalence of abuse for a drug.
Natural language processing and machine learning can be applied to automatically detect posts indicating prescription medication abuse, allowing interested agencies to perform real-time monitoring and analysis of medication abuse information.
Prescription medication abuse and overdose have become the fastest growing medication-related problems in the USA, reaching epidemic proportions [1, 2, 3]. According to the Drug Abuse Warning Network (DAWN) report  there were 5.1 million drug-related (prescription and illicit) emergency department visits in the year 2011, with approximately half of these attributed to misuse or abuse. The negative health consequences of prescription medication abuse are many, ranging from nausea to disorientation, paranoia, seizures, and even death . A recently published Centers for Disease Control (CDC) report  shows that in the year 2013 there were 43,982 deaths due to drug overdose, of which 22,767 were attributable to prescription medications such as opioids and benzodiazepines (some were due to co-ingestion ). The number of deaths due to drug overdose has more than tripled in the USA since 1991 . In the year 2007, opioid abuse alone amounted to an estimated total cost of US$55.7 billion  and later estimates suggest that medication misuse costs up to US$72.5 billion annually [8, 9, 10]. Despite such widespread abuse of prescription medication, there is no current well-established source of data to monitor abusers’ attitudes, methods, and patterns of abuse. Because of the severe nature of this problem, the Office of National Drug Control Policy released a drug abuse prevention plan , which puts monitoring as one of the primary areas of focus.
Current prescription medication abuse monitoring strategies are aimed primarily at distributors and licensed practitioners. The Drug Enforcement Agency (DEA) requires that wholesalers have monitoring programs in place to identify suspicious orders. For licensed, prescribing health practitioners, most states have monitoring programs that are supported by the National Association of State Controlled Substance Authorities and pharmacies are required to report the patients, prescribers, and specific medications dispensed for controlled substances. These data are used by prescribers and law enforcement agencies to identify and limit medication abuse. However, existing control measures lack critical information such as the patterns of usage of various medications and the demographic information of the users. For example, advertisements to deter prescription medication abuse might be more successful if broadcast during high abuse periods, if that information were available. Thus, there is a strong motivation to discover newer monitoring sources and methods.
We take the first steps towards operationalizing an automated, social media-based, medication abuse monitoring system. Social media has evolved into a crucial source of communication and it offers a range of possibilities for establishing multi-directional interaction, as well as acting as a resource for monitoring public sentiment and activity . Twitter  is one of the most popular resources, with 289 million monthly active users, 58 million tweets per day, and 2.3 billion search queries per day . Social media is currently being used as a resource for various tasks ranging from customized advertising  and sentiment analysis  to tasks specific to the public health domain (e.g., monitoring influenza epidemics , sexual health , pharmacovigilance , and drug abuse ). Our aims are to (1) verify that Twitter posts contain identifiable information about prescription medication abuse; (2) annotate abuse-indicating posts and create an annotation guideline for large-scale future research; and (3) verify the future applicability of automatic systems for social media-based medication abuse monitoring. We take a systematic approach towards our end goal following on from our past work on social media-based pharmacovigilance [20, 21, 22].
2.1 Data Collection and Spelling Variant Generation
The three abuse-prone drugs included in the study, their types, and details of common abuse
Schedule II controlled substance. A combination psychostimulant drug used for the treatment of ADHD and narcolepsy. Produces euphoria, alertness, and increased concentration
Adderall® abuse includes intake for weight loss, increased focus (e.g., for studying), athletic performance, and recreational use
Schedule II controlled substance (opioid family). It is an opioid agonist that produces analgesia through its effect on the µ-receptor and contributes to addiction through its effect on dopamine receptors
In 2012, it is estimated that narcotic pain relievers were abused by 2.1 million people in the USA 
An atypical antipsychotic generally used for the treatment of schizophrenia or bipolar disorder. It may produce euphoria in addition to its anxiolytic properties
Known to be less prone to abuse than some other drugs, but has been named in the top 10 list of abused prescription medications 
Examples of abuse and non-abuse-indicating tweets from our dataset
Non-medical use/abuse-indicating tweets
about to be cracked on adderall to survive today
Seroquel is prescribed. i use valerian root sometimes too. mostly i don’t sleep
i’m just gonna shower and overdose on Seroquel so I’ll sleep until morning
a prescription for adderall should come with my college acceptance paper speaking of oxycodone .. i need to take mine. This pain is ridiculous
popped Adderall tonight hahahah let’s finish this 100 page paper
an oxycodone high from snorting lasts for one hour, if it is swallowed, your looking at three hour high
Following the annotation, in order to ascertain if the proportions of abuse tweets for the APMs are different to the proportion among the metformin tweets, we performed Chi squared tests (H0: p1 = p2, i.e., the proportions of abuse tweets are equal for each APM and metformin). In all cases, the null hypothesis was rejected (p < 0.05), verifying that the APMs have significantly higher proportions of abuse-indicating tweets.
2.3 Supervised Classification
We model the task of detecting potentially abuse-indicating tweets as a supervised classification problem and use a number of features to address it. From the perspective of machine learning, classification is the problem of assigning a category, from a finite set of categories, to an observation. In our work, each tweet is an observation and there are two possible categories. Since we have a set of annotated tweets, we use them to train several machine learning algorithms. In this manner, we provide supervision to our algorithms. Given an unclassified observation, our approach generates a set of features from the observation and, using the model built on the training data, assigns a category to the new observation. We describe our feature sets in the following subsections.
2.3.1 Word n-Grams
A word n-gram is a sequence of contiguous n words in a text segment. Prior to generating the n-grams (1-, 2-, and 3-grams), we preprocessed the tweets to remove usernames (e.g., @xxxx) and hyperlinks, stemmed (i.e., converted words to their base forms: controlled, controlling → control) the tweets using the Porter stemmer  and lowercased them. We used a specialized tokenizer and part-of-speech tagger  to break down posts into words and identify their part-of-speech tags. We used the generated word tokens to build the n-grams. Because of the short nature of the tweets, the number of n-grams generated is relatively small. Hence, we attempted to generate a set of additional features from the texts, which encapsulate deeper semantic information.
2.3.2 Abuse-Indicating Terms
2.3.3 Drug–Slang Lexicon
We collected a set of colloquial phrases and terms that are used to discuss drug-related content on the internet . We again used presence and counts as features, leaving out terms that are five characters or less in length (to ignore ambiguous terms: e.g., A, ace).
2.3.4 Synonym Expansion
Our analysis of the tweets during annotation suggested that users often express polarized sentiments when mentioning drug abuse. Therefore, we introduced a feature that has been used in the past for sentiment analysis and polarity classification . This feature is generated by identifying all synonyms of all nouns, verbs and adjectives using WordNet . Synonym expansion enables the generation of a large number of sentiment-indicating terms from a short post.
2.3.5 Word Clusters
Recent text classification tasks have benefited from the use of word clusters, which are broad semantic groupings of words learnt automatically from large amounts of unlabeled data, as features . Therefore, we used the Twitter word clusters provided by Nikfarjam et al. . The clusters were learnt from medication-related chatter collected for monitoring adverse drug reactions and each cluster attempts to encapsulate terms that are generally used in similar contexts. For each term, we used its cluster number as a nominal feature.
We used four off-the-shelf supervised classification algorithms to assess the performance of automatic detection, namely: Naïve Bayes, Support Vector Machines (SVMs), Maximum Entropy (ME), and a decision tree-based classifier (J48). We used the publicly available LibSVM  and Weka  tools for these classifiers. Following the initial classification, we focused on exploring optimization techniques to improve the classification performance particularly for the positive (abuse) class, which is especially difficult due to the class imbalance (i.e., the number of negative examples is much greater than the number of positive examples). To bias our classifiers towards choosing the positive class, we applied weights to give preference to this class . Finally, all four classifiers were combined via stacking , a technique where the predictions from the different classifiers are combined and another algorithm is trained to make a final decision based on the individual predictions.
Using the best classification system, we performed two additional sets of experiments to (1) analyze the feature contributions; and (2) estimate how more data will affect performance. Results are presented in Sect. 3.
2.4 Analysis of Signals
To verify the utility of automatic classification and possible future applications, we performed an analysis of abuse patterns over time for Adderall® and oxycodone. We first classified all of our collected tweets using the stacking-based classifier and then visualized the distributions of tweets over time. Details of this analysis are presented in Sect. 4.
We collected 119,809 tweets for Adderall®, 4082 for oxycodone, 4505 for quetiapine, and 1052 for metformin. Our final annotated dataset contained 5799 annotated tweets (excluding the 600 metformin tweets, and one Adderall® tweet due to character encoding issues): 869 indicating abuse and 4930 with no indication of abuse.3
Tenfold cross-validation results showing F scores for the two classes and the overall accuracies
Abuse F score
Non-abuse F score
Weighted support vector machine (wSVM)
Single-feature and leave-out-feature experiments showing the impact of each of the five feature sets on classification F scores (abuse class)
Single-feature F score
Leave-out-feature F score
Our goals in this study were to verify that social media contains information indicating prescription medication abuse, prepare an annotation guideline for the annotation of Twitter data, and use a moderate sample of annotations to investigate if automatic classification approaches can be used to automatically detect information about prescription medication abuse from Twitter. Our experiments strongly suggest that social networks such as Twitter may provide valuable information about medication abuse. While the task of annotation of social network data is time-consuming and ambiguous, the availability of annotated data allows the training of systems that can identify abuse-related information from large volumes of social media data. Our trained system is capable of classifying abuse and non-abuse tweets with fair accuracy and its performance is likely to improve significantly with the availability of larger amounts of annotated data.
In this section we first outline some related work in order to put our contributions into context. We then verify the utility of automatic classification approaches for medication abuse monitoring. Finally, we present a brief error analysis to identify essential future improvements and discuss some of the limitations of this study.
4.1 Related Work
Toxicovigilance involves the active detection, validation, and follow-up of clinical adverse reactions related to toxic exposures, which may be caused by the non-medical use of prescription medications. Traditional tools for toxicovigilance include federally sponsored surveys and reports from the National Poisoning Data System (NPDS) , the US Food and Drug Administration (FDA) , and hospital networks such as DAWN. The NPDS provides data about calls that are placed to poison centers nationwide and, according to their website, the information may be used to track the risks of prescription medication abuse. The FDA MedWatch program  provides information about adverse drug events but does not monitor patterns of abuse actively (although there is much discussion around opioids and, in the last year, hydrocodone has moved to a schedule II drug). In contrast, DAWN primarily reports emergency department visit data. Although these systems all provide valuable data, there is a gap in determining prevalence (no denominator) and monitoring patterns of and attitudes towards abuse, which is one contribution social media can provide.
The first effort to propose the use of social media for monitoring the prevalence of drug abuse was the Psychonaut project  and recent studies have verified that it operates as a channel for exchanging prescription medication abuse information . Chary et al.  discussed the benefits of using social media for toxicovigilance, relative to traditional tools, and suggested the use of text mining techniques, but did not report conducting any evaluations using these techniques. Recent efforts have attempted to develop web-based platforms and ontologies for social media mining for toxicovigilance . Also, social media data have been used to perform targeted toxicovigilance tasks such as analyzing the effects of drug reformulation  or the phases of drug abuse recovery  from specialized forums.
Some recent studies have focused specifically on utilizing data from Twitter. Cavazos-Rehg et al.  demonstrated that social media can influence the behavior of young people, necessitating the need for surveillance efforts to monitor content on Twitter. Scott et al.  and Hanson et al.  presented similar conclusions and suggested that Twitter serves as a potential resource for not only surveillance but also for studying attitudes towards prescription drug abuse. Hanson et al.  studied the use of Adderall®, concluding that through the analysis of Twitter posts it can be verified that the medication is frequently abused as a study aid by college students. Similarly, Shutler et al.  qualitatively studied opioid abuse using a small set of annotated data. Very recently, Coloma et al.  studied the potential of social media in drug safety surveillance. The study concluded, following an elaborate manual analysis, that further research is required for establishing social media as a reliable resource. Importantly, this and other recent studies on this topic do not utilize the most attractive property of social media—massive volumes of data and automatic processing.
4.2 Utility of Automatic Monitoring
These results verify that automatic social media-based monitoring of prescription medication abuse can play a role in identifying patterns of prescription medication usage. First, the numbers and proportions of abuse-indicating tweets over a period of time give us an indication of the extent of abuse for a specific medication. In addition, deeper analysis, manual or otherwise, of a set of classified tweets may reveal potentially decisive information. Other information, such as demographics of users, can also be extracted via automatic techniques for deeper analysis.
4.3 Error Analysis
False negative and positive tweets for abuse classification with the best classification system (stacking based)
Examples of tweets that are difficult to classify (false positives and false negatives) and examples of co-ingestion
True positives (suggestions of co-ingestion)
they need to make armpit tampons for adderall abusers
if she’s craving ecstasy, oxycodone to, and is tuliao you’re her, she, and is pending mine for one day. maybe
john picked us up from the airport with medicinal, blunts, adderall and booze. he was actually sent from the heavens
why would you want to take seroquel recreationally ***
i got some oxycodone who tryna buy it off me? $6 a pill
adderall to stay focused, xanax to take the edge off, pot to mellow me out, cocaine to wake me back up and morphine..well because its awesome
these are actually (half) sober tweets and i haven’t slept yet thanks Adderall
took adderall thinking it’d make work go by faster now i’m not tired #paper-view
time for my daily afternoon relaxation ritual of smoking weed, taking 2 mgs of clonazepam, and 400 mg of seroquel xr
hello i am looking to speedball some cocaine and adderall so i can complete a large online project if u have any leads hmu
As already mentioned, the biggest limitation of our study, from the perspective of supervised learning, is the lack of sufficient training data. This is particularly true for the abuse class, which has less than 1000 instances. Ambiguity in tweets and the lack of context hinders both annotation and automatic classification. A number of tweets were regarded to be ambiguous during annotations and these were resolved by our pharmacology expert. These ambiguities leave a gray zone in the binary classification process and this limitation will persist until future annotation guidelines are able to specify more fine-tuned annotation rules.
Because we use social media to collect abuse-related information, our study is limited to the population group that is adept at using social media. All public health monitoring studies that rely on social media data are faced with this limitation. However, as the rapid growth of social media continues and as current users grow older, the impact of this limitation will inevitably decrease.
5 Conclusion and Future Directions
We investigated the potential of social media as a resource for monitoring medication abuse patterns. We first verified that social media contains identifiable abuse-indicating information for three commonly abused medications and that these are significantly more prominent than potential noise associated with non-abuse medications. We prepared annotation guidelines and annotated a moderate-sized dataset. Using supervised classification, we obtained classification accuracies of 82 % (positive class F score: 0.46). We identified three key factors that are likely to improve classification performance: identification of personal versus impersonal tweets, normalization of tweets (e.g., spelling correction), and the utilization of more training data. To show the utility of automatic approaches for toxicovigilance, we performed an analysis of usage patterns and showed that our conclusions agree with past manual analyses.
Annotation. We will significantly increase the size of our annotated dataset and perform iterative annotations to reduce ambiguities.
Visualization and real-time monitoring. Figure 5 is an example of how medication abuse information can be visualized. We intend to implement web-based visualization tools for real-time monitoring of the social media sphere.
Natural language processing-oriented improvements. To improve the reliability of our methods, we will explore natural language processing techniques to automatically identify non-personal tweets. We will also attempt to perform lexical normalization as a preprocessing step to correct spelling errors. While some work has been done on social media text normalization , there are no available techniques that are customized to specific types of social media text (e.g., health-related social media text).
We believe that our automatic approaches will have significant importance for various toxicovigilance tasks, including, but not limited to, determining the prevalence of abuse, studying medication abuse patterns, and identifying the impacts of control measures.
A larger number of Adderall® tweets were chosen for annotation because of the significantly larger number of tweets available for it.
The guideline also contains a set of ambiguous tweets identified by our pharmacology expert, which require contextual analysis in the future.
A sample of the finalized annotations will be made available to the research community at http://diego.asu.edu/Publications/DrugAbuse_DrugSafety.html.
Note that the overall accuracy is primarily driven by the classification performance on the larger class (i.e., non-abuse class) because of the significantly larger number of instances.
Slightly different periods are used for the two medications as the collection of oxycodone tweets commenced a little later than the other medications.
The authors would like to thank the anonymous reviewers for their helpful feedback.
Compliance with Ethical Standards
This work was supported by National Institutes of Health (NIH) National Library of Medicine (NLM) grant number NIH NLM 5R01LM011176. The content is solely the responsibility of the authors and does not necessarily represent the official views of the NLM or NIH.
Conflict of interest
Abeed Sarker, Rachel Ginn, Karen O’Connor, Matthew Scotch, Karen Smith, Dan Malone, and Graciela Gonzalez have no conflicts of interest that are directly relevant to the content of this study.
|Funder Name||Grant Number||Funding Note|
|National Institutes of Health|
Open AccessThis article is distributed under the terms of the Creative Commons Attribution-NonCommercial 4.0 International License (http://creativecommons.org/licenses/by-nc/4.0/), which permits any noncommercial use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.