# mugucho/dtw-analisys architecture

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

- Interactive diagram: https://gitdiagram.com/mugucho/dtw-analisys
- Repository: https://github.com/mugucho/dtw-analisys

## Overview

Deserve To Win is a football analytics and betting-support application. Users choose a tournament, inspect fixtures, standings, historical performance and live odds, then request a match analysis and Kelly stake; a separate finance workflow runs and reviews a historical backtest. The frontend calls a FastAPI backend, whose routes delegate to analytics and finance services. The sampled code supports these API and file-data flows; unsampled scraper and collector wiring is not inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/App.jsx) (App state and API client), [`backend/main.py`](https://github.com/mugucho/dtw-analisys/blob/main/backend/main.py) (HTTP API routes), [`backend/services/ml_engine.py`](https://github.com/mugucho/dtw-analisys/blob/main/backend/services/ml_engine.py) (Match and tournament analytics), [`backend/services/finance.py`](https://github.com/mugucho/dtw-analisys/blob/main/backend/services/finance.py) (Kelly and backtest logic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_app["App state and API client<br/>[App.jsx]"]
  node_nav["Tournament navigation<br/>[Navbar.jsx]"]
  node_standings_ui["Standings and history<br/>[StandingsView.jsx]"]
  node_kelly_ui["Match stake analysis"]
  node_finance_ui["Backtest report"]
  node_odds_ui["Live odds explorer<br/>[OddsGrid.jsx]"]
  node_matches_ui["Fixture carousel<br/>[MatchCarousel.jsx]"]
end

subgraph group_api["API and services"]
  node_api_main["HTTP API routes<br/>[main.py]"]
  node_ml["Match and tournament analytics<br/>[ml_engine.py]"]
  node_finance["Kelly and backtest logic<br/>[finance.py]"]
  node_data_loader["Data loading<br/>[data_loader.py]"]
  node_espn["ESPN scraper<br/>[espn_scraper.py]"]
  node_collector["Stats API collector<br/>[api_collector.py]"]
  node_stats_repo["Stats API repository"]
  node_schemas["API request and response schemas<br/>[schemas.py]"]
end

subgraph group_data["Tournament data"]
  node_files[("Tournament CSV and JSON files")]
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_nav
node_app -->|"renders"| node_matches_ui
node_app -->|"renders"| node_standings_ui
node_app -->|"renders"| node_kelly_ui
node_app -->|"renders"| node_finance_ui
node_app -->|"renders"| node_odds_ui
node_app -->|"requests data"| node_api_main
node_api_main -->|"calls analytics"| node_ml
node_api_main -->|"calls finance"| node_finance
node_api_main -->|"validates with"| node_schemas
node_ml -->|"reads and writes"| node_files
node_finance -->|"reads and writes"| node_files

click node_app "https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/App.jsx"
click node_nav "https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/layout/Navbar.jsx"
click node_standings_ui "https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/features/dashboard/components/StandingsView.jsx"
click node_kelly_ui "https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/features/betting/components/KellyCalculator.jsx"
click node_finance_ui "https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/features/finance/components/FinanceDashboard.jsx"
click node_odds_ui "https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/features/odds/components/OddsGrid.jsx"
click node_matches_ui "https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/features/dashboard/components/MatchCarousel.jsx"
click node_api_main "https://github.com/mugucho/dtw-analisys/blob/main/backend/main.py"
click node_ml "https://github.com/mugucho/dtw-analisys/blob/main/backend/services/ml_engine.py"
click node_finance "https://github.com/mugucho/dtw-analisys/blob/main/backend/services/finance.py"
click node_data_loader "https://github.com/mugucho/dtw-analisys/blob/main/backend/services/data_loader.py"
click node_espn "https://github.com/mugucho/dtw-analisys/blob/main/backend/services/espn_scraper.py"
click node_collector "https://github.com/mugucho/dtw-analisys/blob/main/backend/data/repositories/api_collector.py"
click node_stats_repo "https://github.com/mugucho/dtw-analisys/blob/main/backend/data/repositories/stats_api_repository.py"
click node_files "https://github.com/mugucho/dtw-analisys/tree/main/backend/data"
click node_schemas "https://github.com/mugucho/dtw-analisys/blob/main/backend/api/schemas/schemas.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_app,node_nav,node_standings_ui,node_kelly_ui,node_finance_ui,node_odds_ui,node_matches_ui,node_user toneBlue
class node_api_main,node_ml,node_finance,node_data_loader,node_espn,node_collector,node_stats_repo,node_schemas toneAmber
class node_files toneMint
```

## Components

### Web interface

- [App state and API client](https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Tournament navigation](https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/layout/Navbar.jsx): `frontend/src/layout/Navbar.jsx`
- [Standings and history](https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/features/dashboard/components/StandingsView.jsx): `frontend/src/features/dashboard/components/StandingsView.jsx`
- [Match stake analysis](https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/features/betting/components/KellyCalculator.jsx): `frontend/src/features/betting/components/KellyCalculator.jsx`
- [Backtest report](https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/features/finance/components/FinanceDashboard.jsx): `frontend/src/features/finance/components/FinanceDashboard.jsx`
- [Live odds explorer](https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/features/odds/components/OddsGrid.jsx): `frontend/src/features/odds/components/OddsGrid.jsx`
- [Fixture carousel](https://github.com/mugucho/dtw-analisys/blob/main/frontend/src/features/dashboard/components/MatchCarousel.jsx): `frontend/src/features/dashboard/components/MatchCarousel.jsx`

### API and services

- [HTTP API routes](https://github.com/mugucho/dtw-analisys/blob/main/backend/main.py): `backend/main.py`
- [Match and tournament analytics](https://github.com/mugucho/dtw-analisys/blob/main/backend/services/ml_engine.py): `backend/services/ml_engine.py`
- [Kelly and backtest logic](https://github.com/mugucho/dtw-analisys/blob/main/backend/services/finance.py): `backend/services/finance.py`
- [Data loading](https://github.com/mugucho/dtw-analisys/blob/main/backend/services/data_loader.py): `backend/services/data_loader.py`
- [ESPN scraper](https://github.com/mugucho/dtw-analisys/blob/main/backend/services/espn_scraper.py): `backend/services/espn_scraper.py`
- [Stats API collector](https://github.com/mugucho/dtw-analisys/blob/main/backend/data/repositories/api_collector.py): `backend/data/repositories/api_collector.py`
- [Stats API repository](https://github.com/mugucho/dtw-analisys/blob/main/backend/data/repositories/stats_api_repository.py): `backend/data/repositories/stats_api_repository.py`
- [API request and response schemas](https://github.com/mugucho/dtw-analisys/blob/main/backend/api/schemas/schemas.py): `backend/api/schemas/schemas.py`

### Tournament data

- [Tournament CSV and JSON files](https://github.com/mugucho/dtw-analisys/tree/main/backend/data): `backend/data`

### Other components

- **User**

## Connections

- User → App state and API client: uses
- App state and API client → Tournament navigation: renders
- App state and API client → Fixture carousel: renders
- App state and API client → Standings and history: renders
- App state and API client → Match stake analysis: renders
- App state and API client → Backtest report: renders
- App state and API client → Live odds explorer: renders
- App state and API client → HTTP API routes: requests data
- HTTP API routes → Match and tournament analytics: calls analytics
- HTTP API routes → Kelly and backtest logic: calls finance
- HTTP API routes → API request and response schemas: validates with
- Match and tournament analytics → Tournament CSV and JSON files: reads and writes
- Kelly and backtest logic → Tournament CSV and JSON files: reads and writes
