@@ -30,18 +30,21 @@ specific language governing permissions and limitations under the License.
30
30
#include " properties/SEScalarTime.h"
31
31
#include " properties/SEScalarVolume.h"
32
32
#include " properties/SEScalarVolumePerTime.h"
33
+ #include " properties/SEScalar0To1.h"
33
34
#include " engine/PhysiologyEngineTrack.h"
34
35
#include " compartment/SECompartmentManager.h"
35
36
36
37
// --------------------------------------------------------------------------------------------------
37
38
// / \brief
38
- // / Usage for applying a Hemorrhage insult to the patient
39
+ // / Usage for applying a Hemorrhage insult to the patient and also demonstrate how injury code can be used to initiate a hemorrhage if desired
39
40
// /
40
41
// / \details
41
42
// / Refer to the SEHemorrhage class
42
43
// / Refer to the SESubstanceManager class
43
44
// / Refer to the SESubstanceIVFluids class for applying an IV to the patient
44
45
// --------------------------------------------------------------------------------------------------
46
+ std::string ParseMCIS (std::vector<unsigned int > &mcis);
47
+
45
48
void HowToHemorrhage ()
46
49
{
47
50
// Create the engine and load the patient
@@ -78,26 +81,35 @@ void HowToHemorrhage()
78
81
bg->GetLogger ()->Info (std::stringstream () <<" Diastolic Pressure : " << bg->GetCardiovascularSystem ()->GetDiastolicArterialPressure (PressureUnit::mmHg) << PressureUnit::mmHg);
79
82
bg->GetLogger ()->Info (std::stringstream () <<" Heart Rate : " << bg->GetCardiovascularSystem ()->GetHeartRate (FrequencyUnit::Per_min) << " bpm" );;
80
83
81
- // Hemorrhage Starts - instantiate a hemorrhage action and have the engine process it
82
- /* MCIS Code Brief :
83
- Digit 1 = Severity
84
- Digit 2 = Body Region(1 = Head, 2 = Torso, 3 = Arms, 4 = Legs, 5 = Multiple(not currently supported)
85
- Digit 3 = Subregion(not requied for arms or legs)
86
- In Head : 6 = Vessels
87
- In Torso : 6 = Vessels, 7 = Chest, 8 = Abdomen, 9 = Pelvis(not currently supported)
88
- Digit 4
89
- In Vessels : 1 = Intracranial, 3 - 5 = Carotid / Thoracic / Abdominal arteries(all currently removed from aorta compartment), 6 = VenaCava
90
- In Chest : 1 = Lungs, 2 = Heart In Abdomen : 1 = Liver, 2 = Spleen, 3 = Pancreas(Splanchnic), 4 = Kidney, 5 = SmallIntestine, 6 = LargeIntestine
91
- Digit 5 : Wound information too specific for BioGears(any number fine, 0 used here)
92
-
93
- Stopping a hemorrhage requires Severity = 0 and remainder of code consistent with original wound*/
84
+ // We are going to create a hemorrhage in two different ways. One way will be to specify the location and a severity on a scale of 0-1.
85
+ // The other way will be to parse an injury code and derive the location and severity
86
+ // Set the choice variable below either to 1 to run with location/severity or to 2 to run with injury code
87
+ int choice = 2 ;
94
88
95
- SEHemorrhage hemorrhageAbdominal;
96
- std::vector<unsigned int > hemorrhageStart = {4 ,2 ,6 ,5 ,0 };
97
- hemorrhageAbdominal.SetMCIS (hemorrhageStart);
98
- hemorrhageAbdominal.ProcessMCIS (); // Extracts the injury severity and injury location from the mcis code
89
+ // Create variables for scenario
90
+ SEHemorrhage hemorrhageSpleen; // hemorrhage object
91
+ std::string location; // location of hemorrhage, valid options are "Major Artery", "Vena Cava", "Head", "Myocardium", "Lung", "Spleen", "Splanchnic", "Small Intestine", "Large Intestine", "Kidney", "Liver", "Arm", "Leg"
92
+ double severity; // severity (scale 0-1)
93
+ std::vector<unsigned int > mcisCode; // injury code if using option 2, see ParseMCIS method below for more details
94
+ // Let's create an internal hemorrhage in the spleen (maybe it ruptured...)
95
+ switch (choice) {
96
+ case 1 :
97
+ location = " Spleen" ;
98
+ severity = 0.8 ;
99
+ break ;
100
+ case 2 :
101
+ mcisCode = { 4 ,2 ,8 ,2 ,0 }; // This injury code is a high severity hemorrhage in the spleen
102
+ severity = mcisCode[0 ] / 5.0 ; // Digit 1 of mcis is severity on 0-5 scale. Convert it to a 0-1 scale
103
+ location = ParseMCIS (mcisCode);
104
+ break ;
105
+ }
106
+ // Set up hemorrhage with the location and severity info
107
+ hemorrhageSpleen.SetCompartment (location);
108
+ hemorrhageSpleen.GetSeverity ().SetValue (severity);
109
+ hemorrhageSpleen.SetBleedPath (); // This is needed to tell engine which circuit pathway to set the hemorrhage on
99
110
100
- bg->ProcessAction (hemorrhageAbdominal);
111
+ // Hemorrhage Starts - instantiate a hemorrhage action and have the engine process it. Note that BioGears will output the injury code regardless of which method was used
112
+ bg->ProcessAction (hemorrhageSpleen);
101
113
102
114
// Advance some time to let the body bleed out a bit
103
115
tracker.AdvanceModelTime (300 );
@@ -111,11 +123,10 @@ void HowToHemorrhage()
111
123
bg->GetLogger ()->Info (std::stringstream () <<" Diastolic Pressure : " << bg->GetCardiovascularSystem ()->GetDiastolicArterialPressure (PressureUnit::mmHg) << PressureUnit::mmHg);
112
124
bg->GetLogger ()->Info (std::stringstream () <<" Heart Rate : " << bg->GetCardiovascularSystem ()->GetHeartRate (FrequencyUnit::Per_min) << " bpm" );;
113
125
114
- // Hemorrhage is sealed
115
- std::vector<unsigned int > hemorrhageEnd = { 0 ,2 ,6 ,5 ,0 };
116
- hemorrhageAbdominal.SetMCIS (hemorrhageEnd);
117
- hemorrhageAbdominal.ProcessMCIS ();
118
- bg->ProcessAction (hemorrhageAbdominal);
126
+ // Assume that the hemorrhage has been stopped somehow. We do this by setting the severity of our hemorrhage object to 0
127
+ hemorrhageSpleen.GetSeverity ().SetValue (0 );
128
+ // Process update to hemorrhage action
129
+ bg->ProcessAction (hemorrhageSpleen);
119
130
120
131
121
132
// Advance some time while the medic gets the drugs ready
@@ -151,3 +162,57 @@ void HowToHemorrhage()
151
162
bg->GetLogger ()->Info (std::stringstream () <<" Heart Rate : " << bg->GetCardiovascularSystem ()->GetHeartRate (FrequencyUnit::Per_min) << " bpm" );;
152
163
bg->GetLogger ()->Info (" Finished" );
153
164
}
165
+
166
+ std::string ParseMCIS (std::vector<unsigned int > &mcis)
167
+ {
168
+ /* MCIS Code Brief :
169
+ Digit 1 = Severity
170
+ Digit 2 = Body Region(1 = Head, 2 = Torso, 3 = Arms, 4 = Legs, 5 = Multiple(not currently supported)
171
+ Digit 3 = Subregion(not required for arms or legs)
172
+ In Head : 6 = Vessels
173
+ In Torso : 6 = Vessels, 7 = Chest, 8 = Abdomen, 9 = Pelvis(not currently supported)
174
+ Digit 4
175
+ In Vessels : 1 = Intracranial (if in head), 4 = Major Artery (if in torso), 6 = "Vena Cava" (if in torso)
176
+ In Chest : 1 = Lungs, 2 = Heart In Abdomen : 1 = Liver, 2 = Spleen, 3 = Pancreas(Splanchnic), 4 = Kidney, 5 = SmallIntestine, 6 = LargeIntestine
177
+ Digit 5 : Wound information too specific for BioGears(any number fine, 0 used here) */
178
+
179
+ std::string comp = " " ;
180
+ enum region {Head =1 , Torso = 2 , Arm = 3 , Leg = 4 }; // This will decide which region to look for compartment based on digit 2 of code
181
+ std::map<std::vector<unsigned int >, std::string> torsoMap; // There are so many compartments in the torso, it is easier to map them
182
+ // Populate torso map (codes with second digit = 2) so that digits 3-4 of code are key to correct compartment
183
+ torsoMap[{6 , 4 }] = " Major Artery" ;
184
+ torsoMap[{6 , 6 }] = " Vena Cava" ;
185
+ torsoMap[{7 , 1 }] = " Lung" ;
186
+ torsoMap[{7 , 2 }] = " Myocardium" ;
187
+ torsoMap[{8 , 1 }] = " Liver" ;
188
+ torsoMap[{8 , 2 }] = " Spleen" ;
189
+ torsoMap[{8 , 3 }] = " Splanchnic" ;
190
+ torsoMap[{8 , 4 }] = " Kidney" ;
191
+ torsoMap[{8 , 5 }] = " Small Intestine" ;
192
+ torsoMap[{8 , 6 }] = " Large Intestine" ;
193
+
194
+ int caseKey = mcis[1 ]; // Need 2nd digit of mcis code to decide in which region to place hemorrhage
195
+
196
+ switch (caseKey) {
197
+ case Head:
198
+ comp = " Head" ;
199
+ break ;
200
+ case Torso:
201
+ if (torsoMap.find ({ mcis.begin () + 2 ,mcis.end () - 1 }) != torsoMap.end ()) // Check to see if subvector made from digits 3-4 is in map.
202
+ comp = torsoMap[{mcis.begin () + 2 , mcis.end () - 1 }]; // If yes, get compartment that goes with these digits
203
+ else
204
+ comp = " Major Artery" ; // If no, we messed up somewhere and we'll put it on the artery so that the sim doesn't crash
205
+ break ;
206
+ case Arm:
207
+ comp = " Arm" ;
208
+ break ;
209
+ case Leg:
210
+ comp = " Leg" ;
211
+ break ;
212
+ default :
213
+ comp = " Major Artery" ; // Default to artery in case anything goes wrong
214
+ }
215
+
216
+
217
+ return comp;
218
+ }
0 commit comments