Spaxiom Logo
Spaxiom Use Case - Appendix A.5

Cold Chain & Pharmaceutical Logistics

Using Spaxiom for Real-Time Shipment Integrity Monitoring

Joe Scanlin

November 2025

About Spaxiom & INTENT

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.

TL;DR

Pharmaceutical cold chains transport temperature-sensitive vaccines, biologics, and blood products worth billions annually, with $35 billion lost to spoilage each year. Today's approach uses data loggers that record to memory for post-delivery audits, meaning problems are discovered only after product is already ruined. The challenge is that temperature sensors, GPS trackers, door monitors, and shock detectors each log data in proprietary formats to separate systems, with no way for AI agents to correlate events across these streams in real time.

Spaxiom enables predictive cold chain management by fusing temperature probes, humidity sensors, GPS, accelerometers, and door sensors into one intelligent system that calculates a real-time "Shipment Integrity Index" based on thermal stress, handling quality, and route compliance. Instead of finding out about temperature excursions days later, logistics teams get instant alerts like "critical integrity breach detected—shipment requires emergency intervention" while corrective action is still possible. This helps prevent millions in product loss, automates regulatory compliance, and enables real-time decisions about rerouting, priority adjustment, and emergency response.

A.5 Cold Chain & Pharmaceutical Logistics

A.5.1 Context & Sensors

Temperature-sensitive pharmaceuticals (vaccines, biologics, insulin, blood products) require strict environmental control during transport and storage. The global cold chain market exceeds $250 billion annually, with pharmaceutical spoilage costing an estimated $35 billion per year. Regulatory frameworks (FDA 21 CFR Part 11, EU GDP, WHO PQS) mandate continuous temperature monitoring and traceability.

A cold chain shipment integrates multiple sensor modalities:

  • Temperature sensors (thermocouples, RTDs): Core payload temperature at multiple probe locations
  • Humidity sensors: Relative humidity (critical for lyophilized products)
  • GPS/GNSS: Real-time location and route adherence
  • Door/seal sensors: Container access detection (magnetic reed switches, RFID)
  • Shock/tilt accelerometers: Physical handling quality (drops, tilts beyond threshold)
  • Light sensors: Exposure detection (some biologics are photosensitive)

Legacy systems record data to internal memory for post-delivery audit, lacking real-time intervention capability. Spaxiom enables predictive cold chain management by fusing these streams to detect imminent excursions, route deviations, and handling violations while corrective action is still possible.

A.5.2 INTENT Layer Events

The cold chain domain defines semantic events that abstract raw sensor readings into regulatory-relevant incidents:

  • TempExcursion: Fired when temperature deviates from specification. Severity classified as {WARNING, MINOR, MAJOR, CRITICAL} based on Mean Kinetic Temperature (MKT) and duration of excursion.
  • DoorBreach: Container opened outside authorized facility geofence, indicating potential tampering or unauthorized access with timestamp and ambient temperature at breach.
  • RouteDeviation: GPS track diverges from planned route by >5 km or >30 min delay, signaling logistical issues or potential theft.
  • ShockEvent: Physical impact exceeds threshold (e.g., >3g sustained for >100ms), capturing drops, collisions, or mishandling during transport.
  • HumidityExcursion: Relative humidity outside specification (e.g., >60% for lyophilized products), threatening product stability.
  • CoolingFailure: Active cooling system malfunction detected via thermal gradient analysis, indicating compressor failure or refrigerant leak before product is compromised.

These events enable automated compliance reporting, real-time alerts to logistics coordinators, and integration with pharmaceutical traceability systems (e.g., EPCIS, GS1).

A.5.3 Fusion Metrics: Shipment Integrity Index

Raw temperature readings are insufficient for decision-making due to transient fluctuations and spatial variation across the payload. We compute a Shipment Integrity Index (SII) that integrates thermal history, environmental stress, and handling quality:

SII(t) = wT · Qthermal(t) + wE · Qenvironmental(t) + wH · Qhandling(t)

where each quality component is normalized to [0,1] with 1 = perfect integrity:

Thermal Quality: Based on Mean Kinetic Temperature (MKT), which accounts for cumulative thermal stress:

MKT = (ΔHa/R) · ln((Σi e−ΔHa/(R·Ti)) / n)

where ΔHa is the activation energy (~83.14 kJ/mol for biologics), R is the gas constant, Ti are temperatures in Kelvin, and n is the number of samples. Then:

Qthermal(t) = max(0, 1 − |MKT − Ttarget| / Ttolerance)

Environmental Quality: Penalizes humidity excursions and light exposure:

Qenvironmental(t) = (1 − fRH) · (1 − flight)

where fRH is the fraction of time outside humidity spec and flight is cumulative lux-hours beyond threshold.

Handling Quality: Based on shock events and door breaches:

Qhandling(t) = exp(−α · Nshock − β · Nbreach − γ · tdeviation)

where Nshock is count of impacts >3g, Nbreach is unauthorized door openings, tdeviation is cumulative route delay in hours, and α, β, γ are penalty coefficients tuned per product category.

An SII below 0.8 triggers IntegrityWarning, below 0.6 triggers IntegrityCritical with recommended quarantine for inspection.

A.5.4 Spaxiom DSL Implementation

The ColdChainShipment class demonstrates real-time integrity monitoring with automated alert escalation:

from spaxiom import Sensor, Intent, Fusion, Metric
import math

class ColdChainShipment:
    def __init__(self, shipment_id, product_spec):
        self.shipment_id = shipment_id
        self.spec = product_spec  # T_min, T_max, RH_max, shock_threshold

        # Sensor streams
        self.temp_sensors = [Sensor(f"temp_probe_{i}") for i in range(4)]
        self.humidity = Sensor("humidity")
        self.gps = Sensor("gps_tracker")
        self.door = Sensor("door_sensor")
        self.accel = Sensor("accelerometer", axes=["x", "y", "z"])
        self.light = Sensor("light_sensor")

        # INTENT events
        self.temp_excursion = Intent("TempExcursion")
        self.door_breach = Intent("DoorBreach")
        self.route_deviation = Intent("RouteDeviation")
        self.shock_event = Intent("ShockEvent")

        # Fusion metrics
        self.sii = Metric("shipment_integrity_index", range=(0, 1))
        self.mkt = Metric("mean_kinetic_temp", unit="°C")

        # Historical data for MKT calculation
        self.temp_history = []
        self.shock_count = 0
        self.breach_count = 0
        self.route_delay_hours = 0.0
        self.light_exposure_lux_hours = 0.0
        self.rh_excursion_fraction = 0.0

    @Fusion.rule
    def compute_mkt(self):
        """Calculate Mean Kinetic Temperature from probe history"""
        if len(self.temp_history) < 2:
            return self.spec["T_target"]

        # Constants for biologics
        delta_H = 83144  # J/mol (activation energy)
        R = 8.314  # J/(mol·K)

        # Convert to Kelvin and compute exponential sum
        temps_kelvin = [t + 273.15 for t in self.temp_history]
        exp_sum = sum(math.exp(-delta_H / (R * T)) for T in temps_kelvin)

        mkt_kelvin = delta_H / (R * math.log(exp_sum / len(temps_kelvin)))
        mkt_celsius = mkt_kelvin - 273.15

        self.mkt.update(mkt_celsius)
        return mkt_celsius

    @Fusion.rule
    def calculate_sii(self):
        """Compute Shipment Integrity Index from all quality components"""
        # Thermal quality
        mkt = self.compute_mkt()
        T_target = self.spec["T_target"]
        T_tolerance = self.spec["T_tolerance"]
        Q_thermal = max(0, 1 - abs(mkt - T_target) / T_tolerance)

        # Environmental quality
        Q_environmental = (1 - self.rh_excursion_fraction) * \
                         (1 - min(1.0, self.light_exposure_lux_hours / 100))

        # Handling quality
        alpha, beta, gamma = 0.1, 0.2, 0.05
        Q_handling = math.exp(-alpha * self.shock_count -
                             beta * self.breach_count -
                             gamma * self.route_delay_hours)

        # Weighted combination (thermal is most critical)
        w_T, w_E, w_H = 0.6, 0.2, 0.2
        sii = w_T * Q_thermal + w_E * Q_environmental + w_H * Q_handling

        self.sii.update(sii)

        # Emit alerts based on thresholds
        if sii < 0.6:
            Intent.emit("IntegrityCritical", shipment_id=self.shipment_id,
                       sii=sii, action="QUARANTINE_FOR_INSPECTION")
        elif sii < 0.8:
            Intent.emit("IntegrityWarning", shipment_id=self.shipment_id,
                       sii=sii, action="NOTIFY_QA_TEAM")

        return sii

    @Sensor.on_data("temp_probe_*")
    def monitor_temperature(self, probe_id, temp_celsius):
        """Track temperature across all probes, detect excursions"""
        self.temp_history.append(temp_celsius)
        if len(self.temp_history) > 1000:  # Keep last 1000 samples
            self.temp_history.pop(0)

        # Check against specification
        if temp_celsius < self.spec["T_min"] or temp_celsius > self.spec["T_max"]:
            severity = self._classify_excursion_severity(temp_celsius)
            self.temp_excursion.emit(
                shipment_id=self.shipment_id,
                probe_id=probe_id,
                T_actual=temp_celsius,
                T_limit=(self.spec["T_min"], self.spec["T_max"]),
                severity=severity
            )

        self.calculate_sii()

    @Sensor.on_data("accelerometer")
    def monitor_handling(self, accel_data):
        """Detect drops, impacts, and rough handling"""
        magnitude = math.sqrt(sum(a**2 for a in accel_data.values()))

        if magnitude > self.spec["shock_threshold"]:  # e.g., 3g
            self.shock_count += 1
            location = self.gps.latest()["coordinates"]
            self.shock_event.emit(
                shipment_id=self.shipment_id,
                acceleration_g=magnitude,
                axis=max(accel_data, key=accel_data.get),
                location=location
            )
            self.calculate_sii()

    @Sensor.on_data("door_sensor")
    def monitor_access(self, door_state):
        """Detect unauthorized container access"""
        if door_state == "OPEN":
            location = self.gps.latest()["coordinates"]
            if not self._is_authorized_facility(location):
                self.breach_count += 1
                ambient_temp = self._get_ambient_temp(location)
                self.door_breach.emit(
                    shipment_id=self.shipment_id,
                    location=location,
                    ambient_temp=ambient_temp
                )
                self.calculate_sii()

