feat: real ECG/Pleth waveform streaming + clinical monitor UI redesign

- schemas.py: Add ecg_wave and pleth_wave List[int] fields to NormalizedVitals
- contec_parser.py: Extract raw 8-bit waveform samples from binary packets
  - 286/288-byte (Subtype 21): bytes[8..263] = Pleth waveform (256 samples)
  - 989-byte (Subtype 20): bytes[8..903] = ECG waveform, downsampled 4x -> 224 pts
- dashboard.html: Full clinical monitor redesign
  - Scrolling sweep waveform engine (ECG green, Pleth cyan, Resp amber)
  - Real samples fed from WebSocket ecg_wave / pleth_wave arrays
  - Synthetic fallbacks when no live data
  - Right panel: HR, SpO2, RR, NIBP, Temp with range badges
  - MRN-only verification overlay
  - Minimal-mode support for iframe embedding
This commit is contained in:
2026-07-15 13:37:14 +05:30
parent 78500c487a
commit 14f3d45e53
3 changed files with 567 additions and 1545 deletions
+4 -1
View File
@@ -1,5 +1,5 @@
from pydantic import BaseModel
from typing import Optional
from typing import Optional, List
from datetime import datetime
class NormalizedVitals(BaseModel):
@@ -15,6 +15,9 @@ class NormalizedVitals(BaseModel):
respiratory_rate: Optional[float] = None
temperature: Optional[float] = None
present_fields: Optional[list] = None
# Raw waveform sample arrays (8-bit unsigned, 0-255)
ecg_wave: Optional[List[int]] = None # ECG waveform samples from 989-byte packet
pleth_wave: Optional[List[int]] = None # Pleth/SpO2 waveform samples from 286/288-byte packet
# Patient demographics parsed from HL7 PID/PV1 segments
patient_name: Optional[str] = None # PID-5: "Given Family"
patient_gender: Optional[str] = None # PID-8: M / F / U