NYC Data Science Academy| Blog
Bootcamps
Lifetime Job Support Available Financing Available
Bootcamps
Data Science with Machine Learning Flagship ๐Ÿ† Data Analytics Bootcamp Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lesson
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories Testimonials Alumni Directory Alumni Exclusive Study Program
Courses
View Bundled Courses
Financing Available
Bootcamp Prep Popular ๐Ÿ”ฅ Data Science Mastery Data Science Launchpad with Python View AI Courses Generative AI for Everyone New ๐ŸŽ‰ Generative AI for Finance New ๐ŸŽ‰ Generative AI for Marketing New ๐ŸŽ‰
Bundle Up
Learn More and Save More
Combination of data science courses.
View Data Science Courses
Beginner
Introductory Python
Intermediate
Data Science Python: Data Analysis and Visualization Popular ๐Ÿ”ฅ Data Science R: Data Analysis and Visualization
Advanced
Data Science Python: Machine Learning Popular ๐Ÿ”ฅ Data Science R: Machine Learning Designing and Implementing Production MLOps New ๐ŸŽ‰ Natural Language Processing for Production (NLP) New ๐ŸŽ‰
Find Inspiration
Get Course Recommendation Must Try ๐Ÿ’Ž An Ultimate Guide to Become a Data Scientist
For Companies
For Companies
Corporate Offerings Hiring Partners Candidate Portfolio Hire Our Graduates
Students Work
Students Work
All Posts Capstone Data Visualization Machine Learning Python Projects R Projects
Tutorials
About
About
About Us Accreditation Contact Us Join Us FAQ Webinars Subscription An Ultimate Guide to
Become a Data Scientist
    Login
NYC Data Science Acedemy
Bootcamps
Courses
Students Work
About
Bootcamps
Bootcamps
Data Science with Machine Learning Flagship
Data Analytics Bootcamp
Artificial Intelligence Bootcamp New Release ๐ŸŽ‰
Free Lessons
Intro to Data Science New Release ๐ŸŽ‰
Find Inspiration
Find Alumni with Similar Background
Job Outlook
Occupational Outlook
Graduate Outcomes Must See ๐Ÿ”ฅ
Alumni
Success Stories
Testimonials
Alumni Directory
Alumni Exclusive Study Program
Courses
Bundles
financing available
View All Bundles
Bootcamp Prep
Data Science Mastery
Data Science Launchpad with Python NEW!
View AI Courses
Generative AI for Everyone
Generative AI for Finance
Generative AI for Marketing
View Data Science Courses
View All Professional Development Courses
Beginner
Introductory Python
Intermediate
Python: Data Analysis and Visualization
R: Data Analysis and Visualization
Advanced
Python: Machine Learning
R: Machine Learning
Designing and Implementing Production MLOps
Natural Language Processing for Production (NLP)
For Companies
Corporate Offerings
Hiring Partners
Candidate Portfolio
Hire Our Graduates
Students Work
All Posts
Capstone
Data Visualization
Machine Learning
Python Projects
R Projects
About
Accreditation
About Us
Contact Us
Join Us
FAQ
Webinars
Subscription
An Ultimate Guide to Become a Data Scientist
Tutorials
Data Analytics
  • Learn Pandas
  • Learn NumPy
  • Learn SciPy
  • Learn Matplotlib
Machine Learning
  • Boosting
  • Random Forest
  • Linear Regression
  • Decision Tree
  • PCA
Interview by Companies
  • JPMC
  • Google
  • Facebook
Artificial Intelligence
  • Learn Generative AI
  • Learn ChatGPT-3.5
  • Learn ChatGPT-4
  • Learn Google Bard
Coding
  • Learn Python
  • Learn SQL
  • Learn MySQL
  • Learn NoSQL
  • Learn PySpark
  • Learn PyTorch
Interview Questions
  • Python Hard
  • R Easy
  • R Hard
  • SQL Easy
  • SQL Hard
  • Python Easy
Data Science Blog > Data Visualization > Non-Opioid Analgesics - Web Scraping for Market Analysis

Non-Opioid Analgesics - Web Scraping for Market Analysis

Hayley Caddes
Posted on Aug 12, 2018

Background

