From 9618ba13cf48037264abef4940c7253b725f1959 Mon Sep 17 00:00:00 2001 From: Michaela Date: Fri, 18 Jun 2021 17:15:39 +1000 Subject: [PATCH] add descending field --- predict/lambda_function.py | 7 +++---- query/lambda_function.py | 8 +++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/predict/lambda_function.py b/predict/lambda_function.py index 373b6c6..3507480 100644 --- a/predict/lambda_function.py +++ b/predict/lambda_function.py @@ -3,8 +3,6 @@ import botocore.credentials from botocore.awsrequest import AWSRequest from botocore.endpoint import URLLib3Session from botocore.auth import SigV4Auth -from aws_xray_sdk.core import xray_recorder -from aws_xray_sdk.core import patch_all import json import os from datetime import datetime, timedelta, timezone @@ -309,6 +307,7 @@ def predict(event, context): "ascent_rate":value['request']['ascent_rate'], "descent_rate":value['request']['descent_rate'], "burst_altitude": value['request']['burst_altitude'], + "descending": 1 if serials[serial]['rate'] < 0 else 0, "landed": 0, "data": json.dumps(data) }) @@ -339,10 +338,10 @@ if __name__ == "__main__": # max_positions: 0 # position_id: 0 # vehicles: RS_*;*chase - predict( + print(predict( {"queryStringParameters" : { }},{} - ) + )) diff --git a/query/lambda_function.py b/query/lambda_function.py index 0867eb9..5e1d6b7 100644 --- a/query/lambda_function.py +++ b/query/lambda_function.py @@ -264,7 +264,13 @@ def datanew(event, context): "1": { "top_hits": { "size": 5, - "sort": [{"pressure": {"order": "desc","mode" : "median"}},{"humidity": {"order": "desc","mode" : "median"}},{"temp": {"order": "desc","mode" : "median"}},{"alt": {"order": "desc","mode" : "median"}}], + "sort": [ + {"datetime": {"order": "desc"}}, + {"pressure": {"order": "desc","mode" : "median"}}, + {"humidity": {"order": "desc","mode" : "median"}}, + {"temp": {"order": "desc","mode" : "median"}}, + {"alt": {"order": "desc","mode" : "median"}} + ], } } },