Clinical Deterioration Early-Warning System (EWS) with Mechanical Confidence Capping & Hardware TEE Attestation
- Executive Overview
- Core Clinical Innovations
- System Architecture Diagram
- The 5-Stage Mechanical Pipeline
- False-Alarm Suppression & Gating Logic
- Role-Based Access Control (RBAC) Matrix
- Hardware TEE Confidential Enclave Architecture
- Clinical Workflow & Handover (SBAR & PDF)
- Hard Mode Benchmark Simulator
- Repository File Tree
- Installation & Local Deployment
- Clinical Safety & Research Disclaimer
Advance Health is an institutional-grade clinical decision support and patient deterioration early-warning platform designed to operate on sparse, heterogeneous, and asynchronous electronic health records (EHR).
Traditional clinical scoring systems (e.g., NEWS2, MEWS) and black-box machine learning models suffer from two fatal failure modes:
- Alarm Fatigue / False-Positive Cascades: A single artifactual or unverified vital sign spike triggers immediate Rapid Response Team (RRT) sirens, desensitizing frontline hospital staff.
- False Confidence on Sparse Data: Neural networks frequently issue high-probability deterioration predictions even when given only one isolated reading without longitudinal history.
Advance Health solves this through Mechanical Confidence Capping (decoupling risk severity from measurement certainty), a Two-Point Sustained Deterioration Gating Rule, a 5-Stage Deterministic-to-AI Verification Pipeline, and Hardware-Attested Confidential Computing (TEE).
┌─────────────────────────────────────────────────────────────────────────────┐
│ ADVANCE HEALTH PILLARS │
├───────────────────────┬────────────────────────────┬────────────────────────┤
│ 🛡️ MECHANICAL CAPPING │ 📉 FALSE-ALARM SUPPRESSION │ 🔒 HARDWARE TEE ENCLAVE│
│ Data coverage bounds │ Requires 2+ point trend │ Zero-Knowledge PHI │
│ confidence strictly │ to trigger emergency RRT │ AMD SEV-SNP Attested │
└───────────────────────┴────────────────────────────┴────────────────────────┘
Confidence is not a learned probability output from a neural network; it is mechanically bounded by vital/lab coverage, longitudinal time-depth, and measurement recency. If a patient only has a single isolated heart rate reading, the system enforces a strict Low Confidence Ceiling (≤ 35%), preventing premature clinical overreaction.
An extreme parameter (e.g., SpO2 = 88% or HR = 135 bpm) on cross-sectional, single-point data will never trigger an Emergency RRT siren. Instead, it triggers a Diagnostic Clarification Workflow (ordering repeat vitals to confirm trajectory vs. sensor artifact). Emergency escalation strictly requires ≥ 2 consecutive deteriorating observations.
Physiological boundaries dynamically adjust to the patient’s demographic profile and chronic conditions. An SpO2 of 90% is evaluated differently for a known COPD patient (where baseline target is 88–92%) versus a healthy 22-year-old post-op patient.
Data in-transit, at-rest, and in-use is shielded using AMD SEV-SNP / Intel TDX Confidential VM Enclaves with AES-128-XTS RAM encryption and cryptographically verifiable PCR0 hardware measurement hashes.
CLINICAL USERS
┌───────────────────────────┼───────────────────────────┐
▼ ▼ ▼
[Medical Superintendent] [Attending Doctor] [Ward Nurse]
- Hospital Command Deck - Direct Patient Cohort - Unit Ward Surveillance
- ICU Surge Allocation - RRT & Diagnostic Orders - Rapid Vitals & SBAR Note
│ │ │
└───────────────────────────┼───────────────────────────┘
│ (Strict RBAC Scoping)
▼
┌──────────────────────────────────────────────────────────────────────────┐
│ FRONTEND APPLICATION LAYER │
│ React 18 + TypeScript + Vite + Tailwind CSS + Lucide Icons + jsPDF │
├──────────────────────────────────────────────────────────────────────────┤
│ • Ward Triage Grid (Real-time MEWS, Risk vs Confidence badges) │
│ • Patient Deep Dive Telemetry & Longitudinal Time-Series Visualizer │
│ • Interactive Hard-Mode Benchmark Lab (Sensor Drops / Outlier Injections│
│ • SBAR Shift Handover Note Generator & Signed PDF Audit Stamp │
│ • Hospital Superintendent Executive Command Dashboard │
└─────────────────────────────────────┬────────────────────────────────────┘
│ POST /api/assess (JSON)
▼
┌──────────────────────────────────────────────────────────────────────────┐
│ BACKEND API & SECURITY ENGINE │
│ Node.js + Express + Google Gen AI SDK (@google/genai) │
├──────────────────────────────────────────────────────────────────────────┤
│ 🔒 TEE Confidential Enclave Boundary (AMD SEV-SNP Hardware Attestation) │
│ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ STAGE 1: Deterministic Data Completeness & Mechanical Confidence │ │
│ │ Formula: C = (V_cov * 0.25) + (L_cov * 0.10) + Depth + Recency │ │
│ │ Hard Caps: Single-Point <= 35% | Missing Vitals <= 55% │ │
│ └─────────────────────────────────┬──────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────▼──────────────────────────────────┐ │
│ │ STAGE 2: Patient-Specific Trajectory & Anomaly Detection │ │
│ │ Calculates deltas, dynamic baseline offsets & multi-point trends │ │
│ └─────────────────────────────────┬──────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────▼──────────────────────────────────┐ │
│ │ STAGE 3: Decoupled Composite Risk Scoring (Gemini 3.7 Flash) │ │
│ │ Risk (0-100) computed with Mechanical Confidence override │ │
│ └─────────────────────────────────┬──────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────▼──────────────────────────────────┐ │
│ │ STAGE 4: Plain-Language Numerical Factor Attribution │ │
│ │ Cites exact values, deltas, timeframes, and pathophysiologic links│ │
│ └─────────────────────────────────┬──────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────▼──────────────────────────────────┐ │
│ │ STAGE 5: Action Recommendation & Two-Point False-Alarm Gating │ │
│ │ Sustained Deterioration >= 2 pts ? Emergency RRT : Repeat Vitals │ │
│ └─────────────────────────────────┬──────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────────▼──────────────────────────────────┐ │
│ │ SHA-256 Chained Immutable Audit Log & TEE Signature Generation │ │
│ └────────────────────────────────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────────────────────────┘
Advance Health processes every clinical intake through a sequential, audited 5-stage pipeline:
[Patient EHR / Telemetry]
│
▼
┌───────────────────┐
│ STAGE 1 │ ──► [Data Completeness Score & Mechanical Confidence Level]
│ Completeness Eval │ (Vitals Coverage, Lab Depth, Hard Capping Rules)
└─────────┬─────────┘
▼
┌───────────────────┐
│ STAGE 2 │ ──► [Trajectory & Dynamic Baseline Analysis]
│ Dynamic Baselines │ (Deltas, Velocity, Patient-Condition Offsets)
└─────────┬─────────┘
▼
┌───────────────────┐
│ STAGE 3 │ ──► [Decoupled Composite Risk Scoring]
│ Composite Scoring │ (Risk Level 0-100 vs. Bounded Confidence 0-100)
└─────────┬─────────┘
▼
┌───────────────────┐
│ STAGE 4 │ ──► [Explainability & Attribution Engine]
│ Explainability │ (Ranked factors with exact numeric deltas & timeframes)
└─────────┬─────────┘
▼
┌───────────────────┐
│ STAGE 5 │ ──► [Two-Point Gating & Action Pathway]
│ Recommendation │ (Emergency RRT vs Diagnostic Gap Closure List)
└───────────────────┘
The confidence score is computed deterministically via the following equation:
-
Single-Point Constraint: If no multi-point trajectory exists (all readings are cross-sectional single values), confidence is capped at
$\le 35%$ (LOW). -
Missing Core Vitals: If core vital sign coverage is
$< 60%$ (missing HR, BP, RR, SpO2, or Temp), confidence is capped at$\le 55%$ (MODERATE). -
Single Vital Sensor: If only 1 vital parameter is recorded total, confidence is capped at
$\le 28%$ (LOW). -
Thin Trajectory: If fewer than 2 parameters have multi-reading time series, confidence is capped at
$\le 65%$ (MODERATE).
The False-Alarm Mitigation Engine evaluates every high or critical risk signal against strict safety gates before authorizing an Emergency Rapid Response Team (RRT) alert:
[ Incoming Patient Assessment ]
│
▼
Is Composite Risk Score HIGH or CRITICAL?
│
┌───────────────┴───────────────┐
│ NO │ YES
▼ ▼
[ Standard Routine Care ] Does Data have Mechanical
- q4h vital surveillance Confidence >= MODERATE (>= 40%)?
- Clinical pathway tracking │
┌───────────────┴───────────────┐
│ NO │ YES
▼ ▼
[ Alert Gated: Low Confidence ] Is there a Sustained Trend
- Suppress Emergency RRT Sirens Across >= 2 Timepoints?
- Issue "Diagnostic Clarification" │
- Order Immediate Repeat Vitals ┌──────────┴──────────┐
│ NO │ YES
▼ ▼
[ Isolated Outlier Gated ] [ EMERGENCY RRT ALERT ]
- Rule out motion artifact - Immediate Attending Bedside
- Order repeat sensor probe - High-flow oxygenation / IV
- Prevent alert fatigue - Broad-spectrum antibiotics
Advance Health enforces strict HIPAA principle of least privilege and patient-care scoping across all hospital tiers:
| Clinical Role | Security Clearance | Bedside Vitals Entry | Order Diagnostics | Shift SBAR Handover | Export Signed PDF | View Hospital Command | Hospital-Wide Alerts |
|---|---|---|---|---|---|---|---|
| Medical Superintendent | Level 4 - Executive |
✅ | ✅ | ✅ | ✅ | ✅ Full Access | ✅ Global Broadcast |
| Attending Doctor / MD | Level 3 - Attending |
✅ | ✅ | ✅ | ✅ | ❌ Restricted | ❌ Restricted |
| Staff Nurse / RN | Level 2 - Clinical |
✅ | ✅ (Scoped) | ✅ | ✅ | ❌ Restricted | ❌ Restricted |
| AI Safety Auditor | Level 4 - Audit |
❌ | ❌ | ❌ | ✅ | ✅ (Read-Only) | ❌ Restricted |
- Staff Nurses are strictly scoped to patients in their assigned ward unit (e.g., Medical ICU for Marcus Vance, RN; Step-Down 4B for Priya Sharma, RN).
- Attending Physicians are scoped strictly to patients under their service roster (e.g., Dr. Sarah Reynolds sees PT-8942 & PT-9012; Dr. Vikram Malhotra sees PT-3321, PT-4109 & PT-1088).
- Unassigned records render a HIPAA Access Restricted Guard Screen preventing unauthorized PHI exposure.
Advance Health guarantees end-to-end data security for patient telemetry both in storage and during runtime execution in memory:
┌─────────────────────────────────────────────────────────────────────────────┐
│ CONFIDENTIAL VIRTUAL MACHINE (CVM) BOUNDARY │
│ │
│ ┌──────────────────────────────────────────────────────────────────────┐ │
│ │ HARDWARE-ROOT-OF-TRUST ATTESTATION │ │
│ │ • AMD SEV-SNP / Intel TDX Secure Processor Architecture │ │
│ │ • Memory Encryption: AES-128-XTS Real-Time Hardware Key │ │
│ │ • Hardware PCR0 Measurement: 9E4A-88DF-11A0-3BC7-44E2 │ │
│ │ • Enclave Code Signature (MRENCLAVE): 0x7CA4B91E2D8F0103 │ │
│ └──────────────────────────────────┬───────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────────────▼───────────────────────────────────┐ │
│ │ ZERO-KNOWLEDGE PHI TOKENIZATION LAYER │ │
│ │ • Direct Identifiers (SSN, Names, MRNs) stripped prior to compute │ │
│ │ • Ephemeral Session Keys destroyed immediately post-inference │ │
│ │ • Host OS and Hypervisor have Zero Read/Write Visibility into RAM │ │
│ └──────────────────────────────────┬───────────────────────────────────┘ │
│ │ │
│ ┌──────────────────────────────────▼───────────────────────────────────┐ │
│ │ IMMUTABLE SHA-256 AUDIT LOG CHAIN │ │
│ │ • Every Assessment, RRT Call, and Login generates a Hash Block │ │
│ │ • Cryptographically chained: Hash_n = SHA256(Log_n + Hash_{n-1}) │ │
│ └──────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
Standardized medical communication framework built directly into every patient record:
- S (Situation): Current primary clinical concern, room/bed, and deterioration syndrome.
- B (Background): Patient age, admission diagnosis, chronic comorbidities, and baseline vitals.
- A (Assessment): 5-stage trajectory summary, delta values, and mechanical confidence score.
- R (Recommendation): Urgent action steps, frequency of repeat vitals, and diagnostic gap orders.
Generates an institutional PDF report containing:
- Patient demographics & unit assignment
- Full time-series telemetry table with timestamped observations
- 5-Stage deterioration trajectory with factor impact weights
- Authenticating clinician digital signature seal, badge ID, and SHA-256 tamper-evident verification hash
Advance Health includes a built-in Benchmark Lab accessible via the top context bar to test clinical AI edge cases:
┌───────────────────────────────────────────────────────────────────────────────┐
│ BENCHMARK SCENARIO LAB │
├──────────────────────────┬────────────────────────────────────────────────────┤
│ 1. Sepsis Cascade │ Multi-point severe decline (HR > 120, BP < 90/60, │
│ (Sustained Decline) │ Lactate > 4.2). RRT Alert evaluates TRUE. │
├──────────────────────────┼────────────────────────────────────────────────────┤
│ 2. Isolated HR Spike │ Single-point HR 135 bpm on thin data. │
│ (False-Alarm Test) │ False-Alarm Rule suppresses RRT; orders repeats. │
├──────────────────────────┼────────────────────────────────────────────────────┤
│ 3. Sensor Drop / Sparse │ Vitals reduced to single heart rate reading. │
│ (Mechanical Capping) │ Confidence mechanically capped at 28-35% (LOW). │
├──────────────────────────┼────────────────────────────────────────────────────┤
│ 4. Baseline Decompensation│ Gradual HR drift (+24 bpm) in heart failure patient│
│ (Subacute Drift) │ Subacute escalation without emergency panic. │
└──────────────────────────┴────────────────────────────────────────────────────┘
├── .env.example # Environment variable declarations
├── index.html # Application HTML entry point
├── metadata.json # Application metadata and permissions
├── package.json # Project manifest and dependencies
├── server.ts # Express backend, Gemini 3.7 SDK & deterministic engine
├── tsconfig.json # TypeScript compiler configuration
├── vite.config.ts # Vite bundler configuration
│
└── src/
├── main.tsx # React client mounting entry
├── App.tsx # Main workspace controller, view routing & audit state
├── index.css # Tailwind CSS global styles
│
├── components/ # Modular UI Component Library
│ ├── AuditLogModal.tsx # HIPAA immutable audit trail viewer
│ ├── ClinicalDisclaimerModal.tsx # Methodology, evidence & limitations dialog
│ ├── ContributingFactors.tsx # Stage 4 explainability & factor ranking cards
│ ├── DataImprovementPanel.tsx # Stage 5 diagnostic gap closure & 1-click order tool
│ ├── HardModeSimulator.tsx # Edge-case benchmark simulator
│ ├── Header.tsx # Top bar with role status, audit links & mode toggles
│ ├── LoginModal.tsx # Role-Based Authentication switcher
│ ├── MedicalSuperintendentView.tsx # Executive hospital command & ward census
│ ├── PatientForm.tsx # Bedside vitals & time-series data input form
│ ├── PipelineStageInspector.tsx # 5-Stage mechanical pipeline execution inspector
│ ├── RiskConfidenceDisplay.tsx# Primary risk vs. mechanical confidence meters
│ ├── SbarHandoverModal.tsx # SBAR clinical shift handover note generator
│ ├── TeeSecurityModal.tsx # AMD SEV-SNP hardware attestation & enclave stats
│ ├── TimeSeriesVisualizer.tsx # Longitudinal charts & 2h predictive trajectory
│ └── WardTriageGrid.tsx # Hospital ward multi-patient surveillance grid
│
├── data/ # Preset Clinical Datasets & Personas
│ ├── authUsers.ts # Clinical role definitions & security clearances
│ ├── hospitalWardsData.ts # Hospital ward census, ICU beds & incident logs
│ └── presetScenarios.ts # Validated clinical patient trajectories
│
├── services/
│ └── api.ts # Client HTTP service for backend assessment calls
│
├── types/
│ └── clinical.ts # Global TypeScript interfaces & enums
│
└── utils/ # Core Mechanical Engines
├── clinicalAssessmentEngine.ts # High-fidelity deterministic heuristic fallback
├── confidenceEngine.ts # Stage 1 Data Completeness & False-Alarm Gating
└── pdfGenerator.ts # jsPDF clinical audit export with digital seal
- Node.js: v18.0.0 or higher
- Package Manager:
npmorbun - Gemini API Key: (Optional, system includes automatic deterministic fallback)
Clone the repository and copy the environment template:
cp .env.example .envAdd your Gemini API Key to .env (optional):
GEMINI_API_KEY=your_gemini_api_key_herenpm installnpm run devThe server will start at http://0.0.0.0:3000 with hot reload enabled.
npm run build
npm start
⚠️ REGULATORY NOTICE: Advance Health is an investigational clinical decision support research prototype. It is designed to assist registered healthcare professionals in synthesizing complex, multi-modal time-series data. It is NOT a standalone medical diagnostic device and does not replace professional clinical judgment, physical examination, or institutional emergency protocols. All recommendations and RRT triggers must be validated by licensed medical personnel before administering treatment.
Advance Health Engineering Team • Hardware-Attested • Mechanically Capped • Clinically Calibrated