# tomsfridrihsons/basketball_shot_analytics_cv architecture

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

- Interactive diagram: https://gitdiagram.com/tomsfridrihsons/basketball_shot_analytics_cv
- Repository: https://github.com/tomsfridrihsons/basketball_shot_analytics_cv

## Overview

HooperAI analyzes basketball video into made/missed shot results, then exposes the analysis through a laptop API and a companion mobile app for review, labeling, and statistics. The main workflow runs from video detection through shot segmentation, feature extraction, and prediction; labeling and training support model improvement, while evaluation measures performance. The README documents the major pipeline and app capabilities. Some internal calls are supported only by the SOURCE INDEX, so unsampled relationships are not expanded beyond those references.

Main entry points: [`scripts/lstm/lstm_infer.py`](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/lstm/lstm_infer.py) (Video inference), [`HooperAI/src/services/api.js`](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/services/api.js) (Server client), [`scripts/app/server.py`](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/app/server.py) (Analysis API), [`HooperAI/src/utils/storage.js`](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/utils/storage.js) (Local session store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Shot analysis"]
  node_inference["Video inference<br/>[lstm_infer.py]"]
  node_tracking["Ball tracking<br/>[ball_track.py]"]
  node_features["Shot features<br/>[shot_features.py]"]
  node_judge["Rim-pass judge<br/>[shot_judge.py]"]
  node_metrics["Shot metrics<br/>[shot_metrics.py]"]
end

subgraph group_learning["Model learning"]
  node_labeler["Shot labeling<br/>[shot_labeler.py]"]
  node_trainer["Model training<br/>[lstm_train.py]"]
  node_evaluation["Prediction evaluation<br/>[lstm_eval.py]"]
end

subgraph group_backend["Laptop service"]
  node_server["Analysis API<br/>[server.py]"]
  node_webui["Laptop web UI<br/>[app.js]"]
  node_server_auth["API authentication<br/>[auth.py]"]
  node_firestore["Firestore sync<br/>[firestore_sync.py]"]
end

subgraph group_mobile["Mobile experience"]
  node_record["Record and upload<br/>[RecordScreen.js]"]
  node_api_client["Server client<br/>[api.js]"]
  node_session["Session review<br/>[SessionReview.js]"]
  node_session_screen["Session loading<br/>[SessionScreen.js]"]
  node_local_store[("Local session store<br/>[storage.js]")]
  node_stats["Session statistics<br/>[StatsScreen.js]"]
  node_home["Session home<br/>[HomeScreen.js]"]
end

subgraph group_identity["Identity and settings"]
  node_settings["App settings<br/>[settings.js]"]
  node_auth["Firebase sign-in<br/>[auth.js]"]
  node_login["Login screen<br/>[LoginScreen.js]"]
end

node_video_user(("Video user"))
node_phone_user(("Mobile user"))

node_video_user -->|"submits video"| node_inference
node_inference -->|"tracks ball"| node_tracking
node_inference -->|"extracts features"| node_features
node_inference -->|"predicts outcome"| node_judge
node_inference -->|"computes metrics"| node_metrics
node_labeler -->|"shares transforms"| node_features
node_trainer -->|"uses features"| node_features
node_trainer -->|"fits rule"| node_judge
node_evaluation -->|"runs inference"| node_inference
node_server -->|"analyzes video"| node_inference
node_server -->|"authenticates requests"| node_server_auth
node_server -->|"syncs sessions"| node_firestore
node_webui -->|"calls JSON API"| node_server
node_phone_user -->|"records or picks"| node_record
node_record -->|"uploads video"| node_api_client
node_api_client -->|"requests analysis"| node_server
node_api_client -->|"reads connection settings"| node_settings
node_api_client -->|"gets ID token"| node_auth
node_session_screen -->|"loads and saves"| node_local_store
node_session_screen -->|"fetches remote session"| node_api_client
node_session_screen -->|"renders review"| node_session
node_session -->|"stores labels"| node_local_store
node_session -->|"sends feedback"| node_api_client
node_home -->|"reads sessions"| node_local_store
node_stats -->|"reads session data"| node_local_store
node_phone_user -->|"signs in"| node_login
node_login -->|"authenticates account"| node_auth

click node_inference "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/lstm/lstm_infer.py"
click node_tracking "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/ball_track.py"
click node_features "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/shot_features.py"
click node_judge "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/shot_judge.py"
click node_metrics "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/shot_metrics.py"
click node_labeler "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/labeling/shot_labeler.py"
click node_trainer "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/lstm/lstm_train.py"
click node_evaluation "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/lstm/lstm_eval.py"
click node_server "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/app/server.py"
click node_webui "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/app/static/app.js"
click node_server_auth "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/app/auth.py"
click node_firestore "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/app/firestore_sync.py"
click node_record "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/screens/RecordScreen.js"
click node_api_client "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/services/api.js"
click node_session "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/components/SessionReview.js"
click node_session_screen "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/screens/SessionScreen.js"
click node_local_store "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/utils/storage.js"
click node_stats "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/screens/StatsScreen.js"
click node_home "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/screens/HomeScreen.js"
click node_settings "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/services/settings.js"
click node_auth "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/services/auth.js"
click node_login "https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/screens/LoginScreen.js"

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_inference,node_tracking,node_features,node_judge,node_metrics,node_video_user,node_phone_user toneBlue
class node_labeler,node_trainer,node_evaluation toneAmber
class node_server,node_webui,node_server_auth,node_firestore toneMint
class node_record,node_api_client,node_session,node_session_screen,node_local_store,node_stats,node_home toneRose
class node_settings,node_auth,node_login toneIndigo
```

## Components

### Shot analysis

- [Video inference](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/lstm/lstm_infer.py): `scripts/lstm/lstm_infer.py`
- [Ball tracking](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/ball_track.py): `scripts/ball_track.py`
- [Shot features](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/shot_features.py): `scripts/shot_features.py`
- [Rim-pass judge](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/shot_judge.py): `scripts/shot_judge.py`
- [Shot metrics](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/shot_metrics.py): `scripts/shot_metrics.py`

### Model learning

- [Shot labeling](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/labeling/shot_labeler.py): `scripts/labeling/shot_labeler.py`
- [Model training](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/lstm/lstm_train.py): `scripts/lstm/lstm_train.py`
- [Prediction evaluation](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/lstm/lstm_eval.py): `scripts/lstm/lstm_eval.py`

### Laptop service

- [Analysis API](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/app/server.py): `scripts/app/server.py`
- [Laptop web UI](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/app/static/app.js): `scripts/app/static/app.js`
- [API authentication](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/app/auth.py): `scripts/app/auth.py`
- [Firestore sync](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/scripts/app/firestore_sync.py): `scripts/app/firestore_sync.py`

### Mobile experience

- [Record and upload](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/screens/RecordScreen.js): `HooperAI/src/screens/RecordScreen.js`
- [Server client](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/services/api.js): `HooperAI/src/services/api.js`
- [Session review](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/components/SessionReview.js): `HooperAI/src/components/SessionReview.js`
- [Session loading](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/screens/SessionScreen.js): `HooperAI/src/screens/SessionScreen.js`
- [Local session store](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/utils/storage.js): `HooperAI/src/utils/storage.js`
- [Session statistics](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/screens/StatsScreen.js): `HooperAI/src/screens/StatsScreen.js`
- [Session home](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/screens/HomeScreen.js): `HooperAI/src/screens/HomeScreen.js`

### Identity and settings

- [App settings](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/services/settings.js): `HooperAI/src/services/settings.js`
- [Firebase sign-in](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/services/auth.js): `HooperAI/src/services/auth.js`
- [Login screen](https://github.com/tomsfridrihsons/basketball_shot_analytics_cv/blob/main/HooperAI/src/screens/LoginScreen.js): `HooperAI/src/screens/LoginScreen.js`

### Other components

- **Video user**
- **Mobile user**

## Connections

- Video user → Video inference: submits video (evidence: `README.md`)
- Video inference → Ball tracking: tracks ball (evidence: `scripts/lstm/lstm_infer.py`)
- Video inference → Shot features: extracts features (evidence: `scripts/lstm/lstm_infer.py`)
- Video inference → Rim-pass judge: predicts outcome (evidence: `scripts/lstm/lstm_infer.py`)
- Video inference → Shot metrics: computes metrics (evidence: `scripts/lstm/lstm_infer.py`)
- Shot labeling → Shot features: shares transforms (evidence: `scripts/labeling/shot_labeler.py`)
- Model training → Shot features: uses features (evidence: `scripts/lstm/lstm_train.py`)
- Model training → Rim-pass judge: fits rule (evidence: `scripts/lstm/lstm_train.py`)
- Prediction evaluation → Video inference: runs inference (evidence: `scripts/lstm/lstm_eval.py`)
- Analysis API → Video inference: analyzes video (evidence: `scripts/app/server.py`)
- Analysis API → API authentication: authenticates requests (evidence: `scripts/app/server.py`)
- Analysis API → Firestore sync: syncs sessions (evidence: `scripts/app/server.py`)
- Laptop web UI → Analysis API: calls JSON API (evidence: `README.md`)
- Mobile user → Record and upload: records or picks (evidence: `README.md`)
- Record and upload → Server client: uploads video (evidence: `HooperAI/src/screens/RecordScreen.js`)
- Server client → Analysis API: requests analysis (evidence: `HooperAI/src/services/api.js`)
- Server client → App settings: reads connection settings (evidence: `HooperAI/src/services/api.js`)
- Server client → Firebase sign-in: gets ID token (evidence: `HooperAI/src/services/api.js`)
- Session loading → Local session store: loads and saves (evidence: `HooperAI/src/screens/SessionScreen.js`)
- Session loading → Server client: fetches remote session (evidence: `HooperAI/src/screens/SessionScreen.js`)
- Session loading → Session review: renders review (evidence: `HooperAI/src/screens/SessionScreen.js`)
- Session review → Local session store: stores labels (evidence: `HooperAI/src/components/SessionReview.js`)
- Session review → Server client: sends feedback (evidence: `HooperAI/src/components/SessionReview.js`)
- Session home → Local session store: reads sessions (evidence: `HooperAI/src/screens/HomeScreen.js`)
- Session statistics → Local session store: reads session data (evidence: `HooperAI/src/screens/StatsScreen.js`)
- Mobile user → Login screen: signs in (evidence: `HooperAI/src/screens/LoginScreen.js`)
- Login screen → Firebase sign-in: authenticates account (evidence: `HooperAI/src/screens/LoginScreen.js`)
