Skip to content

Commit a99be63

Browse files
committed
Define a new GSI for post-dated enrichment
1 parent 53c7535 commit a99be63

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

SAMtemplates/tables/main.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ Resources:
184184
- TerminalStatus
185185
- LastModified
186186
- Status
187-
- PostDatedLastModifiedSetAt # TODO: Remove this when we deprecate post modified prescriptions.
188187
ProjectionType: INCLUDE
189188
ProvisionedThroughput: !If
190189
- EnableDynamoDBAutoScalingCondition
@@ -202,6 +201,27 @@ Resources:
202201
- ReadCapacityUnits: 1
203202
WriteCapacityUnits: !Ref MinWritePrescriptionStatusUpdatesCapacity
204203
- !Ref "AWS::NoValue"
204+
# TODO: Remove this when we deprecate post modified prescriptions.
205+
- IndexName: PharmacyODSCodePrescriptionIDIndexPostDatedIndex
206+
KeySchema:
207+
- AttributeName: PharmacyODSCode
208+
KeyType: HASH
209+
- AttributeName: PrescriptionID
210+
KeyType: RANGE
211+
Projection:
212+
NonKeyAttributes:
213+
- PatientNHSNumber
214+
- LineItemID
215+
- TerminalStatus
216+
- LastModified
217+
- Status
218+
- PostDatedLastModifiedSetAt
219+
ProjectionType: INCLUDE
220+
ProvisionedThroughput: !If
221+
- EnableDynamoDBAutoScalingCondition
222+
- ReadCapacityUnits: 1
223+
WriteCapacityUnits: !Ref MinWritePrescriptionStatusUpdatesCapacity
224+
- !Ref "AWS::NoValue"
205225
Tags:
206226
- Key: "EPS-Tablename"
207227
Value: "PrescriptionStatusUpdates"

packages/postDatedLambda/src/databaseClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111

1212
const client = new DynamoDBClient()
1313
const tableName = process.env.TABLE_NAME ?? "PrescriptionStatusUpdates"
14-
const pharmacyPrescriptionIndexName = "PharmacyODSCodePrescriptionIDIndex"
14+
const pharmacyPrescriptionIndexName = "PharmacyODSCodePrescriptionIDIndexPostDatedIndex"
1515

1616
export function createPrescriptionLookupKey(prescriptionID: string, pharmacyODSCode: string): string {
1717
return `${prescriptionID.toUpperCase()}#${pharmacyODSCode.toUpperCase()}`

0 commit comments

Comments
 (0)