# sirhcl2037/pongmetrics architecture

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

- Interactive diagram: https://gitdiagram.com/sirhcl2037/pongmetrics
- Repository: https://github.com/sirhcl2037/pongmetrics

## Overview

PongMetrics is an in-development, browser-based table-tennis video review and tracking tool. Its main workflow is to load match footage, annotate shots and rallies (optionally using imported local ball/player tracks), then review shot patterns and recovery; separate workflows analyze recorded or uploaded strokes and single-player movement. Tracking generation is local, while the README describes the deployed app as a static reviewer. Some relationships below are documented in the README or source index; unsampled implementation details are not inferred.

Main entry points: [`frontend/src/VideoWorkspace.tsx`](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/VideoWorkspace.tsx) (Video Workspace), [`frontend/src/ShotAnalysisReview.tsx`](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/ShotAnalysisReview.tsx) (Shot Review), [`frontend/src/App.tsx`](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/App.tsx) (Review App), [`frontend/src/RallyReview.tsx`](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/RallyReview.tsx) (Rally Review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_match["Match Annotation"]
  node_app["Review App<br/>[App.tsx]"]
  node_workspace["Video Workspace<br/>[VideoWorkspace.tsx]"]
  node_session["Session Data<br/>[session.ts]"]
  node_rallies["Rally Data<br/>[rallies.ts]"]
  node_labeling["Shot Labeling<br/>[BallLabeler.tsx]"]
  node_replay["Range Replay<br/>[useRangeReplay.ts]"]
end

subgraph group_tracking["Local Tracking"]
  node_ballgen["Ball Tracking<br/>[temporal_track.py]"]
  node_playergen["Player Tracking<br/>[fast_track.py]"]
  node_localgen["Local Tracking Runner"]
  node_balltracks["Ball Track Data<br/>[ballDetections.ts]"]
  node_playertracks["Player Track Data<br/>[playerTracks.ts]"]
end

subgraph group_analysis["Performance Review"]
  node_shotdetect["Contact Detection<br/>[shotDetection.ts]"]
  node_shotanalysis["Shot Analysis<br/>[shotAnalysis.ts]"]
  node_shotreview["Shot Review"]
  node_movement["Movement Review<br/>[movementReview.ts]"]
  node_movementview["Movement Preview"]
  node_rallyview["Rally Review<br/>[RallyReview.tsx]"]
  node_recovery["Recovery Review<br/>[RecoveryReview.tsx]"]
  node_recoverylogic["Recovery Logic<br/>[recovery.ts]"]
end

subgraph group_stroke["Stroke Analysis"]
  node_strokelab["Stroke Lab<br/>[StrokeLab.tsx]"]
  node_strokeanalysis["Stroke Checks<br/>[strokeAnalysis.ts]"]
  node_camera["Live Stroke Camera<br/>[StrokeCamera.tsx]"]
end

node_player(("Coach / Reviewer"))

node_player -->|"uploads footage"| node_app
node_app -->|"opens review"| node_workspace
node_workspace -->|"updates session"| node_session
node_workspace -->|"renders"| node_labeling
node_workspace -->|"renders"| node_rallyview
node_player -->|"generates tracks"| node_ballgen
node_player -->|"generates tracks"| node_playergen
node_localgen -->|"runs locally"| node_playergen
node_workspace -->|"loads tracks"| node_balltracks
node_workspace -->|"loads tracks"| node_playertracks
node_shotreview -->|"detects candidates"| node_shotdetect
node_shotreview -->|"analyzes shots"| node_shotanalysis
node_shotreview -->|"uses tracks"| node_playertracks
node_workspace -->|"renders"| node_shotreview
node_movementview -->|"computes review"| node_movement
node_movementview -->|"uses tracks"| node_playertracks
node_workspace -->|"opens movement review"| node_movementview
node_rallyview -->|"renders"| node_recovery
node_recovery -->|"computes judgments"| node_recoverylogic
node_rallyview -->|"controls replay"| node_replay
node_app -->|"opens stroke lab"| node_strokelab
node_strokelab -->|"runs checks"| node_strokeanalysis
node_strokelab -->|"offers recording"| node_camera

click node_app "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/App.tsx"
click node_workspace "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/VideoWorkspace.tsx"
click node_session "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/session.ts"
click node_rallies "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/rallies.ts"
click node_labeling "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/BallLabeler.tsx"
click node_replay "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/useRangeReplay.ts"
click node_ballgen "https://github.com/sirhcl2037/pongmetrics/blob/main/experiments/ball_detection/temporal_track.py"
click node_playergen "https://github.com/sirhcl2037/pongmetrics/blob/main/experiments/ball_detection/fast_track.py"
click node_localgen "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/localPlayerTracking.ts"
click node_balltracks "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/ballDetections.ts"
click node_playertracks "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/playerTracks.ts"
click node_shotdetect "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/shotDetection.ts"
click node_shotanalysis "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/shotAnalysis.ts"
click node_shotreview "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/ShotAnalysisReview.tsx"
click node_movement "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/movementReview.ts"
click node_movementview "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/MovementPreview.tsx"
click node_rallyview "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/RallyReview.tsx"
click node_recovery "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/RecoveryReview.tsx"
click node_recoverylogic "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/recovery.ts"
click node_strokelab "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/StrokeLab.tsx"
click node_strokeanalysis "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/strokeAnalysis.ts"
click node_camera "https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/StrokeCamera.tsx"

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,node_workspace,node_session,node_rallies,node_labeling,node_replay,node_player toneBlue
class node_ballgen,node_playergen,node_localgen,node_balltracks,node_playertracks toneAmber
class node_shotdetect,node_shotanalysis,node_shotreview,node_movement,node_movementview,node_rallyview,node_recovery,node_recoverylogic toneMint
class node_strokelab,node_strokeanalysis,node_camera toneRose
```

## Components

### Match Annotation

- [Review App](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Video Workspace](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/VideoWorkspace.tsx): `frontend/src/VideoWorkspace.tsx`
- [Session Data](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/session.ts): `frontend/src/session.ts`
- [Rally Data](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/rallies.ts): `frontend/src/rallies.ts`
- [Shot Labeling](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/BallLabeler.tsx): `frontend/src/BallLabeler.tsx`
- [Range Replay](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/useRangeReplay.ts): `frontend/src/useRangeReplay.ts`

### Local Tracking

- [Ball Tracking](https://github.com/sirhcl2037/pongmetrics/blob/main/experiments/ball_detection/temporal_track.py): `experiments/ball_detection/temporal_track.py`
- [Player Tracking](https://github.com/sirhcl2037/pongmetrics/blob/main/experiments/ball_detection/fast_track.py): `experiments/ball_detection/fast_track.py`
- [Local Tracking Runner](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/localPlayerTracking.ts): `frontend/localPlayerTracking.ts`
- [Ball Track Data](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/ballDetections.ts): `frontend/src/ballDetections.ts`
- [Player Track Data](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/playerTracks.ts): `frontend/src/playerTracks.ts`

### Performance Review

- [Contact Detection](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/shotDetection.ts): `frontend/src/shotDetection.ts`
- [Shot Analysis](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/shotAnalysis.ts): `frontend/src/shotAnalysis.ts`
- [Shot Review](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/ShotAnalysisReview.tsx): `frontend/src/ShotAnalysisReview.tsx`
- [Movement Review](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/movementReview.ts): `frontend/src/movementReview.ts`
- [Movement Preview](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/MovementPreview.tsx): `frontend/src/MovementPreview.tsx`
- [Rally Review](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/RallyReview.tsx): `frontend/src/RallyReview.tsx`
- [Recovery Review](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/RecoveryReview.tsx): `frontend/src/RecoveryReview.tsx`
- [Recovery Logic](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/recovery.ts): `frontend/src/recovery.ts`

### Stroke Analysis

- [Stroke Lab](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/StrokeLab.tsx): `frontend/src/StrokeLab.tsx`
- [Stroke Checks](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/strokeAnalysis.ts): `frontend/src/strokeAnalysis.ts`
- [Live Stroke Camera](https://github.com/sirhcl2037/pongmetrics/blob/main/frontend/src/StrokeCamera.tsx): `frontend/src/StrokeCamera.tsx`

### Other components

- **Coach / Reviewer**

## Connections

- Coach / Reviewer → Review App: uploads footage
- Review App → Video Workspace: opens review (evidence: `frontend/src/App.tsx`)
- Video Workspace → Session Data: updates session (evidence: `frontend/src/VideoWorkspace.tsx`)
- Video Workspace → Shot Labeling: renders (evidence: `frontend/src/VideoWorkspace.tsx`)
- Video Workspace → Rally Review: renders (evidence: `frontend/src/VideoWorkspace.tsx`)
- Coach / Reviewer → Ball Tracking: generates tracks
- Coach / Reviewer → Player Tracking: generates tracks
- Local Tracking Runner → Player Tracking: runs locally (evidence: `frontend/localPlayerTracking.ts`)
- Video Workspace → Ball Track Data: loads tracks (evidence: `frontend/src/VideoWorkspace.tsx`)
- Video Workspace → Player Track Data: loads tracks (evidence: `frontend/src/VideoWorkspace.tsx`)
- Shot Review → Contact Detection: detects candidates (evidence: `frontend/src/ShotAnalysisReview.tsx`)
- Shot Review → Shot Analysis: analyzes shots (evidence: `frontend/src/ShotAnalysisReview.tsx`)
- Shot Review → Player Track Data: uses tracks (evidence: `frontend/src/ShotAnalysisReview.tsx`)
- Video Workspace → Shot Review: renders (evidence: `frontend/src/VideoWorkspace.tsx`)
- Movement Preview → Movement Review: computes review (evidence: `frontend/src/MovementPreview.tsx`)
- Movement Preview → Player Track Data: uses tracks (evidence: `frontend/src/MovementPreview.tsx`)
- Video Workspace → Movement Preview: opens movement review (evidence: `frontend/src/VideoWorkspace.tsx`)
- Rally Review → Recovery Review: renders (evidence: `frontend/src/RallyReview.tsx`)
- Recovery Review → Recovery Logic: computes judgments (evidence: `frontend/src/RecoveryReview.tsx`)
- Rally Review → Range Replay: controls replay (evidence: `frontend/src/RallyReview.tsx`)
- Review App → Stroke Lab: opens stroke lab (evidence: `frontend/src/App.tsx`)
- Stroke Lab → Stroke Checks: runs checks (evidence: `frontend/src/StrokeLab.tsx`)
- Stroke Lab → Live Stroke Camera: offers recording (evidence: `frontend/src/StrokeLab.tsx`)