With the opioid crisis in full swing, the pharmaceutical industry has been under pressure to bring non-opioid pain medications to the market. As of August 2018, there are 17 drugs in late-stage clinical development and 40 drugs in early-stage development. While there is clearly a need for non-addictive pain analgesics, since both chronic and acute pain patients are left without effective pain management alternatives, pharmaceutical companies are rushing to get new drugs to market. Even though the current and most popular pain medications on the market are effective as reducing pain, medical research has shown that these prescriptions are a direct cause of the rapidly increasing number of drug overdose deaths from opioids in the U.S., which rose to almost 50,000 people in 2017.

Yet pain accounts for a greater amount of U.S. healthcare costs compared to diseases such as cancer and diabetes, and as such, the pharmaceutical industry has a huge market opportunity for new, non-opioid pain killers due the crackdown on prescriptions for these analgesics as a result of the opioid abuse public health crisis. However, the biggest mistake that a pharmaceutical company can make when developing a new drug is not to analyze the current market, which risks wasting money and time in research and development on a drug that is not marketable, regardless of its effectiveness. In an attempt to describe the current market outlook for prescription pain medications in the U.S., I web scraped over 10,000 patient reviews of the top six most-reviewed pain medications on WebMD.

Using Python's Scrapy framework, I developed a spider that extracted the following data from the WebMD drug reviews: drug, condition treated, the reviewer's age range, gender, length of treatment, and their comments, as well as their ratings on a scale of 1 - 5 on the drug's effectiveness, ease of use, and their satisfaction with the drug. My scrapy code and resulting data analysis can be found on my Github. The drug reviews I scraped were for the generic drugs tramadol, oxycodone, morphine, and methadone, as well as the brand-name drugs OxyContin and Opana ER.  I then conducted exploratory data analysis in an attempt to answer the following standard pharmaceutical marketing questions:

  1. Who are the customers?
  2. What are their expectations for treatment?
  3. What market segments should be high priority?
  4. What is the competitive target?
  5. What messages should be used to launch the product?

Who are the Customers?

First, I identified the customers of interest. I used the plot.ly package to visualize the data. I looked at the breakdown of the patients by sex, age group, and treatment length.

 

 

 

 

The first plot, showing the breakdown of drug use by gender, demonstrates that the difference in usage by gender only significantly varies with tramadol. One possible explanation for this is that tramadol might often be prescribed to mothers after they have given birth, although I have yet to find evidence to support that claim. The breakdown by age group shows that the patients most frequently prescribed these opioid pain killers are in the age range of 45-54, followed by the ranges of 55-64 and 35-44. Interestingly enough, the third plot shows that for OxyContin, oxycodone, and methadone, patients most frequently are using the drugs for 2 to 5 years, which most likely indicated these drugs are being used to treat chronic pain. Tramadol is prescribed to a significant amount of people for 0 to 6 months, and in these cases is probably being used to treat pain post-surgery, birth, or after a physically traumatic incident. However, the next most frequent group is using tramadol for 2 to 5 years, consistent with the others. At this point, it seems as though opioids are often used to treat long-term or chronic pain, which might indicate doctors failing to talk to their patients about expected opioid use duration after surgery or trauma. It does not seem beneficial to expect patients to take opioids until their pain resolves, as studies show that can turn into a long-term dependence on these highly addictive drugs.

What is the Competitive Target?

