feature: qSOFA Scoring & Sepsis Bundle Compliance
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
using StackExchange.Redis;
|
||||
|
||||
public static class QsofaCalculator
|
||||
{
|
||||
public static readonly IReadOnlyList<string> QsofaCodes = new[]
|
||||
{
|
||||
"RESP_RATE", "SYSTOLIC_BP", "AVPU"
|
||||
};
|
||||
|
||||
public static readonly IReadOnlySet<string> QsofaCodeSet =
|
||||
new HashSet<string>(QsofaCodes);
|
||||
|
||||
// qSOFA criteria (Sepsis-3 consensus):
|
||||
// - Respiratory rate ≥ 22 breaths/min
|
||||
// - Systolic blood pressure ≤ 100 mmHg
|
||||
// - Altered mentation: AVPU score ≥ 1 (any non-Alert state)
|
||||
public static bool MeetsCriterion(string observationCode, decimal value) =>
|
||||
observationCode switch
|
||||
{
|
||||
"RESP_RATE" => value >= 22m,
|
||||
"SYSTOLIC_BP" => value <= 100m,
|
||||
"AVPU" => value >= 1m,
|
||||
_ => false
|
||||
};
|
||||
|
||||
public static string CriterionKey(Guid encounterId, string code) =>
|
||||
$"qsofa:{encounterId}:{code}";
|
||||
|
||||
public static RedisKey[] AllCriterionKeys(Guid encounterId) =>
|
||||
QsofaCodes.Select(c => (RedisKey)CriterionKey(encounterId, c)).ToArray();
|
||||
|
||||
public static int CountActiveCriteria(RedisValue[] values) =>
|
||||
values.Count(v => v.HasValue);
|
||||
}
|
||||
Reference in New Issue
Block a user