test phase 23 verification script
This commit is contained in:
@@ -76,6 +76,17 @@ public class TrendDetector
|
||||
if (!TrendCalculator.ExceedsThreshold(observationCode, rate.Value, threshold))
|
||||
return new TrendResult(TrendOutcome.Stable, observationCode, rate);
|
||||
|
||||
using (var scope = _services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
if (!await db.Encounters.AnyAsync(e => e.Id == encounterId, ct))
|
||||
{
|
||||
_logger.LogWarning(
|
||||
"Skipping trend alert for unknown encounter {EncounterId}", encounterId);
|
||||
return new TrendResult(TrendOutcome.EncounterNotFound, observationCode, rate);
|
||||
}
|
||||
}
|
||||
|
||||
var details = TrendCalculator.DescribeTrend(observationCode, rate.Value, value);
|
||||
var created = await TryCreateAlertAsync(
|
||||
encounterId, patientId, observationCode, details, rate.Value, ct);
|
||||
|
||||
Reference in New Issue
Block a user