Skip to content

Instantly share code, notes, and snippets.

@halcwb
Created September 4, 2023 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save halcwb/9bf2571b92e0d5f6203b76b7ecd26e60 to your computer and use it in GitHub Desktop.
Save halcwb/9bf2571b92e0d5f6203b76b7ecd26e60 to your computer and use it in GitHub Desktop.
Calculate the PELOD-2 score
Sub Main
End Sub
' Define other methods and classes here
Public Function CalcPELOD2Score(intGCS As Integer, strPupil As String, dblLactate As Double, intMAP As Integer,
intMos As Integer, dblCreat As Double, intPaO2 As Integer, intFiO2 As Integer,
intPaCO2 As Integer, blnVent As Boolean, intWBC As Integer, intPlatelets As Integer) As Integer
Dim intScore As Integer = 0
' Neurologic
If intGCS >= 11 Then
intScore += 0
ElseIf intGCS >= 5 And intGCS <= 10 Then
intScore += 1
ElseIf intGCS >= 3 And intGCS <= 4 Then
intScore += 4
End If
If strPupil = "reactive" Then
intScore += 0
ElseIf strPupil = "fixed" Then
intScore += 5
End If
' Cardiovascular
If dblLactate < 5.0 Then
intScore += 0
ElseIf dblLactate >= 5.0 And dblLactate <= 10.9 Then
intScore += 1
ElseIf dblLactate >= 11.0 Then
intScore += 3
End If
If intMos < 1 Then
If intMAP >= 46 Then
intScore += 0
ElseIf intMAP >= 31 And intMAP <= 45 Then
intScore += 1
ElseIf intMAP >= 17 And intMAP <= 30 Then
intScore += 2
ElseIf intMAP <= 16 Then
intScore += 4
End If
ElseIf intMos >= 1 And intMos <= 11 Then
If intMAP >= 55 Then
intScore += 0
ElseIf intMAP >= 39 And intMAP <= 54 Then
intScore += 1
ElseIf intMAP >= 25 And intMAP <= 38 Then
intScore += 2
ElseIf intMAP <= 24 Then
intScore += 4
End If
ElseIf intMos >= 12 And intMos <= 23 Then
If intMAP >= 60 Then
intScore += 0
ElseIf intMAP >= 44 And intMAP <= 59 Then
intScore += 1
ElseIf intMAP >= 31 And intMAP <= 43 Then
intScore += 2
ElseIf intMAP <= 30 Then
intScore += 4
End If
ElseIf intMos >= 24 And intMos <= 59 Then
If intMAP >= 62 Then
intScore += 0
ElseIf intMAP >= 46 And intMAP <= 61 Then
intScore += 1
ElseIf intMAP >= 32 And intMAP <= 44 Then
intScore += 2
ElseIf intMAP <= 31 Then
intScore += 4
End If
ElseIf intMos >= 60 And intMos <= 143 Then
If intMAP >= 65 Then
intScore += 0
ElseIf intMAP >= 49 And intMAP <= 64 Then
intScore += 1
ElseIf intMAP >= 36 And intMAP <= 48 Then
intScore += 2
ElseIf intMAP <= 35 Then
intScore += 4
End If
ElseIf intMos >= 144 Then
If intMAP >= 67 Then
intScore += 0
ElseIf intMAP >= 52 And intMAP <= 66 Then
intScore += 1
ElseIf intMAP >= 38 And intMAP <= 51 Then
intScore += 2
ElseIf intMAP <= 37 Then
intScore += 4
End If
End If
' Renal
If intMos < 1 Then
If dblCreat < 69 Then
intScore += 0
ElseIf dblCreat >= 70 Then
intScore += 2
End If
ElseIf intMos >= 1 And intMos <= 11 Then
If dblCreat < 22 Then
intScore += 0
ElseIf dblCreat >= 23 Then
intScore += 2
End If
ElseIf intMos >= 12 And intMos <= 23 Then
If dblCreat < 34 Then
intScore += 0
ElseIf dblCreat >= 35 Then
intScore += 2
End If
ElseIf intMos >= 24 And intMos <= 59 Then
If dblCreat < 50 Then
intScore += 0
ElseIf dblCreat >= 51 Then
intScore += 2
End If
ElseIf intMos >= 60 And intMos <= 143 Then
If dblCreat < 58 Then
intScore += 0
ElseIf dblCreat >= 59 Then
intScore += 2
End If
ElseIf intMos >= 144 Then
If dblCreat < 92 Then
intScore += 0
ElseIf dblCreat >= 93 Then
intScore += 2
End If
End If
' Respiratory
If intPaO2 / intFiO2 >= 61 Then
intScore += 0
ElseIf intPaO2 / intFiO2 <= 60 Then
intScore += 3
End If
If intPaCO2 >= 58 And intPaCO2 <= 94 Then
intScore += 0
ElseIf intPaCO2 < 58 Then
intScore += 1
ElseIf intPaCO2 >= 95 Then
intScore += 2
End If
If blnVent Then
intScore += 2
Else
intScore += 0
End If
' Hematologic
If intWBC > 2 Then
intScore += 0
ElseIf intWBC <= 2 Then
intScore += 2
End If
If intPlatelets >= 142 Then
intScore += 0
ElseIf intPlatelets >= 77 And intPlatelets <= 141 Then
intScore += 1
ElseIf intPlatelets <= 76 Then
intScore += 3
End If
Return intScore
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment