Skip to content

Commit 59d5ece

Browse files
authored
Merge branch 'main' into aea-0000-updated-related-apis
2 parents 208e318 + b5bebe0 commit 59d5ece

4 files changed

Lines changed: 76 additions & 6 deletions

File tree

.github/workflows/run_regression_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ jobs:
5959
run: |
6060
if [[ "$TARGET_ENVIRONMENT" != "prod" && "$TARGET_ENVIRONMENT" != "ref" ]]; then
6161
# this should be the tag of the tests you want to run
62-
REGRESSION_TEST_REPO_TAG=v3.11.0
62+
REGRESSION_TEST_REPO_TAG=v3.10.9
6363
6464
# this should be the tag of the regression test workflow you want to run
6565
# This will normally be the same as REGRESSION_TEST_REPO_TAG
66-
REGRESSION_TEST_WORKFLOW_TAG=v3.11.0
66+
REGRESSION_TEST_WORKFLOW_TAG=v3.10.9
6767
6868
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
6969
poetry install

SAMtemplates/tables/main.yaml

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ Resources:
184184
- TerminalStatus
185185
- LastModified
186186
- Status
187-
# TODO: Remove this when we deprecate post dated prescriptions.
188-
- PostDatedLastModifiedSetAt
189187
ProjectionType: INCLUDE
190188
ProvisionedThroughput: !If
191189
- EnableDynamoDBAutoScalingCondition
@@ -222,6 +220,27 @@ Resources:
222220
- ReadCapacityUnits: 1
223221
WriteCapacityUnits: !Ref MinWritePrescriptionStatusUpdatesCapacity
224222
- !Ref "AWS::NoValue"
223+
- IndexName: PharmacyODSCodePrescriptionIDIndexIncPostDated
224+
KeySchema:
225+
- AttributeName: PharmacyODSCode
226+
KeyType: HASH
227+
- AttributeName: PrescriptionID
228+
KeyType: RANGE
229+
Projection:
230+
NonKeyAttributes:
231+
- PatientNHSNumber
232+
- LineItemID
233+
- TerminalStatus
234+
- LastModified
235+
- Status
236+
# TODO: Remove this when we deprecate post dated prescriptions.
237+
- PostDatedLastModifiedSetAt
238+
ProjectionType: INCLUDE
239+
ProvisionedThroughput: !If
240+
- EnableDynamoDBAutoScalingCondition
241+
- ReadCapacityUnits: 1
242+
WriteCapacityUnits: !Ref MinWritePrescriptionStatusUpdatesCapacity
243+
- !Ref "AWS::NoValue"
225244
Tags:
226245
- Key: "EPS-Tablename"
227246
Value: "PrescriptionStatusUpdates"
@@ -337,6 +356,56 @@ Resources:
337356
PredefinedMetricSpecification:
338357
PredefinedMetricType: DynamoDBReadCapacityUtilization
339358

359+
PharmacyIndexIncPostDatedScalingWriteTarget:
360+
Type: AWS::ApplicationAutoScaling::ScalableTarget
361+
Condition: EnableDynamoDBAutoScalingCondition
362+
Properties:
363+
MinCapacity: !Ref MinWritePrescriptionStatusUpdatesCapacity
364+
MaxCapacity: !Ref MaxWritePrescriptionStatusUpdatesCapacity
365+
ResourceId: !Sub table/${PrescriptionStatusUpdatesTable}/index/PharmacyODSCodePrescriptionIDIndexIncPostDated
366+
RoleARN: !GetAtt DynamoDbScalingRole.Arn
367+
ScalableDimension: "dynamodb:index:WriteCapacityUnits"
368+
ServiceNamespace: dynamodb
369+
370+
PharmacyIndexIncPostDatedScalingWritePolicy:
371+
Type: AWS::ApplicationAutoScaling::ScalingPolicy
372+
Condition: EnableDynamoDBAutoScalingCondition
373+
Properties:
374+
PolicyName: PharmacyIndexIncPostDatedWriteScalingPolicy
375+
PolicyType: TargetTrackingScaling
376+
ScalingTargetId: !Ref PharmacyIndexIncPostDatedScalingWriteTarget
377+
TargetTrackingScalingPolicyConfiguration:
378+
TargetValue: 50
379+
ScaleInCooldown: 600
380+
ScaleOutCooldown: 0
381+
PredefinedMetricSpecification:
382+
PredefinedMetricType: DynamoDBWriteCapacityUtilization
383+
384+
PharmacyIndexIncPostDatedScalingReadTarget:
385+
Type: AWS::ApplicationAutoScaling::ScalableTarget
386+
Condition: EnableDynamoDBAutoScalingCondition
387+
Properties:
388+
MaxCapacity: 100
389+
MinCapacity: 1
390+
ResourceId: !Sub table/${PrescriptionStatusUpdatesTable}/index/PharmacyODSCodePrescriptionIDIndexIncPostDated
391+
RoleARN: !GetAtt DynamoDbScalingRole.Arn
392+
ScalableDimension: "dynamodb:index:ReadCapacityUnits"
393+
ServiceNamespace: dynamodb
394+
395+
PharmacyIndexIncPostDatedScalingReadPolicy:
396+
Type: AWS::ApplicationAutoScaling::ScalingPolicy
397+
Condition: EnableDynamoDBAutoScalingCondition
398+
Properties:
399+
PolicyName: PharmacyIndexIncPostDatedReadScalingPolicy
400+
PolicyType: TargetTrackingScaling
401+
ScalingTargetId: !Ref PharmacyIndexIncPostDatedScalingReadTarget
402+
TargetTrackingScalingPolicyConfiguration:
403+
TargetValue: 70
404+
ScaleInCooldown: 600
405+
ScaleOutCooldown: 10
406+
PredefinedMetricSpecification:
407+
PredefinedMetricType: DynamoDBReadCapacityUtilization
408+
340409
NHSNumberIndexScalingWriteTarget:
341410
Type: AWS::ApplicationAutoScaling::ScalableTarget
342411
Condition: EnableDynamoDBAutoScalingCondition

packages/gsul/src/dynamoDBclient.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export async function getItemsUpdatesForPrescription(
5050
export function createQueryCommandInput(odsCode: string, prescriptionID: string): QueryCommandInput {
5151
return {
5252
TableName: tableName,
53-
IndexName: "PharmacyODSCodePrescriptionIDIndex",
53+
// TODO: revert to PharmacyODSCodePrescriptionIDIndex once post-dated no longer required
54+
IndexName: "PharmacyODSCodePrescriptionIDIndexIncPostDated",
5455
KeyConditionExpression: "PrescriptionID = :inputPrescriptionID AND PharmacyODSCode = :inputPharmacyODSCode",
5556
ExpressionAttributeValues: {
5657
":inputPharmacyODSCode": odsCode.toUpperCase(),

packages/gsul/tests/testRunDynamoDBQueries.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe("testing dynamoDBClient", () => {
4848

4949
const expected = {
5050
TableName: undefined,
51-
IndexName: "PharmacyODSCodePrescriptionIDIndex",
51+
IndexName: "PharmacyODSCodePrescriptionIDIndexIncPostDated",
5252
KeyConditionExpression: "PrescriptionID = :inputPrescriptionID AND PharmacyODSCode = :inputPharmacyODSCode",
5353
ExpressionAttributeValues: {
5454
":inputPharmacyODSCode": "ODSCODE",

0 commit comments

Comments
 (0)