added correct parsing of input event

This commit is contained in:
Khalim Conn-Kowlessar 2023-09-04 18:22:12 +01:00
parent 6bf89c6aaa
commit f97d79944e
2 changed files with 6 additions and 43 deletions

View file

@ -19,10 +19,12 @@ def handler(event, context):
# Assuming a file in a bucket landing for now?
# Assuming we have a model to use
data_path = event["file_location"]
property_id = event["property_id"]
portfolio_id = event["portfolio_id"]
created_at = event["created_at"]
body = event["body"]
data_path = body["file_location"]
property_id = body["property_id"]
portfolio_id = body["portfolio_id"]
created_at = body["created_at"]
try:
# We could fix the model path but for the moment, we just take the best model path based on the registry

View file

@ -57,42 +57,3 @@ functions:
- http:
path: /predict
method: POST
#resources:
# Resources:
# sapPredictionLambdaRole:
# Type: AWS::IAM::Role
# Properties:
# RoleName: sap-prediction-lambda-role
# AssumeRolePolicyDocument:
# Version: '2012-10-17'
# Statement:
# - Effect: Allow
# Principal:
# Service:
# - lambda.amazonaws.com
# Action: sts:AssumeRole
# Policies:
# - PolicyName: sapPredictionLambdaS3Access
# PolicyDocument:
# Version: '2012-10-17'
# Statement:
# # Allow reading from MODEL_DIRECTORY_BUCKET and DATA_BUCKET
# - Effect: Allow
# Action:
# - s3:GetObject
# - s3:ListBucket
# Resource:
# - arn:aws:s3:::${env:MODEL_DIRECTORY_BUCKET}
# - arn:aws:s3:::${env:MODEL_DIRECTORY_BUCKET}/*
# - arn:aws:s3:::${env:DATA_BUCKET}
# - arn:aws:s3:::${env:DATA_BUCKET}/*
# # Allow reading and writing to PREDICTIONS_BUCKET
# - Effect: Allow
# Action:
# - s3:GetObject
# - s3:PutObject
# - s3:ListBucket
# Resource:
# - arn:aws:s3:::${env:PREDICTIONS_BUCKET}
# - arn:aws:s3:::${env:PREDICTIONS_BUCKET}/*