Diabetes Treatment and Possible Factors Affecting its Effectiveness

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

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

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws 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 Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R 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 Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp