Skip to content

Instantly share code, notes, and snippets.

@halcwb
Created July 27, 2023 22:07
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/7514d08bea541377235b485fbb0564a5 to your computer and use it in GitHub Desktop.
Save halcwb/7514d08bea541377235b485fbb0564a5 to your computer and use it in GitHub Desktop.
Calculate the Alveolar Arterial Oxygen Difference
Sub Main
Console.WriteLine(CalcAaDO2(50, 60, 80))
End Sub
' Calculate the Alveolar Arterial Oxygen Difference. Returns -1 if calculation not possible
' AaDO2 = (713 * FiO2) - (PaCO2 / 0.8) - PaO2
Function CalcAaDO2(dblPaCO2 As Double, dblPaO2 As Double, dblFiO2 As Double) As Double
Dim dblRatio As Double = -1
If dblFiO2 > 1 Then dblFiO2 = dblFiO2 / 100
If dblPaCO2 > 0 And dblPaO2 > 0 And dblFiO2 > 0 Then
dblRatio = (713 * dblFiO2) - (dblPaCO2 / 0.8) - dblPaO2
End If
Return dblRatio
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment