Cookbook 365: Offline Clinical Pediatric Nephrology HUS STEC vs aHUS & Eculizumab Engine

This cookbook details how to deploy a localized, containerized pediatric nephrology, pediatric intensive care ($\text{PICU}$), and hematology decision-support engine for pediatric emergency departments, dialysis units, and apheresis suites to ingest microangiopathic hemolytic anemia markers, thrombocytopenia kinetics, stool Shiga toxin polymerase chain reaction ($\text{PCR}$) assays, $\text{ADAMTS13}$ activity percentages, and complement profiles, classify thrombotic microangiopathies according to the Thrombotic Microangiopathy ($\text{TMA}$) Triad Matrix ($\text{STEC-HUS}$ vs Atypical $\text{aHUS}$ vs $\text{TTP}$), automate Weight-Based Eculizumab (Terminal Complement C5 Inhibitor) Induction Protocols ($<10\text{kg, } 10-19\text{kg, } 20-29\text{kg, } 30-39\text{kg, } \ge 40\text{kg}$), enforce Strict Antibiotic & Antidiarrheal Contraindication Sentinels in $\text{STEC-HUS}$, gate Continuous Renal Replacement Therapy ($\text{CRRT}$) / Hemodialysis, and manage Mandatory Meningococcal Antimicrobial Prophylaxis according to $\text{KDIGO}$, European Society for Paediatric Nephrology ($\text{ESPN}$), and French $\text{HUS}$ Reference Center consensus guidelines without external cloud API reliance.


1. Clinical Background & Pediatric Nephrology Architecture

Hemolytic Uremic Syndrome ($\text{HUS}$) is the leading cause of intrinsic acute kidney injury in children, defined by the classic Thrombotic Microangiopathy ($\text{TMA}$) Triad:


2. Pipeline & Workflow Architecture

[Pediatric Telemetry: Weight kg, Bloody Diarrhea, Schistocytes %, LDH, Platelets, Cr, Stool Stx]
                                         β”‚
                                         β–Ό
      [TMA Triad Evaluator: MAHA (Schistocytes >= 1%) + Thrombocytopenia + AKI]
                                         β”‚
                                         β–Ό
      [ADAMTS13 & Stx Diagnostic Matrix: TTP (<10%) vs STEC-HUS (Stx+) vs aHUS (Stx-)]
                                         β”‚
                                         β–Ό
      [STEC-HUS Pathway: Supportive + Dialysis Gating + Absolute Antibiotic Prohibition]
                                         β”‚
                                         β–Ό
      [aHUS Pathway: Weight-Based Eculizumab Induction Protocol (<10kg, 10-19, 20-29, 30-39, >=40)]
                                         β”‚
                                         β–Ό
      [Meningococcal Antimicrobial Prophylaxis Sentinel: MenACWY/MenB + Oral Penicillin]
                                         β”‚
                                         β–Ό
      [Platelet Transfusion Restriction Sentinel: Avoid Microvascular Thrombosis Fuel]

3. Environment & Prerequisites

Install required scientific Python and pediatric nephrology modeling packages:

pip install numpy scipy pandas torch torchvision matplotlib

4. Complete Offline Python / PyTorch Implementation

