Skip to content

Commit 1c28295

Browse files
committed
Updating final counts and logging.
1 parent dafcfd0 commit 1c28295

2 files changed

Lines changed: 47 additions & 65 deletions

File tree

Tests/BackendE2ETests/ApiRequests/SubmissionZipReader.cs

Lines changed: 44 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,13 @@ public void ValidatePatientFile_1(List<ValidationIssue> issues)
104104
{
105105
["ServiceRequest"] = 20,
106106
["Observation"] = 11,
107-
["MedicationAdministration"] = 8,
108-
["Specimen"] = 7,
109-
["Location"] = 3,
107+
["Location"] = 1,
110108
["Condition"] = 2,
111109
["Medication"] = 2,
112110
["MedicationRequest"] = 2,
113111
["Patient"] = 1,
114112
["Encounter"] = 1,
115113
["Coverage"] = 1,
116-
["Device"] = 1,
117114
["Procedure"] = 1,
118115
["DiagnosticReport"] = 1,
119116
["OperationOutcome"] = 1,
@@ -122,20 +119,17 @@ public void ValidatePatientFile_1(List<ValidationIssue> issues)
122119

123120
var expectedEvalCounts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
124121
{
125-
["__TOTAL__"] = 61,
122+
["__TOTAL__"] = 43,
126123

127124
["ServiceRequest"] = 20,
128125
["Observation"] = 11,
129-
["MedicationAdministration"] = 8,
130-
["Specimen"] = 7,
131-
["Location"] = 3,
126+
["Location"] = 1,
132127
["Condition"] = 2,
133128
["Medication"] = 2,
134129
["MedicationRequest"] = 2,
135130
["Patient"] = 1,
136131
["Encounter"] = 1,
137132
["Coverage"] = 1,
138-
["Device"] = 1,
139133
["Procedure"] = 1,
140134
["DiagnosticReport"] = 1
141135
};
@@ -153,12 +147,10 @@ public void ValidatePatientFile_2(List<ValidationIssue> issues)
153147
{
154148
["ServiceRequest"] = 126,
155149
["Observation"] = 126,
156-
["Specimen"] = 126,
157-
["MedicationAdministration"] = 4,
158150
["MedicationRequest"] = 4,
159151
["Medication"] = 4,
160152
["Condition"] = 4,
161-
["Location"] = 4,
153+
["Location"] = 2,
162154
["Encounter"] = 2,
163155
["Coverage"] = 2,
164156
["Patient"] = 1,
@@ -168,16 +160,14 @@ public void ValidatePatientFile_2(List<ValidationIssue> issues)
168160

169161
var expectedEvalCounts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
170162
{
171-
["__TOTAL__"] = 403,
163+
["__TOTAL__"] = 271,
172164

173165
["ServiceRequest"] = 126,
174166
["Observation"] = 126,
175-
["Specimen"] = 126,
176-
["MedicationAdministration"] = 4,
177167
["MedicationRequest"] = 4,
178168
["Medication"] = 4,
179169
["Condition"] = 4,
180-
["Location"] = 4,
170+
["Location"] = 2,
181171
["Encounter"] = 2,
182172
["Coverage"] = 2,
183173
["Patient"] = 1
@@ -192,12 +182,10 @@ public void ValidatePatientFile_3(List<ValidationIssue> issues)
192182
{
193183
["ServiceRequest"] = 16,
194184
["Observation"] = 5,
195-
["MedicationAdministration"] = 4,
196-
["Specimen"] = 4,
197-
["Location"] = 3,
185+
["Location"] = 1,
198186
["Condition"] = 2,
199-
["Medication"] = 2,
200-
["MedicationRequest"] = 2,
187+
["Medication"] = 1,
188+
["MedicationRequest"] = 1,
201189
["Procedure"] = 2,
202190
["Patient"] = 1,
203191
["Encounter"] = 1,
@@ -210,16 +198,14 @@ public void ValidatePatientFile_3(List<ValidationIssue> issues)
210198

211199
var expectedEvalCounts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
212200
{
213-
["__TOTAL__"] = 45,
201+
["__TOTAL__"] = 33,
214202

215203
["ServiceRequest"] = 16,
216204
["Observation"] = 5,
217-
["MedicationAdministration"] = 4,
218-
["Specimen"] = 4,
219-
["Location"] = 3,
205+
["Location"] = 1,
220206
["Condition"] = 2,
221-
["Medication"] = 2,
222-
["MedicationRequest"] = 2,
207+
["Medication"] = 1,
208+
["MedicationRequest"] = 1,
223209
["Procedure"] = 2,
224210
["Patient"] = 1,
225211
["Encounter"] = 1,
@@ -240,13 +226,11 @@ public void ValidatePatientFile_4(List<ValidationIssue> issues)
240226
var expectedBundleCounts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
241227
{
242228
["ServiceRequest"] = 27,
243-
["MedicationAdministration"] = 13,
244229
["Observation"] = 9,
245-
["Location"] = 6,
246-
["Condition"] = 4,
247-
["Medication"] = 4,
248-
["MedicationRequest"] = 4,
249-
["Specimen"] = 4,
230+
["Location"] = 1,
231+
["Condition"] = 2,
232+
["Medication"] = 2,
233+
["MedicationRequest"] = 2,
250234
["Procedure"] = 4,
251235
["Encounter"] = 2,
252236
["Coverage"] = 2,
@@ -259,16 +243,14 @@ public void ValidatePatientFile_4(List<ValidationIssue> issues)
259243

260244
var expectedEvalCounts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
261245
{
262-
["__TOTAL__"] = 84,
246+
["__TOTAL__"] = 56,
263247

264248
["ServiceRequest"] = 27,
265-
["MedicationAdministration"] = 13,
266249
["Observation"] = 9,
267-
["Location"] = 6,
268-
["Condition"] = 4,
269-
["Medication"] = 4,
270-
["MedicationRequest"] = 4,
271-
["Specimen"] = 4,
250+
["Location"] = 1,
251+
["Condition"] = 2,
252+
["Medication"] = 2,
253+
["MedicationRequest"] = 2,
272254
["Procedure"] = 4,
273255
["Encounter"] = 2,
274256
["Coverage"] = 2,
@@ -290,16 +272,13 @@ public void ValidatePatientFile_5(List<ValidationIssue> issues)
290272
{
291273
["ServiceRequest"] = 31,
292274
["Observation"] = 11,
293-
["Specimen"] = 8,
294-
["MedicationAdministration"] = 3,
295-
["Location"] = 3,
275+
["Location"] = 1,
296276
["Condition"] = 2,
297277
["Medication"] = 2,
298278
["MedicationRequest"] = 2,
299279
["Patient"] = 1,
300280
["Encounter"] = 1,
301281
["Coverage"] = 1,
302-
["Device"] = 1,
303282
["Procedure"] = 1,
304283
["DiagnosticReport"] = 1,
305284
["OperationOutcome"] = 1,
@@ -308,20 +287,17 @@ public void ValidatePatientFile_5(List<ValidationIssue> issues)
308287

309288
var expectedEvalCounts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
310289
{
311-
["__TOTAL__"] = 68,
290+
["__TOTAL__"] = 54,
312291

313292
["ServiceRequest"] = 31,
314293
["Observation"] = 11,
315-
["Specimen"] = 8,
316-
["MedicationAdministration"] = 3,
317-
["Location"] = 3,
294+
["Location"] = 1,
318295
["Condition"] = 2,
319296
["Medication"] = 2,
320297
["MedicationRequest"] = 2,
321298
["Patient"] = 1,
322299
["Encounter"] = 1,
323300
["Coverage"] = 1,
324-
["Device"] = 1,
325301
["Procedure"] = 1,
326302
["DiagnosticReport"] = 1
327303
};
@@ -339,39 +315,35 @@ public void ValidatePatientFile_6(List<ValidationIssue> issues)
339315
{
340316
["ServiceRequest"] = 116,
341317
["Observation"] = 23,
342-
["MedicationAdministration"] = 19,
343-
["Specimen"] = 19,
344318
["Procedure"] = 3,
345319
["Condition"] = 4,
346320
["MedicationRequest"] = 4,
347321
["Medication"] = 4,
348322
["DiagnosticReport"] = 2,
349323
["Encounter"] = 2,
350324
["Coverage"] = 2,
351-
["Device"] = 2,
352-
["Location"] = 4,
325+
["Device"] = 1,
326+
["Location"] = 2,
353327
["Patient"] = 1,
354328
["OperationOutcome"] = 1,
355329
["MeasureReport"] = 1
356330
};
357331

358332
var expectedEvalCounts = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
359333
{
360-
["__TOTAL__"] = 205,
334+
["__TOTAL__"] = 164,
361335

362336
["ServiceRequest"] = 116,
363337
["Observation"] = 23,
364-
["MedicationAdministration"] = 19,
365-
["Specimen"] = 19,
366338
["Procedure"] = 3,
367339
["Condition"] = 4,
368340
["MedicationRequest"] = 4,
369341
["Medication"] = 4,
370342
["DiagnosticReport"] = 2,
371343
["Encounter"] = 2,
372344
["Coverage"] = 2,
373-
["Device"] = 2,
374-
["Location"] = 4,
345+
["Device"] = 1,
346+
["Location"] = 2,
375347
["Patient"] = 1
376348
};
377349

@@ -515,13 +487,15 @@ private void ValidateSinglePatientFile(
515487

516488
foreach (var extraKey in evalCounts.Keys.Where(k => !expectedEvalKeys.Contains(k)))
517489
{
518-
if (excludedTypes.Contains(extraKey))
519-
continue;
490+
var issueType =
491+
string.Equals(extraKey, "OperationOutcome", StringComparison.OrdinalIgnoreCase)
492+
? ValidationIssueType.ObservedResourceTypeCount
493+
: ValidationIssueType.UnexpectedEvaluatedType;
520494

521495
ReportIssue(
522496
fileName,
523497
resourceType: extraKey,
524-
issueType: ValidationIssueType.UnexpectedEvaluatedType,
498+
issueType: issueType,
525499
message: $"evaluatedResource contains unexpected type '{extraKey}'.",
526500
issues: issues);
527501
}
@@ -543,11 +517,15 @@ private void ValidateSinglePatientFile(
543517

544518
if (evalHas)
545519
{
520+
var issueType = exType.Equals("OperationOutcome", StringComparison.OrdinalIgnoreCase)
521+
? ValidationIssueType.OperationOutcomePresentInEvaluated
522+
: ValidationIssueType.ExcludedTypePresentInEvaluated;
523+
546524
ReportIssue(
547525
fileName,
548526
resourceType: exType,
549-
issueType: ValidationIssueType.ExcludedTypePresentInEvaluated,
550-
message: $"Excluded type '{exType}' found in evaluatedResource (should be omitted).",
527+
issueType: issueType,
528+
message: $"Excluded type '{exType}' found in evaluatedResource.",
551529
issues: issues);
552530
}
553531
}
@@ -1084,7 +1062,9 @@ private static readonly Dictionary<ValidationIssueType, ValidationSeverity> Seve
10841062
[ValidationIssueType.ExcludedTypePresentInEvaluated] = ValidationSeverity.Error,
10851063
[ValidationIssueType.BundleVsEvaluatedCountMismatch] = ValidationSeverity.Error,
10861064
[ValidationIssueType.BundleVsEvaluatedIdMismatch] = ValidationSeverity.Error,
1087-
[ValidationIssueType.CrossTypeReference] = ValidationSeverity.Error
1065+
[ValidationIssueType.CrossTypeReference] = ValidationSeverity.Error,
1066+
[ValidationIssueType.OperationOutcomePresentInEvaluated] = ValidationSeverity.Info,
1067+
[ValidationIssueType.ObservedResourceTypeCount] = ValidationSeverity.Info,
10881068
};
10891069

10901070
private static string Truncate(string? value, int maxLength)

Tests/BackendE2ETests/TestConfig.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,11 @@ public enum ValidationIssueType
161161
UnexpectedEvaluatedType,
162162
ExcludedTypeMissingFromBundle,
163163
ExcludedTypePresentInEvaluated,
164+
OperationOutcomePresentInEvaluated,
164165
BundleVsEvaluatedCountMismatch,
165166
BundleVsEvaluatedIdMismatch,
166-
CrossTypeReference
167+
CrossTypeReference,
168+
ObservedResourceTypeCount
167169
}
168170

169171
public sealed class ValidationIssue

0 commit comments

Comments
 (0)