A full basketball analytics pipeline for the Lebanese Basketball Federation's Division A, built on data scraped directly from RealGM: standings, team power rankings, player efficiency, playing-style profiling, win-correlation analysis, and a statistical player-team fit engine.
Two narrative writeups generated from the analysis engine's own numbers — fact-checked against the underlying data before publishing:
- Player to Watch: Christophe Khalil — an under-the-radar forward on a non-competing team, surfaced by the fit engine's rebounding and efficiency signals.
- The Hidden Gem: Desi Washington — the league's assist leader, buried on a losing team, ranked the #1 statistical fit for three different contenders.
- League standings, team power rankings, and team strength scores
- What actually correlates with winning (evidence-based, not assumption-based — see caveat in report)
- Team identity/style profiles (pace, shot profile, ball movement, defensive identity) and each team's statistical needs
- Team profile vs. roster radar charts for the league's top teams
- Full player rankings and efficiency rankings, including a Lebanese-players-only breakdown
- Player-team fit engine: best external targets per team, "hidden gem" recommendations, and underused-player signals from current rosters
- Home/away splits and head-to-head matchup records
scrape_realgm_*.py → data/raw/ (Playwright scrapers)
process_realgm_data.py → data/processed/ (clean season stats)
process_boxscores.py → data/processed/ (clean per-game box scores)
build_standings.py → standings_2025_2026.csv
build_team_profiles.py → team_profiles_2025_2026.csv
rank_teams.py → team_power_rankings_2025_2026.csv
build_team_strengths.py → team_strengths_2025_2026.csv
build_win_correlation_analysis.py → win_correlation_analysis_2025_2026.csv
build_team_style_profiles.py → team_style_profiles_2025_2026.csv
build_player_archetypes.py → player_archetypes_2025_2026.csv
build_player_team_fit.py → player_team_fit_scores_2025_2026.csv
rank_players.py / rank_player_efficiency.py → player rankings
build_home_away_analysis.py → home_away_analysis_2025_2026.csv
build_matchup_summary.py → matchup_summary_2025_2026.csv
build_charts.py → chart PNGs (embedded in report)
generate_html_report.py → index.html (this report)
Validation scripts (validate_*.py) check for scoring/winner consistency, duplicate games, and missing team mappings.
- All normalized "score" and "tier" fields are relative to this season's 12-team field only — not an absolute or cross-season benchmark.
- The win-correlation analysis is based on n=12 teams (one season) — treated as a hypothesis to re-check next season, not proven fact.
- "Lebanese Players" tables use a hand-reviewed name heuristic (RealGM has no nationality field) — see the note in that section of the report.
Python, pandas, matplotlib, scipy (Pearson/Spearman correlation), Playwright (scraping). Report is a single self-contained HTML file with charts embedded as base64 PNGs — no external dependencies except Google Fonts.
pip install pandas matplotlib scipy playwright
python scrape_realgm_lebanon.py
python scrape_realgm_games.py
python scrape_realgm_boxscores.py
# ... run remaining build_*.py / rank_*.py scripts in the order above ...
python generate_html_report.py