# Dispatch: RTSport Frontend-Backend Integration **To:** Daedalus **From:** Wadsworth **Date:** 2026-05-03 **Priority:** High — Blocks LAT demo on May 23 **ETA:** May 16 --- ## What Wire all three RTSport dashboard views (AT, Coach, Parent) to the live FastAPI backend. Replace hardcoded mock data with real API calls. ## Why The backend is complete and tested. Frontend exists but uses static HTML. LAT demo needs real data flowing through all three stakeholder views to validate the communication loop. ## Files ### API Spec (source of truth) - `shared/api-specs/rtsport-v0.3.yaml` — 8 endpoints, OpenAPI 3.1 ### Backend (running) - `shared/build-20260501/backend/` — FastAPI + SQLite - **Server:** `http://127.0.0.1:8001` - **Test credentials:** `at@preble.k12.wi.us` / `testpass123` ### Frontend (to wire) - `shared/build-20260501/frontend/templates/` — HTML templates - `shared/build-20260501/frontend/static/` — CSS + JS ## Endpoints to Integrate | View | Endpoint | Purpose | |------|----------|---------| | AT Dashboard | `GET /api/v1/dashboard/at?school_id={id}` | Stats + active cases | | AT Dashboard | `GET /api/v1/body-parts` | Body part picker | | 3-Tap Entry | `POST /api/v1/events/sideline-entry` | Submit injury | | Athlete Overlay | `GET /api/v1/athletes/{id}?school_id={id}` | Athlete detail | | Athlete Overlay | `GET /api/v1/athletes/{id}/case?school_id={id}` | Case + milestones | | Coach Dashboard | `GET /api/v1/roster?school_id={id}` | Full roster | | Coach Dashboard | `GET /api/v1/athletes/{id}/case?school_id={id}` | Athlete restrictions | | Parent Dashboard | `GET /api/v1/athletes/{id}/case?school_id={id}` | Child recovery plan | ## Auth Pattern ```javascript // Login first POST /api/v1/auth/login/json { "email": "at@preble.k12.wi.us", "password": "testpass123" } → { "access_token": "eyJ...", "role": "at", "school_id": "schl_001" } // Use token on all requests headers: { "Authorization": "Bearer eyJ..." } ``` ## Success Criteria ### AT Dashboard - [ ] Dashboard loads `GET /api/v1/dashboard/at` on page load - [ ] Stats show real numbers (full/modified/out) - [ ] Active cases list renders from API response - [ ] FAB opens 3-tap entry with body parts from `GET /api/v1/body-parts` - [ ] Submit POSTs to `/api/v1/events/sideline-entry` - [ ] After submit, dashboard refreshes showing new case - [ ] Tap case row → opens athlete overlay with real data ### Coach Dashboard - [ ] Loads roster from `GET /api/v1/roster` - [ ] Restriction tags show `current_status` (cleared/restricted/out) - [ ] Tap athlete → shows restriction details from `GET /api/v1/athletes/{id}/case` ### Parent Dashboard - [ ] Shows child's case from `GET /api/v1/athletes/{id}/case` - [ ] Phase bar shows milestones - [ ] Timeline shows visibility-appropriate events (no clinical_notes) - [ ] Care team contacts display ## Notes - **CORS is enabled** — frontend at `hoffdesk.com/rtsport/*` can call `127.0.0.1:8001` - **Role-based filtering** — backend handles FERPA visibility. Parent view gets filtered events automatically. - **No WebSocket needed** — polling acceptable for Phase 1 demo - **Error handling** — show "Unable to load" toast, don't crash the view ## Deliverables 1. Updated frontend templates in `shared/build-20260501/frontend/` 2. Integration test showing all three views working with real data 3. Brief notes on any API schema mismatches found ## Context This is for a live LAT demo on May 23. The athletic trainer needs to see: 1. Their active cases (real data) 2. Log an injury via 3-tap entry (creates real case) 3. See that case appear in dashboard 4. Switch to Coach view — see roster with restriction 5. Switch to Parent view — see recovery plan The core loop: AT logs injury → Coach sees restriction → Parent sees recovery plan.