Cookbook 361: Offline Clinical Surgical Critical Care Abdominal Compartment Syndrome WSACS & APP Engine

This cookbook details how to deploy a localized, containerized surgical critical care, trauma surgery, and acute care medicine decision-support engine for trauma resuscitation bays, surgical intensive care units ($\text{SICUs}$), and emergency laparotomy suites to ingest transvesical bladder pressure measurements, arterial blood pressures, ventilatory compliance indices, urine output kinetics, and fluid balance volumes, classify systemic compromise according to the World Society of the Abdominal Compartment Syndrome ($\text{WSACS 2013 / 2024}$) Intra-Abdominal Hypertension ($\text{IAH}$ Grades I–IV) Staging, compute the Abdominal Perfusion Pressure ($\text{APP} = \text{MAP} - \text{IAP}$), execute the 5-Step Medical Decompression Protocol (Intraluminal, Space-Occupying, Compliance, Fluid Optimization), gate Emergent Decompressive Laparotomy with Open Abdomen Negative Pressure Wound Therapy ($\text{NPWT}$), and enforce Reperfusion Washout Shock & Bladder Instillation Volume Sentinels according to WSACS and Eastern Association for the Surgery of Trauma ($\text{EAST}$) consensus guidelines without external cloud API reliance.


1. Clinical Background & Surgical ICU Pathophysiology

Intra-Abdominal Hypertension ($\text{IAH}$) and Abdominal Compartment Syndrome ($\text{ACS}$) represent life-threatening sequelae of severe blunt/penetrating torso trauma, massive fluid resuscitation ($> 5\text{ L}$ crystalloids), damage-control laparotomy, severe acute pancreatitis, retroperitoneal hemorrhage, and ruptured abdominal aortic aneurysms:


2. Pipeline & Workflow Architecture

[Surgical ICU Telemetry: Bladder IAP mmHg, MAP mmHg, UO, PIP, PaO2/FiO2, Fluid Balance]
                                         │
                                         â–¼
      [Bladder Transduction QC Auditor: Enforce <= 25mL Instillation Volume]
                                         │
                                         â–¼
      [WSACS IAH Staging Matrix: Normal (5-7) vs Grade I-IV (12-15, 16-20, 21-25, >25)]
                                         │
                                         â–¼
      [Abdominal Perfusion Pressure (APP) Engine: APP = MAP - IAP (Target >= 60 mmHg)]
                                         │
                                         â–¼
      [Abdominal Compartment Syndrome (ACS) Evaluator: IAP > 20 + New Organ Failure]
                                         │
                                         â–¼
      [5-Step Medical Escalation Hierarchy: Intraluminal, PCD, NMB, Fluid Depletion]
                                         │
                                         â–¼
      [Emergent Decompressive Laparotomy Gating & Reperfusion Washout Sentinels]

3. Environment & Prerequisites

Install required scientific Python and surgical critical care modeling packages:

pip install numpy scipy pandas torch torchvision matplotlib

4. Complete Offline Python / PyTorch Implementation

"""
Cookbook 361: Offline Surgical Critical Care Abdominal Compartment Syndrome WSACS & APP Engine
OpenPHR Clinical AI Working Group (https://openphr.org)
"""

import math
import numpy as np
import pandas as pd
from typing import Dict, List, Tuple, Optional
from dataclasses import dataclass

@dataclass
class ACSTelemetry:
    patient_id: str
    age_years: float = 46.0
    patient_weight_kg: float = 82.0
    # Pressure Telemetry
    bladder_iap_mmhg: float = 23.5 # >= 21-25 mmHg = Grade III IAH
    instillation_volume_ml: float = 25.0 # Must be <= 25 mL per WSACS Kron standard
    mean_arterial_pressure_mmhg: float = 72.0 # APP = 72 - 23.5 = 48.5 mmHg (< 60 mmHg!)
    # Ventilatory & Respiratory Telemetry
    pao2_fio2_ratio: float = 175.0 # <= 200 = Severe pulmonary compromise
    peak_inspiratory_pressure_cmh2o: float = 38.0 # High intrathoracic transmission
    is_mechanically_ventilated: bool = True
    # Renal & Perfusion Telemetry
    urine_output_ml_kg_hr: float = 0.22 # < 0.5 mL/kg/h = Oliguria (Renal Failure)
    serum_creatinine_mg_dl: float = 2.1
    # Fluid Balance & Interventions
    net_fluid_balance_24h_liters: float = 8.4 # Massive positive fluid resuscitation
    has_nasogastric_tube: bool = True
    has_percutaneous_drain: bool = False
    is_receiving_neuromuscular_blockade: bool = False

@dataclass
class ACSEvaluationReport:
    patient_id: str
    wsacs_iah_grade: str # "GRADE III INTRA-ABDOMINAL HYPERTENSION (21-25 mmHg)"
    abdominal_perfusion_pressure_mmhg: float # 48.5 mmHg
    acs_diagnosis_status: str # "CONFIRMED ABDOMINAL COMPARTMENT SYNDROME (ACS)"
    stepped_medical_orders: List[str]
    surgical_decompression_recommendation: str
    safety_sentinels: List[str]
    clinical_wsacs_east_directive: str

class AbdominalCompartmentDecisionEngine:
    """
    Offline clinical engine for WSACS IAH grading, Abdominal Perfusion Pressure (APP)
    optimization, stepped medical escalation, and emergent decompressive laparotomy gating.
    """

    def audit_transduction_quality(self, d: ACSTelemetry) -> Tuple[bool, List[str]]:
        sentinels = []
        is_valid = True

        if d.instillation_volume_ml > 25.0:
            is_valid = False
            sentinels.append(f"🚨 TRANSDUCTION ARTIFACT ERROR: Bladder instillation volume ({d.instillation_volume_ml:.0f} mL) exceeds WSACS 25 mL limit. High instillation volumes stretch the detrusor muscle, falsely overestimating IAP by 4-8 mmHg. Repeat transduction with strictly <= 20-25 mL sterile saline!")

        return is_valid, sentinels

    def stage_wsacs_iah(self, iap: float) -> Tuple[str, str]:
        if iap > 25.0:
            return "GRADE IV INTRA-ABDOMINAL HYPERTENSION (IAP > 25 mmHg)", "Extreme, life-threatening pressure; severe visceral hypoperfusion and cardiac collapse."
        elif 21.0 <= iap <= 25.0:
            return "GRADE III INTRA-ABDOMINAL HYPERTENSION (IAP 21 to 25 mmHg)", "Severe intra-abdominal hypertension; high risk of progression to full compartment syndrome."
        elif 16.0 <= iap <= 20.0:
            return "GRADE II INTRA-ABDOMINAL HYPERTENSION (IAP 16 to 20 mmHg)", "Moderate intra-abdominal hypertension; requires immediate medical escalation."
        elif 12.0 <= iap <= 15.0:
            return "GRADE I INTRA-ABDOMINAL HYPERTENSION (IAP 12 to 15 mmHg)", "Mild intra-abdominal hypertension; initiate baseline surveillance."
        else:
            return "NORMAL INTRA-ABDOMINAL PRESSURE (< 12 mmHg)", "Intra-abdominal pressure is within acceptable physiological limits."

    def calculate_app(self, d: ACSTelemetry) -> float:
        app = d.mean_arterial_pressure_mmhg - d.bladder_iap_mmhg
        return round(app, 1)

    def evaluate_acs(self, d: ACSTelemetry, iap: float, app: float) -> Tuple[str, List[str]]:
        failures = []

        # Renal Failure
        if d.urine_output_ml_kg_hr < 0.50 or d.serum_creatinine_mg_dl >= 2.0:
            failures.append(f"Oliguric Renal Failure (UO {d.urine_output_ml_kg_hr:.2f} mL/kg/h, Cr {d.serum_creatinine_mg_dl:.1f})")

        # Respiratory Failure
        if d.pao2_fio2_ratio <= 200.0 or d.peak_inspiratory_pressure_cmh2o >= 35.0:
            failures.append(f"Respiratory Failure (PaO2/FiO2 {d.pao2_fio2_ratio:.0f}, PIP {d.peak_inspiratory_pressure_cmh2o:.0f} cmH2O)")

        # Hemodynamic / Perfusion Failure
        if app < 60.0:
            failures.append(f"Visceral Hypoperfusion (APP {app:.1f} mmHg < 60 mmHg)")

        if iap > 20.0 and len(failures) >= 1:
            status = f"🚨 CONFIRMED ABDOMINAL COMPARTMENT SYNDROME (ACS) - Sustained IAP {iap:.1f} mmHg with {len(failures)} New Organ Failures: {'; '.join(failures)}."
        elif iap >= 12.0:
            status = f"Intra-Abdominal Hypertension without Fulminant ACS ({len(failures)} organ dysfunctions detected)."
        else:
            status = "No Abdominal Compartment Syndrome."

        return status, failures

    def generate_stepped_medical_plan(self, d: ACSTelemetry, iap: float, app: float) -> List[str]:
        orders = []

        orders.append("1. STEP 1 (EVACUATE INTRALUMINAL CONTENTS):")
        if not d.has_nasogastric_tube:
            orders.append("   • STAT Placement of Nasogastric/Orogastric Tube on low intermittent suction.")
        else:
            orders.append("   • Verify NG/OG tube patency; initiate rectal tube drainage and prokinetics (Metoclopramide 10mg IV q6h).")

        orders.append("2. STEP 2 (EVACUATE SPACE-OCCUPYING LESIONS):")
        orders.append("   • Perform bedside abdominal ultrasound/CT to assess for drainable ascites, retroperitoneal hematoma, or abscess; perform percutaneous catheter drainage (PCD) if fluid present.")

        orders.append("3. STEP 3 (IMPROVE ABDOMINAL WALL COMPLIANCE):")
        orders.append("   • Deep sedation and analgesia (fentanyl + midazolam/propofol); avoid patient-ventilator dyssynchrony.")
        if not d.is_receiving_neuromuscular_blockade and iap >= 16.0:
            orders.append("   • Initiate Trial of Neuromuscular Blockade (Cisatracurium bolus + continuous infusion) to reduce abdominal wall tension.")

        orders.append("4. STEP 4 (OPTIMIZE FLUID RESUSCITATION & PERFUSION):")
        orders.append(f"   • Target Abdominal Perfusion Pressure (APP) >= 60 mmHg (Current: {app:.1f} mmHg). Titrate Norepinephrine to maintain MAP >= {iap + 60.0:.0f} mmHg.")
        if d.net_fluid_balance_24h_liters > 3.0:
            orders.append("   • CEASE CRYSTALLOID RESUSCITATION. Initiate diuresis (Furosemide + 20% Albumin) or CRRT with net ultrafiltration to achieve negative fluid balance.")

        return orders

    def evaluate_surgical_decompression(self, d: ACSTelemetry, iap: float, app: float, has_acs: bool) -> Tuple[str, List[str]]:
        sentinels = []

        if iap > 25.0 or (has_acs and (app < 50.0 or d.urine_output_ml_kg_hr < 0.30)):
            surg_rec = "🚨 STAT EMERGENT DECOMPRESSIVE LAPAROTOMY MANDATED: Patient has refractory ACS with critical visceral hypoperfusion and multi-organ failure. Immediate surgical decompression with Open Abdomen Negative Pressure Wound Therapy (NPWT / ABThera) indicated."
            sentinels.append("🚨 REPERFUSION WASHOUT SHOCK HAZARD: Surgical release of abdominal fascia releases massive sequestered lactate, potassium, and acid metabolites into systemic circulation while mesenteric vasodilation causes sudden blood pooling. PRE-HYDRATE, PUSH 2 AMPS NaHCO3, AND TITRATE NOREPINEPHRINE BEFORE FASCIAL OPENING TO PREVENT FATAL ASYSTOLE!")
        elif has_acs:
            surg_rec = "URGENT SURGICAL CONSULTATION & DECOMPRESSION PREPARATION: Implement maximal medical escalation for 1-2 hours. If IAP remains > 20 mmHg or organ failure worsens, proceed immediately to decompressive laparotomy."
        else:
            surg_rec = "Surgical decompression not immediately indicated. Continue medical management and serial IAP q4h."

        return surg_rec, sentinels

    def evaluate_case(self, data: ACSTelemetry) -> ACSEvaluationReport:
        is_qc_valid, sentinels_qc = self.audit_transduction_quality(data)
        iap = data.bladder_iap_mmhg
        app = self.calculate_app(data)
        iah_stage, iah_desc = self.stage_wsacs_iah(iap)
        acs_status, failures = self.evaluate_acs(data, iap, app)
        has_acs = "CONFIRMED ABDOMINAL COMPARTMENT SYNDROME" in acs_status

        med_orders = self.generate_stepped_medical_plan(data, iap, app)
        surg_rec, sentinels_surg = self.evaluate_surgical_decompression(data, iap, app, has_acs)

        all_sentinels = sentinels_qc + sentinels_surg

        directives = []
        directives.append(f"STAGE: {iah_stage}.")
        directives.append(f"APP: {app:.1f} mmHg (Target >= 60).")
        directives.append(f"STATUS: {acs_status}.")
        directives.append(f"SURGERY: {surg_rec}.")

        return ACSEvaluationReport(
            patient_id=data.patient_id,
            wsacs_iah_grade=iah_stage,
            abdominal_perfusion_pressure_mmhg=app,
            acs_diagnosis_status=acs_status,
            stepped_medical_orders=med_orders,
            surgical_decompression_recommendation=surg_rec,
            safety_sentinels=all_sentinels,
            clinical_wsacs_east_directive=" ".join(directives)
        )

# Example Execution & Verification
if __name__ == "__main__":
    engine = AbdominalCompartmentDecisionEngine()

    print("=" * 80)
    print("OpenPHR Clinical Surgical ICU Abdominal Compartment Syndrome & APP Engine")
    print("=" * 80)

    # Test Case 1: 46-year-old male s/p exploratory laparotomy and massive transfusion for severe trauma.
    # Labs/Telemetry: Bladder IAP 23.5 mmHg (Grade III IAH), MAP 72 mmHg -> APP 48.5 mmHg (< 60!).
    # Respiratory: PaO2/FiO2 175, PIP 38 cmH2O. Renal: Oliguria 0.22 mL/kg/h, Cr 2.1 mg/dL.
    # Diagnosis: Confirmed Abdominal Compartment Syndrome (ACS) with dual organ failure!
    # Triage: 5-Step Medical Escalation + STAT Decompressive Laparotomy Gating!
    # Sentinel: Pre-decompression bicarb and pressors for Reperfusion Washout Shock!
    acs1 = ACSTelemetry(
        patient_id="SICU-ACS-8801",
        age_years=46.0,
        patient_weight_kg=82.0,
        bladder_iap_mmhg=23.5,
        instillation_volume_ml=25.0,
        mean_arterial_pressure_mmhg=72.0,
        pao2_fio2_ratio=175.0,
        peak_inspiratory_pressure_cmh2o=38.0,
        is_mechanically_ventilated=True,
        urine_output_ml_kg_hr=0.22,
        serum_creatinine_mg_dl=2.1,
        net_fluid_balance_24h_liters=8.4,
        has_nasogastric_tube=True,
        has_percutaneous_drain=False,
        is_receiving_neuromuscular_blockade=False
    )

    rep1 = engine.evaluate_case(acs1)

    print(f"\n[Patient {rep1.patient_id} - Surgical ICU ACS Assessment]")
    print(f"WSACS Staging: {rep1.wsacs_iah_grade}")
    print(f"Abdominal Perfusion Pressure (APP): {rep1.abdominal_perfusion_pressure_mmhg:.1f} mmHg (Target >= 60 mmHg)")
    print(f"ACS Status:\n  {rep1.acs_diagnosis_status}")
    print("\nStepped Medical Management Orders:")
    for o in rep1.stepped_medical_orders:
        print(f"  {o}")
    print(f"\nSurgical Decompression Directive:\n  {rep1.surgical_decompression_recommendation}")
    if rep1.safety_sentinels:
        print("\nSafety Sentinels:")
        for s in rep1.safety_sentinels:
            print(f"  🚨 {s}")
    print(f"\nWSACS / EAST Consensus Directive:\n{rep1.clinical_wsacs_east_directive}")

5. Clinical Verification & Guideline Conformance


6. References