# farhan-s-a-4/ucl-predictor architecture

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

- Interactive diagram: https://gitdiagram.com/farhan-s-a-4/ucl-predictor
- Repository: https://github.com/farhan-s-a-4/ucl-predictor

## Overview

ucl-predictor builds reproducible UEFA Champions League match and season predictions from historical UCL and domestic results. Its main workflow canonicalizes domestic data, prepares historical UCL matches and 2026-27 fixtures, constructs leakage-safe features, trains and evaluates models, predicts fixtures, simulates the league phase and knockout stage, and renders social-media summaries. The graph also retains the documented coefficient/context branch and live-result updates. Some unsampled modules are represented only where README or source-index references establish their role; dashed edges indicate documented or likely links not verified in excerpts.

Main entry points: [`src/data/processing/run_ucl_data_pipeline.py`](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/run_ucl_data_pipeline.py) (UCL data pipeline), [`src/simulation/simulate_2026_27.py`](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/simulation/simulate_2026_27.py) (Season simulation), [`src/visualization/generate_social_media.py`](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/visualization/generate_social_media.py) (Social output generator), [`src/data/run_all_domestic.py`](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/run_all_domestic.py) (Domestic batch runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_domestic_runner["Domestic batch runner"]
  node_league_parsers["League parsers<br/>[common.py]"]
  node_canonical["Canonical data utilities<br/>[canonical.py]"]
  node_domestic_features["Baseline feature builder"]
  node_identity["Team identity resolver"]
  node_ucl_parser["Historical UCL parser"]
  node_fixtures["2026-27 fixture processor"]
  node_coefficients["UEFA coefficient processor"]
  node_team_context["Team coefficient context"]
  node_pipeline["UCL data pipeline"]
end

subgraph group_model["Modeling and prediction"]
  node_baseline_model["Baseline models<br/>[models_baseline.py]"]
  node_backtest["Expanding-window backtest<br/>[models_backtest.py]"]
  node_final_model["Final model training<br/>[models_final.py]"]
  node_live_features["Live feature snapshots"]
  node_next_predictions["Next matchday predictions"]
  node_result_updates["Result updates<br/>[update_results.py]"]
end

subgraph group_simulation["Season simulation"]
  node_season_sim["Season simulation"]
end

subgraph group_outputs["Reporting"]
  node_social_generator["Social output generator"]
  node_heatmap["Position heatmap"]
  node_probable_table["Probable league table"]
end

node_operator(("Project operator"))

node_operator -->|"runs"| node_domestic_runner
node_domestic_runner -->|"parses leagues"| node_league_parsers
node_league_parsers -.->|"normalizes matches"| node_canonical
node_operator -->|"runs"| node_pipeline
node_pipeline -->|"builds history"| node_ucl_parser
node_pipeline -->|"builds coefficients"| node_coefficients
node_pipeline -->|"processes fixtures"| node_fixtures
node_pipeline -->|"builds context"| node_team_context
node_operator -->|"resolves teams"| node_identity
node_operator -->|"builds features"| node_domestic_features
node_operator -->|"evaluates models"| node_backtest
node_backtest -.->|"evaluates"| node_baseline_model
node_operator -->|"trains model"| node_final_model
node_operator -->|"predicts fixtures"| node_next_predictions
node_next_predictions -->|"builds features"| node_live_features
node_operator -.->|"updates results"| node_result_updates
node_operator -->|"simulates season"| node_season_sim
node_final_model -->|"supplies probabilities"| node_season_sim
node_operator -->|"generates graphics"| node_social_generator
node_social_generator -->|"builds heatmap"| node_heatmap
node_social_generator -->|"builds table"| node_probable_table
node_season_sim -->|"provides standings"| node_heatmap
node_season_sim -->|"provides summary"| node_probable_table

click node_domestic_runner "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/run_all_domestic.py"
click node_league_parsers "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/parsers/common.py"
click node_canonical "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/utils/canonical.py"
click node_domestic_features "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/build_baseline_features.py"
click node_identity "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/build_team_identity.py"
click node_ucl_parser "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/parse_ucl_matches.py"
click node_fixtures "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/process_ucl_2026_27.py"
click node_coefficients "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/process_uefa_coefficients.py"
click node_team_context "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/build_ucl_2026_27_context.py"
click node_pipeline "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/run_ucl_data_pipeline.py"
click node_baseline_model "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/models_baseline.py"
click node_backtest "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/models_backtest.py"
click node_final_model "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/models_final.py"
click node_live_features "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/prediction/build_live_features.py"
click node_next_predictions "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/prediction/predict_next_matchday.py"
click node_result_updates "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/prediction/update_results.py"
click node_season_sim "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/simulation/simulate_2026_27.py"
click node_social_generator "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/visualization/generate_social_media.py"
click node_heatmap "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/visualization/build_position_heatmap.py"
click node_probable_table "https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/visualization/build_probable_table.py"

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_domestic_runner,node_league_parsers,node_canonical,node_domestic_features,node_identity,node_ucl_parser,node_fixtures,node_coefficients,node_team_context,node_pipeline toneBlue
class node_baseline_model,node_backtest,node_final_model,node_live_features,node_next_predictions,node_result_updates toneAmber
class node_season_sim toneMint
class node_social_generator,node_heatmap,node_probable_table toneRose
class node_operator toneIndigo
```

## Components

### Data preparation

- [Domestic batch runner](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/run_all_domestic.py): `src/data/run_all_domestic.py`
- [League parsers](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/parsers/common.py): `src/data/parsers/common.py`
- [Canonical data utilities](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/utils/canonical.py): `src/data/utils/canonical.py`
- [Baseline feature builder](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/build_baseline_features.py): `src/data/processing/build_baseline_features.py`
- [Team identity resolver](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/build_team_identity.py): `src/data/processing/build_team_identity.py`
- [Historical UCL parser](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/parse_ucl_matches.py): `src/data/processing/parse_ucl_matches.py`
- [2026-27 fixture processor](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/process_ucl_2026_27.py): `src/data/processing/process_ucl_2026_27.py`
- [UEFA coefficient processor](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/process_uefa_coefficients.py): `src/data/processing/process_uefa_coefficients.py`
- [Team coefficient context](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/build_ucl_2026_27_context.py): `src/data/processing/build_ucl_2026_27_context.py`
- [UCL data pipeline](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/data/processing/run_ucl_data_pipeline.py): `src/data/processing/run_ucl_data_pipeline.py`

### Modeling and prediction

- [Baseline models](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/models_baseline.py): `src/models_baseline.py`
- [Expanding-window backtest](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/models_backtest.py): `src/models_backtest.py`
- [Final model training](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/models_final.py): `src/models_final.py`
- [Live feature snapshots](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/prediction/build_live_features.py): `src/prediction/build_live_features.py`
- [Next matchday predictions](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/prediction/predict_next_matchday.py): `src/prediction/predict_next_matchday.py`
- [Result updates](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/prediction/update_results.py): `src/prediction/update_results.py`

### Season simulation

- [Season simulation](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/simulation/simulate_2026_27.py): `src/simulation/simulate_2026_27.py`

### Reporting

- [Social output generator](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/visualization/generate_social_media.py): `src/visualization/generate_social_media.py`
- [Position heatmap](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/visualization/build_position_heatmap.py): `src/visualization/build_position_heatmap.py`
- [Probable league table](https://github.com/farhan-s-a-4/ucl-predictor/blob/master/src/visualization/build_probable_table.py): `src/visualization/build_probable_table.py`

### Other components

- **Project operator**

## Connections

- Project operator → Domestic batch runner: runs
- Domestic batch runner → League parsers: parses leagues (evidence: `src/data/run_all_domestic.py`)
- League parsers → Canonical data utilities: normalizes matches
- Project operator → UCL data pipeline: runs
- UCL data pipeline → Historical UCL parser: builds history (evidence: `src/data/processing/run_ucl_data_pipeline.py`)
- UCL data pipeline → UEFA coefficient processor: builds coefficients (evidence: `src/data/processing/run_ucl_data_pipeline.py`)
- UCL data pipeline → 2026-27 fixture processor: processes fixtures (evidence: `src/data/processing/run_ucl_data_pipeline.py`)
- UCL data pipeline → Team coefficient context: builds context (evidence: `src/data/processing/run_ucl_data_pipeline.py`)
- Project operator → Team identity resolver: resolves teams
- Project operator → Baseline feature builder: builds features
- Project operator → Expanding-window backtest: evaluates models
- Expanding-window backtest → Baseline models: evaluates
- Project operator → Final model training: trains model
- Project operator → Next matchday predictions: predicts fixtures
- Next matchday predictions → Live feature snapshots: builds features (evidence: `src/prediction/predict_next_matchday.py`)
- Project operator → Result updates: updates results
- Project operator → Season simulation: simulates season
- Final model training → Season simulation: supplies probabilities
- Project operator → Social output generator: generates graphics
- Social output generator → Position heatmap: builds heatmap (evidence: `src/visualization/generate_social_media.py`)
- Social output generator → Probable league table: builds table (evidence: `src/visualization/generate_social_media.py`)
- Season simulation → Position heatmap: provides standings (evidence: `src/visualization/build_position_heatmap.py`)
- Season simulation → Probable league table: provides summary (evidence: `src/visualization/build_probable_table.py`)
