Skip to content

Commit 8fa0813

Browse files
authored
Merge pull request #5626 from dfe-analytical-services/EES-5882
EES-5882: Add Screener API response models.
2 parents 89a92c6 + d04c5a8 commit 8fa0813

File tree

3 files changed

+85
-0
lines changed

3 files changed

+85
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#nullable enable
2+
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Text.Json.Serialization;
6+
7+
namespace GovUk.Education.ExploreEducationStatistics.Admin.Models;
8+
9+
public class DataScreenerResponse
10+
{
11+
// TODO (EES-5353): The screening result will need to be persisted somewhere in the backend.
12+
// If a user attempts to confirm a data set for import, the result should be validated.
13+
// A failed screening should block the import process.
14+
[JsonIgnore]
15+
public Guid Id { get; set; }
16+
17+
// TODO (EES-5353): Discuss if this can just be a boolean (e.g. "Passed", "IsSuccessful")
18+
[JsonPropertyName("overall_stage")]
19+
public ScreenerResult Result { get; set; }
20+
21+
[JsonPropertyName("overall_message")]
22+
public required string Message { get; set; }
23+
24+
[JsonPropertyName("results_table")]
25+
public List<DataScreenerTestResult> TestResults { get; set; } = [];
26+
}
27+
28+
public enum ScreenerResult
29+
{
30+
Passed,
31+
Failed,
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#nullable enable
2+
using System.Collections.Generic;
3+
using System.Text.Json.Serialization;
4+
5+
namespace GovUk.Education.ExploreEducationStatistics.Admin.Models;
6+
7+
public class DataScreenerTestResult
8+
{
9+
[JsonPropertyName("check")]
10+
public required string TestFunctionName { get; set; }
11+
12+
[JsonPropertyName("result")]
13+
public TestResult TestResult { get; set; }
14+
15+
// TODO (EES-5353): The screener currently returns a single string, so this list will fail to deserialise until the response has been updated
16+
[JsonPropertyName("message")]
17+
public List<string> Notes { get; set; } = [];
18+
19+
public Stage Stage { get; set; }
20+
}
21+
22+
// TODO (EES-5353): Rename stages to be more descriptive
23+
public enum Stage
24+
{
25+
InitialFileValidation = 1,
26+
PreScreening1 = 2,
27+
PreScreening2 = 3,
28+
FullChecks = 4,
29+
Passed = 5,
30+
}
31+
32+
public enum TestResult
33+
{
34+
PASS,
35+
FAIL,
36+
WARNING,
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#nullable enable
2+
3+
namespace GovUk.Education.ExploreEducationStatistics.Admin.Requests;
4+
5+
public record DataScreenerRequest
6+
{
7+
public required string StorageContainerName { get; set; }
8+
9+
public required string DataFileName { get; set; }
10+
11+
public required string MetaFileName { get; set; }
12+
13+
public required string DataFilePath { get; set; }
14+
15+
public required string MetaFilePath { get; set; }
16+
}

0 commit comments

Comments
 (0)