# roshan10k/strikelab architecture

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

- Interactive diagram: https://gitdiagram.com/roshan10k/strikelab
- Repository: https://github.com/roshan10k/strikelab

## Overview

StrikeLab is a shot-quality analytics product: users configure a shot or upload match events, then receive xG/PSxG estimates, coaching guidance, and team/player/goalkeeper analytics. The main interactive flow runs from the React calculator through the JSON API to model inference; registry-backed models support inference and gated retraining. The README documents capabilities beyond the sampled source, so those links are shown where documented; unsampled implementation details are not inferred.

Main entry points: [`api_server.py`](https://github.com/roshan10k/strikelab/blob/main/api_server.py) (FastAPI Server), [`frontend/src/api/client.ts`](https://github.com/roshan10k/strikelab/blob/main/frontend/src/api/client.ts) (API Client), [`frontend/src/routes/Calculator.tsx`](https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/Calculator.tsx) (Shot Calculator), [`model_registry.py`](https://github.com/roshan10k/strikelab/blob/main/model_registry.py) (Model Registry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Analytics UI"]
  node_calculator["Shot Calculator<br/>[Calculator.tsx]"]
  node_scenario["Shot Scenario<br/>[scenario.ts]"]
  node_pitch["Tactical Pitch<br/>[PitchView.tsx]"]
  node_goalframe["Goal Frame<br/>[GoalFrame.tsx]"]
  node_matchui["Match Dashboard<br/>[MatchDashboard.tsx]"]
  node_playersui["Player Analytics<br/>[Players.tsx]"]
  node_keepersui["Goalkeeper Analytics<br/>[Keepers.tsx]"]
  node_adminui["Model Admin<br/>[Admin.tsx]"]
  node_client["API Client<br/>[client.ts]"]
end

subgraph group_api["API and analytics"]
  node_server["FastAPI Server<br/>[api_server.py]"]
  node_analytics["Match Aggregation<br/>[analytics.py]"]
end

subgraph group_models["Models and coaching"]
  node_xg["xG Inference"]
  node_psxg["PSxG and Coach<br/>[calculate_psxg.py]"]
end

subgraph group_management["Model management"]
  node_registry[("Model Registry<br/>[model_registry.py]")]
  node_retrain["Retrain Service<br/>[retrain_service.py]"]
  node_synthetic["Synthetic Data"]
  node_trainpsxg["PSxG Training"]
  node_trainxg["xG Training"]
end

node_user(("Analyst"))

node_user -->|"configures shot"| node_calculator
node_calculator -->|"updates state"| node_scenario
node_pitch -->|"updates positions"| node_scenario
node_goalframe -->|"updates placement"| node_scenario
node_calculator -->|"renders"| node_pitch
node_calculator -->|"renders"| node_goalframe
node_calculator -->|"requests estimates"| node_client
node_matchui -->|"requests analytics"| node_client
node_playersui -->|"requests analytics"| node_client
node_keepersui -->|"requests analytics"| node_client
node_adminui -->|"manages models"| node_client
node_client -->|"sends API requests"| node_server
node_server -->|"calls inference"| node_xg
node_server -->|"calls inference"| node_psxg
node_server -->|"aggregates events"| node_analytics
node_xg -->|"loads artifacts"| node_registry
node_psxg -->|"loads artifacts"| node_registry
node_server -->|"dispatches retraining"| node_retrain
node_retrain -->|"generates samples"| node_synthetic
node_retrain -->|"trains PSxG"| node_trainpsxg
node_retrain -->|"trains xG"| node_trainxg
node_trainpsxg -->|"registers model"| node_registry
node_trainxg -->|"registers model"| node_registry
node_registry -->|"reports versions"| node_server
node_user -->|"uploads match data"| node_matchui

click node_calculator "https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/Calculator.tsx"
click node_scenario "https://github.com/roshan10k/strikelab/blob/main/frontend/src/store/scenario.ts"
click node_pitch "https://github.com/roshan10k/strikelab/blob/main/frontend/src/components/pitch/PitchView.tsx"
click node_goalframe "https://github.com/roshan10k/strikelab/blob/main/frontend/src/components/pitch/GoalFrame.tsx"
click node_matchui "https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/MatchDashboard.tsx"
click node_playersui "https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/Players.tsx"
click node_keepersui "https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/Keepers.tsx"
click node_adminui "https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/Admin.tsx"
click node_client "https://github.com/roshan10k/strikelab/blob/main/frontend/src/api/client.ts"
click node_server "https://github.com/roshan10k/strikelab/blob/main/api_server.py"
click node_analytics "https://github.com/roshan10k/strikelab/blob/main/analytics.py"
click node_xg "https://github.com/roshan10k/strikelab/blob/main/calculate_xg_enhanced.py"
click node_psxg "https://github.com/roshan10k/strikelab/blob/main/calculate_psxg.py"
click node_registry "https://github.com/roshan10k/strikelab/blob/main/model_registry.py"
click node_retrain "https://github.com/roshan10k/strikelab/blob/main/retrain_service.py"
click node_synthetic "https://github.com/roshan10k/strikelab/blob/main/generate_psxg_synthetic_data.py"
click node_trainpsxg "https://github.com/roshan10k/strikelab/blob/main/train_psxg_model.py"
click node_trainxg "https://github.com/roshan10k/strikelab/blob/main/train_ultimate_model.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_calculator,node_scenario,node_pitch,node_goalframe,node_matchui,node_playersui,node_keepersui,node_adminui,node_client toneBlue
class node_server,node_analytics toneAmber
class node_xg,node_psxg toneMint
class node_registry,node_retrain,node_synthetic,node_trainpsxg,node_trainxg toneRose
class node_user toneIndigo
```

## Components

### Analytics UI

- [Shot Calculator](https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/Calculator.tsx): `frontend/src/routes/Calculator.tsx`
- [Shot Scenario](https://github.com/roshan10k/strikelab/blob/main/frontend/src/store/scenario.ts): `frontend/src/store/scenario.ts`
- [Tactical Pitch](https://github.com/roshan10k/strikelab/blob/main/frontend/src/components/pitch/PitchView.tsx): `frontend/src/components/pitch/PitchView.tsx`
- [Goal Frame](https://github.com/roshan10k/strikelab/blob/main/frontend/src/components/pitch/GoalFrame.tsx): `frontend/src/components/pitch/GoalFrame.tsx`
- [Match Dashboard](https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/MatchDashboard.tsx): `frontend/src/routes/MatchDashboard.tsx`
- [Player Analytics](https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/Players.tsx): `frontend/src/routes/Players.tsx`
- [Goalkeeper Analytics](https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/Keepers.tsx): `frontend/src/routes/Keepers.tsx`
- [Model Admin](https://github.com/roshan10k/strikelab/blob/main/frontend/src/routes/Admin.tsx): `frontend/src/routes/Admin.tsx`
- [API Client](https://github.com/roshan10k/strikelab/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`

### API and analytics

- [FastAPI Server](https://github.com/roshan10k/strikelab/blob/main/api_server.py): `api_server.py`
- [Match Aggregation](https://github.com/roshan10k/strikelab/blob/main/analytics.py): `analytics.py`

### Models and coaching

- [xG Inference](https://github.com/roshan10k/strikelab/blob/main/calculate_xg_enhanced.py): `calculate_xg_enhanced.py`
- [PSxG and Coach](https://github.com/roshan10k/strikelab/blob/main/calculate_psxg.py): `calculate_psxg.py`

### Model management

- [Model Registry](https://github.com/roshan10k/strikelab/blob/main/model_registry.py): `model_registry.py`
- [Retrain Service](https://github.com/roshan10k/strikelab/blob/main/retrain_service.py): `retrain_service.py`
- [Synthetic Data](https://github.com/roshan10k/strikelab/blob/main/generate_psxg_synthetic_data.py): `generate_psxg_synthetic_data.py`
- [PSxG Training](https://github.com/roshan10k/strikelab/blob/main/train_psxg_model.py): `train_psxg_model.py`
- [xG Training](https://github.com/roshan10k/strikelab/blob/main/train_ultimate_model.py): `train_ultimate_model.py`

### Other components

- **Analyst**

## Connections

- Analyst → Shot Calculator: configures shot (evidence: `README.md`)
- Shot Calculator → Shot Scenario: updates state (evidence: `frontend/src/routes/Calculator.tsx`)
- Tactical Pitch → Shot Scenario: updates positions (evidence: `frontend/src/components/pitch/PitchView.tsx`)
- Goal Frame → Shot Scenario: updates placement (evidence: `frontend/src/components/pitch/GoalFrame.tsx`)
- Shot Calculator → Tactical Pitch: renders (evidence: `frontend/src/routes/Calculator.tsx`)
- Shot Calculator → Goal Frame: renders (evidence: `frontend/src/routes/Calculator.tsx`)
- Shot Calculator → API Client: requests estimates (evidence: `frontend/src/routes/Calculator.tsx`)
- Match Dashboard → API Client: requests analytics (evidence: `frontend/src/routes/MatchDashboard.tsx`)
- Player Analytics → API Client: requests analytics (evidence: `frontend/src/routes/Players.tsx`)
- Goalkeeper Analytics → API Client: requests analytics (evidence: `frontend/src/routes/Keepers.tsx`)
- Model Admin → API Client: manages models (evidence: `frontend/src/routes/Admin.tsx`)
- API Client → FastAPI Server: sends API requests (evidence: `frontend/src/api/client.ts`)
- FastAPI Server → xG Inference: calls inference (evidence: `api_server.py`)
- FastAPI Server → PSxG and Coach: calls inference (evidence: `api_server.py`)
- FastAPI Server → Match Aggregation: aggregates events (evidence: `api_server.py`)
- xG Inference → Model Registry: loads artifacts (evidence: `calculate_xg_enhanced.py`)
- PSxG and Coach → Model Registry: loads artifacts (evidence: `calculate_psxg.py`)
- FastAPI Server → Retrain Service: dispatches retraining (evidence: `api_server.py`)
- Retrain Service → Synthetic Data: generates samples (evidence: `retrain_service.py`)
- Retrain Service → PSxG Training: trains PSxG (evidence: `retrain_service.py`)
- Retrain Service → xG Training: trains xG (evidence: `retrain_service.py`)
- PSxG Training → Model Registry: registers model (evidence: `train_psxg_model.py`)
- xG Training → Model Registry: registers model (evidence: `train_ultimate_model.py`)
- Model Registry → FastAPI Server: reports versions (evidence: `README.md`)
- Analyst → Match Dashboard: uploads match data (evidence: `README.md`)
