forked from bjmoonn/hacksc-x-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
/
triage.py
38 lines (33 loc) · 875 Bytes
/
triage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def check_lifesaving(patient):
if patient['apneic'] or patient['pulseless'] or patient['unresponsive'] or patient['spo2'] < 90:
return 1
else:
return 0
def check_high_risk(patient):
if patient['confusion'] or patient['severe_pain'] or patient['high_risk_situation']:
return 2
else:
return 0
def check_resources(patient):
if patient['resources'] >= 2:
return 3
elif patient['resources'] == 1:
return 4
else:
return 5
def check_vitals(level, patient):
if level == 3:
if patient['hr'] > 100 or patient['rr'] > 20 or patient['spo2'] < 95:
return 2
else:
return 3
else:
return level
def get_esi(patient):
level = check_lifesaving(patient)
if level == 0:
level = check_high_risk(patient)
if level == 0:
level = check_resources(patient)
level = check_vitals(level, patient)
return level