Harden API memory and CPU usage across Phases 19–22.
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

Bound list/PDF payloads, stream MinIO I/O with cancellation, paginate history and FHIR $everything, tighten OCR lifetimes/buffers, and add phase tracking docs.
This commit is contained in:
2026-11-30 23:55:56 +08:00
parent 192cb36dc7
commit a17bc2b734
46 changed files with 1677 additions and 215 deletions
+138
View File
@@ -0,0 +1,138 @@
# Phase 16 — Core Digitization Workstation (Entry, Verification, Approval)
## What exists
From [Phase 14](./phase-14-plan.md) + [Phase 15](./phase-15-plan.md): shell, tokens, shared primitives.
Workstation screens today:
| View | Files | Layout |
|---|---|---|
| Data Entry | [`EntryView.vue`](../../vigilcare-records-web/src/views/EntryView.vue), [`EntryForm.vue`](../../vigilcare-records-web/src/components/EntryForm.vue) | Queue list **or** scan + form split |
| Verification | [`VerificationView.vue`](../../vigilcare-records-web/src/views/VerificationView.vue), [`VerificationForm.vue`](../../vigilcare-records-web/src/components/VerificationForm.vue) | Same pattern |
| Clinical Approval | [`ApprovalView.vue`](../../vigilcare-records-web/src/views/ApprovalView.vue) | Same pattern + approval panel |
| Scan | [`ScanViewer.vue`](../../vigilcare-records-web/src/components/ScanViewer.vue) | Document iframe/blob |
Stores/API: [`stores/batches.ts`](../../vigilcare-records-web/src/stores/batches.ts) — draft CRUD, submit, verify, reject, approve. **Do not change endpoint contracts.**
Design reference: [design-doc.md](../designs/design-doc.md) §§14–16, §22 (density), §34 (evidence hierarchy).
## What needs to be built
Redesign the three high-risk screens for dense, scan-first workflows. Same store methods and routes. Apply Phase 15 SoD, OCR badges, sticky action bars, status badges, confirm dialogs.
Do not start Phase 17 until Entry, Verification, and Clinical Approval meet success criteria.
---
## Step 1 — Shared workstation layout pattern
Introduce a consistent layout (component or shared structure in each view):
1. **Optional left rail:** queue / document list (when useful) — can show assigned/pending items while a batch is open, without new APIs (reuse current list payloads)
2. **Center:** source scan (`ScanViewer`) — dominant evidence (Level 1)
3. **Right:** structured form / draft / clinical summary — Levels 2–4
Queue-only mode (no `batchId`) remains a full-width list with EmptyState/skeletons.
Target desktop width ≥1280px; do not force phone layouts for these flows (design-doc §32).
---
## Step 2 — Scan viewer chrome
Polish [`ScanViewer.vue`](../../vigilcare-records-web/src/components/ScanViewer.vue):
- Neutral page surface, subtle page shadow only
- Controls: zoom, fit width (keep existing capabilities; add only if trivial)
- Loading/error via Phase 15 patterns
- No decorative overlays or “AI confidence” chrome on the image itself
---
## Step 3 — Data Entry
**[`EntryView.vue`](../../vigilcare-records-web/src/views/EntryView.vue) / [`EntryForm.vue`](../../vigilcare-records-web/src/components/EntryForm.vue):**
- Dense form sections driven by existing `fieldRequirements` (unchanged logic)
- OCR badges + assistive banner (Phase 15)
- Sticky `WorkstationActionBar`:
- Left: reject/flag if already supported; otherwise omit
- Center: Save Draft (existing autosave/save)
- Primary: **Submit for Verification**
- Right: optional next-batch navigation if list context exists
- Autosave feedback per design-doc §9 (use existing save behavior; improve visible “Last saved” if data available)
Update tests in [`__tests__/components/EntryForm.test.ts`](../../vigilcare-records-web/src/__tests__/components/EntryForm.test.ts).
---
## Step 4 — Verification
**[`VerificationView.vue`](../../vigilcare-records-web/src/views/VerificationView.vue) / [`VerificationForm.vue`](../../vigilcare-records-web/src/components/VerificationForm.vue):**
- Mount `SeparationOfDutiesBanner`; disable Pass when same user
- Source scan + draft with validation markers remain primary; avoid analytics chrome
- Sticky actions:
- **Pass Verification** when pass selected
- **Return for Rework** when reject selected (with reason — existing reject flow)
- Avoid generic “Submit Decision” labeling
- Confirm dialog for reject if not already modal-confirmed
Update [`__tests__/components/VerificationForm.test.ts`](../../vigilcare-records-web/src/__tests__/components/VerificationForm.test.ts).
---
## Step 5 — Clinical Approval
**[`ApprovalView.vue`](../../vigilcare-records-web/src/views/ApprovalView.vue):**
- Visually distinct from verification (stronger clinical framing, not a clone with purple chip only)
- Show scan + verified draft summary; highlight high-stakes fields from existing draft data when present
- Retroactive alerts toggle: keep existing `enableRetroactiveAlerts` behavior; copy per design-doc §16
- Primary: **Approve & Promote** via `ConfirmDialog` stating promotion to live clinical tables
- Destructive: **Reject Batch** with reason
- Post-success: show promotion result if already returned by API (`promotion-result` / approve response fields) — polish presentation only
---
## Step 6 — Evidence hierarchy (copy + visual weight)
Across all three screens, reinforce design-doc §34:
1. Source scan
2. Entered / verified structured data
3. Verification / approval decision controls
4. Promotion outcome
Do not let secondary panels overpower the scan or draft.
---
## Success criteria
- [ ] Entry, Verification, Approval use shell + dense split layout; sticky CTAs with design-doc labels
- [ ] SoD enforced in Verification UI; OCR badges on Entry/Verification when confidence present
- [ ] Approve & Promote uses confirmation copy about live promotion
- [ ] No new API calls beyond what stores already perform (except optional read-only list for queue rail using existing list/queue fetch)
- [ ] Component/view tests updated and `npm test` passes
- [ ] Manual: walk upload→entry→verify→approve on seed data still works end-to-end
## Out of scope
- OCR region click-to-highlight
- Multi-document batch progress (18/76)
- Switching queues to `work-queue/*` endpoints (Phase 18)
- Batch events audit panel (Phase 18)
- Intake / Live Capture / Dashboard restyle (Phase 17)
## Verification
1. `cd vigilcare-records-web && npm test`
2. Manual E2E with seeded users through Entry → Verification → Clinical Approval
3. Manual: same-user verify attempt shows SoD block
4. Spot-check against design-doc §§14–16 (ignore mockup infra/analytics clutter)
## Gate
Do not start [Phase 17](./phase-17-plan.md) until success criteria above are met.