Skip to content

Commit 5bdf4dc

Browse files
committed
Merge remote-tracking branch 'origin/main' into test/DTOSS-6327-add-ci-pl-for-ui-tests
2 parents 8475f0d + 86397f8 commit 5bdf4dc

56 files changed

Lines changed: 2302 additions & 605 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

application/CohortManager/compose.core.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ services:
225225
- ExceptionFunctionURL=http://create-exception:7070/api/CreateException
226226
- RetrievePdsParticipantURL=https://sandbox.api.service.nhs.uk/personal-demographics/FHIR/R4/Patient
227227
- DemographicDataServiceURL=http://participant-demographic-data-service:7993/api/ParticipantDemographicDataService
228+
- Kid=RetrievePdsDemographic-DEV1
229+
- Audience=https://int.api.service.nhs.uk/oauth2/token
230+
- AuthTokenURL=https://int.api.service.nhs.uk/oauth2/token
231+
- LocalPrivateKeyFileName=RetrievePdsDemographic-DEV1.pem.key
232+
- ClientId="Get-private-key-from-NHS-dev-portal"
228233

229234
manage-nems-subscription:
230235
container_name: manage-nems-subscription

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ private async Task AddBatchToQueue(Batch currentBatch, string name)
153153
_logger.LogInformation("sending {Count} records to queue", currentBatch.AddRecords.Count + currentBatch.UpdateRecords.Count);
154154

155155
await _addBatchToQueue.ProcessBatch(currentBatch.AddRecords, _config.ParticipantManagementTopic);
156+
await _addBatchToQueue.ProcessBatch(currentBatch.UpdateRecords, _config.ParticipantManagementTopic);
156157

157158
foreach (var updateRecords in currentBatch.DeleteRecords)
158159
{

application/CohortManager/src/Functions/CohortDistributionServices/DistributeParticipant/host.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"version": "2.0",
33
"functionTimeout": "01:00:00",
4-
54
"logging": {
65
"applicationInsights": {
76
"samplingSettings": {
@@ -22,6 +21,12 @@
2221
"extensions": {
2322
"durableTask": {
2423
"hubName": "DistributeParticipantTaskHub"
24+
},
25+
"serviceBus": {
26+
"prefetchCount": 0,
27+
"messageHandlerOptions": {
28+
"maxConcurrentCalls": 5
29+
}
2530
}
2631
}
2732
}

application/CohortManager/src/Functions/DemographicServices/ManageNemsSubscription/ManageNemsSubscription.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.2" />
1919
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.4" />
2020
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.2" />
21-
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.5.1" />
21+
<PackageReference Include="Azure.Security.KeyVault.Certificates" Version="4.6.0" />
2222
<PackageReference Include="Azure.Identity" Version="1.14.1" />
2323
</ItemGroup>
2424
<ItemGroup>

application/CohortManager/src/Functions/DemographicServices/RetrievePDSDemographic/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// Register health checks
2222
services.AddBasicHealthCheck("RetrievePdsDemographic");
2323
})
24+
.AddJwtTokenSigning()
2425
.AddTelemetry()
2526
.AddHttpClient()
2627
.Build();

application/CohortManager/src/Functions/DemographicServices/RetrievePDSDemographic/RetrievePDSDemographic.cs

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
namespace NHS.CohortManager.DemographicServices;
22

3+
using System;
34
using System.Net;
45
using System.Text.Json;
56
using Common;
67
using Common.Interfaces;
78
using DataServices.Client;
89
using Microsoft.Azure.Functions.Worker;
910
using Microsoft.Azure.Functions.Worker.Http;
11+
using Microsoft.Extensions.Caching.Memory;
1012
using Microsoft.Extensions.Logging;
1113
using Microsoft.Extensions.Options;
14+
using System.Threading.Tasks;
1215
using Model;
1316

1417
public class RetrievePdsDemographic
@@ -19,22 +22,27 @@ public class RetrievePdsDemographic
1922
private readonly RetrievePDSDemographicConfig _config;
2023
private readonly IFhirPatientDemographicMapper _fhirPatientDemographicMapper;
2124
private readonly IDataServiceClient<ParticipantDemographic> _participantDemographicClient;
25+
private readonly IBearerTokenService _bearerTokenService;
2226
private const string PdsParticipantUrlFormat = "{0}/{1}";
2327

28+
2429
public RetrievePdsDemographic(
2530
ILogger<RetrievePdsDemographic> logger,
2631
ICreateResponse createResponse,
2732
IHttpClientFunction httpClientFunction,
2833
IFhirPatientDemographicMapper fhirPatientDemographicMapper,
2934
IOptions<RetrievePDSDemographicConfig> retrievePDSDemographicConfig,
30-
IDataServiceClient<ParticipantDemographic> participantDemographicClient)
35+
IDataServiceClient<ParticipantDemographic> participantDemographicClient,
36+
IBearerTokenService bearerTokenService
37+
)
3138
{
3239
_logger = logger;
3340
_createResponse = createResponse;
3441
_httpClientFunction = httpClientFunction;
3542
_fhirPatientDemographicMapper = fhirPatientDemographicMapper;
3643
_config = retrievePDSDemographicConfig.Value;
3744
_participantDemographicClient = participantDemographicClient;
45+
_bearerTokenService = bearerTokenService;
3846
}
3947

4048
// TODO: Need to send an exception to the EXCEPTION_MANAGEMENT table whenever this function returns a non OK status.
@@ -43,6 +51,13 @@ public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymou
4351
{
4452
var nhsNumber = req.Query["nhsNumber"];
4553

54+
var bearerToken = await _bearerTokenService.GetBearerToken();
55+
if (bearerToken == null)
56+
{
57+
_logger.LogError("the bearer token could not be found");
58+
return _createResponse.CreateHttpResponse(HttpStatusCode.InternalServerError, req, "The bearer token could not be found");
59+
}
60+
4661
if (string.IsNullOrEmpty(nhsNumber) || !ValidationHelper.ValidateNHSNumber(nhsNumber))
4762
{
4863
return _createResponse.CreateHttpResponse(HttpStatusCode.BadRequest, req, "Invalid NHS number provided.");
@@ -51,8 +66,7 @@ public async Task<HttpResponseData> Run([HttpTrigger(AuthorizationLevel.Anonymou
5166
try
5267
{
5368
var url = string.Format(PdsParticipantUrlFormat, _config.RetrievePdsParticipantURL, nhsNumber);
54-
55-
var response = await _httpClientFunction.SendPdsGet(url);
69+
var response = await _httpClientFunction.SendPdsGet(url, bearerToken);
5670
string jsonResponse = "";
5771

5872
if (response.StatusCode == HttpStatusCode.NotFound)
@@ -145,4 +159,6 @@ private async Task<bool> DeleteDemographicRecord(string nhsNumber)
145159
_logger.LogError("Failed to delete Participant Demographic.");
146160
return false;
147161
}
162+
163+
148164
}

application/CohortManager/src/Functions/DemographicServices/RetrievePDSDemographic/RetrievePDSDemographic.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
2323
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
2424
</None>
25+
<None Update="RetrievePdsDemographic-DEV1.pem.key">
26+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
27+
</None>
2528
</ItemGroup>
2629
<ItemGroup>
2730
<Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />

application/CohortManager/src/Functions/DemographicServices/RetrievePDSDemographic/RetrievePDSDemographicConfig.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,22 @@ namespace NHS.CohortManager.DemographicServices;
44

55
public class RetrievePDSDemographicConfig
66
{
7+
78
[Required]
89
public required string RetrievePdsParticipantURL { get; set; }
910

1011
[Required]
1112
public required string DemographicDataServiceURL { get; set; }
13+
14+
[Required]
15+
public required string Audience { get; set; }
16+
17+
[Required]
18+
public required string ClientId { get; set; }
19+
20+
[Required]
21+
public required string KId { get; set; }
22+
23+
[Required]
24+
public required string AuthTokenURL { get; set; }
1225
}

application/CohortManager/src/Functions/Functions.sln

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeleteParticipant", "Partic
223223
EndProject
224224
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DeleteParticipantTests", "..\..\..\..\tests\UnitTests\ParticipantManagementServicesTests\DeleteParticipantTests\DeleteParticipantTests.csproj", "{4F791A36-A428-4FA8-BDD2-867251326183}"
225225
EndProject
226+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Functions.sln", "Functions.sln", "{E8E33C5F-F9FB-3ACA-2B58-298ED48517C1}"
227+
EndProject
228+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JWTTokenServiceTests", "..\..\..\..\tests\UnitTests\JWTTokenServiceTests\JWTTokenServiceTests.csproj", "{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}"
229+
EndProject
230+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthClientCredentialsTests", "..\..\..\..\tests\UnitTests\AuthClientCredentialsTests\AuthClientCredentialsTests.csproj", "{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}"
231+
EndProject
226232
Global
227233
GlobalSection(SolutionConfigurationPlatforms) = preSolution
228234
Debug|Any CPU = Debug|Any CPU
@@ -1337,6 +1343,30 @@ Global
13371343
{4F791A36-A428-4FA8-BDD2-867251326183}.Release|x64.Build.0 = Release|Any CPU
13381344
{4F791A36-A428-4FA8-BDD2-867251326183}.Release|x86.ActiveCfg = Release|Any CPU
13391345
{4F791A36-A428-4FA8-BDD2-867251326183}.Release|x86.Build.0 = Release|Any CPU
1346+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1347+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Debug|Any CPU.Build.0 = Debug|Any CPU
1348+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Debug|x64.ActiveCfg = Debug|Any CPU
1349+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Debug|x64.Build.0 = Debug|Any CPU
1350+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Debug|x86.ActiveCfg = Debug|Any CPU
1351+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Debug|x86.Build.0 = Debug|Any CPU
1352+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Release|Any CPU.ActiveCfg = Release|Any CPU
1353+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Release|Any CPU.Build.0 = Release|Any CPU
1354+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Release|x64.ActiveCfg = Release|Any CPU
1355+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Release|x64.Build.0 = Release|Any CPU
1356+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Release|x86.ActiveCfg = Release|Any CPU
1357+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050}.Release|x86.Build.0 = Release|Any CPU
1358+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1359+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
1360+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Debug|x64.ActiveCfg = Debug|Any CPU
1361+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Debug|x64.Build.0 = Debug|Any CPU
1362+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Debug|x86.ActiveCfg = Debug|Any CPU
1363+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Debug|x86.Build.0 = Debug|Any CPU
1364+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
1365+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Release|Any CPU.Build.0 = Release|Any CPU
1366+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Release|x64.ActiveCfg = Release|Any CPU
1367+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Release|x64.Build.0 = Release|Any CPU
1368+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Release|x86.ActiveCfg = Release|Any CPU
1369+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6}.Release|x86.Build.0 = Release|Any CPU
13401370
EndGlobalSection
13411371
GlobalSection(SolutionProperties) = preSolution
13421372
HideSolutionNode = FALSE
@@ -1396,5 +1426,7 @@ Global
13961426
{5641FB51-B7C1-445A-A210-EB985E05CC9E} = {CA13ADEB-51D6-44BD-8721-C858D693B481}
13971427
{4A786537-26D6-4964-BB53-C9B03A0CE5D6} = {19500E0D-AAAB-6F02-E24F-82619ACA2290}
13981428
{52C72C2E-9A76-4ECF-A210-C3F7C584C193} = {19500E0D-AAAB-6F02-E24F-82619ACA2290}
1429+
{4BD680A2-1ACB-7D6B-B2FD-8EBE9AEB5050} = {E8E33C5F-F9FB-3ACA-2B58-298ED48517C1}
1430+
{59CBDBE5-29BE-F38C-80E6-40843F2F8AF6} = {E8E33C5F-F9FB-3ACA-2B58-298ED48517C1}
13991431
EndGlobalSection
14001432
EndGlobal

application/CohortManager/src/Functions/ParticipantManagementServices/ManageParticipant/host.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
{
22
"version": "2.0",
3+
"extensions": {
4+
"serviceBus": {
5+
"prefetchCount": 0,
6+
"messageHandlerOptions": {
7+
"maxConcurrentCalls": 5
8+
}
9+
}
10+
},
311
"functionTimeout": "01:00:00",
412
"logging": {
513
"applicationInsights": {

0 commit comments

Comments
 (0)