Skip to content

Commit 619dc05

Browse files
committed
fix: add supersededByNhsNumber and clean up mock data
1 parent b0cd9ee commit 619dc05

2 files changed

Lines changed: 100 additions & 107 deletions

File tree

  • application/CohortManager/src/Web/app

application/CohortManager/src/Web/app/api/GetValidationExceptions/route.ts

Lines changed: 99 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,16 @@ export async function GET(request: Request) {
88
const notRaisedOnly = searchParams.get("notRaisedOnly");
99
const sortBy = searchParams.get("sortBy");
1010

11+
// Mock data for not raised exception ID 2073
1112
if (exceptionId !== null && Number(exceptionId) === 2073) {
1213
const exception: ExceptionAPIDetails = {
1314
ExceptionId: 2073,
14-
FileName:
15-
"202411261720028838554_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet",
1615
NhsNumber: "1211111881",
1716
DateCreated: "2025-05-16T14:26:09.28",
1817
DateResolved: "9999-12-31T00:00:00",
1918
RuleId: -2146233088,
2019
RuleDescription:
2120
"There was problem posting the participant to the database",
22-
ErrorRecord:
23-
'{"RecordType":"ADD","NhsNumber":"1211111881","RemovalReason":"","RemovalEffectiveFromDate":"","ScreeningId":"1","ScreeningName":"Breast Screening","EligibilityFlag":"1"}',
2421
Category: 5,
2522
ScreeningName: "Breast Screening",
2623
ExceptionDate: "2025-01-15T00:00:00",
@@ -40,6 +37,7 @@ export async function GET(request: Request) {
4037
EmailAddressHome: "alice.smith@example.com",
4138
PrimaryCareProvider: "E12345",
4239
Gender: 2,
40+
SupersededByNhsNumber: "",
4341
},
4442
ServiceNowId: "",
4543
ServiceNowCreatedDate: "",
@@ -48,19 +46,56 @@ export async function GET(request: Request) {
4846
return NextResponse.json(exception, { status: 200 });
4947
}
5048

49+
// Mock data for not raised exception with superseded NHS number ID 2075
50+
if (
51+
(exceptionId !== null && Number(exceptionId) === 2075) ||
52+
Number(exceptionId) === 2085
53+
) {
54+
const exception: ExceptionAPIDetails = {
55+
ExceptionId: 2073,
56+
NhsNumber: "1211111881",
57+
DateCreated: "2025-05-16T14:26:09.28",
58+
DateResolved: "9999-12-31T00:00:00",
59+
RuleId: 21,
60+
RuleDescription: "The 'Superseded by NHS number' field is not null",
61+
Category: 5,
62+
ScreeningName: "Breast Screening",
63+
ExceptionDate: "2025-01-15T00:00:00",
64+
CohortName: "",
65+
Fatal: 1,
66+
ExceptionDetails: {
67+
GivenName: "Alice",
68+
FamilyName: "Smith",
69+
DateOfBirth: "19800101",
70+
ParticipantAddressLine1: "123 Main Street",
71+
ParticipantAddressLine2: "Flat 2B",
72+
ParticipantAddressLine3: "Central District",
73+
ParticipantAddressLine4: "London",
74+
ParticipantAddressLine5: "England",
75+
ParticipantPostCode: "E1 6AN",
76+
TelephoneNumberHome: "07123456789",
77+
EmailAddressHome: "alice.smith@example.com",
78+
PrimaryCareProvider: "E12345",
79+
Gender: 2,
80+
SupersededByNhsNumber: "1211111882",
81+
},
82+
ServiceNowId: "",
83+
ServiceNowCreatedDate: "",
84+
RecordUpdatedDate: "2025-01-17T09:27:18.25",
85+
};
86+
return NextResponse.json(exception, { status: 200 });
87+
}
88+
89+
// Mock data for raised exception ID 2083
5190
if (exceptionId !== null && Number(exceptionId) === 2083) {
5291
const exception: ExceptionAPIDetails = {
5392
ExceptionId: 2083,
54-
FileName:
55-
"202411261720028838554_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet",
5693
NhsNumber: "1211111881",
5794
DateCreated: "2025-05-16T14:26:09.28",
5895
DateResolved: "9999-12-31T00:00:00",
5996
RuleId: -2146233088,
6097
RuleDescription:
6198
"There was problem posting the participant to the database",
62-
ErrorRecord:
63-
'{"RecordType":"ADD","NhsNumber":"1211111881","RemovalReason":"","RemovalEffectiveFromDate":"","ScreeningId":"1","ScreeningName":"Breast Screening","EligibilityFlag":"1"}',
6499
Category: 5,
65100
ScreeningName: "Breast Screening",
66101
ExceptionDate: "2025-01-15T00:00:00",
@@ -80,6 +115,7 @@ export async function GET(request: Request) {
80115
EmailAddressHome: "bob.johnson@example.com",
81116
PrimaryCareProvider: "E54321",
82117
Gender: 1,
118+
SupersededByNhsNumber: "",
83119
},
84120
ServiceNowId: "INC0002765",
85121
ServiceNowCreatedDate: "2025-06-16T00:00:00",
@@ -88,80 +124,95 @@ export async function GET(request: Request) {
88124
return NextResponse.json(exception, { status: 200 });
89125
}
90126

127+
// Mock data for not raised exception with superseded NHS number ID 2085
128+
if (exceptionId !== null && Number(exceptionId) === 2085) {
129+
const exception: ExceptionAPIDetails = {
130+
ExceptionId: 2073,
131+
NhsNumber: "1211111881",
132+
DateCreated: "2025-05-16T14:26:09.28",
133+
DateResolved: "9999-12-31T00:00:00",
134+
RuleId: 21,
135+
RuleDescription: "The 'Superseded by NHS number' field is not null",
136+
Category: 5,
137+
ScreeningName: "Breast Screening",
138+
ExceptionDate: "2025-01-15T00:00:00",
139+
CohortName: "",
140+
Fatal: 1,
141+
ExceptionDetails: {
142+
GivenName: "Alice",
143+
FamilyName: "Smith",
144+
DateOfBirth: "19800101",
145+
ParticipantAddressLine1: "123 Main Street",
146+
ParticipantAddressLine2: "Flat 2B",
147+
ParticipantAddressLine3: "Central District",
148+
ParticipantAddressLine4: "London",
149+
ParticipantAddressLine5: "England",
150+
ParticipantPostCode: "E1 6AN",
151+
TelephoneNumberHome: "07123456789",
152+
EmailAddressHome: "alice.smith@example.com",
153+
PrimaryCareProvider: "E12345",
154+
Gender: 2,
155+
SupersededByNhsNumber: "1211111882",
156+
},
157+
ServiceNowId: "INC0002768",
158+
ServiceNowCreatedDate: "",
159+
RecordUpdatedDate: "2025-01-17T09:27:18.25",
160+
};
161+
return NextResponse.json(exception, { status: 200 });
162+
}
163+
91164
if (notRaisedOnly) {
92165
let items = [
93166
{
94167
ExceptionId: 2073,
95-
FileName:
96-
"202411261720028838554_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet",
97168
NhsNumber: "1211111881",
98169
DateCreated: "2025-05-16T14:26:09.28",
99170
DateResolved: "9999-12-31T00:00:00",
100171
RuleId: -2146233088,
101172
RuleDescription:
102173
"There was problem posting the participant to the database",
103-
ErrorRecord:
104-
'{"RecordType":"ADD","NhsNumber":"1211111881","RemovalReason":"","RemovalEffectiveFromDate":"","ScreeningId":"1","ScreeningName":"Breast Screening","EligibilityFlag":"1"}',
105174
Category: 5,
106175
ScreeningName: "Breast Screening",
107176
ExceptionDate: "2025-01-15T00:00:00",
108177
CohortName: "",
109178
Fatal: 1,
110-
ExceptionDetails: {
111-
GivenName: "Charlie",
112-
FamilyName: "Williams",
113-
DateOfBirth: "19900228",
114-
ParticipantAddressLine1: "789 Pine Road",
115-
ParticipantAddressLine2: "Suite 5",
116-
ParticipantAddressLine3: "East Side",
117-
ParticipantAddressLine4: "Birmingham",
118-
ParticipantAddressLine5: "United Kingdom",
119-
ParticipantPostCode: "B2 4QA",
120-
TelephoneNumberHome: "07345678901",
121-
EmailAddressHome: "charlie.williams@example.com",
122-
PrimaryCareProvider: "E67890",
123-
Gender: 1,
124-
},
125179
ServiceNowId: "",
126180
ServiceNowCreatedDate: "",
127181
RecordUpdatedDate: "2025-01-17T09:27:18.25",
128182
},
129183
{
130184
ExceptionId: 2074,
131-
FileName:
132-
"202411261720028838554_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet",
133185
NhsNumber: "1211111882",
134186
DateCreated: "2025-05-17T10:00:00.00",
135187
DateResolved: "9999-12-31T00:00:00",
136188
RuleId: -2146233089,
137189
RuleDescription:
138190
"Another error posting the participant to the database",
139-
ErrorRecord:
140-
'{"RecordType":"ADD","NhsNumber":"1211111882","RemovalReason":"","RemovalEffectiveFromDate":"","ScreeningId":"1","ScreeningName":"Breast Screening","EligibilityFlag":"1"}',
141191
Category: 5,
142192
ScreeningName: "Breast Screening",
143193
ExceptionDate: "2025-01-16T00:00:00",
144194
CohortName: "",
145195
Fatal: 1,
146-
ExceptionDetails: {
147-
GivenName: "Diana",
148-
FamilyName: "Brown",
149-
DateOfBirth: "19851130",
150-
ParticipantAddressLine1: "321 Maple Lane",
151-
ParticipantAddressLine2: "",
152-
ParticipantAddressLine3: "Northfield",
153-
ParticipantAddressLine4: "Leeds",
154-
ParticipantAddressLine5: "England",
155-
ParticipantPostCode: "LS1 4DT",
156-
TelephoneNumberHome: "07456789012",
157-
EmailAddressHome: "diana.brown@example.com",
158-
PrimaryCareProvider: "E98765",
159-
Gender: 2,
160-
},
161196
ServiceNowId: "",
162197
ServiceNowCreatedDate: "",
163198
RecordUpdatedDate: "2025-01-18T09:27:18.25",
164199
},
200+
{
201+
ExceptionId: 2075,
202+
NhsNumber: "1211111881",
203+
DateCreated: "2025-05-16T14:26:09.28",
204+
DateResolved: "9999-12-31T00:00:00",
205+
RuleId: 21,
206+
RuleDescription: "The 'Superseded by NHS number' field is not null",
207+
Category: 5,
208+
ScreeningName: "Breast Screening",
209+
ExceptionDate: "2025-01-15T00:00:00",
210+
CohortName: "",
211+
Fatal: 1,
212+
ServiceNowId: "",
213+
ServiceNowCreatedDate: "",
214+
RecordUpdatedDate: "2025-01-17T09:27:18.25",
215+
},
165216
];
166217

167218
if (sortBy === "1") {
@@ -192,107 +243,50 @@ export async function GET(request: Request) {
192243
let items = [
193244
{
194245
ExceptionId: 2083,
195-
FileName:
196-
"202411261720028838554_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet",
197246
NhsNumber: "1211111881",
198247
DateCreated: "2025-05-16T14:26:09.28",
199248
DateResolved: "9999-12-31T00:00:00",
200249
RuleId: -2146233088,
201250
RuleDescription:
202251
"There was problem posting the participant to the database",
203-
ErrorRecord:
204-
'{"RecordType":"ADD","NhsNumber":"1211111881","RemovalReason":"","RemovalEffectiveFromDate":"","ScreeningId":"1","ScreeningName":"Breast Screening","EligibilityFlag":"1"}',
205252
Category: 5,
206253
ScreeningName: "Breast Screening",
207254
ExceptionDate: "2025-01-15T00:00:00",
208255
CohortName: "",
209256
Fatal: 1,
210-
ExceptionDetails: {
211-
GivenName: "Charlie",
212-
FamilyName: "Williams",
213-
DateOfBirth: "19900228",
214-
ParticipantAddressLine1: "789 Pine Road",
215-
ParticipantAddressLine2: "Suite 5",
216-
ParticipantAddressLine3: "East Side",
217-
ParticipantAddressLine4: "Birmingham",
218-
ParticipantAddressLine5: "United Kingdom",
219-
ParticipantPostCode: "B2 4QA",
220-
TelephoneNumberHome: "07345678901",
221-
EmailAddressHome: "charlie.williams@example.com",
222-
PrimaryCareProvider: "E67890",
223-
Gender: 1,
224-
},
225257
ServiceNowId: "INC0002764",
226258
ServiceNowCreatedDate: "2025-06-16:00:00",
227259
RecordUpdatedDate: "2025-01-17T09:27:18.25",
228260
},
229261
{
230262
ExceptionId: 2084,
231-
FileName:
232-
"202411261720028838554_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet",
233263
NhsNumber: "1211111882",
234264
DateCreated: "2025-05-17T10:00:00.00",
235265
DateResolved: "9999-12-31T00:00:00",
236266
RuleId: -2146233089,
237267
RuleDescription:
238268
"Another error posting the participant to the database",
239-
ErrorRecord:
240-
'{"RecordType":"ADD","NhsNumber":"1211111882","RemovalReason":"","RemovalEffectiveFromDate":"","ScreeningId":"1","ScreeningName":"Breast Screening","EligibilityFlag":"1"}',
241269
Category: 5,
242270
ScreeningName: "Breast Screening",
243271
ExceptionDate: "2025-01-16T00:00:00",
244272
CohortName: "",
245273
Fatal: 1,
246-
ExceptionDetails: {
247-
GivenName: "Diana",
248-
FamilyName: "Brown",
249-
DateOfBirth: "19851130",
250-
ParticipantAddressLine1: "321 Maple Lane",
251-
ParticipantAddressLine2: "",
252-
ParticipantAddressLine3: "Northfield",
253-
ParticipantAddressLine4: "Leeds",
254-
ParticipantAddressLine5: "England",
255-
ParticipantPostCode: "LS1 4DT",
256-
TelephoneNumberHome: "07456789012",
257-
EmailAddressHome: "diana.brown@example.com",
258-
PrimaryCareProvider: "E98765",
259-
Gender: 2,
260-
},
261274
ServiceNowId: "INC0002765",
262275
ServiceNowCreatedDate: "2025-06-10T00:00:00",
263276
RecordUpdatedDate: "2025-01-18T09:27:18.25",
264277
},
265278
{
266279
ExceptionId: 2085,
267-
FileName:
268-
"202411261720028838554_1B8F53_-_CAAS_BREAST_SCREENING_COHORT.parquet",
269280
NhsNumber: "1211111883",
270281
DateCreated: "2025-05-18T11:00:00.00",
271282
DateResolved: "9999-12-31T00:00:00",
272-
RuleId: -2146233090,
273-
RuleDescription: "Third error posting the participant to the database",
274-
ErrorRecord:
275-
'{"RecordType":"ADD","NhsNumber":"1211111883","RemovalReason":"","RemovalEffectiveFromDate":"","ScreeningId":"1","ScreeningName":"Breast Screening","EligibilityFlag":"1"}',
283+
RuleId: 21,
284+
RuleDescription: "The 'Superseded by NHS number' field is not null",
276285
Category: 5,
277286
ScreeningName: "Breast Screening",
278287
ExceptionDate: "2025-01-17T00:00:00",
279288
CohortName: "",
280289
Fatal: 1,
281-
ExceptionDetails: {
282-
GivenName: "Edward",
283-
FamilyName: "Green",
284-
DateOfBirth: "19890214",
285-
ParticipantAddressLine1: "654 Willow Street",
286-
ParticipantAddressLine2: "Apt 7",
287-
ParticipantAddressLine3: "South Park",
288-
ParticipantAddressLine4: "Liverpool",
289-
ParticipantAddressLine5: "England",
290-
ParticipantPostCode: "L1 8JQ",
291-
TelephoneNumberHome: "07567890123",
292-
EmailAddressHome: "edward.green@example.com",
293-
PrimaryCareProvider: "E24680",
294-
Gender: 1,
295-
},
296290
ServiceNowId: "INC0002766",
297291
ServiceNowCreatedDate: "2025-06-12T00:00:00",
298292
RecordUpdatedDate: "2025-01-19T09:27:18.25",

application/CohortManager/src/Web/app/types/exceptionsApi/index.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
export interface ExceptionsAPI {
22
ExceptionId: number;
3-
FileName: string;
43
NhsNumber: string;
54
DateCreated: string;
65
DateResolved: string;
76
RuleId: number;
87
RuleDescription: string;
9-
ErrorRecord: string;
108
Category: number;
119
ScreeningName: string;
1210
ExceptionDate: string;
@@ -32,5 +30,6 @@ export interface ExceptionAPIDetails extends ExceptionsAPI {
3230
TelephoneNumberHome: string;
3331
EmailAddressHome: string;
3432
PrimaryCareProvider: string;
33+
SupersededByNhsNumber?: string;
3534
};
3635
}

0 commit comments

Comments
 (0)