Skip to content

feat(admin): estimation-accuracy tab + suggestion data collection#2

Merged
Rezwoan merged 1 commit into
mainfrom
admin-revamp
Jun 10, 2026
Merged

feat(admin): estimation-accuracy tab + suggestion data collection#2
Rezwoan merged 1 commit into
mainfrom
admin-revamp

Conversation

@Rezwoan

@Rezwoan Rezwoan commented Jun 10, 2026

Copy link
Copy Markdown
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
Copilot AI review requested due to automatic review settings June 10, 2026 07:48
@Rezwoan
Rezwoan merged commit 080fd2c into main Jun 10, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 suggestedWeight on 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/estimation and 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,
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants