feat: computed analytics endpoint, rework Analysis page

Add GET /api/analytics returning real aggregates over the clinic's
patients/appointments/prescriptions/tasks, and rebuild the Analysis page
to render them. Drops the fabricated revenue/profit cards — temetro has no
billing data source.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Khalid Abdi
2026-06-07 19:49:50 +03:00
parent 75940313a4
commit 48378ebc5e
6 changed files with 237 additions and 144 deletions
+23
View File
@@ -0,0 +1,23 @@
// Server-computed clinic analytics returned by GET /api/analytics. All figures
// are aggregates over the active clinic's real data (no fabricated financials).
export type Analytics = {
patients: {
total: number;
newThisMonth: number;
active: number;
};
appointments: {
thisWeek: number;
completed: number;
cancelled: number;
upcoming: number;
};
prescriptions: {
total: number;
active: number;
};
tasks: {
open: number;
done: number;
};
};