Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions application/CohortManager/compose.cohort-distribution.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ services:
- BsSelectGpPracticeUrl=http://reference-data-service:7988/api/BsSelectGpPractice
- DtOsDatabaseConnectionString=Server=db,1433;Database=${DB_NAME};User Id=SA;Password=${PASSWORD};TrustServerCertificate=True
- LanguageCodeUrl=http://reference-data-service:7988/api/LanguageCode
- CurrentPostingUrl=http://reference-data-service:7988/api/CurrentPosting
- ExcludedSMULookupUrl=http://reference-data-service:7988/api/ExcludedSMU
- AcceptableLatencyThresholdMs=500

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ public interface ITransformDataLookupFacade
public string GetBsoCodeUsingPCP(string primaryCareProvider);
public bool ValidateLanguageCode(string languageCode);
public Task<HashSet<string>> GetCachedExcludedSMUValues();
string RetrievePostingCategory(string currentPosting);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
.AddDataServiceStaticCachedClient<BsSelectGpPractice>(config.BsSelectGpPracticeUrl)
.AddDataServiceStaticCachedClient<LanguageCode>(config.LanguageCodeUrl)
.AddDataServiceStaticCachedClient<ExcludedSMULookup>(config.ExcludedSMULookupUrl)
.AddDataServiceStaticCachedClient<CurrentPosting>(config.CurrentPostingUrl)
.Build()
.ConfigureServices(services =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class TransformDataLookupFacade : ITransformDataLookupFacade
private readonly IDataServiceClient<BsSelectGpPractice> _bsSelectGPPracticeClient;
private readonly IDataServiceClient<LanguageCode> _languageCodeClient;
private readonly IDataServiceClient<ExcludedSMULookup> _excludedSMUClient;
private readonly IDataServiceClient<CurrentPosting> _currentPostingClient;
private readonly IMemoryCache _memoryCache;
private readonly TransformDataServiceConfig _transformDataServiceConfig;

Expand All @@ -22,6 +23,7 @@ public TransformDataLookupFacade(IDataServiceClient<BsSelectOutCode> outcodeClie
IDataServiceClient<BsSelectGpPractice> bsSelectGPPracticeClient,
IDataServiceClient<LanguageCode> languageCodeClient,
IDataServiceClient<ExcludedSMULookup> excludedSMUClient,
IDataServiceClient<CurrentPosting> currentPostingClient,
ILogger<TransformDataLookupFacade> logger,
IMemoryCache memoryCache,
IOptions<TransformDataServiceConfig> transformDataServiceConfig)
Expand All @@ -30,6 +32,7 @@ public TransformDataLookupFacade(IDataServiceClient<BsSelectOutCode> outcodeClie
_bsSelectGPPracticeClient = bsSelectGPPracticeClient;
_languageCodeClient = languageCodeClient;
_excludedSMUClient = excludedSMUClient;
_currentPostingClient = currentPostingClient;
_memoryCache = memoryCache;
_logger = logger;
_transformDataServiceConfig = transformDataServiceConfig.Value;
Expand Down Expand Up @@ -113,4 +116,14 @@ public string GetBsoCodeUsingPCP(string primaryCareProvider)

return gpPractice.BsoCode;
}

public string RetrievePostingCategory(string currentPosting)
{
if (string.IsNullOrEmpty(currentPosting))
{
return null;
}
var result = _currentPostingClient.GetSingle(currentPosting).Result;
return result.PostingCategory;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class TransformDataServiceConfig
public string LanguageCodeUrl { get; set; }
[Required]
public string ExcludedSMULookupUrl { get; set; }

[Required]
public string CurrentPostingUrl { get; set; }
public int CacheTimeOutHours { get; set; } = 24;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,19 @@
"RuleName": "8.Transform.UpdatedRecordExcludedAndDMS",
"LocalParams": [
{
"Name": "IsPrimaryCareProviderNullOnUpdatedParticipant",
"Expression": "participant.PrimaryCareProvider == null"
"Name": "DMSInSMU",
"Expression": "participant.CurrentPosting == \"DMS\" && excludedSMUList.Contains(participant.PrimaryCareProvider)"
},
{
"Name": "IsPrimaryCareProviderNullDatabaseParticipant",
"Expression": "databaseParticipant.PrimaryCareProvider == null"
"Name": "WelshCurrentPosting",
"Expression": "dbLookup.RetrievePostingCategory(participant.CurrentPosting) == \"WALES\""
},
{
"Name": "IsNewRecordInSMU",
"Expression": "participant.CurrentPosting == \"DMS\" && (IsPrimaryCareProviderNullOnUpdatedParticipant ? false : !excludedSMUList.Contains(participant.PrimaryCareProvider)) || new string[] { \"English\", \"NHAIS\", \"Cipher\", \"ENG\", \"IM\" }.Contains(participant.CurrentPosting)"
},
{
"Name": "IsOldRecordInSMU",
"Expression": "databaseParticipant.CurrentPosting == \"DMS\" && (IsPrimaryCareProviderNullDatabaseParticipant ? false : excludedSMUList.Contains(databaseParticipant.PrimaryCareProvider)) || new string[] { \"Welsh\", \"NHAIS\", \"Cipher\", \"CYM\" }.Contains(databaseParticipant.CurrentPosting)"
"Name": "NoTransformationRequired",
"Expression": "existingParticipant.PrimaryCareProvider == null && existingParticipant.ReasonForRemoval == \"ORR\""
}
],
"Expression": "participant.RecordType == Actions.Amended && IsNewRecordInSMU && IsOldRecordInSMU",
"Expression": "participant.RecordType == Actions.Amended && (DMSInSMU || WelshCurrentPosting) && !NoTransformationRequired",
"Actions": {
"OnSuccess": {
"Name": "TransformAction",
Expand All @@ -48,6 +44,37 @@
}
}
},
{
"RuleName": "8a.Transform.NoTransformButError",
"LocalParams": [
{
"Name": "DMSInSMU",
"Expression": "participant.CurrentPosting == \"DMS\" && excludedSMUList.Contains(participant.PrimaryCareProvider)"
},
{
"Name": "WelshCurrentPosting",
"Expression": "dbLookup.RetrievePostingCategory(participant.CurrentPosting) == \"WALES\""
},{
"Name": "NoTransformationRequired",
"Expression": "existingParticipant.PrimaryCareProvider == null && existingParticipant.ReasonForRemoval == \"ORR\""
}
],
"Expression": "participant.RecordType == Actions.Amended && (DMSInSMU || WelshCurrentPosting) && NoTransformationRequired",
"Actions": {
"OnSuccess": {
"Name": "TransformAction",
"Context": {
"transformFields": [
{
"isExpression": false,
"field": "PrimaryCareProvider",
"value": null
}
]
}
}
}
},
{
"RuleName": "00.Other.InvalidFlag.TrueAndNoPrimaryCareProvider",
"Expression": "(!string.IsNullOrEmpty(participant.PrimaryCareProvider) && participant.InvalidFlag == \"1\") OR participant.RecordType == Actions.Removed",
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/tf-core/environments/development.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,11 @@ function_apps = {
function_app_key = "ReferenceDataService"
endpoint_name = "LanguageCode"
},
{
env_var_name = "CurrentPostingUrl"
function_app_key = "ReferenceDataService"
endpoint_name = "CurrentPosting"
},
{
env_var_name = "ExcludedSMULookupUrl"
function_app_key = "ReferenceDataService"
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/tf-core/environments/integration.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ function_apps = {
function_app_key = "ReferenceDataService"
endpoint_name = "LanguageCode"
},
{
env_var_name = "CurrentPostingUrl"
function_app_key = "ReferenceDataService"
endpoint_name = "CurrentPosting"
},
{
env_var_name = "ExcludedSMULookupUrl"
function_app_key = "ReferenceDataService"
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/tf-core/environments/nft.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,11 @@ function_apps = {
function_app_key = "ReferenceDataService"
endpoint_name = "LanguageCode"
},
{
env_var_name = "CurrentPostingUrl"
function_app_key = "ReferenceDataService"
endpoint_name = "CurrentPosting"
},
{
env_var_name = "ExcludedSMULookupUrl"
function_app_key = "ReferenceDataService"
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/tf-core/environments/preprod.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ function_apps = {
function_app_key = "ReferenceDataService"
endpoint_name = "LanguageCode"
},
{
env_var_name = "CurrentPostingUrl"
function_app_key = "ReferenceDataService"
endpoint_name = "CurrentPosting"
},
{
env_var_name = "ExcludedSMULookupUrl"
function_app_key = "ReferenceDataService"
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/tf-core/environments/production.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,11 @@ function_apps = {
function_app_key = "ReferenceDataService"
endpoint_name = "LanguageCode"
},
{
env_var_name = "CurrentPostingUrl"
function_app_key = "ReferenceDataService"
endpoint_name = "CurrentPosting"
},
{
env_var_name = "ExcludedSMULookupUrl"
function_app_key = "ReferenceDataService"
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/tf-core/environments/sandbox.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,11 @@ function_apps = {
function_app_key = "ReferenceDataService"
endpoint_name = "LanguageCode"
},
{
env_var_name = "CurrentPostingUrl"
function_app_key = "ReferenceDataService"
endpoint_name = "CurrentPosting"
},
{
env_var_name = "ExcludedSMULookupUrl"
function_app_key = "ReferenceDataService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class TransformDataLookupFacadeTests
private Mock<IDataServiceClient<BsSelectOutCode>> _outcodeClientMock = new();
private readonly Mock<IDataServiceClient<LanguageCode>> _languageCodeClientMock = new();
private Mock<IDataServiceClient<BsSelectGpPractice>> _gpPracticeClientMock = new();

private Mock<IDataServiceClient<CurrentPosting>> _currentPostingClientMock = new();
private Mock<IDataServiceClient<ExcludedSMULookup>> _excludedSMUClient = new();

private Mock<ILogger<TransformDataLookupFacade>> _logger = new();
Expand Down Expand Up @@ -55,7 +55,7 @@ public TransformDataLookupFacadeTests()
};

_memoryCache.Setup(m => m.TryGetValue(It.IsAny<object>(), out dummy)).Returns(true);
_sut = new(_outcodeClientMock.Object, _gpPracticeClientMock.Object, _languageCodeClientMock.Object, _excludedSMUClient.Object, _logger.Object, _memoryCache.Object, _config.Object);
_sut = new(_outcodeClientMock.Object, _gpPracticeClientMock.Object, _languageCodeClientMock.Object, _excludedSMUClient.Object, _currentPostingClientMock.Object, _logger.Object, _memoryCache.Object, _config.Object);
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
// This equates to "@epic4d-" tags, configured in the package.json at the playwright-tests root location.


export const runnerBasedEpic4dTestScenariosAdd = "@DTOSS-9492-01|@DTOSS-9496-01|@DTOSS-9498-01";
export const runnerBasedEpic4dTestScenariosAmend = "@DTOSS-9493-01|@DTOSS-9497-01|@DTOSS-9499-01";
export const runnerBasedEpic4dTestScenariosAdd = "@DTOSS-9496-01|@DTOSS-9498-01|@DTOSS-A456-01|@DTOSS-A457-01|@DTOSS-A459-01";
export const runnerBasedEpic4dTestScenariosAmend = "@DTOSS-9497-01|@DTOSS-9499-01|@DTOSS-A451-01|@DTOSS-A452-01|@DTOSS-A453-01|@DTOSS-A454-01|@DTOSS-A455-01|@DTOSS-A458-01";
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"validations": [
{
"validations": {
"apiEndpoint": "api/CohortDistributionDataService",
"NHSNumber": 9301065649,
"expectedCount": 1
},
"meta": {
"testJiraId": "@DTOSS-10451-01",
"requirementJiraId": "DTOSS-9935",
"additionalTags": "@regression @e2e @epic4d-rule8 Verify ADD records is processed without any Exception and participant is stored on Cohort_Distribution table for NHS Number 9998136431"
}
},
{
"validations": {
"apiEndpoint": "api/ParticipantManagementDataService",
"RecordType": "ADD",
"NHSNumber": 9301065649,
"expectedCount": 1
},
"meta": {
"testJiraId": "@DTOSS-10451-01",
"requirementJiraId": "DTOSS-9935",
"additionalTags": "@regression @e2e @epic4d-rule8 Verify ADD records is processed without any Exception and participant is stored on Participant_Management table for NHS Number 9998136431"
}
},
{
"validations": {
"apiEndpoint": "api/ParticipantDemographicDataService",
"NhsNumber": 9301065649,
"expectedCount": 1
},
"meta": {
"testJiraId": "@DTOSS-10451-01",
"requirementJiraId": "DTOSS-9935",
"additionalTags": "@regression @e2e @epic4d-rule8 Verify ADD records is processed without any Exception and participant is stored on Participant_Demographic table for NHS Number 9998136431"
}
}
],
"inputParticipantRecord": [
{
"record_type": "ADD",
"change_time_stamp": null,
"serial_change_number": 1,
"nhs_number": 9301065649,
"superseded_by_nhs_number": null,
"primary_care_provider": "A81001",
"primary_care_effective_from_date": null,
"current_posting": "DMS",
"current_posting_effective_from_date": "20130319",
"name_prefix": "Mr",
"given_name": "Darren",
"other_given_name": null,
"family_name": "Reg",
"previous_family_name": null,
"date_of_birth": "19720112",
"gender": 1,
"address_line_1": "AddressLine1",
"address_line_2": "AddressLine2",
"address_line_3": "AddressLine3",
"address_line_4": "AddressLine4",
"address_line_5": "AddressLine5",
"postcode": "AB23 1AF",
"paf_key": "Z3S4Q5X8",
"address_effective_from_date": "20250101",
"reason_for_removal": null,
"reason_for_removal_effective_from_date": null,
"date_of_death": null,
"death_status": null,
"home_telephone_number": "161999999",
"home_telephone_effective_from_date": "20240908",
"mobile_telephone_number": "788888888",
"mobile_telephone_effective_from_date": "20010101",
"email_address": "abc123@soup.io",
"email_address_effective_from_date": "20240101",
"preferred_language": "en",
"is_interpreter_required": false,
"invalid_flag": false,
"eligibility": true
}
],
"nhsNumbers": [
"9301065649"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"validations": [
{
"validations": {
"apiEndpoint": "api/ExceptionManagementDataService",
"NhsNumber": "9997111834",
"RuleId": 8,
"RuleDescription": "Participant was transformed as transform rule: UpdatedRecordExcludedAndDMS was executed"
},
"meta": {
"testJiraId": "@DTOSS-10451-01",
"requirementJiraId": "@DTOSS-9935",
"additionalTags": "@regression @e2e @epic4d-rule8 exception raised for participant CurrentPosting is DMS and PrimaryCareProvider is on excluded list with nhs number 9997111834"
}
}
],
"inputParticipantRecord": [
{
"record_type": "AMENDED",
"change_time_stamp": null,
"serial_change_number": 1,
"nhs_number": 9301065649,
"superseded_by_nhs_number": null,
"primary_care_provider": "A91203",
"primary_care_effective_from_date": null,
"current_posting": "DMS",
"current_posting_effective_from_date": "20130319",
"name_prefix": "Mr",
"given_name": "Darren",
"other_given_name": null,
"family_name": "Reg",
"previous_family_name": null,
"date_of_birth": "19720112",
"gender": 1,
"address_line_1": "AddressLine1",
"address_line_2": "AddressLine2",
"address_line_3": "AddressLine3",
"address_line_4": "AddressLine4",
"address_line_5": "AddressLine5",
"postcode": "AB23 1AF",
"paf_key": "Z3S4Q5X8",
"address_effective_from_date": "20250101",
"reason_for_removal": null,
"reason_for_removal_effective_from_date": null,
"date_of_death": null,
"death_status": null,
"home_telephone_number": "161999999",
"home_telephone_effective_from_date": "20240908",
"mobile_telephone_number": "788888888",
"mobile_telephone_effective_from_date": "20010101",
"email_address": "abc123@soup.io",
"email_address_effective_from_date": "20240101",
"preferred_language": "en",
"is_interpreter_required": false,
"invalid_flag": false,
"eligibility": true
}
],
"nhsNumbers": [
"9301065649"
]
}
Loading
Loading