Skip to content
Merged
Show file tree
Hide file tree
Changes from 76 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
3297769
Define the infrastucture. Dummy lambda that runs frequently
wildjames Jan 8, 2026
61fdeca
Merge branch 'main' into aea-6063-trigger-post-dated-prescriptions
wildjames Jan 8, 2026
597059e
Update the PSU lambda to put post-dated data on the post-dated SQS
wildjames Jan 8, 2026
3cda946
Add env var for sqs tests
wildjames Jan 8, 2026
fe140ab
Implement reading the SQS messages in the post dated lambda
wildjames Jan 21, 2026
643f215
Merge branch 'main' into aea-6063-trigger-post-dated-prescriptions
wildjames Jan 21, 2026
0eeaa97
Update package lock
wildjames Jan 21, 2026
e3c8e77
Fix test config
wildjames Jan 21, 2026
d32be2d
log post dated information, if present
wildjames Jan 22, 2026
ee978cf
Forgot to pass the new SQS url through to the lambda functions
wildjames Jan 22, 2026
99eecc1
Fetch matching prescription ID records fromthe prescriptions data table
wildjames Jan 22, 2026
58daa99
Rename file
wildjames Jan 22, 2026
d2c6e3d
Missed the tests file
wildjames Jan 22, 2026
a3e3f4d
The data table fetching was not using the GSI - update it so that it …
wildjames Jan 22, 2026
efc7629
When pushing to SQS, log what url it's going to
wildjames Jan 22, 2026
cecede6
I was passing the incorrect table name in to the post dated lambda
wildjames Jan 22, 2026
7083f88
update table policies
wildjames Jan 22, 2026
939e2e7
Review yesterdays work. Leave some todo notes for the business logic
wildjames Jan 23, 2026
a94ad39
Simplify some logic, clean up some bits
wildjames Jan 23, 2026
c7fe17d
Minor changes.
wildjames Jan 23, 2026
13c033a
Refactor the updatePrecriptionStatus SQS interface so that it's a bit…
wildjames Jan 23, 2026
e3dcf14
Update updatePrescriptionStatus SQS handling test script to test the …
wildjames Jan 23, 2026
8c5fbd6
Add unit tests for the database client
wildjames Jan 23, 2026
1d60b95
Minimal orchestration test setup
wildjames Jan 23, 2026
4e73794
expand the test coverage of the orchestration script a bit
wildjames Jan 23, 2026
13474a0
Imrprove testing coverage of the orchestration suite
wildjames Jan 23, 2026
8240337
Rename util file.
wildjames Jan 23, 2026
2f44905
Forgot to rename imports
wildjames Jan 23, 2026
28974e0
Start writing the unit tests for the SQS interface
wildjames Jan 23, 2026
a5e03b7
Expand SQS test suite
wildjames Jan 23, 2026
97a7f24
Gate the post-dated lambda behind a feature flag in updatePrescriptio…
wildjames Jan 23, 2026
45941d0
When the flag is off, don't require the post dated sqs url. Also, add…
wildjames Jan 23, 2026
5799bbf
Update test env vars
wildjames Jan 23, 2026
f1d9d58
await async call
wildjames Jan 23, 2026
7b4e5ec
Rename PostModifiedDataItem to PostUpdatedDataItem
wildjames Jan 26, 2026
59c0496
Revert "Rename PostModifiedDataItem to PostUpdatedDataItem"
wildjames Jan 26, 2026
2554fa5
Refactor SQS to send messages in parallel
wildjames Jan 26, 2026
cf80b91
rename function. Pass notifications SQS into the post dated lambda
wildjames Jan 26, 2026
ebff1ac
Update the psotDatedLambda to forward matured prescriptions to the no…
wildjames Jan 26, 2026
fd472a9
Update package lock
wildjames Jan 26, 2026
23de0fe
Add dynamo dependency that we needed
wildjames Jan 26, 2026
902d99e
Fix SAM template
wildjames Jan 26, 2026
34c895e
Forgot to pass through feature flag
wildjames Jan 26, 2026
76a3165
Receive dedupe IDs, and pass them through when forwarding SQS messages
wildjames Jan 26, 2026
53c7535
Include postdatedlastmodifiedsetat in dynamo attributes
wildjames Jan 26, 2026
a99be63
Define a new GSI for post-dated enrichment
wildjames Jan 26, 2026
10d6328
Merge branch 'main' into aea-6063-trigger-post-dated-prescriptions
wildjames Jan 26, 2026
4c65bd4
Extend the NotifyDataItem to include the prescription ID, rather than…
wildjames Jan 27, 2026
4f47313
Add an override flag for the post-dated business logic, for testing l…
wildjames Jan 27, 2026
f0d010f
refactor the db client
wildjames Jan 27, 2026
46dd8ec
Partially implement the business logic
wildjames Jan 27, 2026
1d12b94
Fix unit tests
wildjames Jan 27, 2026
f7529b9
Implement business logic
wildjames Jan 27, 2026
719b1b2
Update doc
wildjames Jan 28, 2026
08e3065
Logging and function name change
wildjames Jan 28, 2026
52b0878
Update logic to actually compute the time until the prescription matu…
wildjames Jan 28, 2026
c44f2ef
Add a filter so that prior post-dated updates do not block notificati…
wildjames Jan 28, 2026
9090dfc
Correct the check - logic was backwards
wildjames Jan 28, 2026
07de0b6
Thought of another edge case
wildjames Jan 28, 2026
6f6ae55
convert milliseconds to seconds
wildjames Jan 28, 2026
d645e62
Dont query by ODS code
wildjames Jan 30, 2026
f501651
Write a little prose to help understand the business logic. forgot to…
wildjames Jan 30, 2026
026665d
Refactor out limiting the NPPTS query by ODS code
wildjames Jan 30, 2026
3131059
missed a few ODS code bits
wildjames Jan 30, 2026
ef7610f
key schema attribute needs to be hash, not range
wildjames Jan 30, 2026
40d2751
Flesh out dynamo tests a bit more, and stop sorting in the dynamo client
wildjames Jan 30, 2026
d89b815
merge main
wildjames Feb 3, 2026
89994c8
Remove custom data type for sqs batch message entries, and use the gi…
wildjames Feb 4, 2026
62d107f
Merge branch 'main' into aea-6063-trigger-post-dated-prescriptions
wildjames Feb 4, 2026
a3a196a
Address some of Tim's comments
wildjames Feb 4, 2026
78322dc
Fix typo
wildjames Feb 5, 2026
45782e3
Remove references to overriding post-dated logic
wildjames Feb 6, 2026
64b2466
Update trivy ignore with braces expansion
wildjames Feb 6, 2026
01cd0b6
Use a switch instead of sequential if else
wildjames Feb 6, 2026
ebe85a1
Refactor after some discussion
wildjames Feb 6, 2026
aa91e50
Update docs
wildjames Feb 11, 2026
d4518c2
Update mermaid again
wildjames Feb 11, 2026
57d1e02
remove completed todo
wildjames Feb 12, 2026
589f2dd
Merge main
wildjames Feb 12, 2026
9a1dda8
Merge branch 'main' into aea-6063-trigger-post-dated-prescriptions
wildjames Feb 12, 2026
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
ENABLE_BACKUP: "True"
ENABLE_NOTIFICATIONS_INTERNAL: true
ENABLE_NOTIFICATIONS_EXTERNAL: false
ENABLE_POST_DATED_NOTIFICATIONS: true
ENABLED_SYSTEMS: "Internal Test System"
BLOCKED_SITE_ODS_CODES: "B3J1Z"
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
Expand Down Expand Up @@ -126,6 +127,7 @@ jobs:
ENABLE_BACKUP: "False"
ENABLE_NOTIFICATIONS_INTERNAL: false
ENABLE_NOTIFICATIONS_EXTERNAL: false
ENABLE_POST_DATED_NOTIFICATIONS: true
ENABLED_SYSTEMS: "Internal Test System"
BLOCKED_SITE_ODS_CODES: "B3J1Z"
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
Expand Down Expand Up @@ -163,6 +165,7 @@ jobs:
ENABLE_BACKUP: "False"
ENABLE_NOTIFICATIONS_INTERNAL: false
ENABLE_NOTIFICATIONS_EXTERNAL: false
ENABLE_POST_DATED_NOTIFICATIONS: true
ENABLED_SYSTEMS: "Internal Test System"
BLOCKED_SITE_ODS_CODES: "B3J1Z"
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ jobs:
ENABLE_BACKUP: "False"
ENABLE_NOTIFICATIONS_INTERNAL: true
ENABLE_NOTIFICATIONS_EXTERNAL: false
ENABLE_POST_DATED_NOTIFICATIONS: true
ENABLED_SYSTEMS: "Internal Test System"
BLOCKED_SITE_ODS_CODES: "XXXXX" # Workaround empty string handling
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
ENABLE_BACKUP: "True"
ENABLE_NOTIFICATIONS_INTERNAL: false
ENABLE_NOTIFICATIONS_EXTERNAL: false
ENABLE_POST_DATED_NOTIFICATIONS: true
ENABLED_SYSTEMS: "Internal Test System"
BLOCKED_SITE_ODS_CODES: "XXXXX" # Workaround empty string handling
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
Expand Down Expand Up @@ -223,6 +224,7 @@ jobs:
ENABLE_BACKUP: "False"
ENABLE_NOTIFICATIONS_INTERNAL: false
ENABLE_NOTIFICATIONS_EXTERNAL: false
ENABLE_POST_DATED_NOTIFICATIONS: true
ENABLED_SYSTEMS: "Internal Test System, Apotec Ltd - Apotec CRM - Production, CrxPatientApp, nhsPrescriptionApp, Titan PSU Prod"
BLOCKED_SITE_ODS_CODES: "B3J1Z"
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
Expand Down Expand Up @@ -266,6 +268,7 @@ jobs:
ENABLE_BACKUP: "True"
ENABLE_NOTIFICATIONS_INTERNAL: true
ENABLE_NOTIFICATIONS_EXTERNAL: true
ENABLE_POST_DATED_NOTIFICATIONS: true
ENABLED_SYSTEMS: "Internal Test System" # Workaround empty string handling
BLOCKED_SITE_ODS_CODES: "XXXXX" # Workaround empty string handling
NOTIFY_ROUTING_PLAN_ID: "e57fe5cc-0567-4854-abe2-b7dd9014a50c"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/run_release_code_and_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ on:
required: false
type: boolean
default: false
ENABLE_POST_DATED_NOTIFICATIONS:
required: false
type: boolean
default: false
ENABLED_SYSTEMS:
required: true
type: string
Expand Down Expand Up @@ -215,6 +219,7 @@ jobs:
ENABLE_BACKUP: ${{ inputs.ENABLE_BACKUP }}
ENABLE_NOTIFICATIONS_INTERNAL: ${{ inputs.ENABLE_NOTIFICATIONS_INTERNAL }}
ENABLE_NOTIFICATIONS_EXTERNAL: ${{ inputs.ENABLE_NOTIFICATIONS_EXTERNAL }}
ENABLE_POST_DATED_NOTIFICATIONS: ${{ inputs.ENABLE_POST_DATED_NOTIFICATIONS }}
REQUIRE_APPLICATION_NAME: ${{ inputs.REQUIRE_APPLICATION_NAME }}
ENABLED_SITE_ODS_CODES: ${{ steps.read.outputs.ods_csv }}
ENABLED_SYSTEMS: ${{ inputs.ENABLED_SYSTEMS }}
Expand Down
12 changes: 11 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ repos:
files: ^packages\/checkPrescriptionStatusUpdates
types_or: [ts, tsx, javascript, jsx, json]
pass_filenames: false

