A multi-page Streamlit dashboard turning four IPL data sources — ball-by-ball deliveries, match metadata, statistical venue profiles, and qualitative stadium reports — into an interactive venue-intelligence tool. Single-venue deep dive, side-by-side comparator with K-Means similarity clustering, player rankings, and composite predictive scoring. Reference tool, not a calibrated predictor — and the page is honest about which is which.
Cricket analysts don't ask "predict the venue type." They ask "what's Wankhede's profile? Who historically scores at Chepauk? What should we do at the toss here? Which venues are similar to where we're playing tomorrow?"
Those are lookup-with-context questions — they need a structured interactive tool, not a regression model. Most cricket analytics work overshoots this distinction: it tries to predict what should be a reference lookup, and ends up with overfit toy models that hide the actual signal a coach is looking for.
This project is what an analyst actually opens 30 minutes before a match. Four pages, four data sources, one tool.
Three tabs for one venue — statistics (matches, avg score, runs/over, balls/wicket), phase analysis (PP/Middle/Death rates), and toss impact (bat-first vs bowl-first win %). The pitch profile from Stadium Reports surfaces qualitative tags too — pitch type, bounce, spin assistance, seam movement, dew impact.
Pick two venues, see their metrics side by side and their phase-wise scoring profiles overlaid. Then K-Means clusters all venues on 3-feature space (PP / Middle / Death run rates) and surfaces "venues similar to X" — useful for travel days when you want a proxy for a venue you've never played.
For a chosen venue, rank batters by career runs at that ground with min-runs threshold. Surface top-5 by volume, plus a Strike Rate × Average quadrant scatter — Elite, Anchors, Slow-but-solid, Aggressive-but-prone. Each player point sized by total runs for instant scan.
Two sub-tools. Batter Prediction: pick venue + opponent — composite-scored ranking of likely top performers. Match Strategy: toss recommendation + pitch-aware playing-XI tips. Honest framing — the composite score is a ranked candidate list, not a calibrated probability.
The unglamorous foundation. Cricket data is messy — the same stadium appears under five name variants across sources. Without normalization, every groupby produces garbage. The pipeline below is what makes the rest of the dashboard correct.
@st.cache_data caches the heavy merge so each page navigation is instant. Inner-join deliveries × matches on match_id. Outer-join venue profiles + stadium reports on the normalized venue key. Filter to innings 1 and 2. Phase-tag every delivery (PP / Middle / Death).
11-entry hand-curated map collapses variants — "Ekana Cricket Stadium, Lucknow", "Bharat Ratna Shri Atal Bihari Vajpayee Ekana Cricket Stadium, Lucknow", "BRSABV Ekana Cricket Stadium" — into one canonical name. This is the boring step that makes everything else correct. Without it, every groupby splits one stadium into multiple rows.
Per venue: total matches, total runs, runs per over, balls per wicket, average 1st-innings and 2nd-innings scores. Per (venue × phase): run rate, strike rate, balls per wicket. Per (venue × batter): runs, balls, dismissals, strike rate, average, runs per match.
Pivot phase rates to (venues × 3) matrix — PP, Middle, Death. StandardScaler normalizes. K-Means with n_clusters = min(5, n_venues) and random_state=42. Output: cluster ID per venue. "Similar venues to X" = same cluster.
For a (venue, opponent) pairing: compute each batter's avg-runs-at-venue, recent-form average, and average vs that opponent. MinMax-normalize each component within the result set. Weighted sum: 0.4 × venue + 0.3 × form + 0.3 × vs-opp. Heuristic ranking, not a calibrated probability — labelled clearly in the UI.
If Spin Assistance == 'Very High' → recommend extra spinners. If Seam Movement == 'High' → recommend quality pace bowlers. If Dew Impact == 'High' → flag dew factor for second-innings bowling. Combined with phase analysis (highest-scoring phase at venue) → playing-strategy brief.
Sidebar radio button routes between the four pages. Each page uses Plotly Express for interactive bar/line/scatter charts and pie charts. Hover tooltips, click-to-zoom, all native. Tabs within each page for sub-sections (Stats / Phase / Toss).
For full transparency — here's exactly what the "Predict Top Batters" feature computes. Three components, hand-set weights, MinMax-normalized within the result set. Ranked candidate list, not a probability.
The "Predictive Analytics" page is not a calibrated probability forecast. It's a ranked candidate list from a transparent composite formula. There's no held-out test set, no accuracy metric, no AUC, no Brier score. Stating any of those would be dishonest.
The K-Means venue clusters are not validated by silhouette or Davies-Bouldin score. They're interpretable groupings that pass face-validity checks — high-scoring decks cluster together, low-scoring decks cluster together — but I haven't proven they're statistically optimal.
The Stadium Reports labels (Spin Assistance: Very High, Dew Impact: Medium) are manually compiled. They're useful for the strategy recommendations, but they're not BCCI-authoritative.
Where the project is genuinely strong: the foundational pipeline. The venue name normalization map, the four-way merge, the cached load, the phase tagging, the per-venue aggregates, the multi-page navigation. That's the work most cricket dashboards skip and get wrong — and getting it right is what makes every other view in the app correct.
@st.cache_data on the heavy data load means page-switching is instant. A custom React frontend would take 10× the effort for no analyst-facing benefit.The honest gaps between this dashboard and what a production-grade franchise tool would look like. Every one is a real V2 target, not hand-waving.
n_clusters = 5 is fixed. No silhouette score, no elbow method. Reasonable for 10–15 venues, but not statistically validated.recent_avg includes matches at the prediction venue, so venue history shows up in two of the three composite factors.rapidfuzz. New venues self-map.Full code on GitHub — four data sources merged, four analytical pages, K-Means clustering, composite scoring, deployment config.