Repository navigation
feat: doctor practice insights (#50) and facility staff accounts (#51) - #142
Conversation
…nts (DocForum#51) - DocForum#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. - DocForum#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 DocForum#50 Closes DocForum#51
|
@smaug-1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
afeezorobsco-cyber
left a comment
There was a problem hiding this comment.
Thanks, this is a lot of careful UI work, and the accessible table alternatives and small-sample caveats are good touches. It can't merge as-is, though. Several pieces of demo scaffolding would ship to production:
Blocking
-
?previewRole=sign-in insrc/main.tsx. Any visitor can open…/?previewRole=admin(ordoctor/facility/patient) and get a client-side session for that role with a fake token. The backend will rejectpreview-token, but the production app still renders any role's UI on request. It also overwrites a real signed-in user's session if they open such a link. Please remove it. For screenshots, use test fixtures or a dev-only mock (import.meta.env.DEV) that is stripped from the build. -
Fake success on failed fulfillment (
FacilityDashboardPage.tsx). WhenPOST …/fulfillment-queue/:id/actionfails, thecatchmarks the itemfulfilledorrejectedlocally and stamps "Dispensed by …" with the current user. This is the PRD §7 audit trail ("who fulfilled this?"). A failed dispense must never look like a successful one. On error, show the error and leave the item unchanged. -
Mock patient and staff data shown as real data.
DEFAULT_MOCK_QUEUE(made-up patients and prescriptions),DEFAULT_MOCK_MEMBERS/DEFAULT_MOCK_INVITESandDEFAULT_MOCK_INSIGHTSare rendered whenever the API returns nothing or fails, which is always until docforum-core implements these endpoints. Real facilities and doctors would see invented patients, staff and metrics. Use the repo's existing pattern for not-yet-built endpoints instead: a loading state, an empty state, and an error state with "not available yet". Keep the mocks in the tests. -
Hard-coded facility.
facilityId = 'fac-main'(in bothFacilityDashboardPageandFacilityTeamView) and the "Central Pharmacy & Diagnostic Center" subtitle mean every facility user would query and display the same facility. The facility id has to come from the signed-in user's facility. -
Owner check derived from mock data.
isOwnercomes from the member list, which falls back to the mock list, so the UI can show owner controls based on fake data. Once item 3 is fixed this mostly goes away, but please derive it only from real API data and default to read-only.
Non-blocking
- Please don't commit
screenshots/(about 570 KB of PNGs) to the repo. Attach them to the PR description instead. - This PR combines two issues (#50 and #51) in about 3.3k lines. Separate PRs would be much easier to review and land.
- The branch is 1 commit behind
main, so please rebase when you push the fixes.
Summary
This contribution implements both Issue #50 (Phase W3: Doctor practice insights) and Issue #51 (Phase W4: Facility staff accounts & fulfillment attribution) against documented assumed API contracts in accordance with
ARCHITECTURE_ESSENTIALS.mdandROADMAP.md.Closes #50
Closes #51
Features Implemented
1. Doctor Practice Insights (#50) — Phase W3 Doctor Core Flow
/doctor/insights):<table>alternative with clear column headers (<th>), row headers, captions, and tabular numeric alignment.prefers-reduced-motion: reducewith zero transition and animation delays.DoctorDashboardPage, Layout navigation, and Command Palette (⌘K/mod+4).2. Facility Staff Accounts & Fulfillment Attribution (#51) — Phase W4 Facility Core Flow
/facility/team):ownervsstaff), join dates, and current user indicator./facility):Dispensed by: [Name] ([Role]) on [Timestamp]Sample collected by: [Name] ([Role]) on [Timestamp]Verification & Test Suite
All tests, typecheck, and production builds pass cleanly:
Screenshots Attached
The following desktop (1280px) and mobile (390px) screenshots were captured and included in
screenshots/:screenshots/doctor-practice-insights-desktop.pngscreenshots/doctor-practice-insights-mobile.pngscreenshots/facility-team-owner-desktop.pngscreenshots/facility-team-owner-mobile.pngscreenshots/facility-fulfillment-queue-desktop.pngscreenshots/facility-fulfillment-queue-mobile.pngscreenshots/doctor-dashboard-desktop.pngDocumentation & Architecture
ARCHITECTURE_ESSENTIALS.md"Known assumptions" for Phase W3 Doctor Practice Insights (GET /doctor/insights) and Phase W4 Facility Staff Accounts (GET/POST/DELETE /facilities/:id/members&invites).ROADMAP.mdwith item status and detailed changelog entry.