Skip to content

Commit 022ac38

Browse files
Store to timeseries only thermal with high matching confidence
1 parent 5872a95 commit 022ac38

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

api.Tests/Services/ResultHandlers/WorkflowResultHandlers/ThermalReadingResultHandlerTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ public async Task OnWorkflowCompleted_ValidResult_UploadsTimeseries()
147147
var run = await _db.NewAnalysisRun(analysis);
148148
var workflow = await _db.NewWorkflow(run, workflowType: "thermal-reading");
149149
const float temperature = 23.5f;
150-
workflow.ResultJson = JsonSerializer.Serialize(new { temperature = temperature });
150+
workflow.ResultJson = JsonSerializer.Serialize(
151+
new { temperature = temperature, confidence = 1.00f }
152+
);
151153
await _context.SaveChangesAsync(TestContext.Current.CancellationToken);
152154

153155
using var scope = _factory.Services.CreateScope();

api/Services/ResultHandlers/WorkflowResultHandlers/ThermalReadingResultHandler.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ public async Task OnWorkflowCompleted(Workflow workflow)
7777

7878
await mqttPublisherService.PublishSaraAnalysisResultAvailable(message);
7979

80-
await TryUploadTimeseries(workflow, inspectionRecord, result);
80+
if (result?.Confidence is not null && result.Confidence > 0.99)
81+
{
82+
await TryUploadTimeseries(workflow, inspectionRecord, result);
83+
}
8184
}
8285

8386
private async Task TryUploadTimeseries(

0 commit comments

Comments
 (0)