# Systems Perspective Description Language — Medical Devices (SPDL-MED) **Specification Document ID:** `SPDL-MED-SPEC-2026-v4.2` **Classification:** Open Epistemic Standard / Real-Time Zero-Heap Life-Critical Substrate **Principal Architect:** Asse van Nix | Systems Perspective Framework & Proof-Driven Architecture Group **Target Environment:** Zig 0.16.0 Freestanding Bare-Metal · Cortex-M4/M33 · IEEE 11073 Replacement **Applied Standards:** ISO/IEC 14977 EBNF · GBNF Maskable · IEC 62304 (Class C Medical Software) · ISO 14971 (Risk Management) · IEEE 11073 SDC Replacement · ISO 80601-2-12 (Ventilators) --- ## 1. Epistemic Architecture: Why IEEE 11073 and JSON/FHIR Must Be Replaced 1. **FHIR / JSON Serialization Hazards:** Transmitting clinical telemetry (infusion pump rates, arterial line pressure, ventilator tidal volumes) over JSON/FHIR requires dynamic memory allocation (`malloc`), recursive parsing, and garbage collection—strictly violating IEC 62304 Class C safety mandates. 2. **IEEE 11073 Complexity:** The Medical Device System (MDS) object architecture is so dense that medical devices require external gateway middleware, creating communication lag and latent synchronization errors in closed-loop ICU systems. **SPDL-MED** formalizes physiological pharmacokinetic and respiratory dynamics as machine-provable barrier certificates. --- ## 2. Physical Invariants, DAEs & Mathematical Proof Gates ``` SPDL-MED PHYSIOLOGICAL MANIFOLD ┌─────────────────────────────────────────────────────────────────────────────┐ │ CLOSED-LOOP VENTILATOR EQUATION OF MOTION (Respiratory Mechanics) │ │ P_airway(t) = (1 / C_rs) * V(t) + R_aw * (dV/dt) + PEEP │ ├─────────────────────────────────────────────────────────────────────────────┤ │ BAROTRAUMA AIRWAY PRESSURE BARRIER │ │ h_pressure(P_airway) = P_plateau_max - P_airway(t) >= 0 │ ├─────────────────────────────────────────────────────────────────────────────┤ │ PHARMACOKINETIC DRUG ACCUMULATION BARRIER (3-Compartment Mammillary Model) │ │ C_plasma = A * e^(-alpha*t) + B * e^(-beta*t) + C * e^(-gamma*t) │ │ h_dose(C_plasma) = C_toxicity_limit - C_plasma(t) >= 0 │ └─────────────────────────────────────────────────────────────────────────────┘ ``` --- ## 3. Formal ISO/IEC 14977 EBNF Grammar ```ebnf MedManifest = { Line } ; Line = [ Whitespace ] , ( Comment | MedRecord ) , Newline ; Whitespace = { " " | "\t" | "\r" } ; Newline = "\n" | "\r\n" ; Comment = "#" , { AnyChar - Newline } ; MedRecord = "(I) @MED_INVARIANT" , " " , InvariantFields | "(M) @PHYSIO_PROFILE" , " " , PhysioFields | "(B) @PRESSURE_BARRIER" , " " , PressureBarrierFields | "(B) @DOSE_BARRIER" , " " , DoseBarrierFields | "(M) @VENTILATOR_REG" , " " , VentFields | "(M) @INFUSION_REG" , " " , InfusionFields | "(T) @VITALS_OBSERVER" , " " , ObserverFields ; InvariantFields = "id:" , Token , " class_c:TRUE" , " loop_ms:" , Integer , " alloc_policy:ZERO_HEAP" ; PhysioFields = "id:" , Token , " patient_weight_kg:" , Number , " est_compliance_ml_cmh2o:" , Number ; PressureBarrierFields = "id:" , Token , " max_pip_cmh2o:" , Number , " max_peep_cmh2o:" , Number ; DoseBarrierFields = "id:" , Token , " drug:" , Token , " max_rate_ml_h:" , Number , " max_bolus_ml:" , Number ; VentFields = "id:" , Token , " mode:" , VentMode , " tidal_vol_ml:" , Number , " resp_rate_bpm:" , Integer , " fio2_pct:" , Number ; VentMode = "VOL_CONTROL" | "PRESS_CONTROL" | "SIMV_PRVC" | "CPAP_PSV" ; InfusionFields = "id:" , Token , " drug:" , Token , " rate_ml_h:" , Number , " target_site_conc_ug_ml:" , Number ; ObserverFields = "id:" , Token , " spo2_pct:" , Number , " pip_cmh2o:" , Number , " etco2_mmhg:" , Number , " hr_bpm:" , Integer ; Token = Letter , { Letter | Digit | "_" | "-" } ; Number = [ "-" ] , Digit , { Digit } , [ "." , { Digit } ] ; Integer = [ "-" ] , Digit , { Digit } ; Letter = "A".."Z" | "a".."z" ; Digit = "0".."9" ; AnyChar = ? Any valid Unicode code point ? ; ``` --- ## 4. GBNF Structured Sampling Grammar ```gbnf root ::= MedRecord "\n" MedRecord ::= "(I) @MED_INVARIANT" " " InvariantFields | "(M) @PHYSIO_PROFILE" " " PhysioFields | "(B) @PRESSURE_BARRIER" " " PressureBarrierFields | "(B) @DOSE_BARRIER" " " DoseBarrierFields | "(M) @VENTILATOR_REG" " " VentFields | "(M) @INFUSION_REG" " " InfusionFields | "(T) @VITALS_OBSERVER" " " ObserverFields InvariantFields ::= "id:" [A-Za-z0-9_-]+ " class_c:TRUE loop_ms:" [0-9]+ " alloc_policy:ZERO_HEAP" PhysioFields ::= "id:" [A-Za-z0-9_-]+ " patient_weight_kg:" [0-9.]+ " est_compliance_ml_cmh2o:" [0-9.]+ PressureBarrierFields ::= "id:" [A-Za-z0-9_-]+ " max_pip_cmh2o:" [0-9.]+ " max_peep_cmh2o:" [0-9.]+ DoseBarrierFields ::= "id:" [A-Za-z0-9_-]+ " drug:" [A-Za-z0-9_-]+ " max_rate_ml_h:" [0-9.]+ " max_bolus_ml:" [0-9.]+ VentFields ::= "id:" [A-Za-z0-9_-]+ " mode:" ("VOL_CONTROL"|"PRESS_CONTROL"|"SIMV_PRVC"|"CPAP_PSV") " tidal_vol_ml:" [0-9.]+ " resp_rate_bpm:" [0-9]+ " fio2_pct:" [0-9.]+ InfusionFields ::= "id:" [A-Za-z0-9_-]+ " drug:" [A-Za-z0-9_-]+ " rate_ml_h:" [0-9.]+ " target_site_conc_ug_ml:" [0-9.]+ ObserverFields ::= "id:" [A-Za-z0-9_-]+ " spo2_pct:" [0-9.]+ " pip_cmh2o:" [0-9.]+ " etco2_mmhg:" [0-9.]+ " hr_bpm:" [0-9]+ ``` --- ## 5. Production SPDL-MED Manifest Exemplar ```spdl # ============================================================================== # SPDL-MED v4.2 MANIFEST: CLOSED-LOOP ICU VENTILATOR & PROPOFOL INFUSION # Patient ID: ICU-BED-04 | Classification: IEC 62304 Class C | Zero-Heap # ============================================================================== (I) @MED_INVARIANT id:INV-LIFE-SUPPORT class_c:TRUE loop_ms:10 alloc_policy:ZERO_HEAP # --- PATIENT PHYSIOLOGICAL PROFILE --- (M) @PHYSIO_PROFILE id:PATIENT_70KG patient_weight_kg:72.5 est_compliance_ml_cmh2o:45.0 # --- CLINICAL SAFETY BARRIERS --- (B) @PRESSURE_BARRIER id:BAR_BAROTRAUMA max_pip_cmh2o:35.0 max_peep_cmh2o:15.0 (B) @DOSE_BARRIER id:BAR_PROPOFOL_LIMIT drug:PROPOFOL max_rate_ml_h:30.0 max_bolus_ml:5.0 # --- CONTINUOUS CLOSED-LOOP DELIVERIES --- (M) @VENTILATOR_REG id:VENT_PRVC mode:SIMV_PRVC tidal_vol_ml:440.0 resp_rate_bpm:14 fio2_pct:40.0 (M) @INFUSION_REG id:PUMP_CHANNEL_A drug:PROPOFOL rate_ml_h:18.5 target_site_conc_ug_ml:3.2 # --- PATIENT VITALS TELEMETRY --- (T) @VITALS_OBSERVER id:TEL_BED_MONITOR spo2_pct:98.4 pip_cmh2o:22.4 etco2_mmhg:38.2 hr_bpm:74 ``` --- ## 6. Standards Compliance Matrix ``` ╔═════════════════════════════════╦══════════════════════╦═════════════════════════════════════════════════════╗ ║ Dimension │ Verification Standard│ Enforced Implementation Evidence ║ ╠═════════════════════════════════╬══════════════════════╬═════════════════════════════════════════════════════╣ ║ Life-Critical Software Safety │ IEC 62304 Class C │ Guaranteed zero-heap allocation; bounded stack. ║ ║ Ventilator Barotrauma Prevention│ ISO 80601-2-12 │ Peak Airway Pressure strictly <= 35.0 cmH2O CBF. ║ ║ Closed-Loop Infusion Guard │ ISO 14971 Risk Limit │ Hard barrier prevents drug overdosing via QP limit. ║ ║ Deterministic Grammar Ingestion │ ISO/IEC 14977 / GBNF │ Syntactic error rate P = 0.000%. ║ ╚═════════════════════════════════╩══════════════════════╩═════════════════════════════════════════════════════╝ ```