P PLOFAHub
Table Matches Players Teams Compare Predict Strength News TOTW
26/27
P
PLOFA Hub · Simulation analytics, 26/27 season
Table Matches Players Teams Predictions News Desk
Built from the PLOFA engine
ESC

Loading PLOFA Data...

🛠

Update Guide

Run these steps after every new matchday to refresh the whole app — league table, player stats, team analytics, predictions, the news desk & match reports. Steps 3 & 4 can run in either order. Step 5 needs steps 2 & 3 done first. Step 6 needs steps 2 & 5 done first.

1 Run the simulation

Edit run_match.py (in your ENGINE-FILES folder) with the new matchday's squads, styles & soul players, then run it. It exports a full match folder of real data — JSON timeline, multi-sheet XLSX, CSVs & PNG visualisations.

py run_match.py

Copy the exported match folder into plofa_assets/<Match_MD##>/.

in: run_match.py (squads) out: plofa_assets/<match>/
match.json (full timeline) match.xlsx (8 stat sheets) players.csv shot_map.png · pass_network.png · pressure_map.png …
2 Build core app data

Aggregates every match into the league table, player season stats, team records, match index & upcoming fixtures. This is the foundation every other page reads.

py build_app_data.py
in: plofa_assets/<match>/ · season files
data/league_table.json data/matches_index.json data/players.json data/teams.json data/upcoming_fixtures.json data/matches/<id>.json
⚠️ build_app_data.py is missing from disk — it's referenced by the app but was not found anywhere in the project or engine folders. It needs to be recreated (or located) for this step to run. Until then the core data files won't refresh.
3 Build player analytics

Aggregates every player's events into per-player shot maps, pass maps, goal maps, heat maps & carry maps for the Player Detail analytics tab.

py build_player_analytics.py
in: plofa_assets/<match>/{*.json, *.xlsx}
data/player_analytics.json data/player_analytics/<player>.json
3b Build player heatmaps

Renders dense KDE heatmaps (mplsoccer + seaborn) for the Player Detail Heat Map tab. Each heatmap is a transparent PNG overlay on the SVG pitch.

py build_player_heatmaps.py
in: data/player_analytics.json
data/player_heatmaps/<player>.png
4 Build team analytics

Aggregates every team's season stats — goals by situation, shot maps, team shape, possession zones, xT zones, defence, pressing, goalkeeping & league percentiles.

py build_team_analytics.py
in: plofa_assets/<match>/*.json · data/matches/
data/team_analytics.json
5 Build predictions

Dixon-Coles Poisson model fitted on all-time + current-season results, blended with squad strength (DNA) & recent form. Refreshes the Predict page.

py build_predictions.py
in: data/league_table.json · data/teams.json · data/upcoming_fixtures.json · PLOFA-ALL-TIME.xlsx
data/predictions.json
6 Build the news desk

Auto-writes the News page — match reports, table stories, player spotlights, previews & the Team of the Week — from the same data every other page uses. Hybrid writer: stories are drafted deterministically from real results, xG & the predictor, then (optionally) re-spun into fresh prose by an OpenAI-compatible LLM. Azure OpenAI is supported out of the box — set the standard AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY and AZURE_OPENAI_CHAT_DEPLOYMENT env vars to enable. Without a key it automatically falls back to the deterministic templates.

py build_news.py
in: data/matches_index.json · league_table.json · players.json · predictions.json
data/news.json data/totw/<md>.json + data/totw/index.json
7 Sync upcoming fixtures (kick-off dates/times)

Whenever you change kick-off dates or start times in the master workbook's FIXTURES sheet — Downloads/plofa_checkpoint6/plofa/ PLOFA-2026-2027.xlsx — regenerate the app's fixture list. Only not-yet-played rows are exported, so played matches stay off the Matches page.

py build_fixtures.py
PLOFA-2026-2027.xlsx → FIXTURES sheet
data/upcoming_fixtures.json

If your workbook lives somewhere else, pass its path: py build_fixtures.py "C:/path/to/PLOFA-2026-2027.xlsx"

8 Serve & view

Start the local server and open the app. Hard-refresh the browser (Ctrl+Shift+R) to bust the cache and load the new data.

py -m http.server 8080

Then open http://localhost:8080.

📁 Data files consumed by the app

What app.js loads on startup (all in data/):

FilePowers
league_table.jsonLeague page, team ranks
matches_index.jsonMatches page, match cards
players.jsonPlayers page, player profiles
teams.jsonTeams page, team cards
upcoming_fixtures.jsonFixtures list — synced from the workbook via build_fixtures.py
predictions.jsonPredict page
news.jsonNews Desk page
totw/<md>.json + totw/index.jsonTeam of the Week history toggle
team_analytics.jsonTeam Detail — all tabs
player_analytics.json + player_analytics/Player Detail — analytics maps
player_heatmaps/<player>.pngPlayer Detail — Heat Map tab (dense KDE)
matches/<id>.jsonMatch Detail (lazy-loaded)
Tip: the 🛠 button is always bottom-right. After rebuilding, hard-refresh (Ctrl+Shift+R) so the browser picks up the new JSON.
Missing script: build_app_data.py (step 2) — not found on disk.
Re-run build_news.py after any rebuild to refresh the News Desk feed.