Skip to content

Commit 156614a

Browse files
fix: rename basic participant data fields (#1220)
* fix: rename basic participant data fields * fix: rename field * fix: correct usage * fix: correct usage * fix: correct usage
1 parent d3127f9 commit 156614a

File tree

15 files changed

+56
-56
lines changed

15 files changed

+56
-56
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ private async Task AddRecordToBatch(Participant participant, Batch currentBatch,
134134
{
135135
var basicParticipantCsvRecord = new BasicParticipantCsvRecord
136136
{
137-
Participant = _createBasicParticipantData.BasicParticipantData(participant),
137+
BasicParticipantData = _createBasicParticipantData.BasicParticipantData(participant),
138138
FileName = fileName,
139-
participant = participant
139+
Participant = participant
140140
};
141141
// take note: we don't need to add DemographicData to the queue for update because we loop through all updates in the UpdateParticipant method
142142
switch (participant.RecordType?.Trim())
@@ -192,7 +192,7 @@ private async Task<bool> UpdateOldDemographicRecord(BasicParticipantCsvRecord ba
192192
try
193193
{
194194
long nhsNumber;
195-
if (!long.TryParse(basicParticipantCsvRecord.participant.NhsNumber, out nhsNumber))
195+
if (!long.TryParse(basicParticipantCsvRecord.Participant.NhsNumber, out nhsNumber))
196196
{
197197
throw new FormatException("Unable to parse NHS Number");
198198
}
@@ -205,7 +205,7 @@ private async Task<bool> UpdateOldDemographicRecord(BasicParticipantCsvRecord ba
205205
return false;
206206
}
207207

208-
var participantForUpdate = basicParticipantCsvRecord.participant.ToParticipantDemographic();
208+
var participantForUpdate = basicParticipantCsvRecord.Participant.ToParticipantDemographic();
209209
participantForUpdate.ParticipantId = participant.ParticipantId;
210210

211211
var updated = await _participantDemographic.Update(participantForUpdate);
@@ -221,7 +221,7 @@ private async Task<bool> UpdateOldDemographicRecord(BasicParticipantCsvRecord ba
221221
catch (Exception ex)
222222
{
223223
_logger.LogError(ex, "Update participant function failed.\nMessage: {Message}\nStack Trace: {StackTrace}", ex.Message, ex.StackTrace);
224-
await CreateError(basicParticipantCsvRecord.participant, name);
224+
await CreateError(basicParticipantCsvRecord.Participant, name);
225225
}
226226
return false;
227227
}
@@ -246,7 +246,7 @@ private async Task RemoveParticipant(BasicParticipantCsvRecord basicParticipantC
246246
catch (Exception ex)
247247
{
248248
_logger.LogError(ex, "Remove participant function failed.\nMessage: {Message}\nStack Trace: {StackTrace}", ex.Message, ex.StackTrace);
249-
await CreateError(basicParticipantCsvRecord.participant, filename);
249+
await CreateError(basicParticipantCsvRecord.Participant, filename);
250250
}
251251
}
252252

application/CohortManager/src/Functions/NemsSubscriptionService/ProcessNemsUpdate/ProcessNemsUpdate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ private async Task ProcessRecord(PdsDemographic pdsDemographic)
158158

159159
var basicParticipantCsvRecord = new BasicParticipantCsvRecord
160160
{
161-
Participant = _createBasicParticipantData.BasicParticipantData(participant),
161+
BasicParticipantData = _createBasicParticipantData.BasicParticipantData(participant),
162162
FileName = "NemsMessages",
163-
participant = participant
163+
Participant = participant
164164
};
165165

166166
updateRecord.Enqueue(basicParticipantCsvRecord);

application/CohortManager/src/Functions/ParticipantManagementServices/ManageParticipant/ManageParticipant.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public ManageParticipant(ILogger<ManageParticipant> logger,
4242
public async Task Run([ServiceBusTrigger("%ParticipantManagementQueueName%", Connection = "ServiceBusConnectionString")] string message)
4343
{
4444
var participantRecord = JsonSerializer.Deserialize<BasicParticipantCsvRecord>(message)!;
45-
Participant participant = participantRecord.participant;
45+
Participant participant = participantRecord.Participant;
4646
try
4747
{
4848
_logger.LogInformation("Recieved manage participant request");

application/CohortManager/src/Functions/ParticipantManagementServices/RemoveParticipant/RemoveParticipant.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymou
5151
catch (Exception ex)
5252
{
5353
_logger.LogError(ex, ex.Message);
54-
await _handleException.CreateSystemExceptionLog(ex, basicParticipantCsvRecord.Participant, basicParticipantCsvRecord.FileName);
54+
await _handleException.CreateSystemExceptionLog(ex, basicParticipantCsvRecord.BasicParticipantData, basicParticipantCsvRecord.FileName);
5555
return _createResponse.CreateHttpResponse(HttpStatusCode.BadRequest, req);
5656
}
5757

5858
try
5959
{
6060
var participantCsvRecord = new ParticipantCsvRecord
6161
{
62-
Participant = basicParticipantCsvRecord.participant,
62+
Participant = basicParticipantCsvRecord.Participant,
6363
FileName = basicParticipantCsvRecord.FileName,
6464
};
6565
participantCsvRecord.Participant.EligibilityFlag = EligibilityFlag.Ineligible; //Mark Participant As Ineligible
@@ -71,7 +71,7 @@ public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymou
7171
return _createResponse.CreateHttpResponse(HttpStatusCode.InternalServerError, req);
7272
}
7373

74-
var cohortDistributionResponse = await SendToCohortDistribution(basicParticipantCsvRecord.participant, participantCsvRecord.FileName);
74+
var cohortDistributionResponse = await SendToCohortDistribution(basicParticipantCsvRecord.Participant, participantCsvRecord.FileName);
7575

7676
if (!cohortDistributionResponse)
7777
{
@@ -86,7 +86,7 @@ public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymou
8686
catch (Exception ex)
8787
{
8888
_logger.LogError(ex, "Unable to call function.\nMessage: {Message}\nStack Trace: {StackTrace}", ex.Message, ex.StackTrace);
89-
await _handleException.CreateSystemExceptionLog(ex, basicParticipantCsvRecord.participant, basicParticipantCsvRecord.FileName);
89+
await _handleException.CreateSystemExceptionLog(ex, basicParticipantCsvRecord.Participant, basicParticipantCsvRecord.FileName);
9090
return _createResponse.CreateHttpResponse(HttpStatusCode.InternalServerError, req);
9191
}
9292
}

application/CohortManager/src/Functions/ParticipantManagementServices/addParticipant/addParticipant.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ public async Task Run([QueueTrigger("%AddQueueName%", Connection = "AzureWebJobs
5353
try
5454
{
5555
// Get demographic data
56-
var demographicData = await _getDemographicData.GetDemographicAsync(basicParticipantCsvRecord.Participant.NhsNumber, _config.DemographicURIGet);
56+
var demographicData = await _getDemographicData.GetDemographicAsync(basicParticipantCsvRecord.BasicParticipantData.NhsNumber, _config.DemographicURIGet);
5757
if (demographicData == null)
5858
{
5959
_logger.LogInformation("demographic function failed");
60-
await _handleException.CreateSystemExceptionLog(new Exception("demographic function failed"), basicParticipantCsvRecord.Participant, basicParticipantCsvRecord.FileName);
60+
await _handleException.CreateSystemExceptionLog(new Exception("demographic function failed"), basicParticipantCsvRecord.BasicParticipantData, basicParticipantCsvRecord.FileName);
6161
return;
6262
}
6363

64-
var participant = _createParticipant.CreateResponseParticipantModel(basicParticipantCsvRecord.Participant, demographicData);
64+
var participant = _createParticipant.CreateResponseParticipantModel(basicParticipantCsvRecord.BasicParticipantData, demographicData);
6565
var participantCsvRecord = new ParticipantCsvRecord
6666
{
6767
Participant = participant,
@@ -75,7 +75,7 @@ public async Task Run([QueueTrigger("%AddQueueName%", Connection = "AzureWebJobs
7575
if (response.IsFatal)
7676
{
7777
_logger.LogError("A fatal Rule was violated, so the record cannot be added to the database");
78-
await _handleException.CreateSystemExceptionLog(null, basicParticipantCsvRecord.Participant, basicParticipantCsvRecord.FileName);
78+
await _handleException.CreateSystemExceptionLog(null, basicParticipantCsvRecord.BasicParticipantData, basicParticipantCsvRecord.FileName);
7979
return;
8080
}
8181

@@ -92,7 +92,7 @@ public async Task Run([QueueTrigger("%AddQueueName%", Connection = "AzureWebJobs
9292
if (createResponse.StatusCode != HttpStatusCode.OK)
9393
{
9494
_logger.LogError("There was problem posting the participant to the database");
95-
await _handleException.CreateSystemExceptionLog(new Exception("There was problem posting the participant to the database"), basicParticipantCsvRecord.Participant, basicParticipantCsvRecord.FileName);
95+
await _handleException.CreateSystemExceptionLog(new Exception("There was problem posting the participant to the database"), basicParticipantCsvRecord.BasicParticipantData, basicParticipantCsvRecord.FileName);
9696
return;
9797

9898
}
@@ -103,15 +103,15 @@ public async Task Run([QueueTrigger("%AddQueueName%", Connection = "AzureWebJobs
103103
if (!cohortDistResponse)
104104
{
105105
_logger.LogError("Participant failed to send to Cohort Distribution Service");
106-
await _handleException.CreateSystemExceptionLog(new Exception("Participant failed to send to Cohort Distribution Service"), basicParticipantCsvRecord.Participant, basicParticipantCsvRecord.FileName);
106+
await _handleException.CreateSystemExceptionLog(new Exception("Participant failed to send to Cohort Distribution Service"), basicParticipantCsvRecord.BasicParticipantData, basicParticipantCsvRecord.FileName);
107107
return;
108108
}
109109

110110
}
111111
catch (Exception ex)
112112
{
113113
_logger.LogInformation(ex, "Unable to call function.\nMessage: {Message}\nStack Trace: {StackTrace}", ex.Message, ex.StackTrace);
114-
await _handleException.CreateSystemExceptionLog(ex, basicParticipantCsvRecord.Participant, basicParticipantCsvRecord.FileName);
114+
await _handleException.CreateSystemExceptionLog(ex, basicParticipantCsvRecord.BasicParticipantData, basicParticipantCsvRecord.FileName);
115115
}
116116
}
117117

application/CohortManager/src/Functions/ParticipantManagementServices/updateParticipant/updateParticipant.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ public async Task Run([QueueTrigger("%UpdateQueueName%", Connection = "AzureWebJ
4747

4848
try
4949
{
50-
var demographicData = await _checkDemographic.GetDemographicAsync(basicParticipantCsvRecord.Participant.NhsNumber, _config.DemographicURIGet);
50+
var demographicData = await _checkDemographic.GetDemographicAsync(basicParticipantCsvRecord.BasicParticipantData.NhsNumber, _config.DemographicURIGet);
5151

52-
var participant = _createParticipant.CreateResponseParticipantModel(basicParticipantCsvRecord.Participant, demographicData);
52+
var participant = _createParticipant.CreateResponseParticipantModel(basicParticipantCsvRecord.BasicParticipantData, demographicData);
5353
var participantCsvRecord = new ParticipantCsvRecord
5454
{
5555
Participant = participant,
@@ -84,14 +84,14 @@ public async Task Run([QueueTrigger("%UpdateQueueName%", Connection = "AzureWebJ
8484
catch (Exception ex)
8585
{
8686
_logger.LogError(ex, "Update participant failed.\nMessage: {Message}\nStack Trace: {StackTrace}", ex.Message, ex.StackTrace);
87-
await _handleException.CreateSystemExceptionLog(ex, basicParticipantCsvRecord.Participant, basicParticipantCsvRecord.FileName);
87+
await _handleException.CreateSystemExceptionLog(ex, basicParticipantCsvRecord.BasicParticipantData, basicParticipantCsvRecord.FileName);
8888
}
8989
}
9090

9191
private async Task HandleExceptions(string message, BasicParticipantCsvRecord participantRecord)
9292
{
9393
_logger.LogError(message);
94-
await _handleException.CreateSystemExceptionLog(new SystemException(message), participantRecord.Participant, participantRecord.FileName);
94+
await _handleException.CreateSystemExceptionLog(new SystemException(message), participantRecord.BasicParticipantData, participantRecord.FileName);
9595
}
9696

9797
private async Task<bool> SendToCohortDistribution(Participant participant, string fileName)

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ public async Task CreateDeletedRecordException(BasicParticipantCsvRecord partici
7070
RuleId = 0,
7171
RuleDescription = "Record received was flagged for deletion",
7272
FileName = participantCsvRecord.FileName,
73-
NhsNumber = participantCsvRecord.Participant.NhsNumber,
74-
ErrorRecord = JsonSerializer.Serialize(participantCsvRecord.Participant),
73+
NhsNumber = participantCsvRecord.BasicParticipantData.NhsNumber,
74+
ErrorRecord = JsonSerializer.Serialize(participantCsvRecord.BasicParticipantData),
7575
DateCreated = DateTime.Now,
7676
DateResolved = DateTime.MaxValue,
7777
ExceptionDate = DateTime.Now,
7878
Category = (int)ExceptionCategory.DeleteRecord,
79-
ScreeningName = participantCsvRecord.Participant.ScreeningName,
79+
ScreeningName = participantCsvRecord.BasicParticipantData.ScreeningName,
8080
CohortName = DefaultCohortName,
8181
Fatal = 1
8282

@@ -96,13 +96,13 @@ public async Task CreateSchemaValidationException(BasicParticipantCsvRecord part
9696
RuleId = 0,
9797
RuleDescription = description,
9898
FileName = participantCsvRecord.FileName,
99-
NhsNumber = participantCsvRecord.Participant.NhsNumber,
100-
ErrorRecord = JsonSerializer.Serialize(participantCsvRecord.Participant),
99+
NhsNumber = participantCsvRecord.BasicParticipantData.NhsNumber,
100+
ErrorRecord = JsonSerializer.Serialize(participantCsvRecord.BasicParticipantData),
101101
DateCreated = DateTime.Now,
102102
DateResolved = DateTime.MaxValue,
103103
ExceptionDate = DateTime.Now,
104104
Category = (int)ExceptionCategory.Schema,
105-
ScreeningName = participantCsvRecord.Participant.ScreeningName,
105+
ScreeningName = participantCsvRecord.BasicParticipantData.ScreeningName,
106106
CohortName = DefaultCohortName,
107107
Fatal = 1
108108

application/CohortManager/src/Functions/Shared/Model/BasicParticipantCsvRecord.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ namespace Model;
66
public class BasicParticipantCsvRecord
77
{
88
public string FileName { get; set; }
9-
public BasicParticipantData Participant { get; set; }
10-
public Participant participant { get; set; }
9+
public BasicParticipantData BasicParticipantData { get; set; }
10+
public Participant Participant { get; set; }
1111
}

tests/UnitTests/CaasIntegrationTests/AddBatchToQueueTest/AddBatchToQueueTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ public async Task ProcessBatch_ValidRecord_ProcessSuccessfully()
3030
Environment.SetEnvironmentVariable("AddQueueName", "AddQueueName");
3131
BasicParticipantCsvRecord basicParticipantCsvRecord = new BasicParticipantCsvRecord();
3232
basicParticipantCsvRecord.FileName = "TestFile";
33-
basicParticipantCsvRecord.Participant = new BasicParticipantData() { NhsNumber = "1234567890" };
34-
basicParticipantCsvRecord.participant = new Participant() { NhsNumber = "1234567890" };
33+
basicParticipantCsvRecord.BasicParticipantData = new BasicParticipantData() { NhsNumber = "1234567890" };
34+
basicParticipantCsvRecord.Participant = new Participant() { NhsNumber = "1234567890" };
3535

3636
var queue = new ConcurrentQueue<BasicParticipantCsvRecord>();
3737

tests/UnitTests/CaasIntegrationTests/processCaasFileTest/processCaasFileTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ public async Task AddRecordToBatch_UpdateRecord_addsRecordToBatch()
205205
var basicParticipantCsvRecord = new BasicParticipantCsvRecord()
206206
{
207207
FileName = "testFile",
208-
Participant = new BasicParticipantData { NhsNumber = "1234567890", RecordType = Actions.Amended },
209-
participant = new Participant { NhsNumber = "1234567890", RecordType = Actions.Amended }
208+
BasicParticipantData = new BasicParticipantData { NhsNumber = "1234567890", RecordType = Actions.Amended },
209+
Participant = new Participant { NhsNumber = "1234567890", RecordType = Actions.Amended }
210210
};
211211
var arguments = new object[] { basicParticipantCsvRecord, "TestName" };
212212

@@ -255,8 +255,8 @@ public async Task UpdateRecords_ValidNewRecord_ThrowsError()
255255
var basicParticipantCsvRecord = new BasicParticipantCsvRecord()
256256
{
257257
FileName = "testFile",
258-
Participant = new BasicParticipantData { NhsNumber = "1234567890", RecordType = Actions.Amended },
259-
participant = new Participant { NhsNumber = "1234567890", RecordType = Actions.Amended }
258+
BasicParticipantData = new BasicParticipantData { NhsNumber = "1234567890", RecordType = Actions.Amended },
259+
Participant = new Participant { NhsNumber = "1234567890", RecordType = Actions.Amended }
260260
};
261261

262262
var response = new ParticipantDemographic { ParticipantId = 1, GivenName = "" };
@@ -295,9 +295,9 @@ public async Task RemoveParticipant_ValidRecordNotAllowDeleteRecords_LogsAndHand
295295
var participant = new Participant { NhsNumber = "1234567890", RecordType = Actions.Removed };
296296
var basicParticipantCsvRecord = new BasicParticipantCsvRecord
297297
{
298-
Participant = new BasicParticipantData { NhsNumber = "1234567890", RecordType = Actions.Removed },
298+
BasicParticipantData = new BasicParticipantData { NhsNumber = "1234567890", RecordType = Actions.Removed },
299299
FileName = "testFile",
300-
participant = participant
300+
Participant = participant
301301
};
302302

303303
_exceptionHandlerMock.Setup(m => m.CreateDeletedRecordException(
@@ -334,9 +334,9 @@ public async Task RemoveParticipant_ValidRecordAllowDeleteRecords_LogsInformatio
334334
var participant = new Participant { NhsNumber = "1234567890", RecordType = Actions.Removed };
335335
var basicParticipantCsvRecord = new BasicParticipantCsvRecord
336336
{
337-
Participant = new BasicParticipantData { NhsNumber = "1234567890", RecordType = Actions.Removed },
337+
BasicParticipantData = new BasicParticipantData { NhsNumber = "1234567890", RecordType = Actions.Removed },
338338
FileName = "testFile",
339-
participant = participant
339+
Participant = participant
340340
};
341341

342342
var arguments = new object[] { basicParticipantCsvRecord, "testFile" };
@@ -367,9 +367,9 @@ public async Task RemoveParticipant_ValidRecord_ThrowsError()
367367
var participant = new Participant { NhsNumber = "1234567890", RecordType = Actions.Removed };
368368
var basicParticipantCsvRecord = new BasicParticipantCsvRecord
369369
{
370-
Participant = new BasicParticipantData { NhsNumber = "1234567890", RecordType = Actions.Removed },
370+
BasicParticipantData = new BasicParticipantData { NhsNumber = "1234567890", RecordType = Actions.Removed },
371371
FileName = "testFile",
372-
participant = participant
372+
Participant = participant
373373
};
374374

375375
_exceptionHandlerMock.Setup(m => m.CreateDeletedRecordException(

0 commit comments

Comments
 (0)