Using Spaxiom for Real-Time Clinical Deterioration Detection and Rapid Response
Joe Scanlin
November 2025
Spaxiom is a sensor abstraction layer and runtime that translates billions of heterogeneous sensor streams into structured, semantic events. It provides a spatial-temporal DSL for defining zones, entities, and conditions, making it easy to build context-aware applications across industries.
INTENT (Intelligent Network for Temporal & Embodied Neuro-symbolic Tasks) is Spaxiom's high-level event vocabulary. Instead of overwhelming AI agents with raw sensor data, Spaxiom emits compact, meaningful events that agents can immediately understand and act upon.
Hospital patient deterioration (sepsis, respiratory failure, cardiac arrest) causes 200,000+ preventable deaths annually in U.S. hospitals, with early warning signs often visible 6–12 hours before cardiac arrest but missed due to alarm fatigue and siloed monitoring systems. Traditional vital signs monitoring checks patients every 4–6 hours with manual nurse assessments, creating dangerous gaps where subtle declining trends go undetected until acute crisis. The challenge is that bedside cardiac monitors track heart rate and rhythm through proprietary telemetry systems, pulse oximeters measuring blood oxygen saturation connect to separate devices, automated blood pressure cuffs report to standalone consoles, and electronic health records (EHR) containing lab results and medication data remain isolated in hospital information systems—leaving AI-powered early warning algorithms unable to synthesize real-time physiological data with clinical context across fragmented healthcare IT infrastructure.
Spaxiom fuses continuous vital signs monitoring (ECG heart rate/rhythm, SpO₂ oxygen saturation, respiratory rate, blood pressure, temperature), wearable sensor data (movement/mobility tracking, fall detection), lab results (lactate, white blood cell count, creatinine for organ function), and EHR clinical context (diagnosis, medications, recent procedures) into one intelligent patient surveillance platform. Instead of reacting to individual alarm thresholds (heart rate >120 bpm), it calculates a real-time "Clinical Acuity Score" that detects multi-parameter deterioration patterns 4–8 hours before traditional single-threshold alarms, predicting sepsis onset, respiratory failure, or hemodynamic instability through early trending analysis. This sends targeted rapid response alerts like "patient in room 412 modified early warning score (MEWS) escalating—respiratory rate trending up, blood pressure trending down, lactate 3.2—activate sepsis protocol now" or "post-surgical patient mobility decreasing 60% from baseline—assess for delirium or pain crisis," helping clinical teams intervene during the "golden hours" before irreversible deterioration, reducing preventable cardiac arrests by 30–50% and ICU transfers by 25–40% through proactive surveillance that augments rather than replaces bedside nursing assessment.
Patient deterioration in hospitals (sepsis, respiratory failure, cardiac arrest) causes an estimated 200,000–400,000 preventable deaths annually in the United States alone. Studies show that 80% of cardiac arrests are preceded by observable physiological decline 6–12 hours before the event, yet traditional ward-level monitoring—manual vital signs checks every 4–6 hours—misses these early warning signals. Alarm fatigue (bedside monitors generating 150–300 alarms per patient per day, 85–99% non-actionable) desensitizes clinical staff, while siloed systems prevent holistic patient assessment integrating vital signs, lab results, and clinical context.
Modern hospital monitoring generates extensive physiological data across fragmented platforms:
Legacy hospital systems operate in silos: bedside monitors (Philips, GE) use proprietary protocols, wearables sync to vendor-specific platforms, lab results arrive in EHR with hours of delay, and clinical decision support systems lack real-time physiological integration. Spaxiom enables continuous multi-parameter patient surveillance by fusing heterogeneous data streams to compute composite acuity scores (e.g., Modified Early Warning Score, National Early Warning Score) that detect deterioration patterns invisible to single-parameter threshold alarms.
The clinical monitoring domain defines semantic events that abstract sensor data into actionable clinical alerts:
PhysiologicalDeteriorationDetected: Multi-parameter decline identified via early warning score escalation (e.g., NEWS ≥5) or trending vital sign instability before individual thresholds are crossed. Severity classified as {EARLY, MODERATE, CRITICAL} with estimated time-to-crisis (4–8 hours typical for sepsis).SepsisRiskElevated: Infection indicators (fever/hypothermia, elevated WBC, elevated lactate >2 mmol/L) combined with organ dysfunction markers (tachycardia, hypotension, tachypnea, altered mental status per SIRS criteria). Triggers sepsis protocol bundle: blood cultures, broad-spectrum antibiotics, fluid resuscitation within 1 hour.RespiratoryDistress: Escalating respiratory rate (>24/min), declining SpO₂ despite supplemental oxygen, increased work of breathing detected via accessory muscle use (inferred from high-frequency chest wall movement patterns). Early sign of impending respiratory failure requiring intervention before intubation becomes emergent.HemodynamicInstability: Blood pressure trends declining, heart rate increasing (compensatory tachycardia), narrowing pulse pressure (systolic-diastolic gap), or orthostatic vital sign changes suggesting volume depletion, bleeding, or cardiac dysfunction.PostOperativeComplication: Deviation from expected recovery trajectory: mobility declining (suggesting pain crisis, delirium, or surgical complication), fever onset, unexpected tachycardia, or wound site issues flagged by nurse documentation in EHR.FallRisk: Patient mobility patterns (nocturnal wandering, unsteady gait detected via wearable accelerometry) combined with risk factors (sedating medications, delirium, orthostatic hypotension) predict fall events 2–12 hours before occurrence.These events enable automated rapid response team activation, clinical protocol triggering (sepsis bundles, stroke codes), and risk-stratified nurse rounding intervals (high-acuity patients checked hourly vs. stable patients every 4 hours).
Predicting patient deterioration requires integrating vital signs dynamics, lab values, and clinical context into a composite risk indicator. We implement the Modified Early Warning Score (MEWS) and extend it with continuous monitoring data:
where each subscored component is assigned points based on deviation from normal ranges:
Respiratory Rate Score (SRR):
Heart Rate Score (SHR):
Systolic Blood Pressure Score (SSBP):
Temperature Score (ST):
Level of Consciousness (SAVPU):
Score Interpretation:
Trending Enhancement: Spaxiom augments static MEWS with velocity (rate of change) analysis:
where α weights the trending component and Δt is the forecast horizon (typically 2–4 hours). A patient with MEWS = 3 (moderate) but rapidly increasing (Δ MEWS = +2 over past 3 hours) receives higher priority than static MEWS = 4.
Sepsis-Specific Extension: Quick SOFA (qSOFA) for infection-suspected patients:
qSOFA ≥2 predicts high mortality risk in sepsis, triggering immediate intervention protocols.
The HospitalPatient class demonstrates multi-modal physiological monitoring with early warning score fusion:
from spaxiom import Sensor, Intent, Fusion, Metric
from datetime import datetime, timedelta
class HospitalPatient:
def __init__(self, patient_id, admission_diagnosis, age):
self.patient_id = patient_id
self.admission_diagnosis = admission_diagnosis
self.age = age
# Sensor streams
self.vital_signs_monitor = Sensor("bedside_monitor")
self.pulse_ox = Sensor("pulse_oximeter")
self.bp_cuff = Sensor("automated_bp")
self.temp_sensor = Sensor("continuous_temp_patch")
self.wearable = Sensor("actigraphy_wearable")
self.lab_interface = Sensor("lab_results_feed")
# INTENT events
self.physiological_deterioration = Intent("PhysiologicalDeteriorationDetected")
self.sepsis_risk = Intent("SepsisRiskElevated")
self.respiratory_distress = Intent("RespiratoryDistress")
self.hemodynamic_instability = Intent("HemodynamicInstability")
self.fall_risk = Intent("FallRisk")
# Fusion metrics
self.mews = Metric("modified_early_warning_score", range=(0, 15))
self.mews_trend = Metric("mews_velocity", unit="points/hour")
self.sepsis_probability = Metric("sepsis_risk_score", range=(0, 1))
# State tracking
self.vital_history = {
"heart_rate": [],
"resp_rate": [],
"bp_systolic": [],
"temp_c": [],
"spo2": []
}
self.current_vitals = {}
self.consciousness_level = "Alert" # Alert, Voice, Pain, Unresponsive
self.last_mews_scores = []
def _score_respiratory_rate(self, rr):
"""MEWS respiratory rate component"""
if rr < 9:
return 2
elif 9 <= rr <= 14:
return 0
elif 15 <= rr <= 20:
return 1
elif 21 <= rr <= 29:
return 2
else: # ≥30
return 3
def _score_heart_rate(self, hr):
"""MEWS heart rate component"""
if hr < 40:
return 2
elif 40 <= hr <= 50:
return 1
elif 51 <= hr <= 100:
return 0
elif 101 <= hr <= 110:
return 1
elif 111 <= hr <= 129:
return 2
else: # ≥130
return 3
def _score_systolic_bp(self, sbp):
"""MEWS systolic blood pressure component"""
if sbp < 70:
return 3
elif 71 <= sbp <= 80:
return 2
elif 81 <= sbp <= 100:
return 1
elif 101 <= sbp <= 199:
return 0
else: # ≥200
return 2
def _score_temperature(self, temp_c):
"""MEWS temperature component"""
if temp_c < 35.0:
return 2
elif 35.0 <= temp_c <= 38.4:
return 0
else: # ≥38.5
return 2
def _score_consciousness(self, level):
"""MEWS AVPU consciousness component"""
avpu_scores = {
"Alert": 0,
"Voice": 1,
"Pain": 2,
"Unresponsive": 3
}
return avpu_scores.get(level, 0)
@Fusion.rule
def calculate_mews(self):
"""Compute Modified Early Warning Score from current vitals"""
vitals = self.current_vitals
# Individual component scores
s_rr = self._score_respiratory_rate(vitals.get("resp_rate", 16))
s_hr = self._score_heart_rate(vitals.get("heart_rate", 75))
s_sbp = self._score_systolic_bp(vitals.get("bp_systolic", 120))
s_temp = self._score_temperature(vitals.get("temp_c", 37.0))
s_avpu = self._score_consciousness(self.consciousness_level)
# Total MEWS
mews_value = s_rr + s_hr + s_sbp + s_temp + s_avpu
self.mews.update(mews_value)
# Track history for trending
self.last_mews_scores.append({
"timestamp": datetime.now(),
"mews": mews_value
})
if len(self.last_mews_scores) > 100:
self.last_mews_scores.pop(0)
# Calculate velocity (change over last 3 hours)
if len(self.last_mews_scores) > 10:
recent_window = [s for s in self.last_mews_scores
if (datetime.now() - s["timestamp"]) < timedelta(hours=3)]
if len(recent_window) > 2:
delta_mews = recent_window[-1]["mews"] - recent_window[0]["mews"]
delta_hours = (recent_window[-1]["timestamp"] - recent_window[0]["timestamp"]).total_seconds() / 3600
velocity = delta_mews / delta_hours if delta_hours > 0 else 0
self.mews_trend.update(velocity)
else:
velocity = 0
else:
velocity = 0
# Alert thresholds
if mews_value >= 5 or (mews_value >= 3 and velocity > 0.5):
severity = "CRITICAL" if mews_value >= 7 else "MODERATE"
self.physiological_deterioration.emit(
patient_id=self.patient_id,
mews=mews_value,
mews_velocity=velocity,
severity=severity,
vital_signs=vitals,
action="ACTIVATE_RAPID_RESPONSE_TEAM" if severity == "CRITICAL" else "INCREASE_MONITORING_FREQUENCY"
)
return mews_value
@Fusion.rule
def assess_sepsis_risk(self):
"""Evaluate infection + organ dysfunction for sepsis"""
vitals = self.current_vitals
lab = self.lab_interface.latest()
# SIRS criteria (≥2 = systemic inflammatory response)
sirs_count = 0
# Temperature
temp = vitals.get("temp_c", 37.0)
if temp > 38.0 or temp < 36.0:
sirs_count += 1
# Heart rate
hr = vitals.get("heart_rate", 75)
if hr > 90:
sirs_count += 1
# Respiratory rate
rr = vitals.get("resp_rate", 16)
if rr > 20:
sirs_count += 1
# WBC (from lab)
wbc = lab.get("wbc_count", 7.5) # Normal: 4.5-11 x10^9/L
if wbc > 12 or wbc < 4:
sirs_count += 1
# qSOFA criteria (≥2 = high mortality risk)
qsofa = 0
if rr >= 22:
qsofa += 1
if vitals.get("bp_systolic", 120) <= 100:
qsofa += 1
if self.consciousness_level in ["Voice", "Pain", "Unresponsive"]:
qsofa += 1
# Lactate (organ dysfunction marker)
lactate = lab.get("lactate_mmol", 1.0) # Normal: <2.0 mmol/L
# Sepsis probability (simplified scoring)
sepsis_score = (sirs_count / 4) * 0.4 + (qsofa / 3) * 0.4 + min(lactate / 4, 1) * 0.2
self.sepsis_probability.update(sepsis_score)
# Alert on high sepsis risk
if sepsis_score > 0.6 or (sirs_count >= 2 and qsofa >= 2):
self.sepsis_risk.emit(
patient_id=self.patient_id,
sepsis_probability=sepsis_score,
sirs_count=sirs_count,
qsofa=qsofa,
lactate=lactate,
action="INITIATE_SEPSIS_BUNDLE_WITHIN_1_HOUR"
)
return sepsis_score
@Sensor.on_data("bedside_monitor")
def monitor_vital_signs(self, heart_rate, resp_rate, ecg_rhythm):
"""Continuous cardiac and respiratory monitoring"""
self.current_vitals["heart_rate"] = heart_rate
self.current_vitals["resp_rate"] = resp_rate
# Track history
self.vital_history["heart_rate"].append(heart_rate)
self.vital_history["resp_rate"].append(resp_rate)
# Keep last 1000 readings
for key in self.vital_history:
if len(self.vital_history[key]) > 1000:
self.vital_history[key].pop(0)
# Detect respiratory distress pattern
if resp_rate > 24:
spo2 = self.current_vitals.get("spo2", 98)
if spo2 < 92: # Hypoxemia despite tachypnea
self.respiratory_distress.emit(
patient_id=self.patient_id,
resp_rate=resp_rate,
spo2=spo2,
trend="ESCALATING",
action="ASSESS_FOR_RESPIRATORY_FAILURE"
)
# Detect cardiac arrhythmia (simplified)
if ecg_rhythm != "Normal_Sinus":
Intent.emit("CardiacArrhythmia",
patient_id=self.patient_id,
rhythm=ecg_rhythm,
heart_rate=heart_rate,
action="NOTIFY_PROVIDER_ECG_REVIEW")
self.calculate_mews()
self.assess_sepsis_risk()
@Sensor.on_data("automated_bp")
def monitor_blood_pressure(self, systolic, diastolic, map_pressure):
"""Track hemodynamic stability"""
self.current_vitals["bp_systolic"] = systolic
self.current_vitals["bp_diastolic"] = diastolic
self.vital_history["bp_systolic"].append(systolic)
# Detect hypotension trend
if len(self.vital_history["bp_systolic"]) > 10:
recent_bps = self.vital_history["bp_systolic"][-10:]
avg_recent = sum(recent_bps) / len(recent_bps)
if avg_recent < 90 and systolic < avg_recent - 5: # Declining hypotension
self.hemodynamic_instability.emit(
patient_id=self.patient_id,
systolic_bp=systolic,
map=map_pressure,
trend="DECLINING_HYPOTENSION",
action="ASSESS_FOR_SHOCK_BLEEDING_SEPSIS"
)
self.calculate_mews()
@Sensor.on_data("pulse_oximeter")
def monitor_oxygenation(self, spo2, pleth_waveform_quality):
"""Track oxygen saturation"""
self.current_vitals["spo2"] = spo2
self.vital_history["spo2"].append(spo2)
# Hypoxemia alert
if spo2 < 90 and pleth_waveform_quality == "Good":
self.respiratory_distress.emit(
patient_id=self.patient_id,
spo2=spo2,
severity="CRITICAL",
action="INCREASE_SUPPLEMENTAL_OXYGEN_ASSESS_AIRWAY"
)
@Sensor.on_data("continuous_temp_patch")
def monitor_temperature(self, temp_c):
"""Track temperature trends"""
self.current_vitals["temp_c"] = temp_c
self.vital_history["temp_c"].append(temp_c)
self.calculate_mews()
self.assess_sepsis_risk()
@Sensor.on_data("actigraphy_wearable")
def monitor_mobility(self, step_count_1h, movement_intensity, position_changes):
"""Detect mobility decline or fall risk"""
# Establish baseline from first 24 hours
# Detect significant mobility decline (>50% from baseline)
# Simplified: alert on very low mobility
if step_count_1h < 10 and position_changes < 2:
# Patient immobile for extended period
Intent.emit("MobilityDecline",
patient_id=self.patient_id,
step_count=step_count_1h,
probable_cause="PAIN_DELIRIUM_OR_WEAKNESS",
action="ASSESS_PATIENT_MOBILITY_BARRIERS")
# High nocturnal activity (fall risk)
current_hour = datetime.now().hour
if 22 <= current_hour or current_hour <= 6: # Night hours
if movement_intensity > 0.7: # Active at night
self.fall_risk.emit(
patient_id=self.patient_id,
time="NIGHTTIME",
movement_level="HIGH",
action="IMPLEMENT_FALL_PRECAUTIONS_FREQUENT_ROUNDING"
)
# Example instantiation for post-surgical patient
patient_412 = HospitalPatient(
patient_id="MRN-8847291",
admission_diagnosis="Post-Op Day 2 Colectomy",
age=68
)
Figure A.11 presents a comprehensive 24-hour patient monitoring scenario demonstrating early sepsis detection in a post-operative patient. The visualization integrates four critical surveillance dimensions: vital signs trending (heart rate, respiratory rate, blood pressure, temperature), Modified Early Warning Score (MEWS) evolution with velocity analysis, lab results progression (white blood cell count, lactate), and clinical intervention timeline. The annotated sequence shows how multi-parameter deterioration detected at Hour 12 triggers sepsis protocol activation 6 hours before traditional threshold-based alarms would fire, enabling early antibiotic administration during the critical "golden hour" window that reduces mortality by 15–20% compared to delayed recognition.
Figure A.11: Integrated early warning system detecting sepsis onset in post-operative patient (68-year-old, post-colectomy Day 2) over 24-hour monitoring period. Panel 1: Multi-parameter vital signs trending reveals subtle coordinated deterioration: heart rate gradually increasing (72→115 bpm), respiratory rate escalating (14→26 breaths/min), systolic blood pressure declining (128→95 mmHg), and temperature spiking (37.2→38.9°C). Individual parameters remain within traditional alarm thresholds until Hour 18, but composite pattern indicates SIRS (Systemic Inflammatory Response Syndrome) by Hour 12. Panel 2: Modified Early Warning Score (MEWS) aggregates vital sign deviations into single acuity metric. MEWS escalates from baseline 1 (low risk) to 5 (high risk) at Hour 12, crossing rapid response threshold. Critical innovation: velocity analysis detects acceleration (+0.8 points/hour over 3-hour window), indicating not just elevated score but rapidly worsening trajectory. System fires PhysiologicalDeteriorationDetected alert at Hour 12, 6 hours before traditional single-parameter alarms would trigger. Panel 3: Lab results timeline showing infection and organ dysfunction progression. Baseline labs (Hour 0) normal: WBC 8.5×10⁹/L, lactate 1.2 mmol/L. Follow-up labs at Hour 12 (triggered by MEWS alert) reveal WBC 16.2 (leukocytosis), lactate 3.4 mmol/L (tissue hypoperfusion). Combined with vital signs (RR≥22, SBP≤100, altered mentation), patient meets qSOFA ≥2 criteria for high sepsis mortality risk, triggering SepsisRiskElevated intent and sepsis bundle protocol. Post-intervention labs at Hour 24 show improvement: WBC declining to 12.1, lactate normalizing to 1.8. Panel 4: Clinical intervention timeline comparing Spaxiom early warning vs. traditional threshold-based detection. Early warning track (green): MEWS alert at Hour 12 → stat labs ordered immediately → positive sepsis markers confirmed → broad-spectrum antibiotics initiated Hour 13.5 (within "golden hour" window). Traditional threshold track (red): individual parameter alarms fire Hour 18 when vital signs breach static limits → delayed recognition → antibiotics Hour 19 (5.5 hours later). Literature evidence: Every 1-hour delay in sepsis antibiotic administration increases mortality 7.6%. 5.5-hour advantage translates to estimated 15–20% relative mortality reduction through early intervention during compensated shock phase before irreversible organ damage.
Healthcare systems using Spaxiom-based early warning systems have demonstrated:
The MEWS-based Clinical Acuity Score provides a standardized, evidence-based deterioration metric that integrates vital signs dynamics with clinical context (diagnosis, procedures, lab results). By exposing actionable events like PhysiologicalDeteriorationDetected (composite score with velocity analysis), SepsisRiskElevated (infection + organ dysfunction fusion), and RespiratoryDistress (oxygenation + work of breathing integration), Spaxiom enables closed-loop patient surveillance where monitoring intensity dynamically adapts to acuity: high-risk patients trigger automated nurse rounding escalation (every 1 hour vs. routine 4-hour intervals) and proactive rapid response team notification before traditional "call criteria" thresholds are met. Integration with EHR workflows embeds early warning alerts directly into nursing documentation systems and mobile HIPAA-secure messaging platforms, reducing alert-to-response time from 15–30 minutes (overhead paging systems) to 2–5 minutes (targeted push notifications with clinical context). Critical innovation: system learns facility-specific alarm thresholds through retrospective analysis of historical deterioration events, tuning sensitivity/specificity trade-offs to local patient population characteristics, staffing models, and intervention capacity—transforming one-size-fits-all static scores into adaptive surveillance tailored to organizational needs while maintaining validated clinical evidence base.