"""
Cookbook 365: Offline Pediatric Nephrology HUS STEC vs aHUS & Eculizumab 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 HUSTelemetry:
    patient_id: str
    age_years: float = 4.5
    patient_weight_kg: float = 16.5 # 10 - 19 kg bracket
    # Clinical History
    has_bloody_diarrhea_prodrome: bool = False # Diarrhea-negative -> Higher aHUS suspicion
    days_of_symptoms: int = 4
    # Hematologic & Hemolysis Telemetry (MAHA)
    schistocytes_percent: float = 3.2 # >= 1.0% = Positive MAHA
    serum_ldh_u_l: float = 2450.0 # Markedly elevated (> 2x ULN)
    serum_haptoglobin_mg_dl: float = 2.0 # Undetectable (< 10 mg/dL)
    direct_antiglobulin_test_coombs: str = "Negative" # DAT Negative
    platelet_count_k_ul: float = 38.0 # < 150 k/uL = Severe Thrombocytopenia
    # Renal Telemetry (AKI)
    serum_creatinine_mg_dl: float = 2.4 # Markedly elevated (Baseline 0.4)
    baseline_creatinine_mg_dl: float = 0.4
    urine_output_ml_kg_hr: float = 0.28 # < 0.5 mL/kg/h = Oliguria
    has_hematuria_proteinuria: bool = True
    # Diagnostic Assays
    stool_shiga_toxin_pcr_or_eia: str = "Negative" # "Positive", "Negative", "Pending"
    adamts13_activity_percent: float = 68.0 # >= 10% = Rules out TTP!
    serum_c3_mg_dl: float = 62.0 # Low (Normal 90 - 180) -> Alternative complement activation
    serum_c4_mg_dl: float = 24.0 # Normal (Normal 10 - 40)
    # Clinical Complications
    has_active_severe_bleeding: bool = False
    is_invasive_procedure_planned: bool = False

@dataclass
class HUSEvaluationReport:
    patient_id: str
    tma_triad_status: str # "CONFIRMED THROMBOTIC MICROANGIOPATHY (TMA TRIAD MET)"
    etiological_diagnosis: str # "ATYPICAL HEMOLYTIC UREMIC SYNDROME (aHUS - COMPLEMENT-MEDIATED)"
    eculizumab_dosing_schedule: List[str]
    renal_and_supportive_orders: List[str]
    safety_sentinels: List[str]
    clinical_kdigo_espn_directive: str

class HUSNephrologyDecisionEngine:
    """
    Offline clinical engine for Thrombotic Microangiopathy (TMA) validation,
    STEC-HUS vs aHUS differential gating, Eculizumab weight-based induction titration,
    and antibiotic / meningococcal prophylaxis sentinels.
    """

    def evaluate_tma_triad(self, d: HUSTelemetry) -> Tuple[bool, List[str]]:
        features = []

        # 1. MAHA
        if d.schistocytes_percent >= 1.0 and d.serum_ldh_u_l > 500.0 and d.serum_haptoglobin_mg_dl < 10.0:
            features.append(f"Microangiopathic Hemolytic Anemia (Schistocytes {d.schistocytes_percent:.1f}%, LDH {d.serum_ldh_u_l:.0f} U/L, Undetectable Haptoglobin)")

        # 2. Thrombocytopenia
        if d.platelet_count_k_ul < 150.0:
            features.append(f"Consumptive Thrombocytopenia (Platelets {d.platelet_count_k_ul:.0f} k/uL)")

        # 3. AKI
        cr_ratio = d.serum_creatinine_mg_dl / max(0.1, d.baseline_creatinine_mg_dl)
        if cr_ratio >= 1.5 or d.urine_output_ml_kg_hr < 0.50:
            features.append(f"Acute Kidney Injury (Cr {d.serum_creatinine_mg_dl:.1f} mg/dL [{cr_ratio:.1f}x baseline], UO {d.urine_output_ml_kg_hr:.2f} mL/kg/h)")

        is_triad_complete = len(features) == 3
        return is_triad_complete, features

    def classify_etiology(self, d: HUSTelemetry, is_tma: bool) -> Tuple[str, str]:
        if not is_tma:
            return "NON-TMA ILLNESS", "Full diagnostic triad for Thrombotic Microangiopathy not met."

        # Rule out TTP
        if d.adamts13_activity_percent < 10.0:
            return "THROMBOTIC THROMBOCYTOPENIC PURPURA (TTP)", "Severe ADAMTS13 deficiency (<10%); indicates TTP requiring immediate Therapeutic Plasma Exchange (TPE) + Caplacizumab."

        # STEC-HUS vs aHUS
        stx = d.stool_shiga_toxin_pcr_or_eia.lower()
        if "positive" in stx:
            return "STEC-HUS (SHIGA TOXIN-PRODUCING E. COLI HUS)", "Typical D+ HUS confirmed by positive Shiga toxin assay. Driven by microvascular endothelial Stx binding."
        elif "negative" in stx:
            if d.serum_c3_mg_dl < 80.0 or not d.has_bloody_diarrhea_prodrome:
                return "ATYPICAL HEMOLYTIC UREMIC SYNDROME (aHUS - COMPLEMENT-MEDIATED)", "Primary complement-mediated TMA driven by dysregulated alternative pathway C5 convertase activity. Immediate C5 inhibitor indicated."
            else:
                return "SUSPECTED aHUS / PROBABLE COMPLEMENT-MEDIATED TMA", "Negative Shiga toxin assay; high clinical suspicion for atypical HUS."
        else:
            return "INDETERMINATE TMA (Awaiting Shiga Toxin & Genetics)", "Pending stool Shiga toxin confirmation."

    def generate_eculizumab_schedule(self, d: HUSTelemetry, etiology: str) -> Tuple[List[str], List[str]]:
        orders = []
        sentinels = []
        wt = d.patient_weight_kg

        if "ATYPICAL" in etiology or "SUSPECTED aHUS" in etiology:
            orders.append("1. ECULIZUMAB (SOLIRIS) TERMINAL C5 COMPLEMENT INHIBITOR PROTOCOL:")

            if wt < 10.0:
                orders.append("   β€’ Weight Bracket < 10 kg:")
                orders.append("     - Induction: 300 mg IV Day 1.")
                orders.append("     - Maintenance: 300 mg IV at Week 2, then 300 mg IV every 3 weeks.")
            elif 10.0 <= wt < 20.0:
                orders.append(f"   β€’ Weight Bracket 10 - 19 kg (Current Weight: {wt:.1f} kg):")
                orders.append("     - Induction: 600 mg IV Day 1.")
                orders.append("     - Maintenance: 300 mg IV at Week 2, then 300 mg IV every 2 weeks.")
            elif 20.0 <= wt < 30.0:
                orders.append(f"   β€’ Weight Bracket 20 - 29 kg (Current Weight: {wt:.1f} kg):")
                orders.append("     - Induction: 600 mg IV Day 1.")
                orders.append("     - Maintenance: 600 mg IV at Week 2, then 600 mg IV every 2 weeks.")
            elif 30.0 <= wt < 40.0:
                orders.append(f"   β€’ Weight Bracket 30 - 39 kg (Current Weight: {wt:.1f} kg):")
                orders.append("     - Induction: 600 mg IV Day 1.")
                orders.append("     - Maintenance: 600 mg IV at Week 2, then 900 mg IV every 2 weeks.")
            else: # >= 40 kg
                orders.append(f"   β€’ Weight Bracket >= 40 kg (Current Weight: {wt:.1f} kg):")
                orders.append("     - Induction: 900 mg IV weekly x 4 weeks.")
                orders.append("     - Maintenance: 1,200 mg IV at Week 5, then 1,200 mg IV every 2 weeks.")

            # Meningococcal Sentinel
            sentinels.append("🚨 MANDATORY MENINGOCOCCAL PROPHYLAXIS (Black-Box Warning): Terminal complement blockade increases invasive Neisseria meningitidis infection risk > 1,000-fold! ADMINISTER STAT MenACWY + MenB CONJUGATE VACCINES AND INITIATE ORAL AMOXICILLIN / PENICILLIN PROPHYLAXIS (x at least 2 weeks until vaccine immunity and throughout therapy duration)!")

        elif "STEC-HUS" in etiology:
            orders.append("1. ECULIZUMAB NOT ROUTINELY INDICATED IN STEC-HUS: Disease is driven by direct Shiga toxin receptor injury rather than primary complement gene mutation. Reserve Eculizumab strictly for severe life-threatening extra-renal CNS involvement.")

            # STEC Antibiotic Absolute Contraindication Sentinel
            sentinels.append("🚨 ABSOLUTE ANTIBIOTIC CONTRAINDICATION IN STEC-HUS: Antibiotics (e.g., fluoroquinolones, co-trimoxazole, beta-lactams) induce bacterial lysis and massively upregulate Shiga toxin expression/release into the intestinal lumen, dramatically exacerbating systemic TMA and neurological complications. STRICTLY AVOID ANTIBIOTICS!")

            # Antidiarrheal Sentinel
            sentinels.append("🚨 ABSOLUTE ANTIDIARRHEAL CONTRAINDICATION: Antimotility agents (e.g. Loperamide) prolong bowel transit time and maximize mucosal absorption of Shiga toxins. NEVER administer antimotility agents!")

        return orders, sentinels

    def generate_renal_and_transfusion_plan(self, d: HUSTelemetry) -> Tuple[List[str], List[str]]:
        orders = []
        sentinels = []

        # Renal Gating
        if d.urine_output_ml_kg_hr < 0.30 or d.serum_creatinine_mg_dl >= 2.0:
            orders.append("2. RENAL REPLACEMENT THERAPY (CRRT / HEMODIALYSIS) GATING:")
            orders.append("   β€’ STAT Pediatric Nephrology Consult for CRRT / Hemodialysis catheter placement in severe oliguria, volume overload, or refractory hyperkalemia.")
        else:
            orders.append("2. RENAL SUPPORTIVE CARE: Strict fluid balance titration, isovolemic hydration, and avoidance of nephrotoxic agents.")

        # Platelet Transfusion Sentinel
        if d.platelet_count_k_ul < 50.0 and not d.has_active_severe_bleeding and not d.is_invasive_procedure_planned:
            sentinels.append(f"🚨 PLATELET TRANSFUSION RESTRICTION (Platelets {d.platelet_count_k_ul:.0f} k/uL): Prophylactic platelet transfusions are CONTRAINDICATED in TMA/HUS as transfused platelets aggregate on damaged endothelium, exacerbating microvascular thrombosis and organ infarction. TRANSFUSE PLATELETS ONLY FOR LIFE-THREATENING HEMORRHAGE OR URGENT SURGERY!")

        return orders, sentinels

    def evaluate_case(self, data: HUSTelemetry) -> HUSEvaluationReport:
        is_tma, tma_features = self.evaluate_tma_triad(data)
        triad_status = "CONFIRMED THROMBOTIC MICROANGIOPATHY (TMA Triad Complete)" if is_tma else "INCOMPLETE TMA TRIAD"
        etiology, etio_desc = self.classify_etiology(data, is_tma)
        eculiz_orders, sent_eculiz = self.generate_eculizumab_schedule(data, etiology)
        renal_orders, sent_renal = self.generate_renal_and_transfusion_plan(data)

        all_sentinels = sent_eculiz + sent_renal

        directives = []
        directives.append(f"TRIAD: {triad_status}.")
        directives.append(f"ETIOLOGY: {etiology}.")
        if eculiz_orders: directives.append(f"MANAGEMENT: {eculiz_orders[0]}.")
        directives.append("MONITORING: Daily LDH, haptoglobin, platelets, creatinine, and urine output.")

        return HUSEvaluationReport(
            patient_id=data.patient_id,
            tma_triad_status=triad_status,
            etiological_diagnosis=etiology,
            eculizumab_dosing_schedule=eculiz_orders,
            renal_and_supportive_orders=renal_orders,
            safety_sentinels=all_sentinels,
            clinical_kdigo_espn_directive=" ".join(directives)
        )

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

    print("=" * 80)
    print("OpenPHR Clinical Pediatric Nephrology HUS STEC vs aHUS & Eculizumab Engine")
    print("=" * 80)

    # Test Case 1: 4.5-year-old female (16.5 kg) presenting with severe pallor, petechiae, and anuria.
    # Labs: Schistocytes 3.2%, LDH 2450 U/L, Haptoglobin 2 mg/dL (MAHA), Platelets 38k/uL (Thrombocytopenia).
    # Renal: Cr 2.4 mg/dL (Baseline 0.4), UO 0.28 mL/kg/h (Oliguric AKI) -> Complete TMA Triad!
    # Differential: Stool Shiga Toxin Negative, ADAMTS13 68% (TTP Excluded), Low C3 62 mg/dL.
    # Diagnosis: Atypical Hemolytic Uremic Syndrome (aHUS - Complement-Mediated)!
    # Triage: Eculizumab 10-19 kg bracket (600 mg IV Day 1, then 300 mg at Wk 2, then q2w) + MenACWY/MenB + Penicillin Prophylaxis!
    # Sentinels: Platelet Transfusion Restriction + Meningococcal Antimicrobial Guardrail!
    hus1 = HUSTelemetry(
        patient_id="PEDS-NEPH-6601",
        age_years=4.5,
        patient_weight_kg=16.5,
        has_bloody_diarrhea_prodrome=False,
        days_of_symptoms=4,
        schistocytes_percent=3.2,
        serum_ldh_u_l=2450.0,
        serum_haptoglobin_mg_dl=2.0,
        direct_antiglobulin_test_coombs="Negative",
        platelet_count_k_ul=38.0,
        serum_creatinine_mg_dl=2.4,
        baseline_creatinine_mg_dl=0.4,
        urine_output_ml_kg_hr=0.28,
        has_hematuria_proteinuria=True,
        stool_shiga_toxin_pcr_or_eia="Negative",
        adamts13_activity_percent=68.0,
        serum_c3_mg_dl=62.0,
        serum_c4_mg_dl=24.0,
        has_active_severe_bleeding=False,
        is_invasive_procedure_planned=False
    )

    rep1 = engine.evaluate_case(hus1)

    print(f"\n[Patient {rep1.patient_id} - Pediatric TMA Assessment]")
    print(f"TMA Triad Status: {rep1.tma_triad_status}")
    print(f"Etiological Diagnosis: {rep1.etiological_diagnosis}")
    print("\nEculizumab Dosing Schedule:")
    for o in rep1.eculizumab_dosing_schedule:
        print(f"  {o}")
    print("\nRenal & Supportive Orders:")
    for r in rep1.renal_and_supportive_orders:
        print(f"  {r}")
    if rep1.safety_sentinels:
        print("\nSafety Sentinels:")
        for s in rep1.safety_sentinels:
            print(f"  🚨 {s}")
    print(f"\nKDIGO / ESPN Consensus Directive:\n{rep1.clinical_kdigo_espn_directive}")

5. Clinical Verification & Guideline Conformance


6. References