# joshuammerced/livenbapredictionmodel architecture

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

- Interactive diagram: https://gitdiagram.com/joshuammerced/livenbapredictionmodel
- Repository: https://github.com/joshuammerced/livenbapredictionmodel
- Video tour (about a minute): https://gitdiagram.com/joshuammerced/livenbapredictionmodel/video

## Overview

LiveNBAPredictionModel is an NBA game and player-stat dashboard backed by a FastAPI service. The visible user workflow is dashboard load → /predictions request → NBA schedule/team lookup and response → game and player-stat display. The sampled service currently assigns a fixed 50% win probability; the README’s trained-model claim is not substantiated by the sampled runtime. The tree also contains a separate root-level backend with data-cleaning, ingestion, and database modules. Its relationships to the nested app are unclear, so those modules are represented without inferred call links.

Main entry points: [`backend/data_mapper.py`](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/data_mapper.py) (Database mapping), [`LiveNBAPredictionModel/frontend/src/app/page.tsx`](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/LiveNBAPredictionModel/frontend/src/app/page.tsx) (Prediction dashboard), [`LiveNBAPredictionModel/backend/main.py`](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/LiveNBAPredictionModel/backend/main.py) (Prediction endpoint), [`backend/nba_api_client.py`](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/nba_api_client.py) (NBA data access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_page["Prediction dashboard<br/>[page.tsx]"]
end

subgraph group_service["Prediction service"]
  node_prediction_api["Prediction endpoint<br/>[main.py]"]
end

subgraph group_data["Data and modeling"]
  node_nba_data["NBA data access<br/>[nba_api_client.py]"]
  node_clean_predictions["Schedule and player data<br/>[datacleaining.py]"]
  node_feature_engineering["Feature calculations<br/>[features.py]"]
  node_prediction_model["Prediction model<br/>[predictor.py]"]
  node_data_processing["Data processing<br/>[processor.py]"]
  node_live_data["Live data<br/>[live_data.py]"]
  node_scraper["Data scraper<br/>[scraper.py]"]
  node_db_schema[("Game and player schema<br/>[init_db.py]")]
  node_data_mapper["Database mapping<br/>[data_mapper.py]"]
  node_database_access["Database access<br/>[database.py]"]
end

node_fan(("NBA fan"))
node_nba_stats["NBA Stats API"]

node_fan -->|"views"| node_dashboard_page
node_dashboard_page -->|"requests predictions"| node_prediction_api
node_prediction_api -->|"fetches schedule and teams"| node_nba_stats
node_dashboard_page -->|"renders game and player stats"| node_fan
node_nba_data -->|"fetches game logs"| node_nba_stats
node_data_mapper -->|"fetches game and player logs"| node_nba_stats
node_data_mapper -->|"uses database configuration"| node_db_schema
node_data_mapper -->|"writes mapped records"| node_database_access

click node_dashboard_page "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/LiveNBAPredictionModel/frontend/src/app/page.tsx"
click node_prediction_api "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/LiveNBAPredictionModel/backend/main.py"
click node_nba_data "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/nba_api_client.py"
click node_clean_predictions "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/datacleaining.py"
click node_feature_engineering "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/features.py"
click node_prediction_model "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/predictor.py"
click node_data_processing "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/processor.py"
click node_live_data "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/live_data.py"
click node_scraper "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/scraper.py"
click node_db_schema "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/init_db.py"
click node_data_mapper "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/data_mapper.py"
click node_database_access "https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/database.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_dashboard_page toneBlue
class node_prediction_api toneAmber
class node_nba_data,node_clean_predictions,node_feature_engineering,node_prediction_model,node_data_processing,node_live_data,node_scraper,node_db_schema,node_data_mapper,node_database_access,node_nba_stats toneMint
class node_fan toneIndigo
```

## Components

### Dashboard

- [Prediction dashboard](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/LiveNBAPredictionModel/frontend/src/app/page.tsx): `LiveNBAPredictionModel/frontend/src/app/page.tsx`

### Prediction service

- [Prediction endpoint](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/LiveNBAPredictionModel/backend/main.py): `LiveNBAPredictionModel/backend/main.py`

### Data and modeling

- [NBA data access](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/nba_api_client.py): `backend/nba_api_client.py`
- [Schedule and player data](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/datacleaining.py): `backend/datacleaining.py`
- [Feature calculations](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/features.py): `backend/features.py`
- [Prediction model](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/predictor.py): `backend/predictor.py`
- [Data processing](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/processor.py): `backend/processor.py`
- [Live data](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/live_data.py): `backend/live_data.py`
- [Data scraper](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/scraper.py): `backend/scraper.py`
- [Game and player schema](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/init_db.py): `backend/init_db.py`
- [Database mapping](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/data_mapper.py): `backend/data_mapper.py`
- [Database access](https://github.com/joshuammerced/livenbapredictionmodel/blob/main/backend/database.py): `backend/database.py`

### Other components

- **NBA fan**
- **NBA Stats API**

## Connections

- NBA fan → Prediction dashboard: views (evidence: `LiveNBAPredictionModel/frontend/src/app/page.tsx`)
- Prediction dashboard → Prediction endpoint: requests predictions (evidence: `LiveNBAPredictionModel/frontend/src/app/page.tsx`)
- Prediction endpoint → NBA Stats API: fetches schedule and teams (evidence: `LiveNBAPredictionModel/backend/main.py`)
- Prediction dashboard → NBA fan: renders game and player stats (evidence: `LiveNBAPredictionModel/frontend/src/app/page.tsx`)
- NBA data access → NBA Stats API: fetches game logs (evidence: `backend/nba_api_client.py`)
- Database mapping → NBA Stats API: fetches game and player logs (evidence: `backend/data_mapper.py`)
- Database mapping → Game and player schema: uses database configuration (evidence: `backend/data_mapper.py`)
- Database mapping → Database access: writes mapped records
