Mercurial > public > finance-parser
changeset 13:ab988fd1e6fa
fix minor bugs
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sat, 10 Jun 2023 14:45:38 +0100 |
parents | d4c4cd4760fa |
children | e77f773aeb46 |
files | events/get_report_event.json events/upload_document_event.json get_tickers/app.py |
diffstat | 3 files changed, 19 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/events/get_report_event.json Thu Jun 08 17:48:52 2023 +0100 +++ b/events/get_report_event.json Sat Jun 10 14:45:38 2023 +0100 @@ -1,7 +1,7 @@ { "queryStringParameters": { - "ticker": "acx", - "type": "pnl", - "year": "2021" + "ticker": "itx", + "type": "balance", + "year": "2023" } } \ No newline at end of file
--- a/events/upload_document_event.json Thu Jun 08 17:48:52 2023 +0100 +++ b/events/upload_document_event.json Sat Jun 10 14:45:38 2023 +0100 @@ -2,12 +2,12 @@ "statusCode": 200, "body": { "message": { - "companyTicker": "acx", + "companyTicker": "itx", "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" + "fileId": "9cb68002-2152-48f0-8ebe-529533f28d8c", + "fileName": "itx_pnl_9cb68002-2152-48f0-8ebe-529533f28d8c.json", + "objectKey": "processed/itx_pnl_9cb68002-2152-48f0-8ebe-529533f28d8c.json", + "bucketName": "finance-parser-data" } } } \ No newline at end of file
--- a/get_tickers/app.py Thu Jun 08 17:48:52 2023 +0100 +++ b/get_tickers/app.py Sat Jun 10 14:45:38 2023 +0100 @@ -11,6 +11,15 @@ FilterExpression=Key('pk').begins_with('file') ) + results = [] + for item in response['Items']: + item_pk = item['pk'].split('#', 1)[1] + item_year = item['sk'].split('#', 1)[0] + item_key = f'{item_pk}#{item_year}' # pnl#acx#2022 + + if item_key not in results: + results.append(item_key) + return { "statusCode": 200, "headers": { @@ -20,8 +29,8 @@ }, "body": json.dumps({ "message": { - "items": response['Items'], - "count": len(response['Items']) + "items": results, + "count": len(results) } }), }