Skip to content

Instantly share code, notes, and snippets.

@halcwb
Created July 27, 2023 21:51
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/68e5e336d3b5a2d2347d1395a29b6718 to your computer and use it in GitHub Desktop.
Save halcwb/68e5e336d3b5a2d2347d1395a29b6718 to your computer and use it in GitHub Desktop.
Calculate the oxygenation index
Sub Main
Console.WriteLine(CalcOI(12, 80, 60))
Console.WriteLine(CalcOI(12, 0.8, 60))
End Sub
' Calculate the oxygenation index. Returns -1 if calculation not possible
' OI = (MAP * FiO2 * 100) / PaO2
Function CalcOI(dblMAP As Double, dblFiO2 As Double, dblPaO2 As Double) As Double
Dim dblOI As Double = -1
If dblFiO2 >= 0.21 And dblFiO2 <= 1 Then dblFiO2 = dblFiO2 * 100
If dblPaO2 > 0 And dblMAP > 0 And dblFiO2 >= 21 Then
dblOI = (dblMAP * dblFiO2) / dblPaO2
End If
Return dblOI
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment