CODE RED

Protecting the DOCTORS who protect PATIENTS.

Inspiration

In 2009, a landmark study at Johns Hopkins found that 86% of ICU adverse events were preceded by warning signs that were present—but missed. Not because clinicians were incompetent. Because they were overwhelmed.

The average ICU team manages multiple critically ill patients simultaneously, responds to hundreds of alarms per shift, and makes complex clinical decisions under constant interruption. Yet nearly every clinical technology built over the last two decades has attempted to solve this problem by adding more information, more dashboards, and more alerts.

We started with a different question:

What if the problem isn't information scarcity—but human cognition under pressure?

Research from aviation, military human factors, mission control systems, and emergency medicine consistently demonstrates that once cognitive load exceeds critical thresholds, additional information actively degrades performance.

Pilots simplify displays during emergencies.

Mission control teams establish cognitive firewall protocols.

Anaesthesiologists use crisis checklists that deliberately reduce information complexity.

Modern ICUs have no equivalent system.

We built CODE RED to change that.


What It Does

CODE RED is a real-time adaptive cognitive safety system for critical care environments.

Unlike traditional monitoring platforms that monitor only patients, CODE RED continuously monitors the operational cognitive burden experienced by the clinical team.

The platform combines three integrated engines:

Cognitive Load Index (CLI)

A mathematically derived score recalculated every 2 seconds using:

  • Event density
  • Unresolved criticality
  • Alert entropy
  • Communication entropy
  • Task saturation
  • Interruption fragmentation
  • Decision latency
  • Escalation velocity
  • Simultaneous critical events
  • Task-switching burden

These factors are combined using weighted modeling, multiplicative amplification coefficients, exponential smoothing, and short-term predictive forecasting.

Escalation Topology Engine

CODE RED models how crises propagate through a clinical unit.

For example:

Hypoxia → Ventilator Alarm → Emergency Intubation → Cardiac Arrest

Each event creates probabilistic downstream consequences. Acknowledging root causes prevents future escalation pathways.

Adaptive Interface

The interface automatically transforms itself according to clinician cognitive load:

Standard Mode

  • Full situational awareness
  • Complete information display

Focus Mode

  • Low-priority alerts compressed
  • Non-essential information reduced

Critical Mode

  • Only high-priority events displayed
  • One-click escalation workflows

Lockdown Mode

  • Single highest-risk patient
  • Full-width crisis dashboard
  • AI operational synthesis activated

Recovery Mode

  • Gradual restoration of suppressed information

The result is a system that actively protects clinician attention during periods of overload.


How We Built It

CODE RED consists of three major architectural layers.

Backend (Python + FastAPI)

The backend implements the Operational Cognitive Burden Model (OCBM v1.0).

The cognitive engine combines ten independent workload variables into a unified Cognitive Load Index using:

  • Weighted linear combination
  • Non-linear amplification modifiers
  • Exponential moving averages
  • Predictive trend projection
  • Decay functions

A simulation framework generates realistic ICU deterioration scenarios including:

  • Sepsis cascade
  • Haemorrhagic shock
  • Alarm storm
  • Mass casualty events
  • Communication collapse
  • Handover crises

Communication disorder is modeled using Shannon Information Entropy:

H(X) = -Σ p(x) log₂ p(x)

This allows the system to detect communication breakdowns before operational failure occurs.

Frontend (Next.js + TypeScript)

The frontend uses an adaptive state machine architecture.

Every CLI score maps to a specific operational mode with defined visual behaviors:

  • Alert density
  • Information visibility
  • Animation intensity
  • Typography scaling
  • Layout complexity
  • Escalation workflows

Framer Motion powers cinematic transitions while maintaining responsiveness during rapid state changes.

AI Layer (Claude Sonnet)

Claude is used only where language understanding provides value.

The AI layer generates:

  • Operational summaries
  • Escalation reasoning
  • Situation reports
  • SBAR handovers
  • Clinical workflow synthesis

All safety-critical decisions remain deterministic.

AI assists humans.

AI does not control humans.


Challenges We Ran Into

Building Cognitive Validity Without Clinical Telemetry

Creating a meaningful Cognitive Load Index without access to large-scale ICU datasets required grounding every variable in established human factors literature, cognitive psychology, and clinical workflow research.

Adaptive UI Complexity

Making a system intentionally simpler during crises proved significantly harder than making it more complex.

Every interface element had to justify its existence under overload conditions.

SSR and Hydration Issues

The adaptive state engine initially caused server-client state mismatches in Next.js.

We redesigned the architecture into a fully SSR-safe functional model.

Escalation Graph Design

Building clinically believable event propagation pathways required extensive review of ICU adverse-event literature and crisis management workflows.

AI Reliability

Clinical environments cannot depend on external API availability.

Every AI-generated output required deterministic fallback systems and timeout protections.


Accomplishments That We're Proud Of

A Real Cognitive Load Engine

The CLI is not a demo metric.

It is a mathematically structured workload model running continuously with predictive forecasting.

Autonomous Interface Adaptation

The UI transforms itself based on inferred cognitive overload without human intervention.

Escalation Prediction

CODE RED models crisis propagation before downstream consequences occur.

Alert Suppression with Auditability

Every suppressed alert is logged, justified, timestamped, and restored automatically.

Applying Information Theory to Healthcare

We successfully translated Shannon Entropy concepts into real-time clinical communication monitoring.


What We Learned

Attention Is a Clinical Resource

Healthcare systems monitor oxygen, blood pressure, and ventilation.

Very few monitor clinician attention.

Less Information Can Be Safer

The most valuable information during a crisis is not everything.

It is the right thing.

AI Works Best at the Edge

AI excels at summarization and communication.

Safety-critical logic should remain deterministic, auditable, and reproducible.

Human Factors Matter

The future of healthcare technology is not simply better monitoring.

It is better cognitive infrastructure.


What's Next for CODE RED

Clinical Validation

The next step is validating the Cognitive Load Index using retrospective ICU datasets and prospective simulation studies.

FHIR Integration

The platform architecture is designed for FHIR R4 integration and future EMR connectivity.

Individual Workload Modeling

Future versions will model cognitive burden at the individual clinician level rather than only team-wide workload.

Controlled Simulation Studies

We plan to compare CODE RED against traditional monitoring systems using standardized overload simulations.

Expansion Beyond ICUs

The architecture is applicable to:

  • Emergency Departments
  • Operating Rooms
  • Trauma Centers
  • Neonatal ICUs
  • Command-and-Control Healthcare Operations

Our vision is a new category of clinical software:

Cognitive Infrastructure for Human Attention Under Pressure.

WHY WE COINED THE TERM "CODE RED"

In hospitals, Code Red traditionally signifies an emergency requiring immediate attention.

We deliberately adopted this term because the hidden emergency in modern critical care is often not the patient alone—it is cognitive overload within the clinical team.

Built With

Share this project:

Updates