Skip to content

Commit 500bfad

Browse files
feat: update lookups to be case insensitive (#1644)
1 parent d1875ae commit 500bfad

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
"LocalParams": [
1818
{
1919
"Name": "EnglishPostingCategory",
20-
"Expression": "dbLookup.RetrievePostingCategory(newParticipant.CurrentPosting) == \"ENGLAND\""
20+
"Expression": "string.Equals(dbLookup.RetrievePostingCategory(newParticipant.CurrentPosting), \"ENGLAND\", StringComparison.OrdinalIgnoreCase)"
2121
},
2222
{
2323
"Name": "InvalidPostingCategory",
24-
"Expression": "!(EnglishPostingCategory || newParticipant.CurrentPosting == \"ENG\" || newParticipant.CurrentPosting == \"IM\" || newParticipant.CurrentPosting == \"DMS\")"
24+
"Expression": "!(EnglishPostingCategory || string.Equals(newParticipant.CurrentPosting, \"ENG\", StringComparison.OrdinalIgnoreCase) || string.Equals(newParticipant.CurrentPosting, \"IM\", StringComparison.OrdinalIgnoreCase) || string.Equals(newParticipant.CurrentPosting, \"DMS\", StringComparison.OrdinalIgnoreCase))"
2525
},
2626
{
2727
"Name": "IsExcluded",
@@ -48,7 +48,7 @@
4848
"LocalParams": [
4949
{
5050
"Name": "reasonForRemoval",
51-
"Expression": "newParticipant.ReasonForRemoval == \"RDI\" OR newParticipant.ReasonForRemoval == \"RDR\" OR newParticipant.ReasonForRemoval == \"RPR\""
51+
"Expression": "string.Equals(newParticipant.ReasonForRemoval, \"RDI\", StringComparison.OrdinalIgnoreCase) OR string.Equals(newParticipant.ReasonForRemoval, \"RDR\", StringComparison.OrdinalIgnoreCase) OR string.Equals(newParticipant.ReasonForRemoval, \"RPR\", StringComparison.OrdinalIgnoreCase)"
5252
},
5353
{
5454
"Name": "postcode",

application/CohortManager/src/Functions/ScreeningValidationService/LookupValidation/DataLookupFacadeBreastScreening.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@ public string RetrievePostingCategory(string currentPosting)
109109
var result = _currentPostingClient.GetSingle(currentPosting).Result;
110110
return result.PostingCategory;
111111
}
112-
}
112+
}

application/CohortManager/src/Functions/Shared/Common/ValidationHelper.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ public static bool ValidatePostcode(string postcode)
107107
/// </summary>
108108
/// <param name="postcode">a non-null string representing the postcode</param>
109109
/// <remarks>
110-
/// Works for valid UK postcodes and dummy postcodes.
111-
/// Works with or without a space separator between outcode and incode.
110+
/// Works for valid UK postcodes and dummy postcodes with
111+
/// or without a space separator between outcode and incode.
112+
/// Returns the outcode in upper case.
112113
/// </remarks>
113114
public static string? ParseOutcode(string postcode)
114115
{
@@ -122,7 +123,7 @@ public static bool ValidatePostcode(string postcode)
122123
}
123124

124125
string outcode = match.Groups[1].Value;
125-
return outcode;
126+
return outcode.ToUpper();
126127
}
127128

128129
private static bool ParseInt32(char value, out int integerValue)

0 commit comments

Comments
 (0)