changeset 12:d4c4cd4760fa

fix KeyError bug
author Dennis C. M. <dennis@denniscm.com>
date Thu, 08 Jun 2023 17:48:52 +0100
parents d09dee7a86da
children ab988fd1e6fa
files events/get_report_event.json events/upload_document_event.json upload_document/app.py
diffstat 3 files changed, 14 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/events/get_report_event.json	Thu Jun 08 17:35:26 2023 +0100
+++ b/events/get_report_event.json	Thu Jun 08 17:48:52 2023 +0100
@@ -1,7 +1,7 @@
 {
   "queryStringParameters": {
-    "ticker": "san",
-    "type": "balance",
+    "ticker": "acx",
+    "type": "pnl",
     "year": "2021"
   }
 }
\ No newline at end of file
--- a/events/upload_document_event.json	Thu Jun 08 17:35:26 2023 +0100
+++ b/events/upload_document_event.json	Thu Jun 08 17:48:52 2023 +0100
@@ -1,13 +1,13 @@
 {
-   "statusCode": 200,
-   "body": {
-      "message": {
-         "companyTicker": "san",
-         "docType": "balance",
-         "fileId": "50d30446-015c-47bd-bb33-af487120c0d5",
-         "fileName": "san_balance_50d30446-015c-47bd-bb33-af487120c0d5.json",
-         "objectKey": "processed/san_balance_50d30446-015c-47bd-bb33-af487120c0d5.json",
-         "bucketName": "sandbox-finance-parser-data"
-      }
-   }
+  "statusCode": 200,
+  "body": {
+    "message": {
+      "companyTicker": "acx",
+      "docType": "pnl",
+      "fileId": "decc36fa-540d-40d0-ae50-048cb3270571",
+      "fileName": "acx_pnl_decc36fa-540d-40d0-ae50-048cb3270571.json",
+      "objectKey": "processed/acx_pnl_decc36fa-540d-40d0-ae50-048cb3270571.json",
+      "bucketName": "sandbox-finance-parser-data"
+    }
+  }
 }
\ No newline at end of file
--- a/upload_document/app.py	Thu Jun 08 17:35:26 2023 +0100
+++ b/upload_document/app.py	Thu Jun 08 17:48:52 2023 +0100
@@ -58,7 +58,7 @@
 
                     batch.put_item(
                         Item={
-                            'pk': f"balance#{event_msg['companyTicker']}",
+                            'pk': f"{event_msg['docType']}#{event_msg['companyTicker']}",
                             'sk': f'{date}#{row_index}',
                             'account_name': account_name,
                             'account_value': account_value,