31 lines
1.1 KiB
C#
31 lines
1.1 KiB
C#
public static class News2ContributorBuilder
|
|
{
|
|
private static readonly Dictionary<string, (string Label, string NormalRange)> Labels = new()
|
|
{
|
|
["RESP_RATE"] = ("Respiratory Rate", "12-20 breaths/min"),
|
|
["SPO2"] = ("SpO2", "96-100%"),
|
|
["SYSTOLIC_BP"] = ("Systolic BP", "101-219 mmHg"),
|
|
["HEART_RATE"] = ("Heart Rate", "51-90 bpm"),
|
|
["AVPU"] = ("Consciousness", "Alert"),
|
|
["TEMP_C"] = ("Temperature", "36.1-38.0 °C"),
|
|
["SUPPLEMENTAL_O2"] = ("Supplemental O2", "Room air"),
|
|
};
|
|
|
|
public static List<ScoreContributor> Build(int[] paramScores, string?[]? rawValues = null)
|
|
{
|
|
var contributors = new List<ScoreContributor>();
|
|
for (int i = 0; i < News2Calculator.ParameterCodes.Count; i++)
|
|
{
|
|
var code = News2Calculator.ParameterCodes[i];
|
|
var (label, range) = Labels[code];
|
|
contributors.Add(new ScoreContributor
|
|
{
|
|
Parameter = label,
|
|
Points = paramScores[i],
|
|
RawValue = rawValues?[i],
|
|
NormalRange = range
|
|
});
|
|
}
|
|
return contributors;
|
|
}
|
|
} |