feature: Trend Detection & Alert Suppression Windows

This commit is contained in:
voltsrage
2026-06-18 21:18:13 +08:00
parent e6f7989298
commit 3c54feb38a
31 changed files with 2751 additions and 18 deletions
@@ -0,0 +1,7 @@
public class SuppressionOptions
{
public const string SectionName = "AlertSuppression";
/// <summary>Default suppression window after acknowledgment (minutes).</summary>
public int DefaultWindowMinutes { get; set; } = 30;
}
@@ -0,0 +1,23 @@
public class TrendDetectionOptions
{
public const string SectionName = "TrendDetection";
/// <summary>Sliding window for rate-of-change calculation (minutes).</summary>
public int WindowMinutes { get; set; } = 30;
/// <summary>Maximum history entries stored per parameter in Redis.</summary>
public int MaxHistoryEntries { get; set; } = 10;
/// <summary>Redis TTL for trend history keys (seconds). Default 2 hours.</summary>
public int HistoryTtlSeconds { get; set; } = 7200;
/// <summary>Per-code rate thresholds: units per minute.</summary>
public Dictionary<string, decimal> RateThresholdsPerMinute { get; set; } = new()
{
["HEART_RATE"] = 0.5m, // 15 bpm rise in 30 min
["RESP_RATE"] = 0.3m, // 9 breaths/min rise in 30 min
["SYSTOLIC_BP"] = 1.0m, // 30 mmHg drop in 30 min (negative rate checked separately)
["TEMP_C"] = 0.05m, // 1.5 °C rise in 30 min
["SPO2"] = 0.2m // 6% drop in 30 min (negative rate)
};
}