Patient-Reported Drug Review Analytics & Ranking
Condition-Stratified Drug Ranking Using Bayesian Shrinkage and Interactive Analytics. Real Drugs.com reviews, cleaned, ranked with a shrinkage estimator, checked for stability and temporal drift, and bounded by an explicit validity analysis.
Methodology
How raw scraped reviews became comparable numbers.
Train and test files merged: raw rows.
Dropped rows with no condition and scraped artifacts ("users found this comment helpful") that landed in the condition column.
Trimmed and title-cased conditions, decoded HTML entities in reviews.
One row per condition + drug pair (8,586): review count, mean rating, mean helpful votes and the full 1–10 rating histogram. These sufficient statistics drive everything below, so updates are instant.
Shrink each drug's mean toward its condition's mean (empirical-Bayes style, strength m you can change) so tiny samples cannot win.
Split reviews into random halves and check the two drug rankings agree (split-half Spearman ρ) across 89 conditions.
Inspect rating histograms and year-by-year drift, since averages alone hide polarisation and non-stationarity.
State what the data cannot support, then serve the precomputed statistics client-side so every view is interactive.
Protocol
- Every figure on this page is computed from the real files, nothing is simulated.
- Drugs are only ranked against others reviewed for the same condition.
- Rank by the weighted score, never by raw mean alone; always read the review count beside it.
- Most-helpful reviews are shown verbatim (trimmed) so you can sanity-check the numbers.
Why a weighted score computed live
A drug with three 10/10 reviews should not outrank one with 900 reviews averaging 9.
Condition mean C = (average of all reviews in this dataset). Weighted = n/(n+m)·mean + m/(n+m)·C.
Weight placed on a drug's own mean
Weight = n/(n+m). With m = 10 a drug needs about 10 reviews before its own data counts for half, and at 100 reviews it counts for 91%. Larger m shrinks harder.
Condition lookup real data
Pick a condition, rank its drugs, click a row for the most helpful reviews.
| Drug | Weighted | Mean | Reviews | Avg helpful | Rank vs raw |
|---|
Shrinkage sensitivity live
How each drug's score moves as the prior strength m grows, for the condition selected above.
m = 0 is the raw mean. Drugs with few reviews (steep lines) move toward the condition mean fastest; well-reviewed drugs barely move. Change the condition or minimum reviews above to re-run.
Drug lookup real data
Flip the question: what is one drug reviewed for?
| Condition | Mean rating | Reviews |
|---|
Drug fingerprint
Insights computed from all reviews
The shape of the whole dataset.
Rating distribution
Strongly polarised: most people rate 1 or 10. Averages hide this.
Most reviewed conditions
Reviews per year
Mean rating per year
Highest-rated drugs overall (≥200 reviews)
Lowest-rated drugs overall (≥200 reviews)
Overall rankings mix many conditions, so they are descriptive only: a drug for a hard condition is not "worse" than one for a mild one.
Signature analyses new
Two views that go beyond averages and rankings.
Love-or-Hate map
Love-or-Hate Index = 4 · P(rating ≤ 3) · P(rating ≥ 8). It is 0 when reviewers agree and 1 when they split evenly between hating and loving a drug. Dots are drugs with ≥100 reviews; size = review count. Divisive drugs can have mid-range means.
Most divisive drugs (≥100 reviews)
Bar = index; right = index · mean rating.
Rank robustness: how sure is each rank?
Head-to-head: is drug A really better than drug B?
Love-or-Hate Index by condition
Conditions with ≥300 reviews. Bubble area ∝ review count; colour = index (blue low, orange high). Conditions where patients disagree most sit highest.
Patient language text analysis
What patients write when they love or hate a drug, from the full review text of all 212,698 reviews.
Words that mark 8–10 ratings
Most distinctive words versus 1–3 ratings (log-odds z-score with an informative prior; common stop-words removed).
Words that mark 1–3 ratings
Same method, other direction. Many are about stopping, harm and bleeding.
Side-effect language by rating band
Share of reviews that mention each term, by rating band. Mentions describe what patients wrote, not what a drug causes.
Helpful votes by rating
Mean helpful votes per review: higher-rated reviews are voted helpful more often.
Review length by rating
Median words per review. The most extreme ratings get the shortest reviews.
Visual atlas all reviews
More views of the same real data.
Reliability funnel: mean rating vs review count
Each dot is a condition–drug pair; curves are 95% bands around the overall mean. Spread is widest where reviews are few, which is what shrinkage corrects.
Overall sentiment
Rating profile of the 15 most reviewed conditions
Share of each condition's reviews at each rating. Darker = larger share.
Rating distribution by year
Uncertainty plot for the selected condition
Hollow dot = raw mean with 95% interval (from the rating histogram); filled diamond = shrunk score at the current m. Wide intervals pull in the most. Uses the condition, minimum reviews and m chosen in the lookup above.
Rating distribution of the 8 most reviewed conditions
Share of each condition's reviews at ratings 1–10, drawn on a common vertical scale. U-shaped profiles are typical; their depth differs by condition.
Long-tail concentration of reviews across drugs
Slopegraph: raw rank → shrunk rank
Drugs in the top 10 by raw mean or by shrunk score for the selected condition. Blue = moves up after shrinkage, orange = moves down (typically small-sample drugs).
Treemap: the 30 most reviewed conditions
Area = number of reviews; colour = mean rating (light ≈ 5, dark blue ≈ 8+).
How many conditions is each drug reviewed for?
Temporal drift computed from all reviews
The corpus is not stationary, so pooled comparisons across years are risky.
Share of extreme ratings by year
What changed
Is the decline a change in condition mix?
Mean rating by year within the 8 largest conditions
Review volume by condition and year
Stability validation split-half
Does shrinkage actually make rankings more stable? Tested empirically.
Validity analysis
What this system can and cannot claim.
- Descriptive, condition-specific rankings of patient-reported ratings on one platform.
- Rankings that are more stable for sparsely reviewed drugs (see validation).
- Transparent uncertainty: review counts, rating histograms and sensitivity to m.
- Causal effects: no randomisation or counterfactual, so a high rating is not evidence a drug works.
- Self-selection: people who write reviews are not representative.
- Confounding: dose, severity, treatment duration and co-medication are unobserved.
- Review integrity: duplicate or fabricated reviews are possible.
- Label noise: scraped text contaminated the condition field before cleaning.
- Drift: reviewer population and platform changed over time.
- Sparse cells: shrinkage reduces, but does not remove, small-sample bias.
Run it yourself
Reproduce every number, then extend it — live apps or local code.
Interactive lookup with the same shrinkage ranking — runs live at patient-drug-analysis.streamlit.app.
open https://patient-drug-analysis.streamlit.app/
drug_review_analytics.ipynb loads the raw UCI files (automatic download, or upload archive.zip), cleans them, and reproduces the ranking, funnel, sensitivity, drift and split-half validation, plus a Love-or-Hate index and a true bootstrap rank-robustness analysis.
colab.research.google.com → File → Upload notebook → Runtime → Run all
Dataset: UCI Drug Review Dataset (Drugs.com). This page is one static file and works offline.
Contact: harshinisuresha7@gmail.com