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
+118
View File
@@ -0,0 +1,118 @@
# VigilCare Records — Phase Plans
Implementation guides for the digitization platform. Product Phases **1–13 are complete** (API + initial workstation UI). Historical Phase 1–13 plan files are **not in this repository**; verification scripts under `scripts/` still reference those filenames for provenance only.
## UI redesign (Phases 14–18)
These phases redesign [`vigilcare-records-web`](../../vigilcare-records-web/) against the design specification. **No new backend behavior** — restyle, re-layout, and wire endpoints that already exist.
| Phase | Plan | Focus | Status |
|---|---|---|---|
| 14 | [phase-14-plan.md](./phase-14-plan.md) | Design tokens, app shell (sidebar), login | Planned |
| 15 | [phase-15-plan.md](./phase-15-plan.md) | Shared UX primitives (status, OCR badges, SoD, sticky actions) | Planned |
| 16 | [phase-16-plan.md](./phase-16-plan.md) | Entry / Verification / Clinical Approval workstation layouts | Planned |
| 17 | [phase-17-plan.md](./phase-17-plan.md) | Intake, Cover Sheets, Live Capture, History, Dashboard, FHIR Explorer | Planned |
| 18 | [phase-18-plan.md](./phase-18-plan.md) | Surface unused existing APIs (events, work queues, Users admin) | Done |
```mermaid
flowchart LR
P14[Phase14_Tokens_Shell_Login]
P15[Phase15_Shared_UX]
P16[Phase16_Workstation]
P17[Phase17_Support_Screens]
P18[Phase18_Unused_APIs]
P14 --> P15 --> P16 --> P17 --> P18
```
Complete phases in order. Do not start Phase *N+1* until Phase *N* success criteria pass.
## Performance hardening (Phases 19–22)
Backend CPU/memory/reliability remediations from the VigilCareRecordsAPI performance audit. Master tracker: [performance-hardening-overview.md](./performance-hardening-overview.md).
| Phase | Plan | Focus | Status |
|---|---|---|---|
| 19 | [phase-19-plan.md](./phase-19-plan.md) | Bounds, AsNoTracking, slim GetDocument, FHIR serializer | Done |
| 20 | [phase-20-plan.md](./phase-20-plan.md) | MinIO async/CT, history + `$everything` paging, overview aggregates | Done |
| 21 | [phase-21-plan.md](./phase-21-plan.md) | OCR CT, Azure singleton client, buffer reductions, RawText cap | Done |
| 22 | [phase-22-plan.md](./phase-22-plan.md) | Fuzzy Take cap, seed N+1/CT, PromoteAsync CT, ops notes | Done |
```mermaid
flowchart LR
P19[Phase19_Bounds]
P20[Phase20_Memory]
P21[Phase21_OCR]
P22[Phase22_Polish]
P19 --> P20 --> P21 --> P22
```
Prefer one PR per phase. Keep overview + phase-plan checklists updated in the same PR as the code.
## Design source of truth
- **Spec:** [../designs/design-doc.md](../designs/design-doc.md)
- **Mockups:** PNG files in [`../designs/`](../designs/)
- **Corrections override mockups:** design-doc §36 (no login role picker; no infra health on operator dashboard; OCR is assistive; consistent naming)
### Image → screen mapping
Rename mockup files when convenient so implementers do not rely on ChatGPT timestamps:
| Suggested name | Screen |
|---|---|
| `01-login.png` | Login |
| `02-dashboard.png` | Queue / operator dashboard |
| `03-intake.png` | Intake |
| `04-data-entry.png` | Data Entry |
| `05-verification.png` | Verification |
| `06-clinical-approval.png` | Clinical Approval |
| `07-live-capture.png` | Live Capture |
| `08-patient-history.png` | Patient History |
| `09-cover-sheets.png` | Cover Sheets (if present) |
| `10-fhir-explorer.png` | FHIR Explorer (if present) |
Until renamed, match mockups to design-doc sections by visual content, then apply §36 corrections before implementing.
## Constraint (Phases 14–18)
Allowed:
- Visual system (colors, density, typography scale) — **keep Public Sans**; adopt navy/blue palette from design-doc
- App shell and navigation labels for **existing routes**
- Layout and copy changes on existing views
- Frontend-only OCR badge thresholds and SoD UI mirroring API rules
- Calling existing API endpoints the web UI underuses (`…/events`, `work-queue/*`, `users`)
Not allowed without a later phase / API work:
- New clinical or workflow backend rules
- Fake metrics (API/Redis/MinIO uptime cards, MEWS panels without data)
- SSO, forgot-password, password step-up unless already implemented
- OCR bounding-box click-to-highlight (no coordinates in API)
## Deferred (needs new API or product scope)
Design-doc / mockup items **out of scope for Phases 14–18**:
| Item | Why deferred |
|---|---|
| Global ⌘K search across patients/batches/documents | No unified search API |
| Notifications center | No notifications API |
| Help Center | Content/product, not Records API |
| Supervision: Workload, Reports, Queues (as separate BI) | Beyond `work-queue/overview` |
| Master Data, Configuration, Audit Logs admin UIs | No dedicated admin APIs for config/master data |
| Infra service-health widgets on dashboard | Health probes are ops, not operator UX |
| Multi-document “18 of 76” batch progress | Batches are single-document today |
| OCR region highlight on scan | No field coordinates in OCR payload |
| Hospital SSO / Forgot password | Auth surface not implemented |
| Live Capture password re-auth / critical alert MEWS cards | Not in live-capture API contract as mocked |
Track these in [../vigilcare-records-gap-analysis.md](../vigilcare-records-gap-analysis.md) or a future phase when APIs exist.
## Related docs
- [../vigilcare-records-prd.md](../vigilcare-records-prd.md) — product requirements and phase roadmap
- [../digitization-workstation-guide.md](../digitization-workstation-guide.md) — operator workflows
- [../vigilcare-records-gap-analysis.md](../vigilcare-records-gap-analysis.md) — hardening backlog
- [performance-hardening-overview.md](./performance-hardening-overview.md) — Phases 19–22 audit finding tracker
- [../../README.md](../../README.md) — API reference and quick start