Skip to content

Commit 95a6323

Browse files
authored
Chore: [AEA-6428] - Filter for notifications by application ID rather than name (#2917)
## Summary - Routine Change ### Details We need to update the code to filter notification suppliers based on product ID rather than by application name (which may change without us knowing). However, there needs to be a switchover period. I will implement the logic for the new way in parallel to the old, and have an environment variable `USE_PRODUCT_ID_FOR_NOTIFICATIONS_FILTERING` that toggles from one to the other. The enabled product IDs will be a new parameter also. The order of operations will be: - release this version out to prod, defaulting to still use the application name to filter on - Populate the product IDs for the currently enabled suppliers - Flip the environment variable to move to using product ID - Verify that it's working as expected - Create a new PR which removes the (now unused) product name filtering code, the `EnabledSystemsParameter`, and the environment variable `USE_PRODUCT_ID_FOR_NOTIFICATIONS_FILTERING`. - Release that to prod - Verify we're still good
1 parent 646cd01 commit 95a6323

20 files changed

Lines changed: 134 additions & 23 deletions

File tree

.github/scripts/release_code.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ sam deploy \
6969
EnabledSiteODSCodesValue="${ENABLED_SITE_ODS_CODES:-' '}" \
7070
EnablePostDatedNotifications="$ENABLE_POST_DATED_NOTIFICATIONS" \
7171
EnabledSystemsValue="${ENABLED_SYSTEMS:-' '}" \
72+
EnabledSupplierApplicationIDsValue="${ENABLED_SUPPLIER_APPLICATION_IDS:-' '}" \
7273
BlockedSiteODSCodesValue="${BLOCKED_SITE_ODS_CODES:-' '}" \
7374
NotifyRoutingPlanIDValue="$NOTIFY_ROUTING_PLAN_ID" \
7475
NotifyAPIBaseURLValue="$NOTIFY_API_BASE_URL" \

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ jobs:
8181
ENABLE_POST_DATED_NOTIFICATIONS: true
8282
ENABLED_SYSTEMS: "Internal Test System"
8383
BLOCKED_SITE_ODS_CODES: "B3J1Z"
84+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX"
8485
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
8586
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
8687
MTLS_KEY: psu-mtls-1
@@ -124,6 +125,7 @@ jobs:
124125
ENABLE_POST_DATED_NOTIFICATIONS: true
125126
ENABLED_SYSTEMS: "Internal Test System"
126127
BLOCKED_SITE_ODS_CODES: "B3J1Z"
128+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX" # Workaround empty string handling
127129
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
128130
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
129131
MTLS_KEY: psu-mtls-1
@@ -135,7 +137,8 @@ jobs:
135137
PROXYGEN_ROLE: ${{ secrets.PROXYGEN_PTL_ROLE }}
136138

137139
release_qa:
138-
needs: [tag_release, release_dev, package_code, get_commit_id, get_config_values]
140+
needs:
141+
[tag_release, release_dev, package_code, get_commit_id, get_config_values]
139142
uses: ./.github/workflows/run_release_code_and_api.yml
140143
with:
141144
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
@@ -164,6 +167,7 @@ jobs:
164167
ENABLE_POST_DATED_NOTIFICATIONS: true
165168
ENABLED_SYSTEMS: "Internal Test System"
166169
BLOCKED_SITE_ODS_CODES: "B3J1Z"
170+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX" # Workaround empty string handling
167171
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
168172
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
169173
MTLS_KEY: psu-mtls-1

.github/workflows/pull_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ jobs:
118118
ENABLE_POST_DATED_NOTIFICATIONS: true
119119
ENABLED_SYSTEMS: "Internal Test System"
120120
BLOCKED_SITE_ODS_CODES: "XXXXX" # Workaround empty string handling
121+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX"
121122
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
122123
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
123124
MTLS_KEY: psu-mtls-1
@@ -159,6 +160,7 @@ jobs:
159160
ENABLE_NOTIFICATIONS_EXTERNAL: false
160161
ENABLED_SYSTEMS: "Internal Test System"
161162
BLOCKED_SITE_ODS_CODES: "B3J1Z"
163+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX" # Workaround empty string handling
162164
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
163165
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
164166
MTLS_KEY: psu-mtls-1

.github/workflows/release.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ jobs:
4444
jira_release_prefix: "psu"
4545
secrets:
4646
EXECUTE_JIRA_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
47-
4847

4948
package_code:
5049
needs: [tag_release, get_config_values]
@@ -83,6 +82,7 @@ jobs:
8382
ENABLE_POST_DATED_NOTIFICATIONS: true
8483
ENABLED_SYSTEMS: "Internal Test System"
8584
BLOCKED_SITE_ODS_CODES: "XXXXX" # Workaround empty string handling
85+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX"
8686
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
8787
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
8888
MTLS_KEY: psu-mtls-1
@@ -129,6 +129,7 @@ jobs:
129129
ENABLE_POST_DATED_NOTIFICATIONS: false
130130
ENABLED_SYSTEMS: "Internal Test System"
131131
BLOCKED_SITE_ODS_CODES: "B3J1Z"
132+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX"
132133
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
133134
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
134135
MTLS_KEY: psu-mtls-1
@@ -181,6 +182,7 @@ jobs:
181182
ENABLE_POST_DATED_NOTIFICATIONS: false
182183
ENABLED_SYSTEMS: "Internal Test System, Apotec Ltd - Apotec CRM - Production, CrxPatientApp, nhsPrescriptionApp, Titan PSU Prod"
183184
BLOCKED_SITE_ODS_CODES: "B3J1Z"
185+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX"
184186
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
185187
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
186188
MTLS_KEY: psu-mtls-1
@@ -233,6 +235,7 @@ jobs:
233235
ENABLE_POST_DATED_NOTIFICATIONS: true
234236
ENABLED_SYSTEMS: "Internal Test System, Apotec Ltd - Apotec CRM - Production, CrxPatientApp, nhsPrescriptionApp, Titan PSU Prod"
235237
BLOCKED_SITE_ODS_CODES: "B3J1Z"
238+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX"
236239
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
237240
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
238241
MTLS_KEY: psu-mtls-1
@@ -248,7 +251,8 @@ jobs:
248251
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
249252

250253
release_int:
251-
needs: [tag_release, release_qa, package_code, get_commit_id, get_config_values]
254+
needs:
255+
[tag_release, release_qa, package_code, get_commit_id, get_config_values]
252256
uses: ./.github/workflows/run_release_code_and_api.yml
253257
with:
254258
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
@@ -277,6 +281,7 @@ jobs:
277281
ENABLE_POST_DATED_NOTIFICATIONS: true
278282
ENABLED_SYSTEMS: "CrxPatientApp"
279283
BLOCKED_SITE_ODS_CODES: "XXXXX" # Workaround empty string handling
284+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX"
280285
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
281286
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
282287
MTLS_KEY: psu-mtls-1
@@ -296,7 +301,8 @@ jobs:
296301
REGRESSION_TESTS_PEM: ${{ secrets.REGRESSION_TESTS_PEM }}
297302

298303
release_int_sandbox:
299-
needs: [tag_release, release_qa, package_code, get_commit_id, get_config_values]
304+
needs:
305+
[tag_release, release_qa, package_code, get_commit_id, get_config_values]
300306
uses: ./.github/workflows/run_release_code_and_api.yml
301307
with:
302308
pinned_image: ${{ needs.get_config_values.outputs.pinned_image }}
@@ -323,6 +329,7 @@ jobs:
323329
ENABLE_POST_DATED_NOTIFICATIONS: false
324330
ENABLED_SYSTEMS: "Internal Test System, Apotec Ltd - Apotec CRM - Production, CrxPatientApp, nhsPrescriptionApp, Titan PSU Prod"
325331
BLOCKED_SITE_ODS_CODES: "B3J1Z"
332+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX"
326333
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
327334
NOTIFY_API_BASE_URL: "https://int.api.service.nhs.uk"
328335
MTLS_KEY: psu-mtls-1
@@ -375,6 +382,7 @@ jobs:
375382
ENABLE_POST_DATED_NOTIFICATIONS: false
376383
ENABLED_SYSTEMS: "CrxPatientApp"
377384
BLOCKED_SITE_ODS_CODES: "XXXXX" # Workaround empty string handling
385+
ENABLED_SUPPLIER_APPLICATION_IDS: "XXXXX"
378386
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c" # INT and PROD share a value
379387
NOTIFY_API_BASE_URL: "https://api.service.nhs.uk"
380388
MTLS_KEY: psu-mtls-1

.github/workflows/run_release_code_and_api.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ on:
8585
BLOCKED_SITE_ODS_CODES:
8686
required: true
8787
type: string
88+
ENABLED_SUPPLIER_APPLICATION_IDS:
89+
required: true
90+
type: string
8891
NOTIFY_ROUTING_PLAN_ID:
8992
required: true
9093
type: string
@@ -216,6 +219,7 @@ jobs:
216219
ENABLED_SITE_ODS_CODES: ${{ steps.read.outputs.ods_csv }}
217220
ENABLED_SYSTEMS: ${{ inputs.ENABLED_SYSTEMS }}
218221
BLOCKED_SITE_ODS_CODES: ${{ inputs.BLOCKED_SITE_ODS_CODES }}
222+
ENABLED_SUPPLIER_APPLICATION_IDS: ${{ inputs.ENABLED_SUPPLIER_APPLICATION_IDS }}
219223
NOTIFY_ROUTING_PLAN_ID: ${{ inputs.NOTIFY_ROUTING_PLAN_ID }}
220224
NOTIFY_API_BASE_URL: ${{ inputs.NOTIFY_API_BASE_URL }}
221225
TEST_PRESCRIPTIONS_1: ${{ inputs.TEST_PRESCRIPTIONS_1 || 'noval' }}

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ sam-sync: guard-AWS_DEFAULT_PROFILE guard-stack_name compile
4848
"EnabledSystemsValue=$${ENABLED_SYSTEMS:-Internal Test System}" \
4949
"EnabledSiteODSCodesValue=$${ENABLED_SITE_ODS_CODES:-A83008,FA565}" \
5050
BlockedSiteODSCodesValue=$${BLOCKED_SITE_ODS_CODES:-XXXXX} \
51+
EnabledSupplierApplicationIDsValue=$${ENABLED_SUPPLIER_APPLICATION_IDS:-XXXXX} \
5152
NotifyRoutingPlanIDValue=$${NOTIFY_ROUTING_PLAN_ID:-e57fe5cc-0567-4854-abe2-b7dd9014a50c} \
5253
NotifyAPIBaseURLValue=$${NOTIFY_API_BASE_URL:-https://int.api.service.nhs.uk} \
5354
EnableNotificationsInternal=$${ENABLE_NOTIFICATIONS_INTERNAL:-true} \
@@ -80,6 +81,7 @@ sam-deploy: guard-AWS_DEFAULT_PROFILE guard-stack_name
8081
"EnabledSystemsValue=$${ENABLED_SYSTEMS:-Internal Test System}" \
8182
"EnabledSiteODSCodesValue=$${ENABLED_SITE_ODS_CODES:-A83008,FA565}" \
8283
BlockedSiteODSCodesValue=$${BLOCKED_SITE_ODS_CODES:-XXXXX} \
84+
EnabledSupplierApplicationIDsValue=$${ENABLED_SUPPLIER_APPLICATION_IDS:-XXXXX} \
8385
NotifyRoutingPlanIDValue=$${NOTIFY_ROUTING_PLAN_ID:-e57fe5cc-0567-4854-abe2-b7dd9014a50c} \
8486
NotifyAPIBaseURLValue=$${NOTIFY_API_BASE_URL:-https://int.api.service.nhs.uk} \
8587
EnableNotificationsInternal=$${ENABLE_NOTIFICATIONS_INTERNAL:-true} \

SAMtemplates/functions/main.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ Parameters:
4646
EnabledSystemsParam:
4747
Type: AWS::SSM::Parameter::Name<String>
4848

49+
EnabledSupplierApplicationIDsParam:
50+
Type: AWS::SSM::Parameter::Name<String>
51+
4952
BlockedSiteODSCodesParam:
5053
Type: AWS::SSM::Parameter::Name<String>
5154

@@ -132,8 +135,13 @@ Resources:
132135
POST_DATED_PRESCRIPTIONS_SQS_QUEUE_URL: !Ref PostDatedNotificationsSQSQueueUrl
133136
ENABLE_POST_DATED_NOTIFICATIONS: !Ref EnablePostDatedNotifications
134137
SQS_SALT: !Ref SQSSaltSecret
135-
ENABLED_SITE_ODS_CODES_PARAM: !Ref EnabledSiteODSCodesParam
138+
# Remove this once we've confirmed that product ID based filtering is working as expected and we
139+
# no longer need the ability to switch back to the old filtering method
140+
USE_APP_ID_FOR_NOTIFICATIONS_FILTERING: false
136141
ENABLED_SYSTEMS_PARAM: !Ref EnabledSystemsParam
142+
#
143+
ENABLED_APPLICATION_IDS_PARAM: !Ref EnabledSupplierApplicationIDsParam
144+
ENABLED_SITE_ODS_CODES_PARAM: !Ref EnabledSiteODSCodesParam
137145
BLOCKED_SITE_ODS_CODES_PARAM: !Ref BlockedSiteODSCodesParam
138146
ENABLE_NOTIFICATIONS_PARAM: !Ref EnableNotificationsInternalParam
139147
LOG_LEVEL: !Ref LogLevel

SAMtemplates/main_template.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ Parameters:
129129
Type: String
130130
Default: " "
131131

132+
EnabledSupplierApplicationIDsValue:
133+
Type: String
134+
Default: " "
135+
132136
BlockedSiteODSCodesValue:
133137
Type: String
134138
Default: " "
@@ -188,6 +192,7 @@ Resources:
188192
EnableNotificationsExternalValue: !Ref EnableNotificationsExternal
189193
EnabledSiteODSCodesValue: !Ref EnabledSiteODSCodesValue
190194
EnabledSystemsValue: !Ref EnabledSystemsValue
195+
EnabledSupplierApplicationIDsValue: !Ref EnabledSupplierApplicationIDsValue
191196
BlockedSiteODSCodesValue: !Ref BlockedSiteODSCodesValue
192197
NotifyRoutingPlanIDValue: !Ref NotifyRoutingPlanIDValue
193198
NotifyAPIBaseURLValue: !Ref NotifyAPIBaseURLValue
@@ -254,6 +259,7 @@ Resources:
254259
SQSSaltSecret: !GetAtt Secrets.Outputs.SQSSaltSecret
255260
EnabledSiteODSCodesParam: !GetAtt Parameters.Outputs.EnabledSiteODSCodesParameterName
256261
EnabledSystemsParam: !GetAtt Parameters.Outputs.EnabledSystemsParameterName
262+
EnabledSupplierApplicationIDsParam: !GetAtt Parameters.Outputs.EnabledSupplierApplicationIDsParameterName
257263
BlockedSiteODSCodesParam: !GetAtt Parameters.Outputs.BlockedSiteODSCodesParameterName
258264
NotifyRoutingPlanIDParam: !GetAtt Parameters.Outputs.NotifyRoutingPlanIDParameterName
259265
NotifyAPIBaseURLParam: !GetAtt Parameters.Outputs.NotifyAPIBaseURLParameterName

SAMtemplates/parameters/main.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ Parameters:
2828
Type: String
2929
Default: " "
3030

31+
EnabledSupplierApplicationIDsValue:
32+
Type: String
33+
Default: " "
34+
3135
BlockedSiteODSCodesValue:
3236
Type: String
3337
Default: " "
@@ -39,7 +43,7 @@ Parameters:
3943
NotifyAPIBaseURLValue:
4044
Type: String
4145
Default: " "
42-
46+
4347
TestPresciptionsParamValue1:
4448
Type: String
4549

@@ -69,6 +73,14 @@ Resources:
6973
Type: String
7074
Value: !Ref EnabledSystemsValue
7175

76+
EnabledSupplierApplicationIDsParameter:
77+
Type: AWS::SSM::Parameter
78+
Properties:
79+
Name: !Sub ${StackName}-PSUNotifyEnabledSupplierApplicationIDs
80+
Description: "List of supplier application IDs for which notifications are enabled"
81+
Type: String
82+
Value: !Ref EnabledSupplierApplicationIDsValue
83+
7284
BlockedSiteODSCodesParameter:
7385
Type: AWS::SSM::Parameter
7486
Properties:
@@ -155,6 +167,7 @@ Resources:
155167
Resource:
156168
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${StackName}-PSUNotifyEnabledSiteODSCodes
157169
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${StackName}-PSUNotifyEnabledSystems
170+
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${StackName}-PSUNotifyEnabledSupplierApplicationIDs
158171
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${StackName}-PSUNotifyBlockedSiteODSCodes
159172
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${StackName}-PSUNotifyRoutingPlanID
160173
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${StackName}-PSUNotifyApiBaseUrl
@@ -179,6 +192,12 @@ Outputs:
179192
Export:
180193
Name: !Sub ${StackName}-PSUNotifyEnabledSystemsParam
181194

195+
EnabledSupplierApplicationIDsParameterName:
196+
Description: "Name of the SSM parameter holding enabled supplier apigee application IDs"
197+
Value: !Ref EnabledSupplierApplicationIDsParameter
198+
Export:
199+
Name: !Sub ${StackName}-PSUNotifyEnabledSupplierApplicationIDsParam
200+
182201
BlockedSiteODSCodesParameterName:
183202
Description: "Name of the SSM parameter holding blocked site ODS codes"
184203
Value: !Ref BlockedSiteODSCodesParameter

packages/common/commonTypes/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export interface PSUDataItem {
1010
TaskID: string
1111
TerminalStatus: string
1212
ApplicationName: string
13+
ApplicationID: string
1314
ExpiryTime: number
1415
// (Optional, legacy batch-processors only) Indicates that {@link LastModified} is postdated;
1516
// contains the ISO 8601 timestamp when the postdated update was set.

0 commit comments

Comments
 (0)