Skip to content

Commit

Permalink
update state machine and lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
joelbalcaen committed May 2, 2024
1 parent 25e24d4 commit 4d0b3a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions lambdas/rich_pdf_ingestion/src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ def lambda_handler(event, context):
Etract text/tables from a PDF and store in a s3 object
"""
print(event)
attachment_s3_arn = event['path']

try:
bucket, key = parse_s3_arn(attachment_s3_arn)
bucket, key = event['pdf_s3_uri'].replace("s3://", "").split("/", 1)

print(f"Attachment located at bucket: {bucket} and key: {key}")

Expand Down Expand Up @@ -70,14 +69,6 @@ def extract_text_from_pdf(pdf_file_path):

return text


def parse_s3_arn(s3_arn):
s3_path = s3_arn.replace("arn:aws:s3:::", "")
components = s3_path.split("/")
bucket = components[0]
key = "/".join(components[1:])
return bucket, key

def fetch_file(bucket, key):
local_filename = f"{PATH_TO_WRITE_FILES}/{key.split('/')[-1]}"
s3.download_file(bucket, key, local_filename)
Expand Down
2 changes: 1 addition & 1 deletion state_machines/rfp_email_form_fill/state_machine.json
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
"Parameters": {
"FunctionName": "arn:aws:lambda:us-east-1:446872271111:function:rich_pdf_ingestion:$LATEST",
"Payload": {
"path.$": "$"
"pdf_s3_uri.$": "$"
}
},
"Resource": "arn:aws:states:::lambda:invoke",
Expand Down

0 comments on commit 4d0b3a8

Please sign in to comment.