Files
vigilcare-records/docs/plans/phase-18-plan.md
T
Trent a17bc2b734
CI / changes (push) Successful in 17s
dotnet8-ci / build-and-test (push) Successful in 8m23s
CI / backend (push) Successful in 8m24s
node-ci / build (push) Failing after 2m1s
CI / frontend (push) Failing after 2m2s
Harden API memory and CPU usage across Phases 19–22.
Bound list/PDF payloads, stream MinIO I/O with cancellation, paginate history and FHIR $everything, tighten OCR lifetimes/buffers, and add phase tracking docs.
2026-11-30 23:55:56 +08:00

4.9 KiB
Raw Blame History

Phase 18 — Surface Existing Unused APIs

What exists

From Phases 14–17: redesigned UI chrome and screens.

Backend already provides capabilities the web UI underuses or does not expose:

API Controller Current web usage
GET /api/v1/digitization-batches/{id}/events DigitizationBatchesController Not shown on workstation screens (history has embedded audit)
GET /api/v1/work-queue/entry WorkQueueController Entry uses generic batch list + assignedTo
GET /api/v1/work-queue/verification same Verification filters status: PENDING_VERIFICATION via list
GET /api/v1/work-queue/clinical-approval same Approval filters status via list
GET/POST/PATCH /api/v1/users, reset-password UsersController List-by-role used for assign clerks; no admin Users page

Design reference: design-doc.md §§19, 30, 35 (Users under Administration — only where API exists).

What needs to be built

Wire these existing endpoints into the redesigned UI. No new backend endpoints or behavior. This is the last phase of the UI redesign track.


Step 1 — Batch audit / events panel

Add a collapsible Audit trail panel on Entry / Verification / Approval (and optionally Intake batch detail) that loads:

GET digitization-batches/{id}/events?pageSize=…

  • Cursor pagination if hasMore / cursor returned
  • Display: event type, actor, timestamp, relevant payload summary
  • Matches design-doc §30 (actor, role if present, timestamp, state transitions)

Extend stores/batches.ts with fetchEvents(batchId, cursor?). Types in types/index.ts as needed from API response shape.


Step 2 — Dedicated work-queue fetches

Prefer age-sorted work queues for operator lists:

Screen Endpoint Roles (API)
Data Entry queue work-queue/entry DATA_ENTRY_CLERK, ADMINISTRATOR
Verification queue work-queue/verification VERIFIER, CLINICAL_APPROVER, ADMINISTRATOR
Clinical Approval queue work-queue/clinical-approval CLINICAL_APPROVER, ADMINISTRATOR

Implementation notes:

  • Add store methods or thin API helpers; map response items into existing BatchList props
  • Preserve open-batch-by-id routes (/entry/:batchId, etc.)
  • Keep overview dashboard on work-queue/overview (already used)

Update batch store tests accordingly.


Step 3 — Administrator Users page

New view e.g. UsersView.vue:

  • Route /users, meta.roles: ['ADMINISTRATOR']
  • Sidebar link under Administration (or after FHIR Explorer) when canSupervise / admin role
  • Features backed by existing API:
    • List users (GET /users, optional ?role=)
    • Create user (POST /users)
    • Update fullName / role / isActive (PATCH /users/{id})
    • Reset password (POST /users/{id}/reset-password)
  • Optional: self-service change password via POST /users/me/change-password from profile menu (nice-to-have if time)

Use Phase 15 ConfirmDialog for reset-password. Forms: Phase 14 tokens.

Update router guards tests for the new route.


Step 4 — Navigation and docs touch-up

  • AppShell: add Users for administrators only
  • Do not add Workload / Reports / Master Data / Configuration / Audit Logs links (still no APIs)
  • Update plans README status for Phase 18 → Done when complete; PRD status table when implementing (not required in this docs-only authoring pass)

Success criteria

  • Events panel loads and paginates audit events for an open batch
  • Entry / Verification / Approval queues use work-queue/* endpoints (oldest-first behavior matches API)
  • /users admin CRUD + reset password works against running API for ADMINISTRATOR
  • Sidebar shows Users only for admin; no dead Supervision links
  • npm test passes; add tests for Users view and events/queue store methods

Out of scope

  • Everything in README deferred table
  • New reporting/analytics endpoints
  • Changing SoD or promotion rules on the server

Verification

  1. cd vigilcare-records-web && npm test
  2. Manual: open batch → Audit trail shows create/assign/submit/verify events from seed or fresh workflow
  3. Manual: compare queue order to API (curl work-queue vs UI)
  4. Manual: as admin, create user, patch role, reset password; as new user, log in
  5. Confirm non-admin cannot open /users (guard redirect)

Gate

UI redesign track complete when success criteria pass. Further work requires new product phases (API + UI) for deferred design-doc items.