# mplshassan/polarity architecture

> Architecture diagram of the GitHub repository mplshassan/polarity, 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/mplshassan/polarity
- Repository: https://github.com/mplshassan/polarity

## Overview

Polarity is a Streamlit app for exploring NBA player game performance. Users choose Single or Flux mode, enter one or two players, optionally select a date, and pull stats; the app resolves names and obtains game data, then presents team-colored radar charts and stat details normalized against game highs. The graph separates player lookup, game retrieval, high-stat calculation, transformation, chart construction, and UI orchestration. The app’s game-fetch helper is not shown, so its retrieval link is marked unverified; other links follow shown calls or README capabilities.

Main entry points: [`app.py`](https://github.com/mplshassan/polarity/blob/main/app.py) (Streamlit App), [`charts.py`](https://github.com/mplshassan/polarity/blob/main/charts.py) (Radar Charts), [`data.py`](https://github.com/mplshassan/polarity/blob/main/data.py) (Game Lookup), [`processing.py`](https://github.com/mplshassan/polarity/blob/main/processing.py) (Stat Processing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_app["Streamlit App<br/>[app.py]"]
end

subgraph group_nba_data["NBA Data"]
  node_player_lookup["Player Lookup<br/>[data.py]"]
  node_game_lookup["Game Lookup<br/>[data.py]"]
  node_game_highs["Game Highs<br/>[data.py]"]
end

subgraph group_analytics["Analytics"]
  node_processing["Stat Processing<br/>[processing.py]"]
end

subgraph group_presentation["Presentation"]
  node_config["Visual Configuration<br/>[config.py]"]
  node_charts["Radar Charts<br/>[charts.py]"]
end

node_user(("Player / Fan"))
node_nba_api{{"NBA API"}}

node_user -->|"enters search"| node_app
node_app -->|"resolves names"| node_player_lookup
node_app -.->|"requests game"| node_game_lookup
node_game_lookup -->|"fetches game data"| node_nba_api
node_player_lookup -->|"loads players"| node_nba_api
node_app -->|"loads game highs"| node_game_highs
node_game_highs -->|"fetches box score"| node_nba_api
node_app -->|"validates and normalizes"| node_processing
node_processing -->|"calculates true shooting"| node_game_lookup
node_app -->|"builds radar"| node_charts
node_charts -->|"normalizes stats"| node_processing
node_app -->|"uses team colors"| node_config
node_charts -->|"uses chart colors"| node_config

click node_app "https://github.com/mplshassan/polarity/blob/main/app.py"
click node_player_lookup "https://github.com/mplshassan/polarity/blob/main/data.py"
click node_game_lookup "https://github.com/mplshassan/polarity/blob/main/data.py"
click node_game_highs "https://github.com/mplshassan/polarity/blob/main/data.py"
click node_processing "https://github.com/mplshassan/polarity/blob/main/processing.py"
click node_config "https://github.com/mplshassan/polarity/blob/main/config.py"
click node_charts "https://github.com/mplshassan/polarity/blob/main/charts.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 toneBlue
class node_player_lookup,node_game_lookup,node_game_highs toneAmber
class node_processing,node_nba_api toneMint
class node_config,node_charts toneRose
class node_user toneIndigo
```

## Components

### User Interface

- [Streamlit App](https://github.com/mplshassan/polarity/blob/main/app.py): `app.py`

### NBA Data

- [Player Lookup](https://github.com/mplshassan/polarity/blob/main/data.py): `data.py`
- [Game Lookup](https://github.com/mplshassan/polarity/blob/main/data.py): `data.py`
- [Game Highs](https://github.com/mplshassan/polarity/blob/main/data.py): `data.py`

### Analytics

- [Stat Processing](https://github.com/mplshassan/polarity/blob/main/processing.py): `processing.py`

### Presentation

- [Visual Configuration](https://github.com/mplshassan/polarity/blob/main/config.py): `config.py`
- [Radar Charts](https://github.com/mplshassan/polarity/blob/main/charts.py): `charts.py`

### Other components

- **Player / Fan**
- **NBA API**

## Connections

- Player / Fan → Streamlit App: enters search (evidence: `README.md`)
- Streamlit App → Player Lookup: resolves names (evidence: `app.py`)
- Streamlit App → Game Lookup: requests game (evidence: `app.py`)
- Game Lookup → NBA API: fetches game data (evidence: `data.py`)
- Player Lookup → NBA API: loads players (evidence: `data.py`)
- Streamlit App → Game Highs: loads game highs (evidence: `app.py`)
- Game Highs → NBA API: fetches box score (evidence: `data.py`)
- Streamlit App → Stat Processing: validates and normalizes (evidence: `app.py`)
- Stat Processing → Game Lookup: calculates true shooting (evidence: `processing.py`)
- Streamlit App → Radar Charts: builds radar (evidence: `app.py`)
- Radar Charts → Stat Processing: normalizes stats (evidence: `charts.py`)
- Streamlit App → Visual Configuration: uses team colors (evidence: `app.py`)
- Radar Charts → Visual Configuration: uses chart colors (evidence: `charts.py`)