Next, I wanted to identify the competitive target by looking at the breakdown of different conditions being treated by drug, gender, and treatment length. Users reported a variety of conditions which their pain medications treated, with some conditions being reported , so I grouped specific conditions into broader categories for analytical clarity; those groups are: acute pain, chronic pain, neuropathic pain, pain with drug tolerance, drug abuse, severe pain (which I didn't fold into chronic or acute pain because there was no indication from the patient as to which of those categories it would fall under, so I kept it separate), anesthesia, stiff/tender/painful muscles, and other. The following plot shows the proportion of the scraped reviewed that fell under these categories.

 

 

Upon initial analysis, acute pain and chronic pain are the most prevalent conditions among reviewers. However, some interesting trends appear in the next few plots, which show more detail about the distribution of conditions treated.

 

 

This plot shows the proportion of reviews for different conditions treated by drug. The proportion is how many reviews reported that condition divided by the total amount of reviews (that reported the condition treated) for that specific drug. One thing that jumps out is that generic drugs (methadone, morphine, oxycodone, tramadol) have a significant proportion of reviews for acute pain, while brand-name drugs (OxyContin, Opana ER) have a significant proportion of reviews for chronic pain. This might indicate doctors' loyalty to those brand-name pharmaceutical companies, as their chronic pain patients will take these drugs for a longer period of time than patients with acute pain. Even though doctors cannot legally receive kickbacks from pharmaceutical companies anymore, this might indicate that there is still some sort of preferential treatment.

 

 

 

The plot that shows the breakdown of conditions treated by gender doesn't give much insight into the market besides the fact that it seems as though the genders are being treated for the same conditions in similar proportions. However, the plot showing the breakdown of conditions treated by treatment length gives shows a much more interesting trend. Regardless of treatment length, acute pain accounts for about 40-60% of the reviews. Yet acute pain is just that, acute. Nevertheless, patients report that they've been using these opioids to treat acute pain for up to 10 years or more. This most likely indicates that patients, who might be in severe pain, define their pain as acute when in fact it's probably chronic if they've been treating it for years. This means we cannot necessarily trust the difference in self-reported acute vs. chronic pain. Still, it's clear that a large number of patients reviewing these drugs are using them to treat pain for more than 2 years; about 1300 of these patients report acute pain and about 650 report chronic pain.

What are the Expectations of Treatment?

The next stage of analysis involved looking at reviewers' ratings on effectiveness, ease of use, and satisfaction. The following plots show the distribution by drug and by condition treated.

 

 

 

At first glance, these graphs don't look like they give much information. The average rating in almost all of the categories is between 3 and 4.5. I had to perform some statistical analysis to obtain more valuable information. Whether the ratings are separated by drug or by condition treated, one-way ANOVA tests reveal that there is a statistically significant difference between the average rating for effectiveness, ease of use, and satisfaction, both in the case where ratings are separated by drug and the case where they are separated by condition treated. To get more of an intuition as to what is going on, we can look at how the average ratings, either for a specific drug or a specific condition, differ from the overall average rating. First looking at effectiveness, which has an overall average rating of 3.7, the effectiveness ratings for the six different drugs are all significantly different than that mean value, with morphine, tramadol, and Opana ER having lower ratings than the average and OxyContin, oxycodone, and methadone having higher ratings than the average. However, when looking at the average effectiveness rating reported for each condition treated, only drug abuse has a statistically significantly higher average rating, and only stiff/tender/painful muscles has a significantly lower rating than the average.

The difference between ratings for ease of use is less dramatic, which makes sense because the most common method of delivery for these drugs is tablets or capsules, making the difference between the drugs less distinguishable. The average ease of use rating across the board is 4.3, and only oxycodone has a significantly higher ease of use rating, while only tramadol has a significantly lower rating. The only condition that has a significantly different ease of use rating was drug abuse, which was lower than average. This might be due to the fact that opioid drug abuse can change the way pleasure nerve receptors function in the brain, and a change in taste palette could explain reviewers not liking the taste and thus reporting a lower ease of use score.

Finally, the difference between the overall average satisfaction rating of 3.5 and the average satisfaction rating for each of the different drugs was significant. For the different conditions, drug abuse, neuropathic pain, and pain with drug abuse were the only conditions with significantly higher than average satisfaction ratings.

At this point, the only thing left to analyze is the reviewers' comments. However, valuable insight was hard to come by having only basic NLP skills at this point. The only thing I can confirm is that regardless of user rating (on a scale of 1-5) for effectiveness, ease of use, or satisfaction, there was no significant difference in positive versus negative sentiment when using TextBlob to look at polarity. Future work would be to investigate this using more robust NLP tools.

Recommendations

To clarify upfront, I would never recommend a pharmaceutical company to size or analyze a market based only on scraped WebMD drug reviews, because the insights are going to be inherently biased towards people who most likely feel strongly about the drug either along a positive vein or a negative one. However, this could be a good way for companies to gauge the experience of patients they normally do not have access to through clinical trials. In light of this, the key takeaways from the patient reviews are:

Customers:

The most frequent reviewers are those in the 45-54 age range, followed by 35-44 and 55-64.
The most common treatment lengths for reviewers is 0-6 months and 5-10 years.

Conditions:

Acute pain accounts for 50% of the reviews, while chronic pain accounts for 20%. However, these are patient-defined categories, so the differences between these two categories is hard to quantify.
It seems as though chronic pain is treated more often with brand-name drugs as opposed to acute pain being treated more frequently with generic drugs.

An non-trivial insight is that the bar for efficacy, method of delivery, and patient satisfaction is very high for the current opioid analgesics on the market. If doctors and pharmaceutical companies want to break into the analgesics market with a non-opioid drug, it's going to have to be very effective, easy to take, and patients are going to want to experience similar pain relieving results as they would experience with their opioid counterparts. I believe this to be where the real challenge for pharmaceutical companies lies. Is it possible for them to make effective and safe non-opioid pain relievers that perform at the same level as opioid pain relievers? Possibly, but if they can't, then doctors won't prescribe them and patients won't be satisfied with them, and the responsibility to curb the use of prescription opioids will fall on government regulation.

About Author

Hayley Caddes

View all posts by Hayley Caddes >

Related Articles

Capstone
Catching Fraud in the Healthcare System
Capstone
The Convenience Factor: How Grocery Stores Impact Property Values
Capstone
Acquisition Due Dilligence Automation for Smaller Firms
Machine Learning
Pandemic Effects on the Ames Housing Market and Lifestyle
Machine Learning
The Ames Data Set: Sales Price Tackled With Diverse Models

Leave a Comment

Cancel reply

You must be logged in to post a comment.

No comments found.

View Posts by Categories

All Posts 2399 posts
AI 7 posts
AI Agent 2 posts
AI-based hotel recommendation 1 posts
AIForGood 1 posts
Alumni 60 posts
Animated Maps 1 posts
APIs 41 posts
Artificial Intelligence 2 posts
Artificial Intelligence 2 posts
AWS 13 posts
Banking 1 posts
Big Data 50 posts
Branch Analysis 1 posts
Capstone 206 posts
Career Education 7 posts
CLIP 1 posts
Community 72 posts
Congestion Zone 1 posts
Content Recommendation 1 posts
Cosine SImilarity 1 posts
Data Analysis 5 posts
Data Engineering 1 posts
Data Engineering 3 posts
Data Science 7 posts
Data Science News and Sharing 73 posts
Data Visualization 324 posts
Events 5 posts
Featured 37 posts
Function calling 1 posts
FutureTech 1 posts
Generative AI 5 posts
Hadoop 13 posts
Image Classification 1 posts
Innovation 2 posts
Kmeans Cluster 1 posts
LLM 6 posts
Machine Learning 364 posts
Marketing 1 posts
Meetup 144 posts
MLOPs 1 posts
Model Deployment 1 posts
Nagamas69 1 posts
NLP 1 posts
OpenAI 5 posts
OpenNYC Data 1 posts
pySpark 1 posts
Python 16 posts
Python 458 posts
Python data analysis 4 posts
Python Shiny 2 posts
R 404 posts
R Data Analysis 1 posts
R Shiny 560 posts
R Visualization 445 posts
RAG 1 posts
RoBERTa 1 posts
semantic rearch 2 posts
Spark 17 posts
SQL 1 posts
Streamlit 2 posts
Student Works 1687 posts
Tableau 12 posts
TensorFlow 3 posts
Traffic 1 posts
User Preference Modeling 1 posts
Vector database 2 posts
Web Scraping 483 posts
wukong138 1 posts

Our Recent Popular Posts

AI 4 AI: ChatGPT Unifies My Blog Posts
by Vinod Chugani
Dec 18, 2022
Meet Your Machine Learning Mentors: Kyle Gallatin
by Vivian Zhang
Nov 4, 2020
NICU Admissions and CCHD: Predicting Based on Data Analysis
by Paul Lee, Aron Berke, Bee Kim, Bettina Meier and Ira Villar
Jan 7, 2020

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 ChatGPT 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 football 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 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

NYC Data Science Academy

NYC Data Science Academy teaches data science, trains companies and their employees to better profit from data, excels at big data project consulting, and connects trained Data Scientists to our industry.

NYC Data Science Academy is licensed by New York State Education Department.

Get detailed curriculum information about our
amazing bootcamp!

Please enter a valid email address
Sign up completed. Thank you!

Offerings

  • HOME
  • DATA SCIENCE BOOTCAMP
  • ONLINE DATA SCIENCE BOOTCAMP
  • Professional Development Courses
  • CORPORATE OFFERINGS
  • HIRING PARTNERS
  • About

  • About Us
  • Alumni
  • Blog
  • FAQ
  • Contact Us
  • Refund Policy
  • Join Us
  • SOCIAL MEDIA

    ยฉ 2025 NYC Data Science Academy
    All rights reserved. | Site Map
    Privacy Policy | Terms of Service
    Bootcamp Application