Files
vigilcare-clinical/VigilCareClinicalAPI/Sepsis/SepsisAlertHandler.cs
T
voltsrage bf46e6554a feature: Sepsis Engine Refactor: Remove SIRS, Rewire qSOFA + Bundle
Frontend: GCS Entry, SOFA Display, Sepsis UI Refactor
2026-06-21 03:56:27 +08:00

30 lines
1.0 KiB
C#

public class SepsisAlertHandler
{
private readonly ISepsisBundleService _bundleService;
private readonly ILogger<SepsisAlertHandler> _logger;
public SepsisAlertHandler(ISepsisBundleService bundleService, ILogger<SepsisAlertHandler> logger)
{
_bundleService = bundleService;
_logger = logger;
}
public async Task OnSepsisAlertCreatedAsync(
Guid encounterId, Guid alertId, AlertType alertType, CancellationToken ct)
{
if (alertType != AlertType.SofaSepsis)
{
_logger.LogDebug(
"Alert type {AlertType} does not trigger sepsis bundle — skipping",
alertType.ToDbString());
return;
}
var bundle = await _bundleService.TryCreateBundleAsync(encounterId, alertId, alertType, ct);
if (bundle is not null)
_logger.LogInformation(
"Sepsis bundle {BundleId} created for encounter {EncounterId} (trigger={AlertType})",
bundle.Id, encounterId, alertType.ToDbString());
}
}