Scraping the Personal Experiences of Antihypertensive Drug Side Effects On WebMD Database

Posted on May 1, 2019

Sangwoo Lee

Introduction

There are many drugs offered to treat patients today. While some do exactly what they are supposed to, sometimes they also have negative side-effects. The question is: can people find out more about their medications to get better results? In this paper, we aim at scraping webMD website for opinions stated in reviews, with focus on quantitative and qualitative analysis of side effects. We hope this study will be able to help general patients make more informed decisions about their healthcare and medications.

Data Extraction Flow

The dataset analyzed in this paper is defined as below. Using the python scrapy package, we scraped the webMD website. On its main web page, we first chose ‘drugs and supplements.’ For  ‘conditions,’ we chose ‘hypertension’ as a study case. Out of the 479 medications found by this method, we focused on 9 most reviewed drugs and did further analysis. For each of the medications found this way, there are web pages for review opinions contributed by either patients or caregivers. We used the python scrapy package to scrape review opinions.

A typical review opinion example at the webMD website can be found in Fig. 1. It consists of condition, date and time posted, information about reviewers, ratings on effectiveness, ease of use, and satisfaction. In addition, reviewers can write in a note on their experiences with the medication in a comment. Overall, out of these fields, only effectiveness, ease of use, and satisfaction fields, on the scale of one star through five stars, are required on input on the site; anything else is optional.l. Therefore, we also tried to extract as much information as possible from the reviewer field and the comment field  to enrich our dataset.

By using python’s re library for regular expression processing, we extracted information such as time on medication, age, screen name, patient or caregiver, and gender from the reviewer field and added them to the dataset as additional fields.

 

 
 

Fig. 1. A typical review opinion example

We further analyzed the comment field to find reviewer’s complaints about side effects. For this, we first tried to simplify the comments by using python’s nltk library for filtering and lemmatization. Next, we looked into the words of the simplified comments to find what are typical side effects experienced by reviewers. These efforts brought us a table in which we could categorize theside effects to 28 categories as in table 1. Since many reviewers use diverse expressions for side effects, and some reviews contain  typos, we combined the 28 side effect categories with their respective synonyms and stored them in a python dictionary structure.

   

Table 1. categories of side effects

Results

In Fig. 2 through Fig. 4, we can see that majority of the reviewers gave high ratings for both ease of use and effectiveness. Surprisingly, on the other hand, the majority gave only a one star rating for satisfaction. This means that, most reviewers could take the medications with ease, and the medication actually worked fine to lower the blood pressure, but there were some other aspect of the medication that made the reviewers feel less than satisfied.

 

Fig. 2  ease of use distribution of top 5 most reviewed drugs

 

Fig. 3 effectiveness distribution of top 5 most reviewed drugs

 

Fig. 4 satisfaction distribution of top 5 most reviewed drugs

In Fig. 5, we compared the nine drugs of interest in this paper in the view of the average number of side effects experienced by a reviewer. Drug C showed the largest number, slightly larger than 2.0; drug B and drug C did  better with numbers around 1.25, and all other drugs were in-between.

 

Fig. 5 Drug vs. average number of side effects experienced by a reviewer

In Fig. 6,7,8, we did analysis on drug vs. average percentage of reviewers who experienced specific side effects out of the 28 side effect categories. Focusing only on reviewers who experienced cough, pain, and lethargy, we can compare different medications.

 

Fig. 6 Drug vs average percentage of reviewers with cough side effects

 

Fig. 7 Drug vs average percentage of reviewers with pain side effects

 

Fig. 8 Drug vs average percentage of reviewers with lethargy side effects

 

In Fig 9, we are showing age vs. average number of side effects experienced by each reviewer. Likewise, in Fig 10, we compared to see if gender vs. average number of side effects seen by each reviewer see any trends. In Fig. 9 and Fig. 10, there are clear trends, and their explanations are left as further study topics.

 

Fig. 9 Age vs. average number of side effects per reviewer

 

Fig. 10 Gender vs. average number of side effects per reviewer

Conclusions

In this study, we scraped webMD’s review opinions on 9 of the most popular drugs for anti-hypertension. Using python’s scrapy package and natural language analysis packages, we tried to make a model for  side effects experienced by patients, not only on qualitative, but also on quantitative basis. Since the scrape was not from a general population but from people who wanted to spend their time in leaving feedback, what we found in this study may not be able to explain what is happening in the real world. But relative comparisons that we can make out of the model can provide some insight. For example, when selecting among major OTC medications with awareness of their respective side effects, we can choose based on our own concern. For example, if our priority is to stay away from drugs that cause lethargy, we’ll be able to benefit from this study by comparing drugs in lethargy side effects perspective. In our next step, we’ll increase the size of the dataset by considering other drugs and by scraping more review opinions. In addition, we’ll try to validate Table 1 in which we categorized side effects into 28 categories by inputting known test vectors and then comparing the outputs with the known expected output vectors.

About Author

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI