# Graph Report - /Users/etlab/projects/peak-recorder-snapshot  (2026-07-22)

## Corpus Check
- 37 files · ~48,564 words
- Verdict: corpus is large enough that graph structure adds value.

## Summary
- 129 nodes · 156 edges · 40 communities detected
- Extraction: 76% EXTRACTED · 24% INFERRED · 0% AMBIGUOUS · INFERRED: 38 edges (avg confidence: 0.86)
- Token cost: 0 input · 0 output

## Community Hubs (Navigation)
- [[_COMMUNITY_Community 0|Community 0]]
- [[_COMMUNITY_Community 1|Community 1]]
- [[_COMMUNITY_Community 2|Community 2]]
- [[_COMMUNITY_Community 3|Community 3]]
- [[_COMMUNITY_Community 4|Community 4]]
- [[_COMMUNITY_Community 5|Community 5]]
- [[_COMMUNITY_Community 6|Community 6]]
- [[_COMMUNITY_Community 7|Community 7]]
- [[_COMMUNITY_Community 8|Community 8]]
- [[_COMMUNITY_Community 9|Community 9]]
- [[_COMMUNITY_Community 10|Community 10]]
- [[_COMMUNITY_Community 11|Community 11]]
- [[_COMMUNITY_Community 12|Community 12]]
- [[_COMMUNITY_Community 13|Community 13]]
- [[_COMMUNITY_Community 14|Community 14]]
- [[_COMMUNITY_Community 15|Community 15]]
- [[_COMMUNITY_Community 16|Community 16]]
- [[_COMMUNITY_Community 17|Community 17]]
- [[_COMMUNITY_Community 18|Community 18]]
- [[_COMMUNITY_Community 19|Community 19]]
- [[_COMMUNITY_Community 20|Community 20]]
- [[_COMMUNITY_Community 21|Community 21]]
- [[_COMMUNITY_Community 22|Community 22]]
- [[_COMMUNITY_Community 23|Community 23]]
- [[_COMMUNITY_Community 24|Community 24]]
- [[_COMMUNITY_Community 25|Community 25]]
- [[_COMMUNITY_Community 26|Community 26]]
- [[_COMMUNITY_Community 27|Community 27]]
- [[_COMMUNITY_Community 28|Community 28]]
- [[_COMMUNITY_Community 29|Community 29]]
- [[_COMMUNITY_Community 30|Community 30]]
- [[_COMMUNITY_Community 31|Community 31]]
- [[_COMMUNITY_Community 32|Community 32]]
- [[_COMMUNITY_Community 33|Community 33]]
- [[_COMMUNITY_Community 34|Community 34]]
- [[_COMMUNITY_Community 35|Community 35]]
- [[_COMMUNITY_Community 36|Community 36]]
- [[_COMMUNITY_Community 37|Community 37]]
- [[_COMMUNITY_Community 38|Community 38]]
- [[_COMMUNITY_Community 39|Community 39]]

## God Nodes (most connected - your core abstractions)
1. `get_current_user (JWT auth dependency)` - 14 edges
2. `get_db (DI cursor)` - 14 edges
3. `FastAPI app (Peak Recorder API)` - 7 edges
4. `feedback router (/api/videos)` - 7 edges
5. `POST /api/videos/{video_id}/feedback` - 7 edges
6. `GET /api/records/student/{student_id}` - 7 edges
7. `videos router (/api/videos)` - 7 edges
8. `POST /api/videos` - 7 edges
9. `useUploadQueue.processQueue serial upload loop` - 6 edges
10. `PUT /api/records/{record_id}` - 6 edges

## Surprising Connections (you probably didn't know these)
- `get_current_user (JWT auth dependency)` --rationale_for--> `backend/requirements.txt`  [INFERRED]
  backend/app/deps.py → backend/requirements.txt
- `get_pool (aiomysql pool factory)` --rationale_for--> `backend/requirements.txt`  [INFERRED]
  backend/app/database.py → backend/requirements.txt
- `FastAPI app (Peak Recorder API)` --rationale_for--> `backend/requirements.txt`  [INFERRED]
  backend/app/main.py → backend/requirements.txt
- `feedback router (/api/videos)` --semantically_similar_to--> `records router (/api/records)`  [INFERRED] [semantically similar]
  backend/app/routers/feedback.py → backend/app/routers/records.py
- `_get_bucket (Firebase storage)` --rationale_for--> `backend/requirements.txt`  [INFERRED]
  backend/app/routers/videos.py → backend/requirements.txt

## Hyperedges (group relationships)
- **Record video -> save record -> enqueue blob -> upload to Firebase -> save URL backend** — videorecorder_oncomplete_callback, recordpage_save_then_enqueue, peakapi_saverecord_batch_upsert, uploadqueue_additem, uploadqueue_processqueue, firebase_storage_singleton, recorderapi_savevideo [EXTRACTED 1.00]
- **Login -> token in localStorage -> isLoggedIn gate on every page -> 401 interceptor force logout** — loginpage_handlesubmit, peakapi_login_localstorage, peakapi_isloggedin, mainpage_isloggedin_gate, peakapi_401_redirect, recorderapi_401_redirect [EXTRACTED 1.00]
- **Service worker shell cache + upload queue retry + wake lock + beforeunload guard keep uploads alive** — sw_cache_strategy, sw_api_bypass, uploadqueue_retrycount3, uploadqueue_processinglock, wakelock_pending_subscription, appshell_beforeunload_guard [INFERRED 0.90]
- **Video creation flow: auth → DB insert → background defragment → Firebase reupload** — videos_create_video, deps_get_current_user, database_get_db, db_table_student_videos, videos_defragment_video, external_firebase_storage, external_ffmpeg [EXTRACTED 1.00]
- **Student records query: router → JWT auth → JOIN student_records+record_types+students → response** — records_get_student_records, deps_get_current_user, database_get_db, db_table_student_records, db_table_record_types, db_table_students [EXTRACTED 1.00]
- **Videos list with Firebase metadata enrichment: DB query → enrich_all → fetch metadata → return** — videos_get_today_videos, videos_get_videos, db_table_student_videos, videos_enrich_all, videos_enrich_row, videos_fetch_metadata_sync, external_firebase_storage [EXTRACTED 1.00]
- **PWA Icon Set** — icons_icon_192_svg, icons_icon_192_png, icons_icon_512_svg, icons_favicon_png, icons_icon_maskable_512_png, icons_icon_512_png [EXTRACTED 1.00]

## Communities

### Community 0 - "Community 0"
Cohesion: 0.14
Nodes (15): AppShell beforeunload guard when uploads pending, AppShell mounts useWakeLock at root, firebase.ts initializes app and exports storage singleton, recorder-api.saveVideo POST /api/videos persists Firebase URL to backend, RecordPage handleSave: saveRecord then addItem(blob), RecordPage 2-step flow: camera -> input, RecordTypePage selects record type and mode (record-only or video+record), useUploadQueue.addItem auto-triggers processing (+7 more)

### Community 1 - "Community 1"
Cohesion: 0.33
Nodes (12): get_db (DI cursor), DB table: student_videos, POST /api/videos, DELETE /api/videos/{video_id}, _enrich_all (batch enrich), _enrich_row (merge metadata), _fetch_metadata_sync (Firebase metadata), GET /api/videos/today (+4 more)

### Community 2 - "Community 2"
Cohesion: 0.22
Nodes (4): getToken(), getUser(), getUserName(), isLoggedIn()

### Community 3 - "Community 3"
Cohesion: 0.33
Nodes (11): DB table: record_types, DB table: student_records, DB table: students (peak readonly), get_current_user (JWT auth dependency), Peak JWT issuer (HS256), DELETE /api/records/{record_id}, GET /api/records/student/{student_id}, RecordUpdate (pydantic) (+3 more)

### Community 4 - "Community 4"
Cohesion: 0.22
Nodes (10): get_pool (aiomysql pool factory), ffmpeg subprocess, Firebase Storage (ilsanmax-663f4), FastAPI app (Peak Recorder API), GET /api/health, lifespan (startup/shutdown pool), backend/requirements.txt, students router (/api/students) (+2 more)

### Community 5 - "Community 5"
Cohesion: 0.27
Nodes (10): DB table: trainers, DB table: video_feedback, POST /api/videos/{video_id}/feedback, DELETE /api/videos/{video_id}/feedback, GET /api/videos/{video_id}/feedback, _get_teacher_name (trainer lookup), FeedbackIn (pydantic), FeedbackOut (pydantic) (+2 more)

