add descending field

This commit is contained in:
Michaela 2021-06-18 17:15:39 +10:00
parent a99f6de735
commit 9618ba13cf
2 changed files with 10 additions and 5 deletions

View File

@ -3,8 +3,6 @@ import botocore.credentials
from botocore.awsrequest import AWSRequest from botocore.awsrequest import AWSRequest
from botocore.endpoint import URLLib3Session from botocore.endpoint import URLLib3Session
from botocore.auth import SigV4Auth from botocore.auth import SigV4Auth
from aws_xray_sdk.core import xray_recorder
from aws_xray_sdk.core import patch_all
import json import json
import os import os
from datetime import datetime, timedelta, timezone from datetime import datetime, timedelta, timezone
@ -309,6 +307,7 @@ def predict(event, context):
"ascent_rate":value['request']['ascent_rate'], "ascent_rate":value['request']['ascent_rate'],
"descent_rate":value['request']['descent_rate'], "descent_rate":value['request']['descent_rate'],
"burst_altitude": value['request']['burst_altitude'], "burst_altitude": value['request']['burst_altitude'],
"descending": 1 if serials[serial]['rate'] < 0 else 0,
"landed": 0, "landed": 0,
"data": json.dumps(data) "data": json.dumps(data)
}) })
@ -339,10 +338,10 @@ if __name__ == "__main__":
# max_positions: 0 # max_positions: 0
# position_id: 0 # position_id: 0
# vehicles: RS_*;*chase # vehicles: RS_*;*chase
predict( print(predict(
{"queryStringParameters" : { {"queryStringParameters" : {
}},{} }},{}
) ))

View File

@ -264,7 +264,13 @@ def datanew(event, context):
"1": { "1": {
"top_hits": { "top_hits": {
"size": 5, "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"}}
],
} }
} }
}, },