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 Build( SofaResult result, IReadOnlyDictionary? rawValues = null) { var scores = new[] { result.Respiratory, result.Coagulation, result.Liver, result.Cardiovascular, result.Cns, result.Renal }; var contributors = new List(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; } }