feat(admin): estimation-accuracy tab + suggestion data collection#2
Merged
Conversation
Rezwoan
commented
Jun 10, 2026
Owner
- Persist suggestedWeight on each working set (data collection; algorithm unchanged)
- Extract predictExerciseWeight as shared pure helper (single source of truth)
- New GET /admin/estimation: retrospective replay (predicted vs actual from history) + live suggestion tracking (kept/increased/decreased, override, accuracy)
- Estimation admin tab: KPIs, error distribution, per-exercise bias/accuracy, recent samples
- Persist suggestedWeight on each working set (data collection; algorithm unchanged) - Extract predictExerciseWeight as shared pure helper (single source of truth) - New GET /admin/estimation: retrospective replay (predicted vs actual from history) + live suggestion tracking (kept/increased/decreased, override, accuracy) - Estimation admin tab: KPIs, error distribution, per-exercise bias/accuracy, recent samples
There was a problem hiding this comment.
Pull request overview
Adds an admin-facing “Estimation” dashboard and the underlying data-collection/analysis plumbing to evaluate suggestion accuracy over time, without changing the core progression algorithm.
Changes:
- Persist
suggestedWeighton logged working sets for future accuracy/override analysis. - Extracted the progressive overload prediction into
predictExerciseWeight()as a shared single source of truth. - Introduced
GET /admin/estimationand a new Admin Console tab to visualize retrospective vs. live accuracy KPIs.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/lib/api.ts | Adds adminApi.getEstimation() client call for the new admin endpoint. |
| frontend/src/components/admin/estimation-panel.tsx | New admin UI panel rendering estimation KPIs, distributions, and samples. |
| frontend/src/app/workout/session/[id]/page.tsx | Sends suggestedWeight when logging working sets to support live tracking. |
| frontend/src/app/admin/page.tsx | Adds the “Estimation” tab and renders EstimationPanel. |
| frontend/public/sw.js | Updated PWA service-worker precache manifest (build output). |
| backend/src/workouts/workouts.service.ts | Stores suggestedWeight on sets and centralizes prediction logic in predictExerciseWeight(). |
| backend/src/workouts/workouts.controller.ts | Extends log-set payload to accept suggestedWeight. |
| backend/src/workouts/workout-set.entity.ts | Adds nullable suggestedWeight column to workout_sets. |
| backend/src/admin/admin.service.ts | Implements retrospective replay + live tracking summarization for estimation accuracy. |
| backend/src/admin/admin.controller.ts | Exposes GET /admin/estimation endpoint for the new analysis. |
Files not reviewed (1)
- frontend/public/sw.js: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1
to
+22
| 'use client'; | ||
| import { useEffect, useState } from 'react'; | ||
| import { | ||
| BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Cell, | ||
| } from 'recharts'; | ||
| import { Target, Activity, Scale, TrendingUp, TrendingDown, Gauge, FlaskConical, ArrowRight } from 'lucide-react'; | ||
| import { adminApi } from '@/lib/api'; | ||
| import { Card, CardHeader } from '@/components/ui/card'; | ||
| import { Item, Stagger } from '@/components/ui/motion-primitives'; | ||
|
|
||
| const TT = { background: 'hsl(var(--popover))', border: '1px solid hsl(var(--border))', borderRadius: 12, fontSize: 12 }; | ||
| const fmtDate = (d?: string) => (d ? new Date(d).toLocaleDateString('en-GB', { day: '2-digit', month: 'short' }) : ''); | ||
|
|
||
| export default function EstimationPanel() { | ||
| const [data, setData] = useState<any>(null); | ||
| useEffect(() => { adminApi.getEstimation().then((r) => setData(r.data)).catch(() => {}); }, []); | ||
|
|
||
| if (!data) return <div className="flex items-center justify-center h-48"><div className="loader-ring" /></div>; | ||
|
|
||
| const retro = data.retro || { count: 0 }; | ||
| const live = data.live || { count: 0 }; | ||
|
|
Comment on lines
+94
to
+97
| const set = this.setRepo.create({ | ||
| sessionId, exerciseName, setNumber, actualReps, weightKg, targetReps, isWarmup, | ||
| suggestedWeight: isWarmup ? null : suggestedWeight ?? null, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.