# riteshsinghbharti/fifa-world-cup-ai-predictor architecture

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

- Interactive diagram: https://gitdiagram.com/riteshsinghbharti/fifa-world-cup-ai-predictor
- Repository: https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor

## Overview

This is a Flask web application for predicting FIFA World Cup 2026 match outcomes. Users enter a matchup, the application builds model-compatible features and returns outcome probabilities; related product areas include fixtures, tournament brackets, team statistics, prediction history, and account management. The sampled code shows the application importing its configuration, authentication/database layer, and feature builder, while the README documents the broader user-facing capabilities. Several routes and training stages are only partially sampled, so their links are marked unverified rather than asserted as observed calls.

Main entry points: [`app.py`](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py) (Flask routes), [`feature_builder.py`](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/feature_builder.py) (Feature construction), [`instance/user.py`](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/instance/user.py) (Authentication), [`new_train.py`](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/new_train.py) (Model training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_flask["Flask routes<br/>[app.py]"]
  node_configuration["App configuration<br/>[config.py]"]
  node_fixtures["Match fixtures<br/>[app.py]"]
  node_bracket["Tournament bracket<br/>[app.py]"]
  node_statistics["Team statistics<br/>[app.py]"]
end

subgraph group_prediction["Prediction system"]
  node_match_prediction["Match prediction<br/>[app.py]"]
  node_feature_builder["Feature construction<br/>[feature_builder.py]"]
  node_model["Prediction model"]
end

subgraph group_accounts["Accounts and persistence"]
  node_prediction_history["Prediction history<br/>[app.py]"]
  node_authentication["Authentication<br/>[user.py]"]
  node_user_records[("User and prediction records<br/>[user.py]")]
  node_login_history[("Login history<br/>[user.py]")]
end

subgraph group_training["Model preparation"]
  node_historical_results["Match results data<br/>[results.csv]"]
  node_training_pipeline["Model training<br/>[new_train.py]"]
  node_model_metadata["Model metadata<br/>[fifa_metadata.pkl]"]
end

node_visitor(("Visitor"))

node_visitor -->|"uses"| node_flask
node_flask -->|"configures"| node_configuration
node_flask -->|"imports"| node_authentication
node_flask -.->|"routes"| node_match_prediction
node_match_prediction -.->|"builds features"| node_feature_builder
node_feature_builder -->|"predicts with"| node_model
node_flask -.->|"serves"| node_fixtures
node_flask -->|"builds"| node_bracket
node_bracket -->|"requests outcomes"| node_match_prediction
node_flask -.->|"serves"| node_statistics
node_flask -.->|"serves"| node_prediction_history
node_flask -.->|"reads and writes"| node_user_records
node_authentication -->|"persists accounts"| node_user_records
node_authentication -->|"records logins"| node_login_history
node_training_pipeline -->|"loads"| node_historical_results
node_training_pipeline -.->|"writes"| node_model_metadata
node_feature_builder -->|"uses metadata"| node_model_metadata

click node_flask "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py"
click node_configuration "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/config.py"
click node_match_prediction "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py"
click node_feature_builder "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/feature_builder.py"
click node_fixtures "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py"
click node_bracket "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py"
click node_statistics "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py"
click node_prediction_history "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py"
click node_authentication "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/instance/user.py"
click node_user_records "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/instance/user.py"
click node_login_history "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/instance/user.py"
click node_historical_results "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/results.csv"
click node_training_pipeline "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/new_train.py"
click node_model_metadata "https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/fifa_metadata.pkl"

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_flask,node_configuration,node_fixtures,node_bracket,node_statistics toneBlue
class node_match_prediction,node_feature_builder,node_model toneAmber
class node_prediction_history,node_authentication,node_user_records,node_login_history toneMint
class node_historical_results,node_training_pipeline,node_model_metadata toneRose
class node_visitor toneIndigo
```

## Components

### Web application

- [Flask routes](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py): `app.py`
- [App configuration](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/config.py): `config.py`
- [Match fixtures](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py): `app.py`
- [Tournament bracket](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py): `app.py`
- [Team statistics](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py): `app.py`

### Prediction system

- [Match prediction](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py): `app.py`
- [Feature construction](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/feature_builder.py): `feature_builder.py`
- **Prediction model**

### Accounts and persistence

- [Prediction history](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/app.py): `app.py`
- [Authentication](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/instance/user.py): `instance/user.py`
- [User and prediction records](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/instance/user.py): `instance/user.py`
- [Login history](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/instance/user.py): `instance/user.py`

### Model preparation

- [Match results data](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/results.csv): `results.csv`
- [Model training](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/new_train.py): `new_train.py`
- [Model metadata](https://github.com/riteshsinghbharti/fifa-world-cup-ai-predictor/blob/main/fifa_metadata.pkl): `fifa_metadata.pkl`

### Other components

- **Visitor**

## Connections

- Visitor → Flask routes: uses (evidence: `README.md`)
- Flask routes → App configuration: configures (evidence: `app.py`)
- Flask routes → Authentication: imports (evidence: `app.py`)
- Flask routes → Match prediction: routes (evidence: `app.py`)
- Match prediction → Feature construction: builds features (evidence: `app.py`)
- Feature construction → Prediction model: predicts with (evidence: `feature_builder.py`)
- Flask routes → Match fixtures: serves (evidence: `app.py`)
- Flask routes → Tournament bracket: builds (evidence: `app.py`)
- Tournament bracket → Match prediction: requests outcomes (evidence: `app.py`)
- Flask routes → Team statistics: serves (evidence: `app.py`)
- Flask routes → Prediction history: serves (evidence: `app.py`)
- Flask routes → User and prediction records: reads and writes
- Authentication → User and prediction records: persists accounts (evidence: `instance/user.py`)
- Authentication → Login history: records logins (evidence: `instance/user.py`)
- Model training → Match results data: loads (evidence: `new_train.py`)
- Model training → Model metadata: writes
- Feature construction → Model metadata: uses metadata (evidence: `feature_builder.py`)
