add chase only

This commit is contained in:
Michaela 2021-04-10 15:06:44 +10:00
parent 2f34d42df2
commit 4d8fda7441
2 changed files with 130 additions and 121 deletions

View File

@ -225,7 +225,8 @@ def datanew(event, context):
else:
lt = datetime.now(timezone.utc)
gte = datetime.now(timezone.utc) - timedelta(0, duration)
output = {"positions": {"position": []}}
if "chase_only" not in event["queryStringParameters"] or event["queryStringParameters"]["chase_only"] != "true":
path = "telm-*/_search"
payload = {
"aggs": {
@ -282,7 +283,7 @@ def datanew(event, context):
)
results = es_request(payload, path, "POST")
output = {"positions": {"position": []}}
for sonde in results["aggregations"]["2"]["buckets"]:
for frame in sonde["3"]["buckets"]:
@ -569,12 +570,13 @@ if __name__ == "__main__":
# position_id: 0
# vehicles: RS_*;*chase
print(
get_listeners(
datanew(
{
"queryStringParameters": {
"type" : "positions",
"mode": "1hour",
"position_id": "0"
"mode": "6hours",
"position_id": "0",
"chase_only": "true"
}
},
{},

View File

@ -223,6 +223,13 @@ paths:
- "6hours"
- "3hours"
- "1hour"
- in: query
name: chase_only
type: string
description: Return only chase cars
enum:
- "true"
- "false"
- in: query
name: vehicles
type: string