Skip to content

Commit 86ad9e6

Browse files
committed
adding schema for 34 fields
1 parent 8af3f3f commit 86ad9e6

File tree

3 files changed

+116
-6
lines changed

3 files changed

+116
-6
lines changed

lambdas/shared/tests/test_common/validator/test_schemas/test_schema.json

Lines changed: 100 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"expressionId": "01K5EGR0C7Y1WJ0BC803SQDWK4",
99
"fieldNameFHIR": "contained|#:Patient|identifier|#:https://fhir.nhs.uk/Id/nhs-number|value",
1010
"fieldNameFlat": "NHS_NUMBER",
11+
"fieldNumber": 1,
1112
"errorLevel": 0,
1213
"expression": {
1314
"expressionName": "NHS Number Not Empty Check",
@@ -20,6 +21,7 @@
2021
"expressionId": "01K5EGR0C7QCEJMWH1R4MBPGQA",
2122
"fieldNameFHIR": "contained|#:Patient|name|#:official|given|0",
2223
"fieldNameFlat": "PERSON_FORENAME",
24+
"fieldNumber": 2,
2325
"errorLevel": 0,
2426
"expression": {
2527
"expressionName": "Person Forname Not Empty Check",
@@ -32,6 +34,7 @@
3234
"expressionId": "01K5EGR0C7RRG9F6FVHJ8HE4QX",
3335
"fieldNameFHIR": "contained|#:Patient|name|#:official|family",
3436
"fieldNameFlat": "PERSON_SURNAME",
37+
"fieldNumber": 3,
3538
"errorLevel": 0,
3639
"parentExpression": "01K5EGR0C7Y1WJ0BC803SQDWK4",
3740
"expression": {
@@ -42,21 +45,62 @@
4245
"errorGroup": "completeness"
4346
},
4447
{
45-
"expressionId": "01K5EGR0C8WSJ9N8RV6T8RJJ4W",
46-
"fieldNameFHIR": "performer|#:Organization|actor|identifier|value",
47-
"fieldNameFlat": "SITE_CODE",
48+
"expressionId": "01K8RW1DF635S4FRZ1WF9GDS1T",
49+
"fieldNameFHIR": "contained|#:Patient|birthDate",
50+
"fieldNameFlat": "PERSON_DOB",
51+
"fieldNumber": 4,
4852
"errorLevel": 1,
4953
"expression": {
50-
"expressionName": "Organisation Not Empty Check",
54+
"expressionName": "Date of Birth Not Empty Check",
5155
"expressionType": "NOTEMPTY",
5256
"expressionRule": ""
5357
},
58+
"errorGroup": "consistency"
59+
},
60+
{
61+
"expressionId": "01K8RW2ATXRM572BFG19S8TFJ2",
62+
"fieldNameFHIR": "contained|#:Patient|gender",
63+
"fieldNameFlat": "PERSON_GENDER_CODE",
64+
"fieldNumber": 5,
65+
"errorLevel": 1,
66+
"expression": {
67+
"expressionName": "Gender Valid Check",
68+
"expressionType": "NOTEMPTY",
69+
"expressionRule": ""
70+
},
71+
"errorGroup": "consistency"
72+
},
73+
{
74+
"expressionId": "01K8RW2MYFNE6YZJ99RC8B3XES",
75+
"fieldNameFHIR": "contained|#:Patient|address|#:postalCode|postalCode",
76+
"fieldNameFlat": "PERSON_POSTCODE",
77+
"fieldNumber": 6,
78+
"errorLevel": 2,
79+
"expression": {
80+
"expressionName": "Defaults to",
81+
"expressionType": "",
82+
"expressionRule": "NOTEMPTY"
83+
},
5484
"errorGroup": "completeness"
5585
},
86+
{
87+
"expressionId": "EXP007",
88+
"fieldNameFHIR": "occurrenceDateTime",
89+
"fieldNameFlat": "DATE_AND_TIME",
90+
"fieldNumber": 6,
91+
"errorLevel": 0,
92+
"expression": {
93+
"expressionName": "Date Convert",
94+
"expressionType": "",
95+
"expressionRule": ""
96+
},
97+
"errorGroup": "consistency"
98+
},
5699
{
57100
"expressionId": "01K5EGR0C8M1MVNKTQCE6MSG68",
58101
"fieldNameFHIR": "performer|#:Organization|actor|identifier|value",
59102
"fieldNameFlat": "SITE_CODE",
103+
"fieldNumber": 7,
60104
"errorLevel": 0,
61105
"expression": {
62106
"expressionName": "Organisation Look Up Check",
@@ -65,6 +109,58 @@
65109
},
66110
"errorGroup": "consistency"
67111
},
112+
{
113+
"expressionId": "EXP009",
114+
"fieldNameFHIR": "performer|#:Organization|actor|identifier|system",
115+
"fieldNameFlat": "SITE_CODE_TYPE_URI",
116+
"fieldNumber": 8,
117+
"errorLevel": 1,
118+
"expression": {
119+
"expressionName": "Defaults to",
120+
"expressionType": "DEFAULT",
121+
"expressionRule": ""
122+
},
123+
"errorGroup": "consistency"
124+
},
125+
{
126+
"expressionId": "EXP010",
127+
"fieldNameFHIR": "identifier|0|value",
128+
"fieldNameFlat": "UNIQUE_ID",
129+
"fieldNumber": 9,
130+
"errorLevel": 0,
131+
"expression": {
132+
"expressionName": "Unique ID Not Empty Check",
133+
"expressionType": "NOTEMPTY",
134+
"expressionRule": ""
135+
},
136+
"errorGroup": "validity"
137+
},
138+
{
139+
"expressionId": "EXP011",
140+
"fieldNameFHIR": "identifier|0|system",
141+
"fieldNameFlat": "UNIQUE_ID_URI",
142+
"fieldNumber": 10,
143+
"errorLevel": 0,
144+
"expression": {
145+
"expressionName": "Unique ID URI Not Empty Check",
146+
"expressionType": "NOTEMPTY",
147+
"expressionRule": ""
148+
},
149+
"errorGroup": "validity"
150+
},
151+
{
152+
"expressionId": "EXP012",
153+
"fieldNameFHIR": "id",
154+
"fieldNameFlat": "ACTION_FLAG",
155+
"fieldNumber": 11,
156+
"errorLevel": 1,
157+
"expression": {
158+
"expressionName": "Change To",
159+
"expressionType": "",
160+
"expressionRule": "NOTEMPTY"
161+
},
162+
"errorGroup": "validity"
163+
},
68164
{
69165
"expressionId": "01K5EGR0C8SDQBTNCEP8TJNCCW",
70166
"fieldNameFHIR": "contained|#:Practitioner|name|0|given|0",

lambdas/shared/tests/test_common/validator/test_validation_csv_row.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ def setUp(self):
2626
def test_run_validation_on_valid_csv_row(self):
2727
valid_rows = build_row(CSV_HEADER, CSV_VALUES)
2828
error_report = self.validator.validate_csv_row(valid_rows, CSV_HEADER, True, True, True)
29+
print(f"Error Report: {error_report}")
30+
self.maxDiff = None
2931
self.assertEqual(error_report, [])
3032

3133
def test_run_validation_on_invalid_csv_row(self):
@@ -38,4 +40,8 @@ def test_run_validation_on_invalid_csv_row(self):
3840
"Value not empty failure",
3941
"Value is empty, not as expected",
4042
)
43+
self.maxDiff = None
44+
print(f"Error Report: {error_report}")
45+
print(f"Messages: {messages}")
46+
print(f"Expected Error: {expected_error}")
4147
self.assertIn(expected_error, messages)

lambdas/shared/tests/test_common/validator/testing_utils/constants.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Comma-separated header string for building CSV test rows
22

33
CSV_HEADER = (
4-
"NHS_NUMBER,PERSON_FORENAME,PERSON_SURNAME,SITE_CODE,"
5-
"PERFORMING_PROFESSIONAL_FORENAME,PERFORMING_PROFESSIONAL_SURNAME,PRIMARY_SOURCE,"
4+
"NHS_NUMBER,PERSON_FORENAME,PERSON_SURNAME,PERSON_DOB,PERSON_GENDER_CODE,PERSON_POSTCODE,DATE_AND_TIME,SITE_CODE,"
5+
"SITE_CODE_TYPE_URI,UNIQUE_ID,UNIQUE_ID_URI,ACTION_FLAG,PERFORMING_PROFESSIONAL_FORENAME,PERFORMING_PROFESSIONAL_SURNAME,PRIMARY_SOURCE,"
66
"VACCINATION_PROCEDURE_CODE,VACCINATION_PROCEDURE_TERM,DOSE_SEQUENCE,"
77
"VACCINE_PRODUCT_CODE,VACCINE_PRODUCT_TERM,VACCINE_MANUFACTURER,BATCH_NUMBER"
88
)
@@ -13,7 +13,15 @@
1313
"NHS_NUMBER": "9000000009",
1414
"PERSON_FORENAME": "JOHN",
1515
"PERSON_SURNAME": "DOE",
16+
"PERSON_DOB": "19800101",
17+
"PERSON_GENDER_CODE": "M",
18+
"PERSON_POSTCODE": "AB12 3CD",
19+
"DATE_AND_TIME": "20250306T13281701",
1620
"SITE_CODE": "RJ1",
21+
"SITE_CODE_TYPE_URI": "https://fhir.nhs.uk/Id/ods-organization-code",
22+
"UNIQUE_ID": "ACME-vacc123456",
23+
"UNIQUE_ID_URI": "https://supplierABC/identifiers/vacc",
24+
"ACTION_FLAG": "UPDATE",
1725
"PERFORMING_PROFESSIONAL_FORENAME": "ALICE",
1826
"PERFORMING_PROFESSIONAL_SURNAME": "SMITH",
1927
"PRIMARY_SOURCE": "true",

0 commit comments

Comments
 (0)