# reisz1995/tabelanba2 architecture

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

- Interactive diagram: https://gitdiagram.com/reisz1995/tabelanba2
- Repository: https://github.com/reisz1995/tabelanba2

## Overview

Tabelanba 2.0 is an automated NBA data and prediction platform. Its main workflow collects standings, player leaders, team momentum, advanced metrics, injuries, and game context; persists those datasets in Supabase; then generates AI-assisted betting analysis and exposes injury data through a local REST API. The graph includes the documented prediction inputs and output, though the relevant predictor implementation is only partially excerpted; edges not directly supported by shown code are omitted or marked unverified.

Main entry points: [`scrape.js`](https://github.com/reisz1995/tabelanba2/blob/main/scrape.js) (Standings and pace), [`nba_injuries_api.py`](https://github.com/reisz1995/tabelanba2/blob/main/nba_injuries_api.py) (Injury sync), [`importPlayers.js`](https://github.com/reisz1995/tabelanba2/blob/main/importPlayers.js) (Player leaders), [`scripts/update-nba-stats.js`](https://github.com/reisz1995/tabelanba2/blob/main/scripts/update-nba-stats.js) (Team momentum)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Data collection"]
  node_standings["Standings and pace<br/>[scrape.js]"]
  node_playerleaders["Player leaders<br/>[importPlayers.js]"]
  node_momentum["Team momentum"]
  node_advanced["Advanced metrics"]
  node_schedule["Game schedule<br/>[nba_scraper.py]"]
end

subgraph group_analytics["Analysis and prediction"]
  node_predictor["AI game predictions<br/>[predict_games.py]"]
end

subgraph group_injuries["Injury service"]
  node_injurysync["Injury sync"]
  node_injuryapi["Injury REST API<br/>[flask_api.py]"]
  node_exampleclient["API examples<br/>[exemplos_uso.py]"]
end

subgraph group_storage["Persistence"]
  node_supabase[("Supabase database")]
  node_localcache["Injury JSON cache<br/>[nba_injuries.json]"]
  node_jsonimport["Injury JSON importer"]
end

subgraph group_integration["External sources"]
  node_espn["ESPN APIs"]
  node_hollinger["Hollinger"]
  node_databallr["Databallr"]
  node_scores24["Scores24"]
  node_groq["Groq LLaMA"]
end

node_operator(("Pipeline operator"))
node_apiuser(("Injury API consumer"))

node_operator -->|"runs"| node_standings
node_operator -->|"runs"| node_playerleaders
node_operator -->|"runs"| node_momentum
node_operator -->|"runs"| node_advanced
node_operator -->|"runs"| node_schedule
node_operator -->|"runs"| node_injurysync
node_operator -->|"runs"| node_predictor
node_standings -->|"fetches standings"| node_espn
node_standings -->|"fetches pace"| node_hollinger
node_standings -->|"writes standings"| node_supabase
node_playerleaders -->|"fetches leaders"| node_espn
node_playerleaders -->|"upserts leaders"| node_supabase
node_momentum -->|"fetches games"| node_espn
node_momentum -->|"updates records"| node_supabase
node_advanced -->|"extracts metrics"| node_databallr
node_advanced -->|"upserts metrics"| node_supabase
node_schedule -->|"scrapes games"| node_scores24
node_schedule -->|"upserts schedule"| node_supabase
node_injurysync -->|"fetches rosters"| node_espn
node_injurysync -->|"writes injuries"| node_supabase
node_injurysync -->|"backs up injuries"| node_localcache
node_apiuser -->|"requests data"| node_injuryapi
node_injuryapi -->|"reads cache"| node_localcache
node_exampleclient -->|"calls endpoints"| node_injuryapi
node_jsonimport -->|"loads injuries"| node_localcache
node_jsonimport -->|"upserts injuries"| node_supabase
node_predictor -->|"reads analytics"| node_supabase
node_predictor -->|"generates analysis"| node_groq

click node_standings "https://github.com/reisz1995/tabelanba2/blob/main/scrape.js"
click node_playerleaders "https://github.com/reisz1995/tabelanba2/blob/main/importPlayers.js"
click node_momentum "https://github.com/reisz1995/tabelanba2/blob/main/scripts/update-nba-stats.js"
click node_advanced "https://github.com/reisz1995/tabelanba2/blob/main/scraper_databallr.py"
click node_schedule "https://github.com/reisz1995/tabelanba2/blob/main/nba_scraper.py"
click node_injurysync "https://github.com/reisz1995/tabelanba2/blob/main/nba_injuries_api.py"
click node_injuryapi "https://github.com/reisz1995/tabelanba2/blob/main/flask_api.py"
click node_exampleclient "https://github.com/reisz1995/tabelanba2/blob/main/exemplos_uso.py"
click node_predictor "https://github.com/reisz1995/tabelanba2/blob/main/predict_games.py"
click node_localcache "https://github.com/reisz1995/tabelanba2/blob/main/nba_injuries.json"
click node_jsonimport "https://github.com/reisz1995/tabelanba2/blob/main/supabase_integration.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_standings,node_playerleaders,node_momentum,node_advanced,node_schedule toneBlue
class node_predictor toneAmber
class node_injurysync,node_injuryapi,node_exampleclient,node_apiuser toneMint
class node_supabase,node_localcache,node_jsonimport toneRose
class node_espn,node_hollinger,node_databallr,node_scores24,node_groq,node_operator toneIndigo
```

## Components

### Data collection

- [Standings and pace](https://github.com/reisz1995/tabelanba2/blob/main/scrape.js): `scrape.js`
- [Player leaders](https://github.com/reisz1995/tabelanba2/blob/main/importPlayers.js): `importPlayers.js`
- [Team momentum](https://github.com/reisz1995/tabelanba2/blob/main/scripts/update-nba-stats.js): `scripts/update-nba-stats.js`
- [Advanced metrics](https://github.com/reisz1995/tabelanba2/blob/main/scraper_databallr.py): `scraper_databallr.py`
- [Game schedule](https://github.com/reisz1995/tabelanba2/blob/main/nba_scraper.py): `nba_scraper.py`

### Analysis and prediction

- [AI game predictions](https://github.com/reisz1995/tabelanba2/blob/main/predict_games.py): `predict_games.py`

### Injury service

- [Injury sync](https://github.com/reisz1995/tabelanba2/blob/main/nba_injuries_api.py): `nba_injuries_api.py`
- [Injury REST API](https://github.com/reisz1995/tabelanba2/blob/main/flask_api.py): `flask_api.py`
- [API examples](https://github.com/reisz1995/tabelanba2/blob/main/exemplos_uso.py): `exemplos_uso.py`

### Persistence

- **Supabase database**
- [Injury JSON cache](https://github.com/reisz1995/tabelanba2/blob/main/nba_injuries.json): `nba_injuries.json`
- [Injury JSON importer](https://github.com/reisz1995/tabelanba2/blob/main/supabase_integration.py): `supabase_integration.py`

### External sources

- **ESPN APIs**
- **Hollinger**
- **Databallr**
- **Scores24**
- **Groq LLaMA**

### Other components

- **Pipeline operator**
- **Injury API consumer**

## Connections

- Pipeline operator → Standings and pace: runs (evidence: `README.md`)
- Pipeline operator → Player leaders: runs (evidence: `README.md`)
- Pipeline operator → Team momentum: runs (evidence: `README.md`)
- Pipeline operator → Advanced metrics: runs (evidence: `README.md`)
- Pipeline operator → Game schedule: runs (evidence: `README.md`)
- Pipeline operator → Injury sync: runs (evidence: `README.md`)
- Pipeline operator → AI game predictions: runs (evidence: `README.md`)
- Standings and pace → ESPN APIs: fetches standings (evidence: `scrape.js`)
- Standings and pace → Hollinger: fetches pace (evidence: `scrape.js`)
- Standings and pace → Supabase database: writes standings (evidence: `scrape.js`)
- Player leaders → ESPN APIs: fetches leaders (evidence: `importPlayers.js`)
- Player leaders → Supabase database: upserts leaders (evidence: `importPlayers.js`)
- Team momentum → ESPN APIs: fetches games (evidence: `scripts/update-nba-stats.js`)
- Team momentum → Supabase database: updates records (evidence: `scripts/update-nba-stats.js`)
- Advanced metrics → Databallr: extracts metrics (evidence: `README.md`)
- Advanced metrics → Supabase database: upserts metrics (evidence: `scraper_databallr.py`)
- Game schedule → Scores24: scrapes games (evidence: `README.md`)
- Game schedule → Supabase database: upserts schedule (evidence: `nba_scraper.py`)
- Injury sync → ESPN APIs: fetches rosters (evidence: `nba_injuries_api.py`)
- Injury sync → Supabase database: writes injuries (evidence: `nba_injuries_api.py`)
- Injury sync → Injury JSON cache: backs up injuries (evidence: `nba_injuries_api.py`)
- Injury API consumer → Injury REST API: requests data (evidence: `README.md`)
- Injury REST API → Injury JSON cache: reads cache (evidence: `flask_api.py`)
- API examples → Injury REST API: calls endpoints (evidence: `exemplos_uso.py`)
- Injury JSON importer → Injury JSON cache: loads injuries (evidence: `supabase_integration.py`)
- Injury JSON importer → Supabase database: upserts injuries (evidence: `supabase_integration.py`)
- AI game predictions → Supabase database: reads analytics (evidence: `README.md`)
- AI game predictions → Groq LLaMA: generates analysis (evidence: `README.md`)
