Stop consumers from committing past failed offsets, harden Rabbit/DataLake/gateway backpressure, dispose JsonDocument/MinIO correctly, and batch expensive DB/HTTP paths. Track progress in docs/performance.
42 lines
1.5 KiB
Markdown
42 lines
1.5 KiB
Markdown
# Phase 43 — Throughput Hot Paths
|
|
|
|
| Field | Value |
|
|
|-------|-------|
|
|
| Status | Complete |
|
|
| Audit findings | 6, 9, 10, 11, 12, 13 |
|
|
| Depends on | Phase 42 |
|
|
|
|
## Goal
|
|
|
|
Cut DB and HTTP round-trips under peak traffic and gateway catch-up without changing clinical scoring semantics.
|
|
|
|
## What to build
|
|
|
|
- [x] Clinical sync: removed nested TX around ApplySyncedObservation (SaveChanges + Clear on conflict)
|
|
- [x] PHI list audit: `LogViewsAsync` batch + one SaveChanges
|
|
- [x] Reconciliation checks: preload open keys + single SaveChanges
|
|
- [x] Ward `AddHttpClient("central")`: BaseAddress + 30s timeout; per-request headers (no DefaultRequestHeaders mutation)
|
|
- [x] Encounter replica sync: upsert from list summary when patient exists; detail GET only for new patients
|
|
- [x] Encounter timeline: 7-day window + Take(500) per event type
|
|
- [x] Ward list: latest-per-encounter GroupBy/First for NEWS2/SOFA/GCS/sepsis
|
|
|
|
## Key files
|
|
|
|
- `ClinicalSyncBatchProcessor.cs`, `ObservationService.cs`
|
|
- `PatientService.cs`, `PhiAccessLogService.cs`
|
|
- Reconciliation checks under `BackgroundServices/Reconciliation/`
|
|
- `VigilCare.WardGateway/Program.cs`, `EncounterReplicaSyncService.cs`
|
|
- `EncounterService.cs`
|
|
|
|
## Acceptance criteria
|
|
|
|
- Fewer commits per sync batch / patient list / reconciliation run
|
|
- Named HttpClient configured once with timeout
|
|
- Timeline and ward-list score queries bounded
|
|
- Relevant tests green
|
|
|
|
## Verification notes
|
|
|
|
- API + WardGateway build green after changes.
|
|
- Focused unit tests (PoisonPill/KafkaConsumerRetry/DataLakeEventParser) green.
|