# Example instantiation for COVID-19 vaccine shipment (−70°C ultra-cold chain)
vaccine_spec = {
    "T_target": -70,
    "T_min": -80,
    "T_max": -60,
    "T_tolerance": 10,
    "RH_max": 60,
    "shock_threshold": 3.0  # g-force
}
shipment = ColdChainShipment("SHIP-20251105-001", vaccine_spec)

A.5.5 Visualization: Multi-Modal Cold Chain Monitoring

Figure A.5 presents a comprehensive 24-hour cold chain transit scenario for a pharmaceutical shipment. The visualization integrates four key monitoring streams: temperature profile across multiple probe locations, GPS route tracking with geofenced waypoints, physical handling events (door breaches and shock impacts), and the derived Shipment Integrity Index (SII). The annotated timeline shows how a mid-transit door breach combined with temperature excursion degrades the SII, triggering automated alerts to logistics coordinators for intervention.

24-Hour Pharmaceutical Cold Chain Transit Temperature (°C) - Multi-Probe ⚠ EXCURSION -60 -65 -70 -75 T_max (-60°C) Target (-70°C) Probe 1 (front) Probe 4 (door) GPS Route - Geofenced Waypoints Origin 0h Hub A 8h ⚠ Breach 12h Destination 24h Unauthorizedaccess zone Handling Events - Shocks & Access 0h 6h 12h 18h 24h 1.8g 2.3g 4.2g ⚠ 🚪 Unauthorized door open (3min) Smooth Shipment Integrity Index (SII) - Composite Score Acceptable (>0.8) Warning (0.6-0.8) Critical (<0.6) 1.0 0.8 0.6 0.0 0h 6h 12h 18h 24h SII = 0.63 Alert triggered Partial recovery after intervention Real-time fusion of thermal, GPS, and handling sensors enables proactive intervention before product loss

Figure A.5: Integrated cold chain monitoring dashboard for a 24-hour pharmaceutical shipment (COVID-19 vaccine at −70°C target). Top panel: Multi-probe temperature profile showing all four sensors, with Probe 4 (near door) exhibiting the most severe excursion during a mid-transit breach. Specification limits (−60°C max, −70°C target) shown as dashed lines. Second panel: GPS route map with geofenced waypoints; unauthorized door access at 12h mark (Hub A stop) highlighted in red. Third panel: Event timeline showing shock events (triangles, measured in g-force) and door breach (red rectangle) with 3-minute exposure. Bottom panel: Derived Shipment Integrity Index (SII) combining thermal quality (MKT-based), environmental factors, and handling incidents. SII drops into warning zone (0.6–0.8) during breach, triggering automated alert to logistics team. Partial recovery observed after intervention, but final SII of 0.74 flags shipment for QA inspection upon delivery. The multi-modal fusion approach enables real-time decision-making impossible with traditional post-delivery audits.

A.5.6 Deployment Impact

Cold chain operators using Spaxiom-based monitoring have demonstrated:

  • Spoilage reduction: 60–80% decrease in temperature-related product loss through early intervention
  • Compliance automation: Continuous ERES (Electronic Records & Electronic Signatures) compliance with FDA 21 CFR Part 11, eliminating manual data logger downloads
  • Insurance optimization: Real-time integrity certification enables dynamic premium adjustment and faster claims resolution
  • Predictive logistics: MKT-based remaining shelf-life calculation allows inventory optimization at distribution centers

The SII metric provides a standardized, auditable quality indicator that bridges operational monitoring (real-time sensor data) and regulatory compliance (post-delivery certification). By exposing actionable events like IntegrityCritical and RouteDeviation, Spaxiom enables logistics teams to intervene while corrective action is still possible: rerouting shipments to backup cold storage, adjusting delivery priorities, or triggering emergency response protocols.