# justingore4/nbastatspredictor architecture

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

- Interactive diagram: https://gitdiagram.com/justingore4/nbastatspredictor
- Repository: https://github.com/justingore4/nbastatspredictor

## Overview

AIverson Bets is a Flask app for predicting an NBA player’s points against an opponent. Users choose a player, team, and recent-game count; the app validates the request, filters historical data, prepares model features, predicts points, and renders a result. A separate data-collection and training workflow supplies the CSV and saved model. The README describes a chart of recent performance, but the sampled app code does not pass chart data to the result template, so that connection is not mapped.

Main entry points: [`app.py`](https://github.com/justingore4/nbastatspredictor/blob/main/app.py) (Flask app), [`fetch_player_data.py`](https://github.com/justingore4/nbastatspredictor/blob/main/fetch_player_data.py) (Game-log collector), [`templates/index.html`](https://github.com/justingore4/nbastatspredictor/blob/main/templates/index.html) (Prediction form), [`templates/prediction_result.html`](https://github.com/justingore4/nbastatspredictor/blob/main/templates/prediction_result.html) (Prediction result)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Flask app<br/>[app.py]"]
  node_form["Prediction form<br/>[index.html]"]
  node_result["Prediction result"]
  node_styles["Page styling<br/>[styles.css]"]
end

subgraph group_prediction["Prediction runtime"]
  node_config["Player and team catalog<br/>[config.py]"]
  node_history[("Game history CSV")]
  node_model[("XGBoost model<br/>[xgboost_model.pkl]")]
end

subgraph group_modeldata["Data and model pipeline"]
  node_fetch["Game-log collector"]
  node_train["Model training"]
end

subgraph group_external["External data"]
  node_nba["NBA API"]
end

node_user(("User"))

node_user -->|"submits request"| node_app
node_app -->|"renders form"| node_form
node_app -->|"reads catalog"| node_config
node_app -->|"loads and predicts"| node_model
node_app -->|"reads games"| node_history
node_app -->|"renders prediction"| node_result
node_form -->|"presents choices"| node_user
node_result -->|"displays result"| node_user
node_styles -->|"styles page"| node_form
node_styles -->|"styles page"| node_result
node_fetch -->|"requests game logs"| node_nba
node_fetch -->|"reads player catalog"| node_config
node_fetch -->|"writes game history"| node_history
node_train -->|"reads training data"| node_history
node_train -->|"saves trained model"| node_model

click node_app "https://github.com/justingore4/nbastatspredictor/blob/main/app.py"
click node_form "https://github.com/justingore4/nbastatspredictor/blob/main/templates/index.html"
click node_result "https://github.com/justingore4/nbastatspredictor/blob/main/templates/prediction_result.html"
click node_styles "https://github.com/justingore4/nbastatspredictor/blob/main/static/styles.css"
click node_config "https://github.com/justingore4/nbastatspredictor/blob/main/config.py"
click node_history "https://github.com/justingore4/nbastatspredictor/blob/main/player_last_10_games.csv"
click node_model "https://github.com/justingore4/nbastatspredictor/blob/main/xgboost_model.pkl"
click node_fetch "https://github.com/justingore4/nbastatspredictor/blob/main/fetch_player_data.py"
click node_train "https://github.com/justingore4/nbastatspredictor/blob/main/fetch_and_train_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_app,node_form,node_result,node_styles,node_user toneBlue
class node_config,node_history,node_model toneAmber
class node_fetch,node_train toneMint
class node_nba toneRose
```

## Components

### Web experience

- [Flask app](https://github.com/justingore4/nbastatspredictor/blob/main/app.py): `app.py`
- [Prediction form](https://github.com/justingore4/nbastatspredictor/blob/main/templates/index.html): `templates/index.html`
- [Prediction result](https://github.com/justingore4/nbastatspredictor/blob/main/templates/prediction_result.html): `templates/prediction_result.html`
- [Page styling](https://github.com/justingore4/nbastatspredictor/blob/main/static/styles.css): `static/styles.css`

### Prediction runtime

- [Player and team catalog](https://github.com/justingore4/nbastatspredictor/blob/main/config.py): `config.py`
- [Game history CSV](https://github.com/justingore4/nbastatspredictor/blob/main/player_last_10_games.csv): `player_last_10_games.csv`
- [XGBoost model](https://github.com/justingore4/nbastatspredictor/blob/main/xgboost_model.pkl): `xgboost_model.pkl`

### Data and model pipeline

- [Game-log collector](https://github.com/justingore4/nbastatspredictor/blob/main/fetch_player_data.py): `fetch_player_data.py`
- [Model training](https://github.com/justingore4/nbastatspredictor/blob/main/fetch_and_train_model.py): `fetch_and_train_model.py`

### External data

- **NBA API**

### Other components

- **User**

## Connections

- User → Flask app: submits request
- Flask app → Prediction form: renders form
- Flask app → Player and team catalog: reads catalog
- Flask app → XGBoost model: loads and predicts
- Flask app → Game history CSV: reads games
- Flask app → Prediction result: renders prediction
- Prediction form → User: presents choices
- Prediction result → User: displays result
- Page styling → Prediction form: styles page
- Page styling → Prediction result: styles page
- Game-log collector → NBA API: requests game logs
- Game-log collector → Player and team catalog: reads player catalog
- Game-log collector → Game history CSV: writes game history
- Model training → Game history CSV: reads training data
- Model training → XGBoost model: saves trained model
