# cmunch1/nba-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/cmunch1/nba-prediction
- Repository: https://github.com/cmunch1/nba-prediction

## Overview

This is an end-to-end NBA game winner prediction project: historical and newly scraped game data are processed into model features, used to train and evaluate probability classifiers, then served with current-season predictions and performance information in a Streamlit app. The README also describes scheduled scraping and retraining, plus a Hopsworks feature-store/registry integration that is currently suspended. Some pipeline stages are documented but their notebook wiring was not sampled, so those relationships are cited to the README rather than inferred from filenames.

Main entry points: [`src/streamlit_app.py`](https://github.com/cmunch1/nba-prediction/blob/main/src/streamlit_app.py) (Streamlit app), [`data/games_engineered.csv`](https://github.com/cmunch1/nba-prediction/blob/main/data/games_engineered.csv) (Engineered games), [`src/model_training.py`](https://github.com/cmunch1/nba-prediction/blob/main/src/model_training.py) (Model training), [`models/model.pkl`](https://github.com/cmunch1/nba-prediction/blob/main/models/model.pkl) (Trained model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data collection"]
  node_scraper["Game scraper<br/>[webscraping.py]"]
  node_rawgames[("Historical games<br/>[games.csv]")]
end

subgraph group_features["Feature preparation"]
  node_clean["Data processing<br/>[data_processing.py]"]
  node_engineer["Feature engineering"]
  node_featuresdata[("Engineered games")]
end

subgraph group_model["Model development"]
  node_split["Train test split<br/>[data_processing.py]"]
  node_tune["Hyperparameter tuning"]
  node_train["Model training<br/>[model_training.py]"]
  node_modelartifact[("Trained model<br/>[model.pkl]")]
  node_hops["Hopsworks utilities<br/>[hopsworks_utils.py]"]
end

subgraph group_serve["Prediction and reporting"]
  node_app["Streamlit app<br/>[streamlit_app.py]"]
  node_dashboard["Prediction reporting"]
  node_metrics[("Accuracy metrics")]
end

node_nba(("NBA data"))
node_user(("App user"))

node_nba -->|"provides scores"| node_scraper
node_scraper -.->|"collects games"| node_rawgames
node_rawgames -.->|"loads data"| node_clean
node_clean -.->|"prepares games"| node_engineer
node_engineer -.->|"writes features"| node_featuresdata
node_featuresdata -.->|"splits data"| node_split
node_split -.->|"supplies splits"| node_train
node_tune -.->|"tunes models"| node_train
node_train -.->|"saves model"| node_modelartifact
node_hops -.->|"stores features"| node_featuresdata
node_hops -.->|"supports registry"| node_modelartifact
node_user -->|"requests predictions"| node_app
node_app -->|"reads games"| node_featuresdata
node_app -.->|"loads model"| node_modelartifact
node_app -.->|"reports predictions"| node_dashboard
node_dashboard -.->|"exports accuracy"| node_metrics

click node_scraper "https://github.com/cmunch1/nba-prediction/blob/main/src/webscraping.py"
click node_rawgames "https://github.com/cmunch1/nba-prediction/blob/main/data/original/games.csv"
click node_clean "https://github.com/cmunch1/nba-prediction/blob/main/src/data_processing.py"
click node_engineer "https://github.com/cmunch1/nba-prediction/blob/main/src/feature_engineering.py"
click node_featuresdata "https://github.com/cmunch1/nba-prediction/blob/main/data/games_engineered.csv"
click node_split "https://github.com/cmunch1/nba-prediction/blob/main/src/data_processing.py"
click node_tune "https://github.com/cmunch1/nba-prediction/blob/main/src/optuna_objectives.py"
click node_train "https://github.com/cmunch1/nba-prediction/blob/main/src/model_training.py"
click node_modelartifact "https://github.com/cmunch1/nba-prediction/blob/main/models/model.pkl"
click node_hops "https://github.com/cmunch1/nba-prediction/blob/main/src/hopsworks_utils.py"
click node_app "https://github.com/cmunch1/nba-prediction/blob/main/src/streamlit_app.py"
click node_dashboard "https://github.com/cmunch1/nba-prediction/blob/main/src/dashboard_processing.py"
click node_metrics "https://github.com/cmunch1/nba-prediction/blob/main/data/running_accuracy_metrics.csv"

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_scraper,node_rawgames,node_user toneBlue
class node_clean,node_engineer,node_featuresdata toneAmber
class node_split,node_tune,node_train,node_modelartifact,node_hops toneMint
class node_app,node_dashboard,node_metrics toneRose
class node_nba toneIndigo
```

## Components

### Data collection

- [Game scraper](https://github.com/cmunch1/nba-prediction/blob/main/src/webscraping.py): `src/webscraping.py`
- [Historical games](https://github.com/cmunch1/nba-prediction/blob/main/data/original/games.csv): `data/original/games.csv`

### Feature preparation

- [Data processing](https://github.com/cmunch1/nba-prediction/blob/main/src/data_processing.py): `src/data_processing.py`
- [Feature engineering](https://github.com/cmunch1/nba-prediction/blob/main/src/feature_engineering.py): `src/feature_engineering.py`
- [Engineered games](https://github.com/cmunch1/nba-prediction/blob/main/data/games_engineered.csv): `data/games_engineered.csv`

### Model development

- [Train test split](https://github.com/cmunch1/nba-prediction/blob/main/src/data_processing.py): `src/data_processing.py`
- [Hyperparameter tuning](https://github.com/cmunch1/nba-prediction/blob/main/src/optuna_objectives.py): `src/optuna_objectives.py`
- [Model training](https://github.com/cmunch1/nba-prediction/blob/main/src/model_training.py): `src/model_training.py`
- [Trained model](https://github.com/cmunch1/nba-prediction/blob/main/models/model.pkl): `models/model.pkl`
- [Hopsworks utilities](https://github.com/cmunch1/nba-prediction/blob/main/src/hopsworks_utils.py): `src/hopsworks_utils.py`

### Prediction and reporting

- [Streamlit app](https://github.com/cmunch1/nba-prediction/blob/main/src/streamlit_app.py): `src/streamlit_app.py`
- [Prediction reporting](https://github.com/cmunch1/nba-prediction/blob/main/src/dashboard_processing.py): `src/dashboard_processing.py`
- [Accuracy metrics](https://github.com/cmunch1/nba-prediction/blob/main/data/running_accuracy_metrics.csv): `data/running_accuracy_metrics.csv`

### Other components

- **NBA data**
- **App user**

## Connections

- NBA data → Game scraper: provides scores (evidence: `src/webscraping.py`)
- Game scraper → Historical games: collects games
- Historical games → Data processing: loads data
- Data processing → Feature engineering: prepares games
- Feature engineering → Engineered games: writes features
- Engineered games → Train test split: splits data
- Train test split → Model training: supplies splits
- Hyperparameter tuning → Model training: tunes models
- Model training → Trained model: saves model
- Hopsworks utilities → Engineered games: stores features
- Hopsworks utilities → Trained model: supports registry
- App user → Streamlit app: requests predictions (evidence: `README.md`)
- Streamlit app → Engineered games: reads games (evidence: `src/streamlit_app.py`)
- Streamlit app → Trained model: loads model (evidence: `README.md`)
- Streamlit app → Prediction reporting: reports predictions
- Prediction reporting → Accuracy metrics: exports accuracy
