mirror of
https://github.com/projecthorus/sondehub-infra.git
synced 2024-12-19 21:27:55 +00:00
Fixes #112 - switched to terms and remove sondehubv1 filters
This commit is contained in:
parent
0663be8241
commit
76def2eada
@ -78,7 +78,7 @@ def predict(event, context):
|
|||||||
for payload_callsign in event["queryStringParameters"]["vehicles"].split(","):
|
for payload_callsign in event["queryStringParameters"]["vehicles"].split(","):
|
||||||
payload["query"]["bool"]["should"].append(
|
payload["query"]["bool"]["should"].append(
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"payload_callsign.keyword": payload_callsign
|
"payload_callsign.keyword": payload_callsign
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -524,14 +524,7 @@ async def predict_async(event, context):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"should": [],
|
"should": []
|
||||||
"must_not": [
|
|
||||||
{
|
|
||||||
"match_phrase": {
|
|
||||||
"software_name": "SondehubV1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"size": 0
|
"size": 0
|
||||||
|
@ -44,7 +44,7 @@ def query(event, context):
|
|||||||
"bool": {
|
"bool": {
|
||||||
"filter": [
|
"filter": [
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"payload_callsign.keyword": payload_callsign
|
"payload_callsign.keyword": payload_callsign
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ def fetch_es(serial, s3_data):
|
|||||||
"bool": {
|
"bool": {
|
||||||
"filter": [
|
"filter": [
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"serial.keyword": serial
|
"serial.keyword": serial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ def history(event, context):
|
|||||||
"filter": [
|
"filter": [
|
||||||
{"match_all": {}},
|
{"match_all": {}},
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"serial": str(event["pathParameters"]["serial"])
|
"serial.keyword": str(event["pathParameters"]["serial"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -78,7 +78,7 @@ def predict(event, context):
|
|||||||
for serial in event["queryStringParameters"]["vehicles"].split(","):
|
for serial in event["queryStringParameters"]["vehicles"].split(","):
|
||||||
payload["query"]["bool"]["should"].append(
|
payload["query"]["bool"]["should"].append(
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"serial.keyword": serial
|
"serial.keyword": serial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -556,14 +556,7 @@ async def predict_async(event, context):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"should": [],
|
"should": []
|
||||||
"must_not": [
|
|
||||||
{
|
|
||||||
"match_phrase": {
|
|
||||||
"software_name": "SondehubV1"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"size": 0
|
"size": 0
|
||||||
|
@ -172,8 +172,8 @@ def get_telem(event, context):
|
|||||||
payload["aggs"]["2"]["aggs"]["3"]["aggs"]["1"]["top_hits"]["sort"].append({"pressure": {"order": "desc","mode" : "median"}})
|
payload["aggs"]["2"]["aggs"]["3"]["aggs"]["1"]["top_hits"]["sort"].append({"pressure": {"order": "desc","mode" : "median"}})
|
||||||
payload["query"]["bool"]["filter"].append(
|
payload["query"]["bool"]["filter"].append(
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"serial": str(event["queryStringParameters"]["serial"])
|
"serial.keyword": str(event["queryStringParameters"]["serial"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -302,8 +302,8 @@ def get_listener_telemetry(event, context):
|
|||||||
if "uploader_callsign" in event["queryStringParameters"]:
|
if "uploader_callsign" in event["queryStringParameters"]:
|
||||||
payload["query"]["bool"]["filter"].append(
|
payload["query"]["bool"]["filter"].append(
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"uploader_callsign": str(event["queryStringParameters"]["uploader_callsign"])
|
"uploader_callsign.keyword": str(event["queryStringParameters"]["uploader_callsign"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -374,8 +374,8 @@ def get_sites(event, context):
|
|||||||
if "station" in event["queryStringParameters"]:
|
if "station" in event["queryStringParameters"]:
|
||||||
payload["query"]["bool"]["filter"].append(
|
payload["query"]["bool"]["filter"].append(
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"station": str(event["queryStringParameters"]["station"])
|
"station.keyword": str(event["queryStringParameters"]["station"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -62,16 +62,15 @@ from . import *
|
|||||||
# {},
|
# {},
|
||||||
# )
|
# )
|
||||||
# )
|
# )
|
||||||
print(get_sites({},{}))
|
# print(get_sites({"queryStringParameters":{"station":-1}},{}))
|
||||||
|
|
||||||
# a=get_telem(
|
print(get_telem(
|
||||||
# {
|
{
|
||||||
# "queryStringParameters": {
|
"queryStringParameters": {
|
||||||
# "duration": "3h",
|
"duration": "3h",
|
||||||
# # "serial": "S4430086"
|
# "serial": "S4430086"
|
||||||
# }},{}
|
}},{}
|
||||||
|
))
|
||||||
# )
|
|
||||||
# b=get_telem(
|
# b=get_telem(
|
||||||
# {
|
# {
|
||||||
# "queryStringParameters": {
|
# "queryStringParameters": {
|
||||||
|
@ -170,7 +170,7 @@ def get_telem(event, context):
|
|||||||
"query": {
|
"query": {
|
||||||
"bool": {
|
"bool": {
|
||||||
"minimum_should_match": 1,
|
"minimum_should_match": 1,
|
||||||
"must_not": [{"match_phrase": {"software_name": "SondehubV1"}}, {"match_phrase": {"payload_callsign": "xxxxxxxx"}}],
|
"must_not": [{"term": {"payload_callsign.keyword": "xxxxxxxx"}}],
|
||||||
"should": [
|
"should": [
|
||||||
{
|
{
|
||||||
"bool": {
|
"bool": {
|
||||||
@ -219,7 +219,7 @@ def get_telem(event, context):
|
|||||||
payloads = str(event["queryStringParameters"]["payload_callsign"]).split(",")
|
payloads = str(event["queryStringParameters"]["payload_callsign"]).split(",")
|
||||||
payload["query"]["bool"]["must"] = {
|
payload["query"]["bool"]["must"] = {
|
||||||
"bool": {
|
"bool": {
|
||||||
"should": [ {"match_phrase": {"payload_callsign": x}} for x in payloads ]
|
"should": [ {"term": {"payload_callsign.keyword": x}} for x in payloads ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
results = es.request(json.dumps(payload), path, "POST")
|
results = es.request(json.dumps(payload), path, "POST")
|
||||||
@ -287,7 +287,7 @@ def get_telem_full(event, context):
|
|||||||
"query": {
|
"query": {
|
||||||
"bool": {
|
"bool": {
|
||||||
"minimum_should_match": 1,
|
"minimum_should_match": 1,
|
||||||
"must_not": [{"match_phrase": {"software_name": "SondehubV1"}}, {"match_phrase": {"payload_callsign": "xxxxxxxx"}}],
|
"must_not": [ {"term": {"payload_callsign.keyword": "xxxxxxxx"}}],
|
||||||
"should": [
|
"should": [
|
||||||
{
|
{
|
||||||
"bool": {
|
"bool": {
|
||||||
@ -333,8 +333,8 @@ def get_telem_full(event, context):
|
|||||||
}
|
}
|
||||||
payload["query"]["bool"]["filter"].append(
|
payload["query"]["bool"]["filter"].append(
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"payload_callsign": str(event["pathParameters"]["payload_callsign"])
|
"payload_callsign.keyword": str(event["pathParameters"]["payload_callsign"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -578,8 +578,8 @@ def get_listener_telemetry(event, context):
|
|||||||
if "uploader_callsign" in event["queryStringParameters"]:
|
if "uploader_callsign" in event["queryStringParameters"]:
|
||||||
payload["query"]["bool"]["filter"].append(
|
payload["query"]["bool"]["filter"].append(
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"uploader_callsign": str(event["queryStringParameters"]["uploader_callsign"])
|
"uploader_callsign.keyword": str(event["queryStringParameters"]["uploader_callsign"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -3,17 +3,17 @@ import base64
|
|||||||
|
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
response = get_telem(
|
response = get_telem_full(
|
||||||
{
|
{
|
||||||
"pathParameters": {
|
"pathParameters": {
|
||||||
|
"payload_callsign": "PD3EGE"
|
||||||
},
|
},
|
||||||
"queryStringParameters":{
|
"queryStringParameters":{
|
||||||
# "payload_callsign" : "NOB14,VE6AGD-11",
|
# "payload_callsign" : "NOB14,VE6AGD-11",
|
||||||
# "last": "10800",
|
"last": "22269",
|
||||||
# "datetime": "2022-06-26T08:30:00.000001Z",
|
"datetime": "1688655220.471",
|
||||||
# "format": "kml"
|
# "format": "kml"
|
||||||
"duration": "732d"
|
#"duration": "732d"
|
||||||
}
|
}
|
||||||
}, {})
|
}, {})
|
||||||
print(len(response['body']))
|
print(len(response['body']))
|
||||||
|
@ -30,7 +30,7 @@ def handler(event, context):
|
|||||||
},
|
},
|
||||||
"query": {
|
"query": {
|
||||||
"bool": {
|
"bool": {
|
||||||
"must_not": [{"match_phrase": {"serial": "xxxxxxxx"}}],
|
"must_not": [{"term": {"serial": "xxxxxxxx"}}],
|
||||||
"filter": [
|
"filter": [
|
||||||
{
|
{
|
||||||
"range": {
|
"range": {
|
||||||
|
@ -36,7 +36,7 @@ def sondeExists(serial):
|
|||||||
"bool": {
|
"bool": {
|
||||||
"filter": [
|
"filter": [
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"serial.keyword": serial
|
"serial.keyword": serial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,13 +88,13 @@ def getRecovered(serial):
|
|||||||
"bool": {
|
"bool": {
|
||||||
"filter": [
|
"filter": [
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"serial.keyword": serial
|
"serial.keyword": serial
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"recovered": True
|
"recovered.keyword": True # not sure if this right? should be a bool time. function is never called though
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -182,7 +182,7 @@ def get(event, context):
|
|||||||
for serial in serials:
|
for serial in serials:
|
||||||
should.append(
|
should.append(
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"serial.keyword": serial
|
"serial.keyword": serial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ def predict(event, context):
|
|||||||
for serial in event["queryStringParameters"]["vehicles"].split(","):
|
for serial in event["queryStringParameters"]["vehicles"].split(","):
|
||||||
payload["query"]["bool"]["should"].append(
|
payload["query"]["bool"]["should"].append(
|
||||||
{
|
{
|
||||||
"match_phrase": {
|
"term": {
|
||||||
"serial.keyword": serial
|
"serial.keyword": serial
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user