Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
4d3c4fe
chore: debugging
tstephen-nhs Mar 4, 2026
29f8331
Upgrade: [dependabot] - bump actions/download-artifact from 7.0.0 to …
dependabot[bot] Mar 4, 2026
4d8e6f6
feat: expose gsul in ptl for debugging purposes
tstephen-nhs Mar 5, 2026
2f113fa
chore: log if post-dating update
tstephen-nhs Mar 5, 2026
134ea34
Upgrade: [dependabot] - bump @aws-sdk/client-secrets-manager from 3.1…
dependabot[bot] Mar 6, 2026
affd291
Upgrade: [dependabot] - bump @middy/http-header-normalizer from 7.1.2…
dependabot[bot] Mar 6, 2026
c992475
Upgrade: [dependabot] - bump @aws-sdk/lib-dynamodb from 3.1000.0 to 3…
dependabot[bot] Mar 6, 2026
bb9d0b2
Upgrade: [dependabot] - bump NHSDigital/eps-common-workflows/.github/…
dependabot[bot] Mar 9, 2026
fc819a5
Upgrade: [dependabot] - bump black from 26.1.0 to 26.3.0 (#2820)
dependabot[bot] Mar 9, 2026
973eb71
Upgrade: [dependabot] - bump NHSDigital/eps-common-workflows/.github/…
dependabot[bot] Mar 9, 2026
c244002
Upgrade: [dependabot] - bump @redocly/cli from 2.20.1 to 2.20.4 (#2830)
dependabot[bot] Mar 10, 2026
4c75755
Upgrade: [dependabot] - bump @middy/input-output-logger from 7.1.2 to…
dependabot[bot] Mar 11, 2026
f607051
Chore: [AEA-0000] - Stagger dependabot (#2834)
anthony-nhs Mar 12, 2026
6368519
Upgrade: [dependabot] - bump NHSDigital/eps-common-workflows/.github/…
dependabot[bot] Mar 12, 2026
ce8c298
Upgrade: [dependabot] - bump actions/download-artifact from 8.0.0 to …
dependabot[bot] Mar 12, 2026
6db580e
Upgrade: [dependabot] - bump jose from 6.1.3 to 6.2.1 (#2855)
dependabot[bot] Mar 12, 2026
111fe8a
Upgrade: [dependabot] - bump @types/node from 25.3.3 to 25.4.0 (#2858)
dependabot[bot] Mar 12, 2026
d8eaf0a
Upgrade: [dependabot] - bump jest from 30.2.0 to 30.3.0 (#2854)
dependabot[bot] Mar 12, 2026
bcd0641
Upgrade: [dependabot] - bump @typescript-eslint/parser from 8.56.1 to…
dependabot[bot] Mar 12, 2026
e54b004
Upgrade: [dependabot] - bump @middy/input-output-logger from 7.1.3 to…
dependabot[bot] Mar 12, 2026
6ad1694
Upgrade: [dependabot] - bump @middy/http-header-normalizer from 7.1.3…
dependabot[bot] Mar 12, 2026
a1f31da
Upgrade: [dependabot] - bump typescript-eslint from 8.56.1 to 8.57.0 …
dependabot[bot] Mar 12, 2026
a8ae0cc
Upgrade: [dependabot] - bump @aws-sdk/client-backup from 3.1000.0 to …
dependabot[bot] Mar 13, 2026
37aa734
Upgrade: [dependabot] - bump @redocly/cli from 2.20.4 to 2.21.1 (#2846)
dependabot[bot] Mar 13, 2026
72b6ad6
Upgrade: [dependabot] - bump @aws-sdk/client-sqs from 3.995.0 to 3.10…
dependabot[bot] Mar 13, 2026
d775067
Upgrade: [dependabot] - bump @aws-sdk/lib-dynamodb from 3.1003.0 to 3…
dependabot[bot] Mar 13, 2026
53959c8
Upgrade: [dependabot] - bump eslint from 10.0.2 to 10.0.3 (#2844)
dependabot[bot] Mar 13, 2026
08e78af
Upgrade: [dependabot] - bump black from 26.3.0 to 26.3.1 (#2840)
dependabot[bot] Mar 13, 2026
f29bed1
Upgrade: [dependabot] - bump @aws-sdk/client-ssm from 3.1000.0 to 3.1…
dependabot[bot] Mar 13, 2026
faa1bd5
Upgrade: [dependabot] - bump @aws-sdk/client-secrets-manager from 3.1…
dependabot[bot] Mar 13, 2026
39a4268
Chore: [AEA-0000] - fix combined common workflows (#2861)
tstephen-nhs Mar 13, 2026
f1be8f4
Fix: [AEA-0000] - use env var name rather than value (#2862)
anthony-nhs Mar 13, 2026
8cc43cb
Upgrade: [dependabot] - bump NHSDigital/eps-common-workflows/.github/…
dependabot[bot] Mar 13, 2026
857017a
Upgrade: [dependabot] - bump NHSDigital/eps-common-workflows/.github/…
dependabot[bot] Mar 13, 2026
a89f7e4
Upgrade: [dependabot] - bump @aws-sdk/client-dynamodb from 3.1008.0 t…
dependabot[bot] Mar 14, 2026
5dd2c86
Upgrade: [dependabot] - bump esbuild from 0.27.3 to 0.27.4 (#2868)
dependabot[bot] Mar 14, 2026
69b9fc7
Upgrade: [dependabot] - bump @aws-sdk/client-backup from 3.1007.0 to …
dependabot[bot] Mar 14, 2026
7e4704b
Upgrade: [dependabot] - bump @types/node from 25.4.0 to 25.5.0 (#2871)
dependabot[bot] Mar 14, 2026
f45c1ac
Upgrade: [dependabot] - bump @aws-sdk/client-sqs from 3.1008.0 to 3.1…
dependabot[bot] Mar 14, 2026
724fe98
Upgrade: [dependabot] - bump @aws-sdk/client-ssm from 3.1008.0 to 3.1…
dependabot[bot] Mar 14, 2026
c6c188c
Upgrade: [dependabot] - bump @aws-sdk/lib-dynamodb from 3.1008.0 to 3…
dependabot[bot] Mar 14, 2026
15385a8
Upgrade: [dependabot] - bump @middy/input-output-logger from 7.1.4 to…
dependabot[bot] Mar 14, 2026
ed850c4
Upgrade: [dependabot] - bump @aws-sdk/client-secrets-manager from 3.1…
dependabot[bot] Mar 14, 2026
2f2ce0a
Upgrade: [dependabot] - bump @middy/http-header-normalizer from 7.1.5…
dependabot[bot] Mar 14, 2026
6cfc90b
Upgrade: [dependabot] - bump NHSDigital/eps-common-workflows/.github/…
dependabot[bot] Mar 14, 2026
306486d
Upgrade: [dependabot] - bump NHSDigital/eps-common-workflows/.github/…
dependabot[bot] Mar 14, 2026
ceef0a4
Upgrade: [dependabot] - bump NHSDigital/eps-common-workflows/.github/…
dependabot[bot] Mar 14, 2026
806d446
chore: add post-dated to gsul index
tstephen-nhs Mar 17, 2026
42ddd66
chore: tune down post-dated logging
tstephen-nhs Mar 17, 2026
e599931
chore: call proposed tests
tstephen-nhs Mar 17, 2026
4875267
chore: tweak gsul envs to all exc. prod, sandbox
tstephen-nhs Mar 17, 2026
7c6b588
chore: bump workflow tag to latest
tstephen-nhs Mar 18, 2026
2279936
chore: trivy ignore CVE-2026-33036
tstephen-nhs Mar 18, 2026
e93a804
chore: bump reg tests to v3.10.0
tstephen-nhs Mar 18, 2026
52974d7
chore: reword comment
tstephen-nhs Mar 18, 2026
6a4e064
chore: make logging more concise
tstephen-nhs Mar 18, 2026
b4153b3
chore: clarify logging
tstephen-nhs Mar 18, 2026
3711e55
chore: more concise logging
tstephen-nhs Mar 18, 2026
03ba644
chore: bump reg test to 3.11.0
tstephen-nhs Mar 18, 2026
ac1f1db
Merge branch 'main' into aea-6055-revoke-rtc
tstephen-nhs Mar 18, 2026
9ad41f6
chore: trigger build
tstephen-nhs Mar 19, 2026
cd26f65
Merge branch 'main' into aea-6055-revoke-rtc
tstephen-nhs Mar 19, 2026
2fb0153
Merge branch 'main' into aea-6055-revoke-rtc
tstephen-nhs Mar 23, 2026
50e6961
chore: trigger build
tstephen-nhs Mar 23, 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
9 changes: 9 additions & 0 deletions .github/scripts/deploy_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ echo "Apigee environment: ${APIGEE_ENVIRONMENT}"
echo "Proxygen private key name: ${PROXYGEN_PRIVATE_KEY_NAME}"
echo "Proxygen KID: ${PROXYGEN_KID}"
echo "Deploy Check Prescription Status Update: ${DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE}"
echo "Expose Get Status Updates: ${EXPOSE_GET_STATUS_UPDATES}"
echo "Dry run: ${DRY_RUN}"
# shellcheck disable=SC2153
echo "is_pull_request: ${IS_PULL_REQUEST}"
Expand Down Expand Up @@ -106,6 +107,14 @@ if [[ "${DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE}" == "false" ]]; then
fi
fi

# Remove get-status-updates if not needed
if [[ "${EXPOSE_GET_STATUS_UPDATES}" == "false" ]]; then
if [[ "${API_TYPE}" == "standard" ]]; then
echo "Removing get-status-updates endpoint"
jq 'del(.paths."/get-status-updates")' "$SPEC_PATH" > temp.json && mv temp.json "$SPEC_PATH"
fi
fi

# Find and replace the x-nhsd-apim.target.secret value
jq --arg mtls_key "${MTLS_KEY}" '.["x-nhsd-apim"].target.security.secret = "\($mtls_key)"' "${SPEC_PATH}" > temp.json && mv temp.json "${SPEC_PATH}"

Expand Down
1 change: 1 addition & 0 deletions .github/scripts/release_code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ sam deploy \
LogRetentionInDays="$LOG_RETENTION_DAYS" \
Environment="$TARGET_ENVIRONMENT" \
DeployCheckPrescriptionStatusUpdate="$DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE" \
ExposeGetStatusUpdates="$EXPOSE_GET_STATUS_UPDATES" \
EnableAlerts="$ENABLE_ALERTS" \
StateMachineLogLevel="$STATE_MACHINE_LOG_LEVEL" \
EnableNotificationsInternal="$ENABLE_NOTIFICATIONS_INTERNAL" \
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
DYNAMODB_AUTOSCALE: false
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: true
ENABLE_ALERTS: true
REQUIRE_APPLICATION_NAME: false
RUN_REGRESSION_TEST: true
Expand Down Expand Up @@ -113,6 +114,7 @@ jobs:
DYNAMODB_AUTOSCALE: false
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: false
RUN_REGRESSION_TEST: false
STATE_MACHINE_LOG_LEVEL: ALL
LOG_LEVEL: DEBUG
Expand Down Expand Up @@ -151,6 +153,7 @@ jobs:
DYNAMODB_AUTOSCALE: false
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: true
ENABLE_ALERTS: true
RUN_REGRESSION_TEST: true
STATE_MACHINE_LOG_LEVEL: ALL
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ jobs:
DYNAMODB_AUTOSCALE: false
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: true
ENABLE_ALERTS: false
REQUIRE_APPLICATION_NAME: false
RUN_REGRESSION_TEST: true
Expand Down Expand Up @@ -150,6 +151,7 @@ jobs:
DYNAMODB_AUTOSCALE: false
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: false
RUN_REGRESSION_TEST: false
STATE_MACHINE_LOG_LEVEL: ALL
ENABLE_BACKUP: "False"
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
DYNAMODB_AUTOSCALE: false
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: true
ENABLE_ALERTS: true
REQUIRE_APPLICATION_NAME: false
RUN_REGRESSION_TEST: true
Expand Down Expand Up @@ -119,6 +120,7 @@ jobs:
DYNAMODB_AUTOSCALE: false
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: false
RUN_REGRESSION_TEST: false
STATE_MACHINE_LOG_LEVEL: ALL
ENABLE_BACKUP: "False"
Expand Down Expand Up @@ -169,6 +171,7 @@ jobs:
DYNAMODB_AUTOSCALE: true
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: true
ENABLE_ALERTS: true
RUN_REGRESSION_TEST: false
STATE_MACHINE_LOG_LEVEL: ERROR
Expand Down Expand Up @@ -220,6 +223,7 @@ jobs:
DYNAMODB_AUTOSCALE: false
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: true
ENABLE_ALERTS: true
RUN_REGRESSION_TEST: true
STATE_MACHINE_LOG_LEVEL: ALL
Expand Down Expand Up @@ -263,6 +267,7 @@ jobs:
DYNAMODB_AUTOSCALE: false
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: true
ENABLE_ALERTS: true
RUN_REGRESSION_TEST: true
STATE_MACHINE_LOG_LEVEL: ALL
Expand Down Expand Up @@ -309,6 +314,7 @@ jobs:
DYNAMODB_AUTOSCALE: false
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: true
EXPOSE_GET_STATUS_UPDATES: false
RUN_REGRESSION_TEST: false
STATE_MACHINE_LOG_LEVEL: ALL
ENABLE_BACKUP: "False"
Expand Down Expand Up @@ -359,6 +365,7 @@ jobs:
DYNAMODB_AUTOSCALE: true
DEPLOY_APIGEE_CPSU: true
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: false
EXPOSE_GET_STATUS_UPDATES: false
ENABLE_ALERTS: true
RUN_REGRESSION_TEST: false
STATE_MACHINE_LOG_LEVEL: ERROR
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run_regression_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ jobs:
run: |
if [[ "$TARGET_ENVIRONMENT" != "prod" && "$TARGET_ENVIRONMENT" != "ref" ]]; then
# this should be the tag of the tests you want to run
REGRESSION_TEST_REPO_TAG=v3.6.2
REGRESSION_TEST_REPO_TAG=v3.11.0
Comment thread
tstephen-nhs marked this conversation as resolved.

# this should be the tag of the regression test workflow you want to run
# This will normally be the same as REGRESSION_TEST_REPO_TAG
REGRESSION_TEST_WORKFLOW_TAG=v3.6.2
REGRESSION_TEST_WORKFLOW_TAG=v3.11.0

curl https://raw.githubusercontent.com/NHSDigital/electronic-prescription-service-api-regression-tests/refs/tags/${REGRESSION_TEST_WORKFLOW_TAG}/scripts/run_regression_tests.py -o run_regression_tests.py
poetry install
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/run_release_code_and_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ on:
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE:
type: boolean
default: false
EXPOSE_GET_STATUS_UPDATES:
type: boolean
default: false
ENABLE_ALERTS:
type: boolean
default: true
Expand Down Expand Up @@ -202,6 +205,7 @@ jobs:
VERSION_NUMBER: ${{ inputs.VERSION_NUMBER }}
DYNAMODB_AUTOSCALE: ${{ inputs.DYNAMODB_AUTOSCALE }}
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: ${{ inputs.DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE }}
EXPOSE_GET_STATUS_UPDATES: ${{ inputs.EXPOSE_GET_STATUS_UPDATES }}
ENABLE_ALERTS: ${{ inputs.ENABLE_ALERTS }}
STATE_MACHINE_LOG_LEVEL: ${{ inputs.STATE_MACHINE_LOG_LEVEL }}
ENABLE_BACKUP: ${{ inputs.ENABLE_BACKUP }}
Expand Down Expand Up @@ -255,6 +259,7 @@ jobs:
PROXYGEN_KID: "eps-cli-key-1"
DRY_RUN: false
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: ${{ inputs.DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE }}
EXPOSE_GET_STATUS_UPDATES: ${{ inputs.EXPOSE_GET_STATUS_UPDATES }}
IS_PULL_REQUEST: ${{ inputs.IS_PULL_REQUEST }}
MTLS_KEY: ${{ inputs.MTLS_KEY }}
ENABLE_MUTUAL_TLS: ${{ inputs.ENABLE_MUTUAL_TLS }}
Expand All @@ -276,6 +281,7 @@ jobs:
PROXYGEN_KID: eps-cli-key-cpsu-1
DRY_RUN: false
DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE: ${{ inputs.DEPLOY_CHECK_PRESCRIPTION_STATUS_UPDATE }}
EXPOSE_GET_STATUS_UPDATES: ${{ inputs.EXPOSE_GET_STATUS_UPDATES }}
IS_PULL_REQUEST: ${{ inputs.IS_PULL_REQUEST }}
MTLS_KEY: ${{ inputs.MTLS_KEY }}
ENABLE_MUTUAL_TLS: ${{ inputs.ENABLE_MUTUAL_TLS }}
Expand Down
76 changes: 74 additions & 2 deletions SAMtemplates/apis/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ Parameters:
Type: String
Default: none

GetStatusUpdatesFunctionName:
Type: String
Default: none

GetStatusUpdatesFunctionArn:
Type: String
Default: none

NHSNotifyUpdateCallbackFunctionName:
Type: String
Default: none
Expand All @@ -71,6 +79,10 @@ Parameters:
DeployCheckPrescriptionStatusUpdate:
Type: String

ExposeGetStatusUpdates:
Type: String
Default: false

ForwardCsocLogs:
Type: String
Default: false
Expand All @@ -81,6 +93,9 @@ Conditions:
ShouldDeployCheckPrescriptionStatusUpdate: !Equals
- true
- !Ref DeployCheckPrescriptionStatusUpdate
ShouldExposeGetStatusUpdates: !Equals
- true
- !Ref ExposeGetStatusUpdates

Resources:
GenerateCertificate:
Expand Down Expand Up @@ -526,6 +541,58 @@ Resources:
IntegrationHttpMethod: POST
Uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${CheckPrescriptionStatusUpdatesFunctionArn}/invocations

GetStatusUpdatesResource:
Condition: ShouldExposeGetStatusUpdates
Type: AWS::ApiGateway::Resource
Properties:
RestApiId: !Ref RestApiGateway
ParentId: !GetAtt RestApiGateway.RootResourceId
PathPart: get-status-updates

GetStatusUpdatesMethod:
Condition: ShouldExposeGetStatusUpdates
Type: AWS::ApiGateway::Method
Properties:
RestApiId: !Ref RestApiGateway
ResourceId: !Ref GetStatusUpdatesResource
HttpMethod: POST
AuthorizationType: NONE
Integration:
Type: AWS
Credentials: !GetAtt RestApiGatewayResources.Outputs.ApiGwRoleArn
IntegrationHttpMethod: POST
Uri: !Sub arn:aws:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${GetStatusUpdatesFunctionArn}/invocations
Comment thread
tstephen-nhs marked this conversation as resolved.
RequestTemplates:
application/json: |-
$input.json('$')
IntegrationResponses:
- StatusCode: 200
Comment thread
tstephen-nhs marked this conversation as resolved.
ResponseTemplates:
application/json: |-
$input.body
MethodResponses:
- StatusCode: "200"

GetStatusUpdatesHandle:
Condition: ShouldExposeGetStatusUpdates
DependsOn: GetStatusUpdatesMethod
Type: "AWS::CloudFormation::WaitConditionHandle"

GetStatusUpdatesWaitHandle:
Type: "AWS::CloudFormation::WaitConditionHandle"

GetStatusUpdatesWaitCondition:
Type: "AWS::CloudFormation::WaitCondition"
Properties:
Handle:
!If [
ShouldExposeGetStatusUpdates,
!Ref GetStatusUpdatesHandle,
!Ref GetStatusUpdatesWaitHandle,
]
Timeout: "1"
Count: 0

# we can not use a conditional in depends on in ApiGateway::Deployment
# so instead we use a wait condition that has the conditional in it and use that as a dependency
# taken from https://garbe.io/blog/2017/07/17/cloudformation-hacks/
Expand Down Expand Up @@ -553,7 +620,7 @@ Resources:
# if you add a new endpoint, then change the name of this resource
# also need to change it in RestApiGatewayStage.Properties.DeploymentId
# *********************************************************************
RestApiGatewayDeploymentV2f:
RestApiGatewayDeploymentV2h:
Type: AWS::ApiGateway::Deployment
DependsOn:
# see note above if you add something in here when you add a new endpoint
Expand All @@ -563,6 +630,7 @@ Resources:
- Format1UpdatePrescriptionStatusMethod
- CheckPrescriptionStatusUpdatesWaitCondition
- NotificationDeliveryStatusCallbackMethod
- GetStatusUpdatesWaitCondition
# see note above if you add something in here when you add a new endpoint
Properties:
RestApiId: !Ref RestApiGateway
Expand All @@ -571,7 +639,7 @@ Resources:
Type: AWS::ApiGateway::Stage
Properties:
RestApiId: !Ref RestApiGateway
DeploymentId: !Ref RestApiGatewayDeploymentV2f
DeploymentId: !Ref RestApiGatewayDeploymentV2h
StageName: prod
TracingEnabled: true
AccessLogSetting:
Expand All @@ -595,6 +663,10 @@ Resources:
- Fn::ImportValue: !Sub ${StackName}:functions:${StatusFunctionName}:ExecuteLambdaPolicyArn
- Fn::ImportValue: !Sub ${StackName}:functions:${CapabilityStatementFunctionName}:ExecuteLambdaPolicyArn
- Fn::ImportValue: !Sub ${StackName}:functions:${NHSNotifyUpdateCallbackFunctionName}:ExecuteLambdaPolicyArn
- !If
- ShouldExposeGetStatusUpdates
- Fn::ImportValue: !Sub ${StackName}:functions:${GetStatusUpdatesFunctionName}:ExecuteLambdaPolicyArn
- !Ref AWS::NoValue
- Fn::ImportValue: !Sub ${StackName}:state-machines:${Format1UpdatePrescriptionsStatusStateMachineName}:ExecuteStateMachinePolicy
- !If
- ShouldDeployCheckPrescriptionStatusUpdate
Expand Down
10 changes: 10 additions & 0 deletions SAMtemplates/main_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ Parameters:
DeployCheckPrescriptionStatusUpdate:
Type: String

ExposeGetStatusUpdates:
Type: String
Default: false
AllowedValues:
- true
- false

Environment:
Type: String

Expand Down Expand Up @@ -223,11 +230,14 @@ Resources:
CapabilityStatementFunctionArn: !GetAtt Functions.Outputs.CapabilityStatementFunctionArn
CheckPrescriptionStatusUpdatesFunctionName: !GetAtt Functions.Outputs.CheckPrescriptionStatusUpdatesFunctionName
CheckPrescriptionStatusUpdatesFunctionArn: !GetAtt Functions.Outputs.CheckPrescriptionStatusUpdatesFunctionArn
GetStatusUpdatesFunctionName: !GetAtt Functions.Outputs.GetStatusUpdatesFunctionName
GetStatusUpdatesFunctionArn: !GetAtt Functions.Outputs.GetStatusUpdatesFunctionArn
NHSNotifyUpdateCallbackFunctionName: !GetAtt Functions.Outputs.NHSNotifyUpdateCallbackFunctionName
NHSNotifyUpdateCallbackFunctionArn: !GetAtt Functions.Outputs.NHSNotifyUpdateCallbackFunctionArn
LogRetentionInDays: !Ref LogRetentionInDays
EnableSplunk: !Ref EnableSplunk
DeployCheckPrescriptionStatusUpdate: !Ref DeployCheckPrescriptionStatusUpdate
ExposeGetStatusUpdates: !Ref ExposeGetStatusUpdates
ForwardCsocLogs: !Ref ForwardCsocLogs

Functions:
Expand Down
4 changes: 3 additions & 1 deletion SAMtemplates/tables/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ Resources:
- TerminalStatus
- LastModified
- Status
# TODO: Remove this when we deprecate post dated prescriptions.
- PostDatedLastModifiedSetAt
ProjectionType: INCLUDE
ProvisionedThroughput: !If
- EnableDynamoDBAutoScalingCondition
Expand All @@ -201,7 +203,7 @@ Resources:
- ReadCapacityUnits: 1
WriteCapacityUnits: !Ref MinWritePrescriptionStatusUpdatesCapacity
- !Ref "AWS::NoValue"
# TODO: Remove this when we deprecate post modified prescriptions.
# TODO: Remove this when we deprecate post dated prescriptions.
- IndexName: PrescriptionIDPostDatedIndex
KeySchema:
- AttributeName: PrescriptionID
Expand Down
16 changes: 16 additions & 0 deletions packages/gsul/src/getStatusUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ export const filterOutFutureReduceToLatestUpdates = (
const updateTime = Date.parse(item.lastUpdateDateTime)
return updateTime <= currentTime
})
logger.debug("filtered out future updates (should only be post-dated ones)", {
prescriptionID: inputPrescription.prescriptionID,
count_dropped: (items.length - validTimeUpdates.length),
count_received: items.length
})

// group by itemId and separate post-dated from regular updates
const itemGroups: Record<string, {regular: itemType | null, postDated: itemType | null}> = {}
Expand Down Expand Up @@ -79,6 +84,9 @@ export const filterOutFutureReduceToLatestUpdates = (
}
}
})
logger.debug("grouped updates by itemId and type", {
itemGroupCount: Object.entries(itemGroups).length
})

// flatten both regular and post-dated updates into single array
// but exclude post-dated updates if they have been revoked by a subsequent regular update
Expand All @@ -96,12 +104,20 @@ export const filterOutFutureReduceToLatestUpdates = (
}
}
})
logger.debug("flattened updates into unique items", {
validTimeCount: validTimeUpdates.length, uniqueItemsCount: uniqueItems.length
})
Comment thread
tstephen-nhs marked this conversation as resolved.

const result: outputPrescriptionType = {
prescriptionID: inputPrescription.prescriptionID,
onboarded: items.length > 0, // consider onboarded even if all updates were post-dated
items: uniqueItems
}
logger.info("returning updates result", {
prescriptionID: result.prescriptionID,
onboarded: result.onboarded,
itemCount: result.items.length
})
return result
}

Expand Down
Loading
Loading