Needle decompression in latest pulse code

I built the latest Pulse from source today (using the integration branch, commit f6f0a3e9). I had to tweak my code a little (e.g., the SEHemorrhage.ExternalCompartment class seems to have been replaced by the HemorrageData.eCompartment class), but otherwise things appear to work fine.

But on closer inspection it appears that the needle decompression action has changed in some way. I’m using the soldier patient and inducing these injuries at time 0:

  • Hemorrhage, right chest, severity 0.25
  • TensionPneumoThorax, right side, gate open, severity 0.7

Once the heart rate has started rising rapidly, I apply the following actions:

  • ChestOcclusiveDressing, right chest, state on
  • Hemorrhage, right chest, severity 0.0
  • NeedleDecompression, right chest, state on

With Pulse 4.1.0, after applying these actions the heart rate would return to ~100 bpm eventually. With the latest pulse from source, it seems that the heart rate keeps rising until it gets to ~192 bpm (which is lower than the 200 bpm that 4.1.0 would go up to).

The heart rate not coming down seems like a bug. Or maybe the actions I have to take are different? Or additional parameters are now needed (although I don’t see any error messages to that effect)? Maybe I just need a guide to the various changes that have to be made to update to the latest version (beyond fixing compiler errors).

Our models have changed over the version
You can see a list of changes here

This could have changed your scenario output…

If you could send me your log, I can easily rerun what you are doing and see what is happening
(This is also a new feature and really helps us to investigate issues like this)

How do I create the log? I have implemented a LogListener (on the Java side) and hardly anything gets logged there (I have it set at the trace level) – just a little bit at the beginning about loading the native libs.

https://gitlab.kitware.com/physiology/engine/-/blob/integration/src/java/com/kitware/pulse/howto/HowTo_EngineUse.java#L124

Got it! Here’s the log (the forum won’t let me attach the file directly):

[INFO] [0(s)] [SerializingFromFile] C:\Users\BOB~1.MAR\AppData\Local\Temp\isaac-pulse15960462575947792935\patients\Soldier@0s.json
[INFO] [0(s)] Human Adult Whole Body
[INFO] [0(s)] Version : 4.2.0
[INFO] [0(s)] GitHash : f6f0a3e9
[INFO] [0(s)] Build Time : Wed Apr 19 09:47:51 2023
[INFO] [0(s)] Loading state generated from Pulse-4.2.0-f6f0a3e9
[INFO] [0(s)] [SimTime(s)] 0(s)
[INFO] [0(s)] [Action]
{
 "PatientAction": {
  "Hemorrhage": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "Compartment": "Skin",
   "Type": "External",
   "Severity": {
    "Scalar0To1": {
     "Value": 0.01,
     "Unit": "",
     "ReadOnly": false
    }
   }
  }
 }
}

[INFO] [0(s)] [Action]
{
 "PatientAction": {
  "Hemorrhage": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "Compartment": "Muscle",
   "Type": "External",
   "Severity": {
    "Scalar0To1": {
     "Value": 0.01,
     "Unit": "",
     "ReadOnly": false
    }
   }
  }
 }
}

[INFO] [0(s)] [Action]
{
 "PatientAction": {
  "TensionPneumothorax": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "Type": "Open",
   "Side": "Right",
   "Severity": {
    "Scalar0To1": {
     "Value": 0.7,
     "Unit": "",
     "ReadOnly": false
    }
   }
  }
 }
}

[INFO] [45.18(s)] [Event] 45.18(s),  Patient has Tachycardia
[INFO] [57.06(s)] Baroreceptors Saturated 
[INFO] [59.66(s)] Baroreceptors Saturated 
[INFO] [65.24(s)] Starting Baroreceptor timer 
[INFO] [71(s)] [Action]
{
 "PatientAction": {
  "ChestOcclusiveDressing": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "State": "On",
   "Side": "Right"
  }
 }
}

[INFO] [71(s)] [Action]
{
 "PatientAction": {
  "ChestOcclusiveDressing": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "State": "On",
   "Side": "Right"
  }
 }
}

