diff --git a/model_data/simulation_system/handlers/predictions_app.py b/model_data/simulation_system/handlers/predictions_app.py index ea764276..1c77897f 100644 --- a/model_data/simulation_system/handlers/predictions_app.py +++ b/model_data/simulation_system/handlers/predictions_app.py @@ -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 diff --git a/sapmodel.serverless.yml b/sapmodel.serverless.yml index 5f51af5d..8831901a 100644 --- a/sapmodel.serverless.yml +++ b/sapmodel.serverless.yml @@ -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}/*