From 70248fc68c47cf53a43f8bf91e7aeae857dae372 Mon Sep 17 00:00:00 2001 From: smaug-1 <331982178+smaug-1@users.noreply.github.com> Date: Sun, 18 Oct 2026 10:23:03 -0500 Subject: [PATCH] feat: doctor practice insights (#50) and facility staff accounts (#51) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - #50 Doctor practice insights: slot utilisation by week, no-show and late-cancellation rates, referral acceptance turnaround, and messages response time with SVG charts paired with accessible semantic table alternatives; date range selector (presets + custom); clearly labelled small-sample caveats; doctor-only confidential data (peer-comparison suppression). Wired into DoctorDashboardPage, command palette (mod+4), and navigation. - #51 Facility staff accounts & fulfillment attribution: dedicated team management page (/facility/team) with member list, role assignment (owner vs staff), email invitations, resend/revoke pending invites, member removal with backend session revocation warning, and last-owner protection. Enforced read-only view and action suppression for staff members. Fulfillment queue (/facility) action attribution showing who dispensed/ fulfilled each item for PRD §7 audit trail. - Updated ARCHITECTURE_ESSENTIALS.md Known assumptions and ROADMAP.md. - 24 test files and 112/112 tests passing. Desktop and mobile screenshots included. Closes #50 Closes #51 --- ARCHITECTURE_ESSENTIALS.md | 19 + ROADMAP.md | 9 +- screenshots/doctor-dashboard-desktop.png | Bin 0 -> 65951 bytes .../doctor-practice-insights-desktop.png | Bin 0 -> 89413 bytes .../doctor-practice-insights-mobile.png | Bin 0 -> 76560 bytes .../facility-fulfillment-queue-desktop.png | Bin 0 -> 109350 bytes .../facility-fulfillment-queue-mobile.png | Bin 0 -> 86610 bytes screenshots/facility-team-owner-desktop.png | Bin 0 -> 90001 bytes screenshots/facility-team-owner-mobile.png | Bin 0 -> 67727 bytes src/App.tsx | 15 + src/components/Layout.tsx | 20 ++ .../components/FacilityMemberList.tsx | 102 ++++++ .../components/FacilityTeam.module.css | 294 +++++++++++++++ .../components/FacilityTeam.test.tsx | 202 +++++++++++ .../components/FacilityTeamView.tsx | 203 +++++++++++ .../FulfillmentQueueWithAttribution.tsx | 126 +++++++ .../components/InviteMemberModal.tsx | 103 ++++++ .../components/PendingInvitesList.tsx | 97 +++++ .../components/RemoveMemberModal.tsx | 88 +++++ .../facility-team/hooks/useFacilityTeam.ts | 99 ++++++ .../insights/components/DateRangeSelector.tsx | 81 +++++ .../insights/components/NoShowMetricsCard.tsx | 171 +++++++++ .../components/PracticeInsights.module.css | 335 ++++++++++++++++++ .../components/PracticeInsights.test.tsx | 214 +++++++++++ .../components/PracticeInsightsView.tsx | 181 ++++++++++ .../components/TurnaroundMetricsCard.tsx | 292 +++++++++++++++ .../insights/components/UtilisationChart.tsx | 201 +++++++++++ .../insights/hooks/useDoctorInsights.ts | 20 ++ src/main.tsx | 17 + src/pages/DoctorDashboardPage.tsx | 13 + src/pages/DoctorPracticeInsightsPage.tsx | 15 + src/pages/FacilityDashboardPage.tsx | 133 ++++++- src/pages/FacilityTeamPage.tsx | 21 ++ src/services/facility-team-service.ts | 84 +++++ src/services/insights-service.ts | 22 ++ src/types/models.ts | 136 +++++++ 36 files changed, 3304 insertions(+), 9 deletions(-) create mode 100644 screenshots/doctor-dashboard-desktop.png create mode 100644 screenshots/doctor-practice-insights-desktop.png create mode 100644 screenshots/doctor-practice-insights-mobile.png create mode 100644 screenshots/facility-fulfillment-queue-desktop.png create mode 100644 screenshots/facility-fulfillment-queue-mobile.png create mode 100644 screenshots/facility-team-owner-desktop.png create mode 100644 screenshots/facility-team-owner-mobile.png create mode 100644 src/features/facility-team/components/FacilityMemberList.tsx create mode 100644 src/features/facility-team/components/FacilityTeam.module.css create mode 100644 src/features/facility-team/components/FacilityTeam.test.tsx create mode 100644 src/features/facility-team/components/FacilityTeamView.tsx create mode 100644 src/features/facility-team/components/FulfillmentQueueWithAttribution.tsx create mode 100644 src/features/facility-team/components/InviteMemberModal.tsx create mode 100644 src/features/facility-team/components/PendingInvitesList.tsx create mode 100644 src/features/facility-team/components/RemoveMemberModal.tsx create mode 100644 src/features/facility-team/hooks/useFacilityTeam.ts create mode 100644 src/features/insights/components/DateRangeSelector.tsx create mode 100644 src/features/insights/components/NoShowMetricsCard.tsx create mode 100644 src/features/insights/components/PracticeInsights.module.css create mode 100644 src/features/insights/components/PracticeInsights.test.tsx create mode 100644 src/features/insights/components/PracticeInsightsView.tsx create mode 100644 src/features/insights/components/TurnaroundMetricsCard.tsx create mode 100644 src/features/insights/components/UtilisationChart.tsx create mode 100644 src/features/insights/hooks/useDoctorInsights.ts create mode 100644 src/pages/DoctorPracticeInsightsPage.tsx create mode 100644 src/pages/FacilityTeamPage.tsx create mode 100644 src/services/facility-team-service.ts create mode 100644 src/services/insights-service.ts diff --git a/ARCHITECTURE_ESSENTIALS.md b/ARCHITECTURE_ESSENTIALS.md index 0f86815..8532f87 100644 --- a/ARCHITECTURE_ESSENTIALS.md +++ b/ARCHITECTURE_ESSENTIALS.md @@ -154,8 +154,27 @@ Undo behaviour: start/complete are applied optimistically and can be reverted wi - `POST /consultation-notes/:id/addenda` (body: `{content}`) → `ConsultationAddendum` — append-only; no edit/delete UI for addenda. - Auto sign-off deadline, if present, is exposed as `autoSignOffAt` on the note. +#### Doctor practice insights (issue #50, depends on docforum-core#124) +- `GET /doctor/insights?preset=&startDate=&endDate=` → `DoctorPracticeInsights` +- Scoped strictly to the authenticated doctor's own practice data; peer-comparison suppression guarantees no benchmarking against other named doctors. +- Aggregates weekly slot utilisation (offered vs booked), no-show and late-cancellation (<24h) rates, referral acceptance turnaround (average, median, distribution), and message response time (within 2h/24h). +- Small-sample caveats (`sampleSizeWarning: true`) automatically flagged when denominators are low (total slots < 10, referrals < 5, message threads < 5) to warn against misleading rate volatility. +- Every chart view has a full accessible `