### Community 6 - "Community 6"
Cohesion: 1.0
Nodes (7): brand: favicon, brand: icon-192 (png), brand: icon-192 (svg), brand: icon-512 (png), brand: icon-512 (svg), brand: icon-maskable-512, brand: logo

### Community 7 - "Community 7"
Cohesion: 0.33
Nodes (6): MainPage sessionStorage peak_selectedClass restore, StudentRecordsPage rotates landscape video CSS when stream is portrait, VideoRecorder canvas rotation workaround for iOS portrait-frame in landscape, VideoRecorder matchMedia orientation detection, VideoRecorder rotation-lock dismissed sessionStorage modal, useWakeLock iOS NoSleep.js fallback vs WakeLock API

### Community 8 - "Community 8"
Cohesion: 0.5
Nodes (4): RecordPage URL.revokeObjectURL on cleanup, UploadBadge surfaces retryItem for error items, useUploadQueue releases blob to free memory after done/final-error, useUploadQueue retry up to 3, then mark error and free blob

### Community 9 - "Community 9"
Cohesion: 0.5
Nodes (3): BaseSettings, Config, Settings

### Community 10 - "Community 10"
Cohesion: 0.67
Nodes (3): MainPage parallel fetch getAssignments + getTodayVideos, StudentCard shows today's recorded badges from todayVideos prop, StudentsPage roster from getActiveStudents grouped by grade

### Community 11 - "Community 11"
Cohesion: 0.67
Nodes (3): FeedbackSection isAuthor gate for edit/delete UI, StudentRecordsPage inline player + FeedbackSection per video, VideosPage inline video player + FeedbackSection

### Community 12 - "Community 12"
Cohesion: 1.0
Nodes (0): 

### Community 13 - "Community 13"
Cohesion: 1.0
Nodes (2): VideosPage calendar with per-day video counts, VideosPage handleDelete updates videoCounts in-place

### Community 14 - "Community 14"
Cohesion: 1.0
Nodes (2): FeedbackSection handles 403 (not author) and 409 (already exists), recorder-api feedback CRUD (get/create/update/delete)

### Community 15 - "Community 15"
Cohesion: 1.0
Nodes (0): 

### Community 16 - "Community 16"
Cohesion: 1.0
Nodes (0): 

### Community 17 - "Community 17"
Cohesion: 1.0
Nodes (0): 

### Community 18 - "Community 18"
Cohesion: 1.0
Nodes (0): 

### Community 19 - "Community 19"
Cohesion: 1.0
Nodes (0): 

### Community 20 - "Community 20"
Cohesion: 1.0
Nodes (0): 

### Community 21 - "Community 21"
Cohesion: 1.0
Nodes (0): 

### Community 22 - "Community 22"
Cohesion: 1.0
Nodes (1): MainPage isLoggedIn gate redirects to /login

### Community 23 - "Community 23"
Cohesion: 1.0
Nodes (1): MainPage owner-vs-instructor class filter

### Community 24 - "Community 24"
Cohesion: 1.0
Nodes (1): LoginPage handleSubmit calls login() and routes to /

### Community 25 - "Community 25"
Cohesion: 1.0
Nodes (0): 

### Community 26 - "Community 26"
Cohesion: 1.0
Nodes (1): AppShell registers /sw.js on mount

### Community 27 - "Community 27"
Cohesion: 1.0
Nodes (1): RecordInput numeric/decimal input + notes form

### Community 28 - "Community 28"
Cohesion: 1.0
Nodes (1): recorder-api 401 interceptor clears token and redirects /login

### Community 29 - "Community 29"
Cohesion: 1.0
Nodes (1): recorder-api request interceptor attaches Bearer token

### Community 30 - "Community 30"
Cohesion: 1.0
Nodes (0): 

### Community 31 - "Community 31"
Cohesion: 1.0
Nodes (0): 

### Community 32 - "Community 32"
Cohesion: 1.0
Nodes (1): Verify Peak JWT token and extract user info.

### Community 33 - "Community 33"
Cohesion: 1.0
Nodes (1): Download fragmented MP4 from Firebase, defragment, re-upload.

### Community 34 - "Community 34"
Cohesion: 1.0
Nodes (1): frontend/README.md (Next.js boilerplate)

### Community 35 - "Community 35"
Cohesion: 1.0
Nodes (1): stock: file

