fix: Replay controls

This commit is contained in:
voltsrage
2026-06-20 14:41:11 +08:00
parent 584d1edd58
commit 7cfc5567fd
9 changed files with 291 additions and 73 deletions
+3 -3
View File
@@ -110,7 +110,7 @@ Use the sidebar (desktop) or bottom navigation (mobile) to move between screens.
| **Sepsis bundle** | If sepsis was suspected — four time-critical elements and compliance status |
| **Vital sign charts** | Trends for HR, RR, systolic BP, SpO₂, temperature |
| **NEWS2 history** | How the early warning score changed over time |
| **Replay controls** | Local timeline bar (pause, speed, **Next Alert →**) to step through the case |
| **Replay controls** | Local timeline bar (pause, speed, **Next Alert →**) — scrubs charts/vitals to a point in time; does not control the simulator |
**What to notice:** Would you trust these charts and explanations during a real handoff? Is anything missing?
@@ -271,7 +271,7 @@ Use this during or after your session.
- [ ] Vital sign charts show sensible trends
- [ ] NEWS2 history chart updates over time
- [ ] Sepsis bundle panel appears when sepsis alerts fire
- [ ] **Next Alert →** scrolls to review section and selects alerts
- [ ] **Next Alert →** selects each open alert, scrubs charts to that time, and scrolls the review section into view
### Alert Center
- [ ] Open / Acknowledged / Resolved tabs filter correctly
@@ -330,7 +330,7 @@ No. Rate any alert in any status.
*Useful* = good alert clinically. *Would act* = you would specifically change care because of it. An alert can be useful information but not change your plan — use the button that best matches your reasoning.
**The replay bar doesnt pause the simulator.**
Correct — replay controls only scrub data already loaded in the browser. The facilitator controls simulator speed separately.
Correct — replay controls scrub observation/chart data already loaded in the browser (pause, speed, and **Next Alert →** move a local timeline). The facilitator controls simulator speed separately.
**Dark mode?**
Toggle in the header if your eyes prefer it; all screens support dark mode.
+12 -6
View File
@@ -197,13 +197,17 @@ Five **vital sign trend** line charts (Chart.js via `vue-chartjs`):
#### Replay controls
Local playback UI for reviewing scenario timelines:
Local playback UI for reviewing scenario timelines against data already loaded for this encounter:
- Pause / resume, speed presets (1×, 60×, 360×, Instant)
- Progress bar and elapsed time display
- **Next Alert →** cycles through open alerts chronologically, selects each for reasoning, and scrolls to the chart section
- **Pause / resume** — starts paused at the end of the timeline (all data visible). Resume rewinds to the start and plays forward.
- **Speed presets** (1×, 60×, 360×, Instant) — advance the replay clock through observation and NEWS2 timestamps; **Instant** jumps to the end.
- **Progress bar and elapsed time** — derived from the earliest to latest timestamp across observations, NEWS2 history, and alerts.
- **Chart scrubbing** — vitals panel, vital trend charts, and NEWS2 history show only data at or before the replay clock.
- **Next Alert →** — cycles open/escalated alerts chronologically, selects each for the reasoning panel, scrubs the replay clock to that alerts `triggeredAt`, scrolls the alert row into view, and scrolls to the chart section.
> Replay state is **client-side only**. It does not send commands to the simulator.
Selecting an alert row in **Active Alerts** also scrubs the replay clock to that alerts time.
> Replay state is **client-side only**. It does not send commands to the simulator. Patient detail loads encounter-scoped alerts on every poll so the alert list and **Next Alert →** are not affected by a prior visit to Alert Center.
Patient detail data polls every **5 seconds**.
@@ -232,7 +236,7 @@ Typical demo flow:
2. Replay a scenario at moderate speed (`--speed 60`).
3. Open **Virtual Ward** — new or updated encounters appear as the simulator creates them.
4. Click the patient — watch vitals and charts fill in as observations ingest.
5. When alerts fire, click an alert row to read reasoning; try **Next Alert →** on the replay bar.
5. When alerts fire, click an alert row to read reasoning (replay scrubs to that time); try **Next Alert →** on the replay bar.
6. Use **Alert Center** to acknowledge alerts globally.
**Suggested scenarios:**
@@ -305,6 +309,8 @@ Implementation plans: `docs/plans/phase-17-plan.md` (ward shell + detail), `docs
| Blank ward / network errors in console | API not running or wrong URL | Start API; check `VITE_API_URL` |
| CORS error in browser | Dashboard origin not allowed | Add origin to API `DashboardOptions` in `appsettings.json` |
| Charts crash on mount | Chart data not unwrapped | Ensure `VitalTrendChart` wrapper is used (see `TrendsGrid.vue`) |
| Replay bar stuck at 0:00 | No timestamped data yet | Wait for observations/alerts to load; bounds sync after first fetch |
| Next Alert shows wrong patient | Stale global alert store | Fixed in Patient Detail — encounter alerts reload on mount/poll |
| No patients listed | No active encounters | Run simulator or use seeded API data |
| NEWS2 chart empty | Scores not computed yet | Wait for Kafka `news2-scoring` consumer after observations ingest |
| Acknowledge fails 400 | Invalid clinician ID | Set `clinicianId` in localStorage or settings store |