Diabetes Treatment and Possible Factors Affecting its Effectiveness

Oluwole Alowolodu
Posted on Feb 4, 2019

This project was conducted to analyze public reviews and deduce possible factors that might be responsible for the effectiveness ratings in diabetes treatment. A significant proportion of the world population is diabetic, according to the World Health Organization, 8.5% of the current world population is diabetic and in the, U.S, 9.4% amounting to 30.3 million people live with diabetes.


Although there are many health service stores online, WebMd was chosen for this project because of its independence and comprehensive database. It is an online source for health-related information with huge user review database that includes the name, date, gender, duration of treatment, age range, comments and most importantly ratings based on effectiveness, ease of use and satisfaction.

Scrapy, an open source website scraping framework was used to extract data of 3 diabetes drugs. The drugs are Avandia Oral, Metformin HCl and Invokana. All the information needed appear on one URL of WebMD which makes Scrapy a perfect tool to scrap the website. Upon download, data cleaning was the first exercise that needed to be carried out and was done before I analyzed the data. Below is the image of the data frame before cleaning.

Some features that are of importance to this analysis that needed to be cleaned are the condition column which has attached to it some links, and duration column which was downloaded as a string(text) and need to be converted to integers. Upon cleaning, a new feature was added, created from averaging the duration feature, average duration.


Effectiveness reviews of the drugs, the core of this project, were analyzed alongside the satisfaction ratings.

Bar plot of Avandia's satisfaction and effectiveness ratings

Below is how the effectiveness and satisfaction ratings of Avandia drug stack together:

Avandia's ratings
Bar plot of Metformin's satisfaction and effectiveness ratings
Metformin's ratings
Bar plot of Invokana's satisfaction and effectiveness ratings
Invokana's ratings

Apart from metformin with slightly more than average review, the drugs are highly rated in terms of effectiveness. Satisfaction ratings vary from drug to drug, users are highly unsatisfied with Avandia and Metformin while Invokana has a relatively favorable satisfaction.

Plot of age-range and duration against effectiveness ratings of Avandia drug
Plot of age-range and duration against effectiveness ratings of Metformin drug
Plot of age-range and duration against effectiveness ratings of Invokana drug

From the plots in Figures 5,6 and 7, duration of treatment produced more interesting visuals than age-range of the user.  Effectiveness of the drugs tends to increase with continued usage of all the drugs. Users of Avandia for over two years period gave a very high effectiveness ratings while those that treated their condition with either metformin or Invokana for at least three months rated the effectiveness 4 stars and above.

Bar plot of different categories of age-range analyzed
Plot of gender distribution

The 2 figures above show the demographic make-up of the users, majority of diabetic patients are between the ages of 45 to 74 years, and are mostly females.


Scraping and analyzing WebMD reviews of three type II diabetes drugs has given some insight into public perception of the treatment. Prior to carrying out this project, one might assume a 5-star rated effective drug would translate to customer satisfaction, but this analysis has shown that it is not always the case and both can be independent of each other.

Further work will include sentiment analysis of the comments which could help elucidate what is responsible for customer dissatisfaction.

Based on the reviews, effectiveness improves with increased duration of treatment, while age-range of the patient does not affect potency of the drugs.

Analyzing these reviews can help medical practitioners make informed decisions based on real-life feedback as against the usual practice of relying solely on the information supplied by the Pharmaceutical companies and the FDA. More importantly is the insight this will give the producing pharmaceutical companies of these 3 drugs and other diabetic drug manufacturers, on the factors that affect the effectiveness of these drugs. In marketing, companies should consider the messaging, and in production, manufacturers should consider the formulations, active pharmaceutical ingredients and excipients since most consumers will be advised to stay on the drugs for a long period of time.


Oluwole Alowolodu


About Author

Oluwole Alowolodu

Oluwole Alowolodu

Recent graduate of Biotechnology - MS. Data science fellow and AI enthusiast.
View all posts by Oluwole Alowolodu >

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