### Community 36 - "Community 36"
Cohesion: 1.0
Nodes (1): stock: vercel

### Community 37 - "Community 37"
Cohesion: 1.0
Nodes (1): stock: next

### Community 38 - "Community 38"
Cohesion: 1.0
Nodes (1): stock: globe

### Community 39 - "Community 39"
Cohesion: 1.0
Nodes (1): stock: window

## Knowledge Gaps
- **43 isolated node(s):** `MainPage isLoggedIn gate redirects to /login`, `MainPage parallel fetch getAssignments + getTodayVideos`, `MainPage owner-vs-instructor class filter`, `MainPage sessionStorage peak_selectedClass restore`, `StudentRecordsPage inline player + FeedbackSection per video` (+38 more)
  These have ≤1 connection - possible missing edges or undocumented components.
- **Thin community `Community 12`** (2 nodes): `RootLayout()`, `layout.tsx`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 13`** (2 nodes): `VideosPage calendar with per-day video counts`, `VideosPage handleDelete updates videoCounts in-place`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 14`** (2 nodes): `FeedbackSection handles 403 (not author) and 409 (already exists)`, `recorder-api feedback CRUD (get/create/update/delete)`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 15`** (2 nodes): `RecordTypeButton()`, `RecordTypeButton.tsx`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 16`** (2 nodes): `shouldRedirectToLogin()`, `auth-redirect.ts`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 17`** (1 nodes): `postcss.config.mjs`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 18`** (1 nodes): `next-env.d.ts`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 19`** (1 nodes): `eslint.config.mjs`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 20`** (1 nodes): `next.config.ts`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 21`** (1 nodes): `sw.js`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 22`** (1 nodes): `MainPage isLoggedIn gate redirects to /login`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 23`** (1 nodes): `MainPage owner-vs-instructor class filter`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 24`** (1 nodes): `LoginPage handleSubmit calls login() and routes to /`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 25`** (1 nodes): `auth.ts`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 26`** (1 nodes): `AppShell registers /sw.js on mount`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 27`** (1 nodes): `RecordInput numeric/decimal input + notes form`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 28`** (1 nodes): `recorder-api 401 interceptor clears token and redirects /login`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 29`** (1 nodes): `recorder-api request interceptor attaches Bearer token`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 30`** (1 nodes): `__init__.py`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 31`** (1 nodes): `__init__.py`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 32`** (1 nodes): `Verify Peak JWT token and extract user info.`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 33`** (1 nodes): `Download fragmented MP4 from Firebase, defragment, re-upload.`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 34`** (1 nodes): `frontend/README.md (Next.js boilerplate)`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 35`** (1 nodes): `stock: file`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 36`** (1 nodes): `stock: vercel`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 37`** (1 nodes): `stock: next`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 38`** (1 nodes): `stock: globe`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.
- **Thin community `Community 39`** (1 nodes): `stock: window`
  Too small to be a meaningful cluster - may be noise or needs more connections extracted.

## Suggested Questions
_Questions this graph is uniquely positioned to answer:_

- **Why does `get_current_user (JWT auth dependency)` connect `Community 3` to `Community 1`, `Community 4`, `Community 5`?**
  _High betweenness centrality (0.031) - this node is a cross-community bridge._
- **Why does `get_db (DI cursor)` connect `Community 1` to `Community 3`, `Community 4`, `Community 5`?**
  _High betweenness centrality (0.029) - this node is a cross-community bridge._
- **Why does `POST /api/videos` connect `Community 1` to `Community 3`, `Community 4`?**
  _High betweenness centrality (0.023) - this node is a cross-community bridge._
- **Are the 2 inferred relationships involving `feedback router (/api/videos)` (e.g. with `videos router (/api/videos)` and `records router (/api/records)`) actually correct?**
  _`feedback router (/api/videos)` has 2 INFERRED edges - model-reasoned connections that need verification._
- **What connects `MainPage isLoggedIn gate redirects to /login`, `MainPage parallel fetch getAssignments + getTodayVideos`, `MainPage owner-vs-instructor class filter` to the rest of the system?**
  _43 weakly-connected nodes found - possible documentation gaps or missing edges._
- **Should `Community 0` be split into smaller, more focused modules?**
  _Cohesion score 0.14 - nodes in this community are weakly interconnected._