Refactor augmentation Lambda to read from S3 instead of SQS body#424
Open
Refactor augmentation Lambda to read from S3 instead of SQS body#424
Conversation
7ec9353 to
ad36342
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #424 +/- ##
==========================================
- Coverage 95.78% 95.75% -0.03%
==========================================
Files 42 42
Lines 2183 2216 +33
==========================================
+ Hits 2091 2122 +31
- Misses 92 94 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #418
TTCAugmentationMetadataV2/{persistenceId}and the original eICR fromeCRMessageV2/{persistenceId}, matching the APHL AIMS eCR pipeline architectureS3_BUCKETenv var)TTCAugmentationMetadataV2/prefix, Lambda event source mapping, IAM policy, and S3 EventBridge notificationREGIONenv var was used instead ofAWS_REGION(whichlambda_handler.create_s3_client()expects)Changes
packages/augmentation-lambda/lambda_function.py: Complete rewrite — parses EventBridge S3 events from SQS, reads inputs from S3 vialambda_handlerhelpers, adds_parse_nonstandard_codes()to validate TTC output entries asNonstandardCodeInstanceobjectspyproject.toml: Addedaws-lambda-powertools,structlogdeps; addedboto3,motodev depstests/conftest.py(new): motomock_awsfixtures with EventBridge S3 event payloads and pre-populated S3 test datatests/test_augmentation_lambda_function.py: Rewritten with 10 tests covering success, S3 writes, source-bucket routing, missing files, mixed batch, and_parse_nonstandard_codesparsingterraform/main.tf: AddedEICR_INPUT_PREFIXandTTC_OUTPUT_PREFIXenv vars, fixedREGION→AWS_REGION, added SQS queue + DLQ, EventBridge rule, event source mapping, and SQS IAM policys3.tf: Enabled EventBridge notifications on the S3 bucket