This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "nuget: Newtonsoft.Json" | |
/// Utility methods to use ollama | |
/// https://github.com/ollama/ollama/blob/main/docs/api.md#generate-a-chat-completion | |
module Ollama = | |
open System |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Main | |
End Sub | |
' This function, CalculatePedSOFAScore, calculates the Pediatric Sequential Organ Failure Assessment (pSOFA) score for a child based on various physiological parameters. | |
' The pSOFA score is used to assess the extent of organ dysfunction in critically ill patients. | |
' | |
' The function takes several parameters including the age of the child in months, partial pressure of oxygen to fraction of inspired oxygen (PaO2/FiO2), | |
' saturation of peripheral oxygen to fraction of inspired oxygen (SpO2/FiO2), platelet count, bilirubin, mean arterial pressure (MAP), | |
' rates of infusion of various vasoactive drugs (Dopamine, Dobutamine, Epinephrine, Norepinephrine), Glasgow Coma Scale (GCS), and Creatinine. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Main | |
Dim SOFAScore As Integer | |
SOFAScore = CalculateSOFAScore(350, 120, 14, 1.5, 75, 0, 0, 0.1, 0.1, 2.5, 600, True) | |
Console.WriteLine("SOFA Score: " & SOFAScore) | |
End Sub | |
' A function that calculates a SOFA score (Sequential Organ Failure Assessment) | |
' This function calculates the SOFA (Sequential Organ Failure Assessment) score based on various parameters. | |
' The SOFA score is used to assess the extent of a person's organ function or rate of failure in the ICU (Intensive Care Unit). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Main | |
Dim SOFAScore As Integer | |
SOFAScore = CalculateSOFAScore(350, 120, 14, 1.5, 75, 0, 0, 0.1, 0.1, 2.5, 600, True) | |
Console.WriteLine("SOFA Score: " & SOFAScore) | |
End Sub | |
' A function that calculates a SOFA score (Sequential Organ Failure Assessment) | |
' This function calculates the SOFA (Sequential Organ Failure Assessment) score based on various parameters. | |
' The SOFA score is used to assess the extent of a person's organ function or rate of failure in the ICU (Intensive Care Unit). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Fixes the precision of a double number. | |
/// </summary> | |
/// <param name="dblNum">The double number to fix the precision of.</param> | |
/// <param name="intPrec">The desired precision.</param> | |
/// <returns>The double number with the fixed precision.</returns> | |
let fixPrecision (dblNum: double) (intPrec: int) : double = | |
let strNum = dblNum.ToString("F99", CultureInfo.InvariantCulture) | |
let colNum = List.ofArray (strNum.Split('.')) | |
let strN, strD = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Main | |
Console.WriteLine(CalcArterialAlveolarRatio(50, 60, 80)) | |
End Sub | |
' Calculate the a/A ratio. Returns -1 if calculation not possible | |
' aARatio = 100 * PaO2 / (713 * FiO2 - PaCO2) | |
Function CalcArterialAlveolarRatio(dblPaCO2 As Double, dblPaO2 As Double, dblFiO2 As Double) As Double | |
Dim dblRatio As Double = -1 | |
If dblFiO2 > 1 Then dblFiO2 = dblFiO2 / 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Main | |
Console.WriteLine(CalcVentilationIndex(50, 25, 10, 15)) | |
End Sub | |
' Calculate the ventilation index. Returns -1 if calculation not possible | |
' VI = (PaCO2 * (PIP - PEEP) * rate) / 1000 | |
Function CalcVentilationIndex(dblPaCO2 As Double, dblPIP As Double, dblPEEP As Double, intRate As Integer) As Double | |
Dim dblVI As Double = -1 | |
If dblPaCO2 > 0 And dblPIP > 0 And dblPEEP > 0 And intRate > 0 Then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
NewerOlder