Clinical Sync Batch Engine: first commit
This commit is contained in:
@@ -54,6 +54,7 @@ public enum AlertType
|
||||
|
||||
public static class AlertTypeExtensions
|
||||
{
|
||||
#pragma warning disable CS0618 // Legacy alert types retained for historical DB strings
|
||||
public static string ToDbString(this AlertType t) => t switch
|
||||
{
|
||||
AlertType.SepsisWarning => "SEPSIS_WARNING",
|
||||
@@ -97,7 +98,9 @@ public static class AlertTypeExtensions
|
||||
AlertType.QsofaScreen => "QSOFA_SCREEN",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(t))
|
||||
};
|
||||
#pragma warning restore CS0618
|
||||
|
||||
#pragma warning disable CS0618 // Legacy alert types retained for historical DB strings
|
||||
public static AlertType FromDbString(string v) => v switch
|
||||
{
|
||||
"SEPSIS_WARNING" => AlertType.SepsisWarning,
|
||||
@@ -141,6 +144,7 @@ public static class AlertTypeExtensions
|
||||
"SOFA_WARNING" => AlertType.SofaWarning,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown alert type: '{v}'")
|
||||
};
|
||||
#pragma warning restore CS0618
|
||||
|
||||
// Threshold alerts are derived from observation codes in alert_thresholds — not free-form strings.
|
||||
public static AlertType CriticalFor(string observationCode) => observationCode switch
|
||||
@@ -184,6 +188,7 @@ public static class AlertTypeExtensions
|
||||
nameof(observationCode), $"No warning alert type for observation code '{observationCode}'")
|
||||
};
|
||||
|
||||
#pragma warning disable CS0618 // Legacy alert types retained for historical DB strings
|
||||
public static bool IsSuppressible(this AlertType t) => t switch
|
||||
{
|
||||
AlertType.SepsisWarning or AlertType.News2Emergency => false,
|
||||
@@ -197,6 +202,7 @@ public static class AlertTypeExtensions
|
||||
AlertType.SofaSepsis => false,
|
||||
_ => true // all Warning* types, News2Warning, QsofaScreen, SofaWarning, GcsWarning
|
||||
};
|
||||
#pragma warning restore CS0618
|
||||
|
||||
public static string? ObservationCodeForWarning(this AlertType t) => t switch
|
||||
{
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
public enum ClinicalSyncBatchStatus { Received, Processing, Applied, Conflict, Rejected }
|
||||
|
||||
public static class ClinicalSyncBatchStatusExtensions
|
||||
{
|
||||
public static string ToDbString(this ClinicalSyncBatchStatus s) => s switch
|
||||
{
|
||||
ClinicalSyncBatchStatus.Received => "RECEIVED",
|
||||
ClinicalSyncBatchStatus.Processing => "PROCESSING",
|
||||
ClinicalSyncBatchStatus.Applied => "APPLIED",
|
||||
ClinicalSyncBatchStatus.Conflict => "CONFLICT",
|
||||
ClinicalSyncBatchStatus.Rejected => "REJECTED",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(s))
|
||||
};
|
||||
|
||||
public static ClinicalSyncBatchStatus FromDbString(string v) => v switch
|
||||
{
|
||||
"RECEIVED" => ClinicalSyncBatchStatus.Received,
|
||||
"PROCESSING" => ClinicalSyncBatchStatus.Processing,
|
||||
"APPLIED" => ClinicalSyncBatchStatus.Applied,
|
||||
"CONFLICT" => ClinicalSyncBatchStatus.Conflict,
|
||||
"REJECTED" => ClinicalSyncBatchStatus.Rejected,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown sync batch status: '{v}'")
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
public enum GatewayStatus { Online, Degraded, Offline }
|
||||
|
||||
public static class GatewayStatusExtensions
|
||||
{
|
||||
public static string ToDbString(this GatewayStatus s) => s switch
|
||||
{
|
||||
GatewayStatus.Online => "ONLINE",
|
||||
GatewayStatus.Degraded => "DEGRADED",
|
||||
GatewayStatus.Offline => "OFFLINE",
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(s))
|
||||
};
|
||||
|
||||
public static GatewayStatus FromDbString(string v) => v switch
|
||||
{
|
||||
"ONLINE" => GatewayStatus.Online,
|
||||
"DEGRADED" => GatewayStatus.Degraded,
|
||||
"OFFLINE" => GatewayStatus.Offline,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown gateway status: '{v}'")
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user