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

Posted on May 1, 2019

Sangwoo Lee


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


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


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

Your email address will not be published. Required fields are marked *

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags