Run initial test for Climate Resilience Verification Suite

Add first part of Alert Quality Analytics
This commit is contained in:
voltsrage
2026-06-24 03:01:00 +08:00
parent 032cd1d240
commit 185dc93fa1
50 changed files with 4116 additions and 55 deletions
@@ -101,6 +101,41 @@ public class WardGatewayLocalPathTests : IAsyncLifetime
b.ItemType == BufferedSyncItemType.Ack && !b.Synced)).Should().Be(1);
}
[Fact]
public async Task Acknowledge_WithClinicianId_UsesScenarioAttribution()
{
await _client.PostAsJsonAsync(
$"/api/v1/encounters/{_encounterId}/observations",
new
{
observationCode = "HEART_RATE",
value = 160,
unit = "bpm",
source = "DEVICE",
recordedAt = DateTimeOffset.UtcNow,
idempotencyKey = Guid.NewGuid().ToString()
});
var alertsResp = await _client.GetAsync($"/api/v1/encounters/{_encounterId}/alerts");
var alertsDoc = await alertsResp.Content.ReadFromJsonAsync<JsonDocument>();
var alertId = alertsDoc!.RootElement
.GetProperty("data").GetProperty("items")[0].GetProperty("id").GetGuid();
var ackResp = await _client.PostAsJsonAsync(
$"/api/v1/alerts/{alertId}/acknowledge",
new AcknowledgeAlertRequest("Calcium gluconate ordered.", "RN-Wu"));
ackResp.StatusCode.Should().Be(HttpStatusCode.OK);
using var scope = _fixture.Services.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<GatewayDbContext>();
var alert = await db.ClinicalAlerts.SingleAsync(a => a.Id == alertId);
alert.AcknowledgedBy.Should().Be("RN-Wu");
var bufferedAck = await db.BufferedSyncItems.SingleAsync(b =>
b.ItemType == BufferedSyncItemType.Ack && !b.Synced);
bufferedAck.Payload.Should().Contain("RN-Wu");
}
[Fact]
public async Task CentralDown_ReachabilityReportsDegraded()
{