# costasgk/scorecast architecture

> Architecture diagram of the GitHub repository costasgk/scorecast, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/costasgk/scorecast
- Repository: https://github.com/costasgk/scorecast

## Overview

ScoreCast turns football and basketball history plus upcoming fixtures into match predictions, then serves those predictions and analysis through a Flask application. The principal football workflow is data refresh, calendar enrichment, Dixon–Coles fitting and prediction, with separate season simulation and walk-forward market benchmarking. Basketball has its own data and rating-model path, plus player statistics. The README documents several web features whose route-level implementation was not sampled; those capabilities are included without inferring internal call chains.

Main entry points: [`Scripts/WebApp/app.py`](https://github.com/costasgk/scorecast/blob/main/Scripts/WebApp/app.py) (Flask application), [`Scripts/ScorelineModel.py`](https://github.com/costasgk/scorecast/blob/main/Scripts/ScorelineModel.py) (Dixon-Coles model), [`Scripts/refresh.py`](https://github.com/costasgk/scorecast/blob/main/Scripts/refresh.py) (Refresh orchestrator), [`Scripts/pipeline.py`](https://github.com/costasgk/scorecast/blob/main/Scripts/pipeline.py) (Legacy pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_football_data["Football data"]
  node_registry["League registry<br/>[leagues.py]"]
  node_fd_fetch["Football results<br/>[FootballData.py]"]
  node_calendar["Fixture calendars<br/>[fixtures.py]"]
  node_legacy_scraper["FBref scraper<br/>[Scrapping.py]"]
  node_cleaning["Match cleaning<br/>[Cleaning.py]"]
end

subgraph group_football_models["Football models"]
  node_score_model["Dixon-Coles model<br/>[ScorelineModel.py]"]
  node_season_sim["Season projection<br/>[simulate_season.py]"]
end

subgraph group_basketball["Basketball"]
  node_basket_data["Basketball data<br/>[EuroleagueData.py]"]
  node_basket_model["Opponent ratings<br/>[EuroleagueModel.py]"]
  node_player_stats["Player statistics<br/>[players.py]"]
  node_basket_backtest["Basketball backtest<br/>[backtest.py]"]
end

subgraph group_web["Web product"]
  node_web_app["Flask application<br/>[app.py]"]
  node_web_features["Prediction and analysis pages"]
end

subgraph group_operations["Refresh and evaluation"]
  node_refresh["Refresh orchestrator<br/>[refresh.py]"]
  node_pipeline["Legacy pipeline<br/>[pipeline.py]"]
  node_benchmark["Market benchmark<br/>[benchmark.py]"]
  node_calibrate["Model calibration<br/>[calibrate.py]"]
  node_decay_tuning["Decay tuning<br/>[tune_decay.py]"]
end

node_user(("Visitor"))
node_football_source{{"football-data.co.uk"}}
node_calendar_sources{{"ESPN and FBref"}}
node_basket_api{{"EuroLeague API"}}

node_user -->|"views"| node_web_app
node_refresh -->|"fetches results"| node_fd_fetch
node_refresh -->|"fetches calendars"| node_calendar
node_refresh -->|"refits and predicts"| node_score_model
node_refresh -->|"projects seasons"| node_season_sim
node_fd_fetch -->|"downloads CSVs"| node_football_source
node_fd_fetch -->|"uses league list"| node_registry
node_calendar -->|"fetches calendars"| node_calendar_sources
node_calendar -->|"uses league list"| node_registry
node_legacy_scraper -->|"is orchestrated by"| node_pipeline
node_pipeline -->|"cleans matches"| node_cleaning
node_pipeline -->|"fetches results"| node_fd_fetch
node_pipeline -->|"runs predictions"| node_score_model
node_score_model -->|"supplies model"| node_season_sim
node_benchmark -->|"evaluates predictions"| node_score_model
node_calibrate -->|"calibrates"| node_score_model
node_decay_tuning -->|"tunes decay"| node_score_model
node_basket_data -->|"fetches live games"| node_basket_api
node_basket_model -->|"fits game data"| node_basket_data
node_player_stats -->|"loads box scores"| node_basket_data
node_basket_backtest -->|"validates ratings"| node_basket_model
node_web_app -->|"renders pages"| node_web_features
node_web_app -->|"serves predictions"| node_score_model
node_web_app -->|"serves projections"| node_season_sim
node_web_app -->|"shows benchmark"| node_benchmark
node_web_app -->|"shows leaders"| node_player_stats
node_web_app -.->|"serves basketball"| node_basket_model

click node_refresh "https://github.com/costasgk/scorecast/blob/main/Scripts/refresh.py"
click node_registry "https://github.com/costasgk/scorecast/blob/main/Scripts/leagues.py"
click node_fd_fetch "https://github.com/costasgk/scorecast/blob/main/Scripts/FootballData.py"
click node_calendar "https://github.com/costasgk/scorecast/blob/main/Scripts/fixtures.py"
click node_legacy_scraper "https://github.com/costasgk/scorecast/blob/main/Scripts/Scrapping.py"
click node_cleaning "https://github.com/costasgk/scorecast/blob/main/Scripts/Cleaning.py"
click node_pipeline "https://github.com/costasgk/scorecast/blob/main/Scripts/pipeline.py"
click node_score_model "https://github.com/costasgk/scorecast/blob/main/Scripts/ScorelineModel.py"
click node_season_sim "https://github.com/costasgk/scorecast/blob/main/Scripts/simulate_season.py"
click node_benchmark "https://github.com/costasgk/scorecast/blob/main/Scripts/benchmark.py"
click node_calibrate "https://github.com/costasgk/scorecast/blob/main/Scripts/calibrate.py"
click node_decay_tuning "https://github.com/costasgk/scorecast/blob/main/Scripts/tune_decay.py"
click node_basket_data "https://github.com/costasgk/scorecast/blob/main/Scripts/Euroleague_scripts/EuroleagueData.py"
click node_basket_model "https://github.com/costasgk/scorecast/blob/main/Scripts/Euroleague_scripts/EuroleagueModel.py"
click node_player_stats "https://github.com/costasgk/scorecast/blob/main/Scripts/Euroleague_scripts/players.py"
click node_basket_backtest "https://github.com/costasgk/scorecast/blob/main/Scripts/Euroleague_scripts/backtest.py"
click node_web_app "https://github.com/costasgk/scorecast/blob/main/Scripts/WebApp/app.py"
click node_web_features "https://github.com/costasgk/scorecast/tree/main/Scripts/WebApp/templates"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_registry,node_fd_fetch,node_calendar,node_legacy_scraper,node_cleaning toneBlue
class node_score_model,node_season_sim toneAmber
class node_basket_data,node_basket_model,node_player_stats,node_basket_backtest,node_basket_api toneMint
class node_web_app,node_web_features toneRose
class node_refresh,node_pipeline,node_benchmark,node_calibrate,node_decay_tuning,node_user,node_football_source,node_calendar_sources toneIndigo
```

## Components

### Football data

- [League registry](https://github.com/costasgk/scorecast/blob/main/Scripts/leagues.py): `Scripts/leagues.py`
- [Football results](https://github.com/costasgk/scorecast/blob/main/Scripts/FootballData.py): `Scripts/FootballData.py`
- [Fixture calendars](https://github.com/costasgk/scorecast/blob/main/Scripts/fixtures.py): `Scripts/fixtures.py`
- [FBref scraper](https://github.com/costasgk/scorecast/blob/main/Scripts/Scrapping.py): `Scripts/Scrapping.py`
- [Match cleaning](https://github.com/costasgk/scorecast/blob/main/Scripts/Cleaning.py): `Scripts/Cleaning.py`

### Football models

- [Dixon-Coles model](https://github.com/costasgk/scorecast/blob/main/Scripts/ScorelineModel.py): `Scripts/ScorelineModel.py`
- [Season projection](https://github.com/costasgk/scorecast/blob/main/Scripts/simulate_season.py): `Scripts/simulate_season.py`

### Basketball

- [Basketball data](https://github.com/costasgk/scorecast/blob/main/Scripts/Euroleague_scripts/EuroleagueData.py): `Scripts/Euroleague_scripts/EuroleagueData.py`
- [Opponent ratings](https://github.com/costasgk/scorecast/blob/main/Scripts/Euroleague_scripts/EuroleagueModel.py): `Scripts/Euroleague_scripts/EuroleagueModel.py`
- [Player statistics](https://github.com/costasgk/scorecast/blob/main/Scripts/Euroleague_scripts/players.py): `Scripts/Euroleague_scripts/players.py`
- [Basketball backtest](https://github.com/costasgk/scorecast/blob/main/Scripts/Euroleague_scripts/backtest.py): `Scripts/Euroleague_scripts/backtest.py`

### Web product

- [Flask application](https://github.com/costasgk/scorecast/blob/main/Scripts/WebApp/app.py): `Scripts/WebApp/app.py`
- [Prediction and analysis pages](https://github.com/costasgk/scorecast/tree/main/Scripts/WebApp/templates): `Scripts/WebApp/templates`

### Refresh and evaluation

- [Refresh orchestrator](https://github.com/costasgk/scorecast/blob/main/Scripts/refresh.py): `Scripts/refresh.py`
- [Legacy pipeline](https://github.com/costasgk/scorecast/blob/main/Scripts/pipeline.py): `Scripts/pipeline.py`
- [Market benchmark](https://github.com/costasgk/scorecast/blob/main/Scripts/benchmark.py): `Scripts/benchmark.py`
- [Model calibration](https://github.com/costasgk/scorecast/blob/main/Scripts/calibrate.py): `Scripts/calibrate.py`
- [Decay tuning](https://github.com/costasgk/scorecast/blob/main/Scripts/tune_decay.py): `Scripts/tune_decay.py`

### Other components

- **Visitor**
- **football-data.co.uk**
- **ESPN and FBref**
- **EuroLeague API**

## Connections

- Visitor → Flask application: views (evidence: `README.md`)
- Refresh orchestrator → Football results: fetches results (evidence: `README.md`)
- Refresh orchestrator → Fixture calendars: fetches calendars (evidence: `README.md`)
- Refresh orchestrator → Dixon-Coles model: refits and predicts (evidence: `README.md`)
- Refresh orchestrator → Season projection: projects seasons (evidence: `README.md`)
- Football results → football-data.co.uk: downloads CSVs (evidence: `Scripts/FootballData.py`)
- Football results → League registry: uses league list (evidence: `Scripts/FootballData.py`)
- Fixture calendars → ESPN and FBref: fetches calendars (evidence: `README.md`)
- Fixture calendars → League registry: uses league list (evidence: `Scripts/fixtures.py`)
- FBref scraper → Legacy pipeline: is orchestrated by (evidence: `Scripts/pipeline.py`)
- Legacy pipeline → Match cleaning: cleans matches (evidence: `Scripts/pipeline.py`)
- Legacy pipeline → Football results: fetches results (evidence: `Scripts/pipeline.py`)
- Legacy pipeline → Dixon-Coles model: runs predictions (evidence: `Scripts/pipeline.py`)
- Dixon-Coles model → Season projection: supplies model (evidence: `Scripts/simulate_season.py`)
- Market benchmark → Dixon-Coles model: evaluates predictions (evidence: `Scripts/calibrate.py`)
- Model calibration → Dixon-Coles model: calibrates (evidence: `Scripts/calibrate.py`)
- Decay tuning → Dixon-Coles model: tunes decay (evidence: `Scripts/tune_decay.py`)
- Basketball data → EuroLeague API: fetches live games (evidence: `Scripts/Euroleague_scripts/EuroleagueData.py`)
- Opponent ratings → Basketball data: fits game data (evidence: `Scripts/Euroleague_scripts/run.py`)
- Player statistics → Basketball data: loads box scores (evidence: `Scripts/Euroleague_scripts/players.py`)
- Basketball backtest → Opponent ratings: validates ratings (evidence: `Scripts/Euroleague_scripts/backtest.py`)
- Flask application → Prediction and analysis pages: renders pages (evidence: `README.md`)
- Flask application → Dixon-Coles model: serves predictions (evidence: `README.md`)
- Flask application → Season projection: serves projections (evidence: `README.md`)
- Flask application → Market benchmark: shows benchmark (evidence: `README.md`)
- Flask application → Player statistics: shows leaders (evidence: `README.md`)
- Flask application → Opponent ratings: serves basketball