[INFO] [71(s)] [Action]
{
 "PatientAction": {
  "Hemorrhage": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "Compartment": "Skin",
   "Type": "External",
   "Severity": {
    "Scalar0To1": {
     "Value": 0,
     "Unit": "",
     "ReadOnly": false
    }
   }
  }
 }
}

[INFO] [71(s)] [Action]
{
 "PatientAction": {
  "Hemorrhage": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "Compartment": "Muscle",
   "Type": "External",
   "Severity": {
    "Scalar0To1": {
     "Value": 0,
     "Unit": "",
     "ReadOnly": false
    }
   }
  }
 }
}

[INFO] [76.72(s)] [Event] 76.72(s),  Patient has Hypoxia
[INFO] [85.64(s)] [Event] 85.64(s),  Patient has Tachypnea
[INFO] [88(s)] [Action]
{
 "PatientAction": {
  "NeedleDecompression": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "State": "On",
   "Side": "Right"
  }
 }
}

[INFO] [88(s)] [Action]
{
 "PatientAction": {
  "NeedleDecompression": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "State": "On",
   "Side": "Right"
  }
 }
}

I was able to run your scenario in both the new and old versions for comparison and it looks like changes to our collapsing lung model since version 4.1.0 are making it so needle decompression doesn’t allow the patient to trend towards healthy as much. The tension pneumothorax model now matches validation data better, especially for cardiovascular vitals, but the heart rate doesn’t drop when needle decompression is applied.

I’ll see if there’s a “quick fix” that I can apply that would still be valid and won’t deviate from the other expected outcomes.

@bob.marinier I pushed a fix to the feature/needle_decompression_update branch that should have the patient’s vitals trend more toward healthy when a needle decompression is performed. It will likely get merged into the integration branch soon.

Thanks @coolwebb. Pulse is now crashing for me. It starts up fine, and I’m able to create the needle decompression action, but when I create that action and then advance time, there’s a crash on the native side during the call to nativeAdvanceTimeStep(nativeObj).

Here’s pulse.log; it contains a lot of warnings that weren’t there before. Also, it looks like the patient state models haven’t been updated since commit f6f0a3e9 – maybe that’s the problem?

[INFO] [0(s)] [SerializingFromFile] C:\Users\BOB~1.MAR\AppData\Local\Temp\isaac-pulse17166371710646230072\patients\Soldier@0s.json
[INFO] [0(s)] Human Adult Whole Body
[INFO] [0(s)] Version : 4.2.0
[INFO] [0(s)] GitHash : e9c5b74a
[INFO] [0(s)] Build Time : Mon Apr 24 16:15:56 2023
[INFO] [0(s)] Loading state generated from Pulse-4.2.0-f6f0a3e9
[INFO] [0(s)] [SimTime(s)] 0(s)
[WARN] [0(s)] Could not find expected Pulmonary compartment, LeftNeedle in compartment manager
[WARN] [0(s)] Could not find expected Pulmonary compartment, RightNeedle in compartment manager
[WARN] [0(s)] Could not find expected Aerosol compartment, LeftNeedle in compartment manager
[WARN] [0(s)] Could not find expected Aerosol compartment, RightNeedle in compartment manager
[WARN] [0(s)] Could not find expected Pulmonary compartment, LeftNeedle in compartment manager
[WARN] [0(s)] Could not find expected Pulmonary compartment, RightNeedle in compartment manager
[WARN] [0(s)] Could not find expected Aerosol compartment, LeftNeedle in compartment manager
[WARN] [0(s)] Could not find expected Aerosol compartment, RightNeedle in compartment manager
[WARN] [0(s)] Could not find expected Pulmonary compartment, LeftNeedle in compartment manager
[WARN] [0(s)] Could not find expected Pulmonary compartment, RightNeedle in compartment manager
[WARN] [0(s)] Could not find expected Aerosol compartment, LeftNeedle in compartment manager
[WARN] [0(s)] Could not find expected Aerosol compartment, RightNeedle in compartment manager
[INFO] [0(s)] [Action]
{
 "PatientAction": {
  "Hemorrhage": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "Compartment": "Skin",
   "Type": "External",
   "Severity": {
    "Scalar0To1": {
     "Value": 0.01,
     "Unit": "",
     "ReadOnly": false
    }
   }
  }
 }
}

[INFO] [0(s)] [Action]
{
 "PatientAction": {
  "Hemorrhage": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "Compartment": "Muscle",
   "Type": "External",
   "Severity": {
    "Scalar0To1": {
     "Value": 0.01,
     "Unit": "",
     "ReadOnly": false
    }
   }
  }
 }
}

[INFO] [0(s)] [Action]
{
 "PatientAction": {
  "TensionPneumothorax": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "Type": "Open",
   "Side": "Right",
   "Severity": {
    "Scalar0To1": {
     "Value": 0.7,
     "Unit": "",
     "ReadOnly": false
    }
   }
  }
 }
}

[WARN] [0(s)] Could not find expected Pulmonary compartment, LeftNeedle in compartment manager
[WARN] [0(s)] Could not find expected Pulmonary compartment, RightNeedle in compartment manager
[WARN] [0(s)] Could not find expected Aerosol compartment, LeftNeedle in compartment manager
[WARN] [0(s)] Could not find expected Aerosol compartment, RightNeedle in compartment manager
[INFO] [45.18(s)] [Event] 45.18(s),  Patient has Tachycardia
[INFO] [57.06(s)] Baroreceptors Saturated 
[INFO] [59.66(s)] Baroreceptors Saturated 
[INFO] [65.24(s)] Starting Baroreceptor timer 
[INFO] [76.24(s)] [Event] 76.24(s),  Patient has Hypoxia
[INFO] [85.7(s)] [Event] 85.7(s),  Patient has Tachypnea
[INFO] [101.9(s)] [Event] 101.9(s),  Patient has Antidiuresis
[INFO] [129(s)] [Action]
{
 "PatientAction": {
  "ChestOcclusiveDressing": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "State": "On",
   "Side": "Right"
  }
 }
}

[INFO] [129(s)] [Action]
{
 "PatientAction": {
  "ChestOcclusiveDressing": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "State": "On",
   "Side": "Right"
  }
 }
}

[INFO] [129(s)] [Action]
{
 "PatientAction": {
  "NeedleDecompression": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "State": "On",
   "Side": "Right"
  }
 }
}

[INFO] [129(s)] [Action]
{
 "PatientAction": {
  "NeedleDecompression": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "State": "On",
   "Side": "Right"
  }
 }
}

[INFO] [129(s)] [Action]
{
 "PatientAction": {
  "Hemorrhage": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "Compartment": "Skin",
   "Type": "External",
   "Severity": {
    "Scalar0To1": {
     "Value": 0,
     "Unit": "",
     "ReadOnly": false
    }
   }
  }
 }
}

[INFO] [129(s)] [Action]
{
 "PatientAction": {
  "Hemorrhage": {
   "PatientAction": {
    "Action": {
     "Comment": ""
    }
   },
   "Compartment": "Muscle",
   "Type": "External",
   "Severity": {
    "Scalar0To1": {
     "Value": 0,
     "Unit": "",
     "ReadOnly": false
    }
   }
  }
 }
}

[WARN] [129(s)] Could not find expected Pulmonary compartment, LeftNeedle in compartment manager
[WARN] [129(s)] Could not find expected Pulmonary compartment, RightNeedle in compartment manager
[WARN] [129(s)] Could not find expected Aerosol compartment, LeftNeedle in compartment manager
[WARN] [129(s)] Could not find expected Aerosol compartment, RightNeedle in compartment manager

The state you are loading is Loading state generated from Pulse-4.2.0-f6f0a3e9

It looks like in updating the needle decompression model, Jeff has created new objects for the needle decompression model so we can cleanly and dynamically modify the circuit/compartment graph better. These objects are expected in the state and serialization ensures they are part of the loaded state. They are not in the f6f state file, but will be from now on, so if you regenerate your states you should be good

We have been moving most of our dynamic circuit/compartment modifying actions to this more formal pattern.

Thanks!

You can do this from a cmd prompt in your install/bin
type: run genStates

That worked! The needle decompression works as expected now. Thanks!