# Needle decompression in latest pulse code

**URL:** https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019
**Category:** Pulse Physiology Engine
**Created:** [April 18, 2023, 6:50pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019 "2023-04-18T18:50:55Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![bob.marinier](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@bob.marinier](https://discourse.kitware.com/u/bob.marinier)
#### Post date: [April 18, 2023, 6:50pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019/1 "2023-04-18T18:50:55Z")

</div>

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).

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [April 18, 2023, 8:27pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019/2 "2023-04-18T20:27:38Z")

</div>

Our models have changed over the version  
You can see a list of [changes here](https://gitlab.kitware.com/physiology/engine/-/blob/integration/docs/Markdown/Versioning.md#pulse-v420-april-2023)

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)

---

<div class="post-metadata">

### Author: ![bob.marinier](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@bob.marinier](https://discourse.kitware.com/u/bob.marinier)
#### Post date: [April 19, 2023, 12:57pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019/3 "2023-04-19T12:57:48Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [April 19, 2023, 1:04pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019/4 "2023-04-19T13:04:34Z")

</div>

[https://gitlab.kitware.com/physiology/engine/-/blob/integration/src/java/com/kitware/pulse/howto/HowTo\_EngineUse.java#L124](https://gitlab.kitware.com/physiology/engine/-/blob/integration/src/java/com/kitware/pulse/howto/HowTo_EngineUse.java#L124)

---

<div class="post-metadata">

### Author: ![bob.marinier](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@bob.marinier](https://discourse.kitware.com/u/bob.marinier)
#### Post date: [April 19, 2023, 1:51pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019/5 "2023-04-19T13:51:04Z")

</div>

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

```auto
[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"
  }
 }
}

```

---

<div class="post-metadata">

### Author: ![coolwebb](https://discourse.kitware.com/user_avatar/discourse.kitware.com/coolwebb/32/25_2.png) [@coolwebb](https://discourse.kitware.com/u/coolwebb)
#### Post date: [April 20, 2023, 11:49pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019/6 "2023-04-20T23:49:42Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![coolwebb](https://discourse.kitware.com/user_avatar/discourse.kitware.com/coolwebb/32/25_2.png) [@coolwebb](https://discourse.kitware.com/u/coolwebb)
#### Post date: [April 24, 2023, 6:27pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019/7 "2023-04-24T18:27:28Z")

</div>

@bob.marinier I pushed a fix to the [feature/needle\_decompression\_update](https://gitlab.kitware.com/physiology/engine/-/tree/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.

---

<div class="post-metadata">

### Author: ![bob.marinier](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@bob.marinier](https://discourse.kitware.com/u/bob.marinier)
#### Post date: [April 24, 2023, 8:23pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019/8 "2023-04-24T20:23:35Z")

</div>

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?

```auto
[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

```

---

<div class="post-metadata">

### Author: ![abray](https://discourse.kitware.com/user_avatar/discourse.kitware.com/abray/32/12_2.png) [@abray](https://discourse.kitware.com/u/abray)
#### Post date: [April 24, 2023, 10:13pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019/9 "2023-04-24T22:13:19Z")

</div>

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`

---

<div class="post-metadata">

### Author: ![bob.marinier](https://discourse.kitware.com/letter_avatar_proxy/v4/letter/b/7ab992/32.png) [@bob.marinier](https://discourse.kitware.com/u/bob.marinier)
#### Post date: [April 25, 2023, 12:53pm UTC](https://discourse.kitware.com/t/needle-decompression-in-latest-pulse-code/1019/10 "2023-04-25T12:53:23Z")

</div>

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