- id: lint-nhsNotifyLambda
name: Lint nhsNotifyLambda
entry: npm
Expand All @@ -97,6 +97,16 @@ repos:
types_or: [ts, tsx, javascript, jsx, json]
pass_filenames: false

- id: lint-postDatedLambda
name: List Post-dated handling lambda
entry: npm
args:
["run", "--prefix=packages/postDatedLambda", "lint"]
language: system
files: ^packages\/postDatedLambda
types_or: [ts, tsx, javascript, jsx, json]
pass_filenames: false

- id: lint-commonTesting
name: Lint common/testing
entry: npm
Expand Down
6 changes: 5 additions & 1 deletion .trivyignore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@ vulnerabilities:
- id: CVE-2026-25128
statement: fast-xml-parser vulnerability accepted as risk - dependency of aws-sdk/client-dynamodb
expired_at: 2026-03-01

- id: CVE-2026-25547
paths:
- "package-lock.json"
statement: downstream dependency of @isaacs/brace-expansion
expired_at: 2026-06-01
4 changes: 4 additions & 0 deletions .vscode/eps-prescription-status-update-api.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
"name": "packages/nhsNotifyLambda",
"path": "../packages/nhsNotifyLambda"
},
{
"name": "packages/postDatedLambda",
"path": "../packages/postDatedLambda"
},
{
"name": "packages/nhsNotifyUpdateCallback",
"path": "../packages/nhsNotifyUpdateCallback"
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ sam-list-resources: guard-AWS_DEFAULT_PROFILE guard-stack_name
sam-list-outputs: guard-AWS_DEFAULT_PROFILE guard-stack_name
sam list stack-outputs --stack-name $$stack_name

sam-validate:
sam-validate:
sam validate --template-file SAMtemplates/main_template.yaml --region eu-west-2
sam validate --template-file SAMtemplates/apis/main.yaml --region eu-west-2
sam validate --template-file SAMtemplates/apis/api_resources.yaml --region eu-west-2
Expand Down Expand Up @@ -120,6 +120,7 @@ lint-node: compile-node
npm run lint --workspace packages/cpsuLambda
npm run lint --workspace packages/checkPrescriptionStatusUpdates
npm run lint --workspace packages/nhsNotifyLambda
npm run lint --workspace packages/postDatedLambda
npm run lint --workspace packages/nhsNotifyUpdateCallback
npm run lint --workspace packages/common/testing
npm run lint --workspace packages/common/middyErrorHandler
Expand Down Expand Up @@ -152,6 +153,7 @@ test: compile
npm run test --workspace packages/cpsuLambda
npm run test --workspace packages/checkPrescriptionStatusUpdates
npm run test --workspace packages/nhsNotifyLambda
npm run test --workspace packages/postDatedLambda
npm run test --workspace packages/nhsNotifyUpdateCallback
npm run test --workspace packages/common/middyErrorHandler
npm run test --workspace packages/psuRestoreValidationLambda
Expand All @@ -172,6 +174,8 @@ clean:
rm -rf packages/cpsuLambda/lib
rm -rf packages/nhsNotifyLambda/coverage
rm -rf packages/nhsNotifyLambda/lib
rm -rf packages/postDatedLambda/coverage
rm -rf packages/postDatedLambda/lib
rm -rf packages/nhsNotifyUpdateCallback/coverage
rm -rf packages/nhsNotifyUpdateCallback/lib
rm -rf packages/checkPrescriptionStatusUpdates/lib
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# EPS Prescription Status Update API

![Build](https://github.com/NHSDigital/eps-prescription-status-update-api/actions/workflows/ci.yml/badge.svg?branch=main)
![Build](https://github.com/NHSDigital/eps-prescription-status-update-api/actions/workflows/ci.yml/badge.svg?branch=main)
![Release](https://github.com/NHSDigital/eps-prescription-status-update-api/actions/workflows/release.yml/badge.svg?branch=main)

## Versions and deployments

Version release history can be found ot https://github.com/NHSDigital/eps-prescription-status-update-api/releases.
We use eslint convention for commit messages for commits to main branch. Descriptions for the types of changes in a release can be found in the [contributing guidelines](./CONTRIBUTING.md)
Version release history can be found ot https://github.com/NHSDigital/eps-prescription-status-update-api/releases.
We use eslint convention for commit messages for commits to main branch. Descriptions for the types of changes in a release can be found in the [contributing guidelines](./CONTRIBUTING.md)
Deployment history can be found at https://nhsdigital.github.io/eps-prescription-status-update-api/

## Introduction
Expand All @@ -20,6 +20,7 @@ This is the AWS layer that provides an API for EPS Prescription Status Update.
- `packages/capabilityStatement` Returns a static capability statement.
- `packages/cpsuLambda` Handles updating prescription status using a custom format.
- `packages/nhsNotifyLambda` Handles sending prescription notifications to the NHS Notify service.
- `packages/postDatedLambda` Handles business logic for post-dated prescriptions getting notifications \[deprecated\].
- `packages/nhsNotifyUpdateCallback` Handles receiving notification updates from the NHS Notify service.
- `packages/checkPrescriptionStatusUpdates` Validates and retrieves prescription status update data.
- `packages/gsul` Expose data owned by PSU but needed by [PfP](https://github.com/NHSDigital/prescriptionsforpatients)
Expand Down Expand Up @@ -56,9 +57,9 @@ The contents of this repository are protected by Crown Copyright (C).

## Development

It is recommended that you use visual studio code and a devcontainer as this will install all necessary components and correct versions of tools and languages.
See https://code.visualstudio.com/docs/devcontainers/containers for details on how to set this up on your host machine.
There is also a workspace file in .vscode that should be opened once you have started the devcontainer. The workspace file can also be opened outside of a devcontainer if you wish.
It is recommended that you use visual studio code and a devcontainer as this will install all necessary components and correct versions of tools and languages.
See https://code.visualstudio.com/docs/devcontainers/containers for details on how to set this up on your host machine.
There is also a workspace file in .vscode that should be opened once you have started the devcontainer. The workspace file can also be opened outside of a devcontainer if you wish.
The project uses [SAM](https://aws.amazon.com/serverless/sam/) to develop and deploy the APIs and associated resources.

All commits must be made using [signed commits](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits).
Expand Down Expand Up @@ -239,8 +240,8 @@ Workflows are in the `.github/workflows` folder:

### Github pages

Github pages is used to display deployment information. The source for github pages is in the gh-pages branch.
As part of the ci and release workflows, the release tag (either the short commit SHA or release tag) is appended to \_data/{environment}\_deployments.csv so we have a history of releases and replaced in \_data/{environment}\_latest.csv so we now what the latest released version is.
Github pages is used to display deployment information. The source for github pages is in the gh-pages branch.
As part of the ci and release workflows, the release tag (either the short commit SHA or release tag) is appended to \_data/{environment}\_deployments.csv so we have a history of releases and replaced in \_data/{environment}\_latest.csv so we now what the latest released version is.
There are different makefile targets in this branch. These are

- `run-jekyll` - runs the site locally so changes can be previewed during development
Expand Down
112 changes: 112 additions & 0 deletions SAMtemplates/functions/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Parameters:
Type: String
Default: none

PostDatedNotificationsSQSQueueUrl:
Type: String
Default: none

SQSSaltSecret:
Type: AWS::SecretsManager::Secret::Name<String>

Expand All @@ -57,6 +61,10 @@ Parameters:
EnableNotificationsInternalParam:
Type: AWS::SSM::Parameter::Name<String>

EnablePostDatedNotifications:
Type: AWS::SSM::Parameter::Name<String>
Default: "false"

RequireApplicationName:
Type: String
Default: false
Expand Down Expand Up @@ -121,6 +129,8 @@ Resources:
Variables:
TABLE_NAME: !Ref PrescriptionStatusUpdatesTableName
NHS_NOTIFY_PRESCRIPTIONS_SQS_QUEUE_URL: !Ref NHSNotifyPrescriptionsSQSQueueUrl
POST_DATED_PRESCRIPTIONS_SQS_QUEUE_URL: !Ref PostDatedNotificationsSQSQueueUrl
ENABLE_POST_DATED_NOTIFICATIONS: !Ref EnablePostDatedNotifications
SQS_SALT: !Ref SQSSaltSecret
ENABLED_SITE_ODS_CODES_PARAM: !Ref EnabledSiteODSCodesParam
ENABLED_SYSTEMS_PARAM: !Ref EnabledSystemsParam
Expand Down Expand Up @@ -165,6 +175,7 @@ Resources:
- Fn::ImportValue: !Sub ${StackName}:tables:UsePrescriptionStatusUpdatesKMSKeyPolicyArn
- Fn::ImportValue: !Sub ${StackName}-UseNotificationSQSQueueKMSKeyPolicyArn
- Fn::ImportValue: !Sub ${StackName}-WriteNHSNotifyPrescriptionsSQSQueuePolicyArn
- Fn::ImportValue: !Sub ${StackName}-WritePostDatedNotificationsSQSQueuePolicyArn
- Fn::ImportValue: !Sub ${StackName}-GetSQSSaltSecretPolicy
- Fn::ImportValue: !Sub ${StackName}-GetNotificationsParameterPolicy
LogRetentionInDays: !Ref LogRetentionInDays
Expand Down Expand Up @@ -489,6 +500,98 @@ Resources:
- Fn::ImportValue: !Sub ${StackName}-GetPSUSecretPolicy
- Fn::ImportValue: !Sub ${StackName}-UsePSUSecretsKMSKeyPolicyArn

## Post-dated lambda definitions
PostDatedNotifyLambdaScheduleEventRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- scheduler.amazonaws.com
Action:
- sts:AssumeRole
ManagedPolicyArns:
- !Ref PostDatedNotifyLambdaScheduleEventRolePolicy

PostDatedNotifyLambdaScheduleEventRolePolicy:
Type: AWS::IAM::ManagedPolicy
Properties:
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action:
- lambda:InvokeFunction
Resource:
- !GetAtt PostDatedNotifyLambda.Arn

PostDatedNotifyLambda:
Type: AWS::Serverless::Function
Properties:
FunctionName: !Sub ${StackName}-postDatedNotifyLambda
Timeout: 900
CodeUri: ../../packages/
Handler: main.handler
Role: !GetAtt PostDatedNotifyLambdaResources.Outputs.LambdaRoleArn
Environment:
Variables:
LOG_LEVEL: !Ref LogLevel
NHS_NOTIFY_PRESCRIPTIONS_SQS_QUEUE_URL: !Ref NHSNotifyPrescriptionsSQSQueueUrl
POST_DATED_PRESCRIPTIONS_SQS_QUEUE_URL: !Ref PostDatedNotificationsSQSQueueUrl
TABLE_NAME: !Ref PrescriptionStatusUpdatesTableName
Events:
ScheduleEvent:
Type: ScheduleV2
Properties:
Name: !Sub ${StackName}-PostDatedNotifySchedule
ScheduleExpression: "rate(2 minutes)" # TODO: Increase to 15 minutes
RoleArn: !GetAtt PostDatedNotifyLambdaScheduleEventRole.Arn
Metadata:
BuildMethod: esbuild
guard:
SuppressedRules:
- LAMBDA_DLQ_CHECK
- LAMBDA_INSIDE_VPC
- LAMBDA_CONCURRENCY_CHECK
BuildProperties:
Minify: true
Target: es2020
Sourcemap: true
packages: bundle
# set tsconfig path to whatever you actually have for this lambda package
tsconfig: postDatedLambda/tsconfig.json
EntryPoints:
- postDatedLambda/src/main.ts

PostDatedNotifyLambdaResources:
Type: AWS::Serverless::Application
Properties:
Location: lambda_resources.yaml
Parameters:
StackName: !Ref StackName
LambdaName: !Sub ${StackName}-postDatedNotifyLambda
LambdaArn: !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${StackName}-postDatedNotifyLambda
LogRetentionInDays: !Ref LogRetentionInDays
CloudWatchKMSKeyId: !ImportValue account-resources:CloudwatchLogsKmsKeyArn
EnableSplunk: !Ref EnableSplunk
SplunkSubscriptionFilterRole: !ImportValue lambda-resources:SplunkSubscriptionFilterRole
SplunkDeliveryStreamArn: !ImportValue lambda-resources:SplunkDeliveryStream
IncludeAdditionalPolicies: true
AdditionalPolicies: !Join
- ","
- - Fn::ImportValue: !Sub ${StackName}-WriteNHSNotifyPrescriptionsSQSQueuePolicyArn
- Fn::ImportValue: !Sub ${StackName}-ReadNHSNotifyPrescriptionsSQSQueuePolicyArn
- Fn::ImportValue: !Sub ${StackName}-UseNotificationSQSQueueKMSKeyPolicyArn
- Fn::ImportValue: !Sub ${StackName}-WritePostDatedNotificationsSQSQueuePolicyArn
- Fn::ImportValue: !Sub ${StackName}-ReadPostDatedNotificationsSQSQueuePolicyArn
- Fn::ImportValue: !Sub ${StackName}:tables:${PrescriptionStatusUpdatesTableName}:TableWritePolicyArn
- Fn::ImportValue: !Sub ${StackName}:tables:${PrescriptionStatusUpdatesTableName}:TableReadPolicyArn
- Fn::ImportValue: !Sub ${StackName}:tables:UsePrescriptionStatusUpdatesKMSKeyPolicyArn
## End of post-dated lambda bits

NHSNotifyUpdateCallback:
Type: AWS::Serverless::Function
Properties:
Expand Down Expand Up @@ -719,3 +822,12 @@ Outputs:
NHSNotifyUpdateCallbackFunctionArn:
Description: The function ARN of the NHSNotifyUpdateCallback lambda
Value: !GetAtt NHSNotifyUpdateCallback.Arn

# Post-dated lambda outputs
PostDatedNotifyLambdaFunctionName:
Description: The function name of the postDatedNotifyLambda
Value: !Ref PostDatedNotifyLambda

PostDatedNotifyLambdaFunctionArn:
Description: The function ARN of the postDatedNotifyLambda
Value: !GetAtt PostDatedNotifyLambda.Arn
6 changes: 6 additions & 0 deletions SAMtemplates/main_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ Parameters:
Type: String
Default: " "

EnablePostDatedNotifications:
Type: String
Default: "false"

NotifyRoutingPlanIDValue:
Type: String
Default: " "
Expand Down Expand Up @@ -231,6 +235,8 @@ Resources:
PrescriptionStatusUpdatesTableName: !GetAtt Tables.Outputs.PrescriptionStatusUpdatesTableName
PrescriptionNotificationStatesTableName: !GetAtt Tables.Outputs.PrescriptionNotificationStatesTableName
NHSNotifyPrescriptionsSQSQueueUrl: !GetAtt Messaging.Outputs.NHSNotifyPrescriptionsSQSQueueUrl
PostDatedNotificationsSQSQueueUrl: !GetAtt Messaging.Outputs.PostDatedNotificationsSQSQueueUrl
EnablePostDatedNotifications: !Ref EnablePostDatedNotifications
SQSSaltSecret: !GetAtt Secrets.Outputs.SQSSaltSecret
EnabledSiteODSCodesParam: !GetAtt Parameters.Outputs.EnabledSiteODSCodesParameterName
EnabledSystemsParam: !GetAtt Parameters.Outputs.EnabledSystemsParameterName
Expand Down
Loading