mirror of
https://github.com/temetro/temetro.git
synced 2026-07-28 12:48:58 +00:00
48378ebc5e
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>
30 lines
640 B
TypeScript
30 lines
640 B
TypeScript
import { apiFetch } from "@/lib/api-client";
|
|
|
|
// Server-computed clinic analytics. Mirrors the backend `src/types/analytics.ts`.
|
|
// All figures are aggregates over the active clinic's real data.
|
|
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;
|
|
};
|
|
};
|
|
|
|
export function getAnalytics(): Promise<Analytics> {
|
|
return apiFetch<Analytics>("/api/analytics");
|
|
}
|