Howdy,
Loving Pulse. I’m trying to do some experiments regarding the efficacy of different ventilator modes for patients affected with ARDS. But I’m having some trouble getting the ventilators to improve the patient’s health at all.
I’m closely following the code provided in the HowTo_MechanicalVentilator.py file, and I’m using Pulse 4.1.0 through the Docker image.
def init_patient(
pulse,
data_mgr,
ards_left=0,
ards_right=0,
ards_severity=0,
):
# Load a default patient
data_root_dir = "/mnt/data/"
pc = SEPatientConfiguration()
pc.set_data_root_dir(data_root_dir)
pc.set_patient_file(f"{data_root_dir}/patients/StandardMale.json")
# ARDS - must set before initialisation
ards = pc.get_conditions().get_acute_respiratory_distress_syndrome()
ards.get_left_lung_affected().set_value(ards_left)
ards.get_right_lung_affected().set_value(ards_right)
ards.get_severity().set_value(ards_severity)
# Don't need to initialize if we serialize from file
# https://gitlab.kitware.com/physiology/engine/-/blob/stable/src/python/pulse/howto/HowTo_AsthmaAttack.py#L3
# Initialize the engine with our configuration
# In this case we've given the patient a condition (ARDS) so it needs to stabilise to a
# steady state (i.e. a converged system) so that we can work with it. Actions however are
# considred acute responses and do not require stabilization. Conditions can only be
# changed at run time via exacerbations
if not pulse.initialize_engine(pc, data_mgr):
print("Unable to load stabilize engine")
return
# May see something like this: 'Convergence took 26.5s to simulate 437s to get engine to a steady state'
# But note that the time 'in the sim' is still t=0 until we advance time
# Get default data at time 0s from the engine post initialization
print("Engine and patient initialized")
ards_setting = 0.8
init_patient(
pulse,
data_mgr,
ards_left=ards_setting,
ards_right=ards_setting,
ards_severity=ards_setting,
)
I’m using the standard male patient and setting their ARDS as shown above^^.
I simulate the patient for 8 minutes with no ventilation, and then I apply a ventilator (pc_ac) and simulate for another 8 minutes. The vent is set like so:
pc_ac = SEMechanicalVentilatorPressureControl()
pc_ac.set_connection(eSwitch.On)
pc_ac.set_mode(eMechanicalVentilator_PressureControlMode.AssistedControl)
pc_ac.get_fraction_inspired_oxygen().set_value(0.21)
pc_ac.get_inspiratory_period().set_value(1.0, TimeUnit.s)
pc_ac.get_inspiratory_pressure().set_value(13.0, PressureUnit.cmH2O)
pc_ac.get_positive_end_expired_pressure().set_value(5.0, PressureUnit.cmH2O)
pc_ac.get_respiration_rate().set_value(12.0, FrequencyUnit.Per_min)
pc_ac.get_slope().set_value(0.1, TimeUnit.s)
pulse.process_action(pc_ac)
Here’s an example of the patient’s readings throughout the simulation:
As you can see, the patient’s health for the first half of the simulation is as expected for severe ARDS, then as soon as the ventilator action is applied their health degrades significantly. awRR goes to 0, HR jumps, PLETH and SpO2 to zero … what have I done wrong here? It seems that the ventilator is not helping at all.
Any advice appreciated,
Isaac