Skip to content

Commit d9c2ff6

Browse files
fix: reinstate category numbers for validation exceptions (#913)
* fix: adding the name of the place we are sending the error to the rules and parsing the category name to a number in the enum ExceptionCategory while preserving categorys numbers for other types of category ouside of NBO, CaaS and BSSelect * fix: making sure that rule 22 still has its name and new category * making sure to add correct cattegories for rules * fix: unit tests * fix: unit tests * fxing strange build errors in tests * fix: addrssisng comments and fixing tests * fix: fixing unit tests * fix: fixing unit tests * fix: making sure rule 51 goes to category nine * fix: fixing unit tests * fix: explaining why we use a number in the tests for non fatal and non fatal rules
1 parent 7b50360 commit d9c2ff6

File tree

18 files changed

+184
-141
lines changed

18 files changed

+184
-141
lines changed

application/CohortManager/src/Functions/CaasIntegration/receiveCaasFile/ProcessFileClasses/ProcessCaasFile.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace NHS.Screening.ReceiveCaasFile;
99
using Microsoft.Extensions.Options;
1010
using Microsoft.IdentityModel.Protocols.Configuration;
1111
using Model;
12+
using Model.Enums;
1213

1314
public class ProcessCaasFile : IProcessCaasFile
1415
{
@@ -88,7 +89,7 @@ await Parallel.ForEachAsync(values, options, async (rec, cancellationToken) =>
8889

8990
if (!ValidationHelper.ValidateNHSNumber(participant.NhsNumber))
9091
{
91-
await _exceptionHandler.CreateSystemExceptionLog(new Exception($"Invalid NHS Number was passed in for participant {participant} and file {name}"), participant, name);
92+
await _exceptionHandler.CreateSystemExceptionLog(new Exception($"Invalid NHS Number was passed in for participant {participant} and file {name}"), participant, name, nameof(ExceptionCategory.CaaS));
9293
return; // skip current participant
9394
}
9495

application/CohortManager/src/Functions/ScreeningValidationService/LookupValidation/Breast_Screening_cohortRules.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"WorkflowName": "Common",
44
"Rules": [
55
{
6-
"RuleName": "35.TooManyDemographicsFieldsChanged.NonFatal",
6+
"RuleName": "35.TooManyDemographicsFieldsChanged.NBO.NonFatal",
77
"LocalParams": [
88
{
99
"Name": "NewDateOfBirth",
@@ -17,7 +17,7 @@
1717
"Expression": "existingParticipant.ParticipantId == null || ((newParticipant.FamilyName == existingParticipant.FamilyName AND newParticipant.Gender == existingParticipant.Gender) OR (newParticipant.FamilyName == existingParticipant.FamilyName AND NewDateOfBirth == ExistingDateOfBirth) OR (newParticipant.Gender == existingParticipant.Gender AND NewDateOfBirth == ExistingDateOfBirth))"
1818
},
1919
{
20-
"RuleName": "54.ValidateBsoCode.NonFatal",
20+
"RuleName": "54.ValidateBsoCode.NBO.NonFatal",
2121
"LocalParams": [
2222
{
2323
"Name": "reasonForRemoval",
@@ -44,7 +44,7 @@
4444
"WorkflowName": "AMENDED",
4545
"Rules": [
4646
{
47-
"RuleName": "51.ParticipantLocationRemainingOutsideOfCohort.NonFatal",
47+
"RuleName": "51.ParticipantLocationRemainingOutsideOfCohort.ParticipantLocationRemainingOutsideOfCohort.NonFatal",
4848
"LocalParams": [
4949
{
5050
"Name": "ExistingParticipantInDMS",

application/CohortManager/src/Functions/ScreeningValidationService/LookupValidation/Breast_Screening_lookupRules.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222
},
2323
{
24-
"RuleName": "36.ValidatePrimaryCareProvider.NonFatal",
24+
"RuleName": "36.ValidatePrimaryCareProvider.BSSelect.NonFatal",
2525
"Expression": "string.IsNullOrEmpty(newParticipant.PrimaryCareProvider) || dbLookup.CheckIfPrimaryCareProviderExists(newParticipant.primaryCareProvider)",
2626
"Actions": {
2727
"OnFailure": {
@@ -33,7 +33,7 @@
3333
}
3434
},
3535
{
36-
"RuleName": "3645.CurrentPostingAndPrimaryProvider.NonFatal",
36+
"RuleName": "3645.CurrentPostingAndPrimaryProvider.BSSelect.NonFatal",
3737
"LocalParams": [
3838
{
3939
"Name": "ValidPostingCategory",
@@ -47,7 +47,7 @@
4747
"Expression": "!(ValidPostingCategory AND InvalidPrimaryCareProvider)"
4848
},
4949
{
50-
"RuleName": "58.CurrentPosting.NonFatal",
50+
"RuleName": "58.CurrentPosting.NBO.NonFatal",
5151
"Expression": "ValidCurrentPosting",
5252
"Actions": {
5353
"OnFailure": {
@@ -59,7 +59,7 @@
5959
}
6060
},
6161
{
62-
"RuleName": "00.ValidateLanguageCode.NonFatal",
62+
"RuleName": "00.ValidateLanguageCode.NBO.NonFatal",
6363
"LocalParams": [
6464
{
6565
"Name": "languageCode",
@@ -77,7 +77,7 @@
7777
}
7878
},
7979
{
80-
"RuleName": "11.ValidateReasonForRemoval.NonFatal",
80+
"RuleName": "11.ValidateReasonForRemoval.NBO.NonFatal",
8181
"LocalParams": [
8282
{
8383
"Name": "newRecordType",
@@ -96,7 +96,7 @@
9696
"WorkflowName": "ADD",
9797
"Rules": [
9898
{
99-
"RuleName": "47.ParticipantMustNotExist.Fatal",
99+
"RuleName": "47.ParticipantMustNotExist.CaaS.Fatal",
100100
"Expression": "string.IsNullOrWhiteSpace(existingParticipant.NhsNumber)"
101101
}
102102
]
@@ -105,7 +105,7 @@
105105
"WorkflowName": "AMENDED",
106106
"Rules": [
107107
{
108-
"RuleName": "22.ParticipantMustExist.Fatal",
108+
"RuleName": "22.ParticipantMustExist.CaaS.Fatal",
109109
"Expression": "!string.IsNullOrWhiteSpace(existingParticipant.NhsNumber)"
110110
}
111111
]
@@ -114,7 +114,7 @@
114114
"WorkflowName": "DEL",
115115
"Rules": [
116116
{
117-
"RuleName": "22.ParticipantMustExist.Fatal",
117+
"RuleName": "22.ParticipantMustExist.CaaS.Fatal",
118118
"Expression": "!string.IsNullOrWhiteSpace(existingParticipant.NhsNumber)"
119119
}
120120
]

application/CohortManager/src/Functions/ScreeningValidationService/StaticValidation/Breast_Screening_staticRules.json

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"WorkflowName": "Common",
44
"Rules": [
55
{
6-
"RuleName": "9.NhsNumber.Fatal",
6+
"RuleName": "9.NhsNumber.CaaS.Fatal",
77
"Expression": "Regex.IsMatch(participant.NhsNumber, \"^\\\\d{10}$\")",
88
"Actions": {
99
"OnFailure": {
@@ -15,7 +15,7 @@
1515
}
1616
},
1717
{
18-
"RuleName": "57.SupersededByNhsNumber.NonFatal",
18+
"RuleName": "57.SupersededByNhsNumber.NBO.NonFatal",
1919
"Expression": "string.IsNullOrEmpty(participant.SupersededByNhsNumber) OR Regex.IsMatch(participant.SupersededByNhsNumber, \"^\\\\d{10}$\")",
2020
"Actions": {
2121
"OnFailure": {
@@ -27,7 +27,7 @@
2727
}
2828
},
2929
{
30-
"RuleName": "8.RecordType.NonFatal",
30+
"RuleName": "8.RecordType.CaaS.NonFatal",
3131
"Expression": "participant.RecordType == Actions.New OR participant.RecordType == Actions.Amended OR participant.RecordType == Actions.Removed",
3232
"Actions": {
3333
"OnFailure": {
@@ -39,7 +39,7 @@
3939
}
4040
},
4141
{
42-
"RuleName": "14.ReasonForRemoval.NonFatal",
42+
"RuleName": "14.ReasonForRemoval.NBO.NonFatal",
4343
"Expression": "string.IsNullOrEmpty(participant.ReasonForRemoval) OR new string[] {\"AFL\",\"AFN\",\"CGA\",\"DEA\",\"DIS\",\"EMB\",\"LDN\",\"NIT\",\"OPA\",\"ORR\",\"RDI\",\"RDR\",\"RFI\",\"RPR\",\"SCT\",\"SDL\",\"SDN\",\"TRA\"}.Contains(participant.ReasonForRemoval)",
4444
"Actions": {
4545
"OnFailure": {
@@ -51,7 +51,7 @@
5151
}
5252
},
5353
{
54-
"RuleName": "30.Postcode.NonFatal",
54+
"RuleName": "30.Postcode.NBO.NonFatal",
5555
"Expression": "string.IsNullOrEmpty(participant.Postcode) OR ValidationHelper.ValidatePostcode(participant.Postcode)",
5656
"Actions": {
5757
"OnFailure": {
@@ -63,7 +63,7 @@
6363
}
6464
},
6565
{
66-
"RuleName": "3.PrimaryCareProviderAndReasonForRemoval.NonFatal",
66+
"RuleName": "3.PrimaryCareProviderAndReasonForRemoval.NBO.NonFatal",
6767
"Expression": "(string.IsNullOrEmpty(participant.PrimaryCareProvider) AND !string.IsNullOrEmpty(participant.ReasonForRemoval)) OR (!string.IsNullOrEmpty(participant.PrimaryCareProvider) AND string.IsNullOrEmpty(participant.ReasonForRemoval))",
6868
"Actions": {
6969
"OnFailure": {
@@ -75,7 +75,7 @@
7575
}
7676
},
7777
{
78-
"RuleName": "17.DateOfBirth.NonFatal",
78+
"RuleName": "17.DateOfBirth.NBO.NonFatal",
7979
"Expression": "!(string.IsNullOrEmpty(participant.DateOfBirth) || !ValidationHelper.ValidatePastDate(participant.DateOfBirth))",
8080
"Actions": {
8181
"OnFailure": {
@@ -87,7 +87,7 @@
8787
}
8888
},
8989
{
90-
"RuleName": "39.FamilyName.NonFatal",
90+
"RuleName": "39.FamilyName.NBO.NonFatal",
9191
"Expression": "!(participant.RecordType != Actions.Amended && string.IsNullOrEmpty(participant.FamilyName))",
9292
"Actions": {
9393
"OnFailure": {
@@ -99,7 +99,7 @@
9999
}
100100
},
101101
{
102-
"RuleName": "40.FirstName.NonFatal",
102+
"RuleName": "40.FirstName.NBO.NonFatal",
103103
"Expression": "!(participant.RecordType != Actions.Amended && string.IsNullOrEmpty(participant.FirstName))",
104104
"Actions": {
105105
"OnFailure": {
@@ -111,7 +111,7 @@
111111
}
112112
},
113113
{
114-
"RuleName": "42.GPPracticeCode.NonFatal",
114+
"RuleName": "42.GPPracticeCode.NBO.NonFatal",
115115
"Expression": "participant.RecordType != Actions.New OR !string.IsNullOrEmpty(participant.PrimaryCareProvider)",
116116
"Actions": {
117117
"OnFailure": {
@@ -123,7 +123,7 @@
123123
}
124124
},
125125
{
126-
"RuleName": "19.ReasonForRemovalEffectiveFromDate.NonFatal",
126+
"RuleName": "19.ReasonForRemovalEffectiveFromDate.NBO.NonFatal",
127127
"Expression": "string.IsNullOrEmpty(participant.ReasonForRemovalEffectiveFromDate) OR ValidationHelper.ValidatePastDate(participant.ReasonForRemovalEffectiveFromDate)",
128128
"Actions": {
129129
"OnFailure": {
@@ -135,31 +135,31 @@
135135
}
136136
},
137137
{
138-
"RuleName": "100.PrimaryCareProviderEffectiveFromDate.NonFatal",
138+
"RuleName": "100.PrimaryCareProviderEffectiveFromDate.NBO.NonFatal",
139139
"Expression": "string.IsNullOrEmpty(participant.PrimaryCareProviderEffectiveFromDate) OR ValidationHelper.ValidatePastDate(participant.PrimaryCareProviderEffectiveFromDate)"
140140
},
141141
{
142-
"RuleName": "101.CurrentPostingEffectiveFromDate.NonFatal",
142+
"RuleName": "101.CurrentPostingEffectiveFromDate.NBO.NonFatal",
143143
"Expression": "string.IsNullOrEmpty(participant.CurrentPostingEffectiveFromDate) OR ValidationHelper.ValidatePastDate(participant.CurrentPostingEffectiveFromDate)"
144144
},
145145
{
146-
"RuleName": "102.UsualAddressEffectiveFromDate.NonFatal",
146+
"RuleName": "102.UsualAddressEffectiveFromDate.NBO.NonFatal",
147147
"Expression": "string.IsNullOrEmpty(participant.UsualAddressEffectiveFromDate) OR ValidationHelper.ValidatePastDate(participant.UsualAddressEffectiveFromDate)"
148148
},
149149
{
150-
"RuleName": "103.TelephoneNumberEffectiveFromDate.NonFatal",
150+
"RuleName": "103.TelephoneNumberEffectiveFromDate.NBO.NonFatal",
151151
"Expression": "string.IsNullOrEmpty(participant.TelephoneNumberEffectiveFromDate) OR ValidationHelper.ValidatePastDate(participant.TelephoneNumberEffectiveFromDate)"
152152
},
153153
{
154-
"RuleName": "104.MobileNumberEffectiveFromDate.NonFatal",
154+
"RuleName": "104.MobileNumberEffectiveFromDate.NBO.NonFatal",
155155
"Expression": "string.IsNullOrEmpty(participant.MobileNumberEffectiveFromDate) OR ValidationHelper.ValidatePastDate(participant.MobileNumberEffectiveFromDate)"
156156
},
157157
{
158-
"RuleName": "105.EmailAddressEffectiveFromDate.NonFatal",
158+
"RuleName": "105.EmailAddressEffectiveFromDate.NBO.NonFatal",
159159
"Expression": "string.IsNullOrEmpty(participant.EmailAddressEffectiveFromDate) OR ValidationHelper.ValidatePastDate(participant.EmailAddressEffectiveFromDate)"
160160
},
161161
{
162-
"RuleName": "18.DateOfDeath.NonFatal",
162+
"RuleName": "18.DateOfDeath.NBO.NonFatal",
163163
"Expression": "string.IsNullOrEmpty(participant.DateOfDeath) OR ValidationHelper.ValidatePastDate(participant.DateOfDeath)",
164164
"Actions": {
165165
"OnFailure": {
@@ -171,7 +171,7 @@
171171
}
172172
},
173173
{
174-
"RuleName": "47.NewParticipantWithRemovalOrDeath.NonFatal",
174+
"RuleName": "47.NewParticipantWithRemovalOrDeath.NBO.NonFatal",
175175
"Expression": "participant.RecordType != Actions.New OR (string.IsNullOrEmpty(participant.ReasonForRemoval) AND string.IsNullOrEmpty(participant.ReasonForRemovalEffectiveFromDate) AND string.IsNullOrEmpty(participant.DateOfDeath))",
176176
"Actions": {
177177
"OnFailure": {
@@ -183,7 +183,7 @@
183183
}
184184
},
185185
{
186-
"RuleName": "49.InterpreterCheck.NonFatal",
186+
"RuleName": "49.InterpreterCheck.NBO.NonFatal",
187187
"Expression": "int.Parse(participant.IsInterpreterRequired) != 0 OR int.Parse(participant.IsInterpreterRequired) != 1",
188188
"Actions": {
189189
"OnFailure": {
@@ -195,7 +195,7 @@
195195
}
196196
},
197197
{
198-
"RuleName": "61.InvalidFlag.NonFatal",
198+
"RuleName": "61.InvalidFlag.NBO.NonFatal",
199199
"Expression": "participant.InvalidFlag == \"1\" OR participant.InvalidFlag == \"0\"",
200200
"Actions": {
201201
"OnFailure": {
@@ -207,7 +207,7 @@
207207
}
208208
},
209209
{
210-
"RuleName": "62.ValidateReasonForRemoval.NonFatal",
210+
"RuleName": "62.ValidateReasonForRemoval.NBO.NonFatal",
211211
"Expression": "!(participant.ReasonForRemoval == \"LDN\" AND string.IsNullOrEmpty(participant.SupersededByNhsNumber))",
212212
"Actions": {
213213
"OnFailure": {
@@ -219,7 +219,7 @@
219219
}
220220
},
221221
{
222-
"RuleName": "53.CurrentPostingAndPrimaryCareProvider.NonFatal",
222+
"RuleName": "53.CurrentPostingAndPrimaryCareProvider.NBO.NonFatal",
223223
"LocalParams": [
224224
{
225225
"Name": "currentPosting",
@@ -241,7 +241,7 @@
241241
}
242242
},
243243
{
244-
"RuleName": "94.EligibilityFlag.NonFatal",
244+
"RuleName": "94.EligibilityFlag.CaaS.NonFatal",
245245
"LocalParams": [
246246
{
247247
"Name": "newRecordType",
@@ -284,7 +284,7 @@
284284
"WorkflowName": "ADD",
285285
"Rules": [
286286
{
287-
"RuleName": "71.NewParticipantWithNoAddress.NonFatal",
287+
"RuleName": "71.NewParticipantWithNoAddress.NBO.NonFatal",
288288
"Expression": "!(participant.RecordType == Actions.New AND string.IsNullOrEmpty(participant.AddressLine1) AND string.IsNullOrEmpty(participant.AddressLine2) AND string.IsNullOrEmpty(participant.AddressLine3) AND string.IsNullOrEmpty(participant.AddressLine4) AND string.IsNullOrEmpty(participant.AddressLine5))",
289289
"Actions": {
290290
"OnFailure": {
@@ -301,7 +301,7 @@
301301
"WorkflowName": "AMENDED",
302302
"Rules": [
303303
{
304-
"RuleName": "66.DeathStatus.NonFatal",
304+
"RuleName": "66.DeathStatus.NBO.NonFatal",
305305
"LocalParams": [
306306
{
307307
"Name": "IsUpdateRequest",

0 commit comments

Comments
 (0)