feature: Explainable Alerts
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
public static class SofaContributorBuilder
|
||||
{
|
||||
private static readonly (string Label, string NormalRange)[] OrganSystems =
|
||||
[
|
||||
("Respiratory", "0"),
|
||||
("Coagulation", "0"),
|
||||
("Liver", "0"),
|
||||
("Cardiovascular", "0"),
|
||||
("CNS", "0"),
|
||||
("Renal", "0"),
|
||||
];
|
||||
|
||||
private static readonly string[] OrganKeys =
|
||||
[
|
||||
"RESPIRATORY", "COAGULATION", "LIVER", "CARDIOVASCULAR", "CNS", "RENAL"
|
||||
];
|
||||
|
||||
public static List<ScoreContributor> Build(
|
||||
SofaResult result,
|
||||
IReadOnlyDictionary<string, string?>? rawValues = null)
|
||||
{
|
||||
var scores = new[]
|
||||
{
|
||||
result.Respiratory, result.Coagulation, result.Liver,
|
||||
result.Cardiovascular, result.Cns, result.Renal
|
||||
};
|
||||
|
||||
var contributors = new List<ScoreContributor>(scores.Length);
|
||||
for (int i = 0; i < scores.Length; i++)
|
||||
{
|
||||
contributors.Add(new ScoreContributor
|
||||
{
|
||||
Parameter = OrganSystems[i].Label,
|
||||
Points = scores[i],
|
||||
RawValue = rawValues?.GetValueOrDefault(OrganKeys[i]),
|
||||
NormalRange = OrganSystems[i].NormalRange
|
||||
});
|
||||
}
|
||||
return contributors;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user