mirror of
https://github.com/projecthorus/sondehub-infra.git
synced 2025-01-02 19:36:47 +00:00
add uploader information to get_telem
This commit is contained in:
parent
b14ea4754d
commit
da3b13d6e7
@ -153,8 +153,14 @@ def get_telem(event, context):
|
|||||||
# {"field": "datetime"},
|
# {"field": "datetime"},
|
||||||
# ],
|
# ],
|
||||||
# "_source": "position",
|
# "_source": "position",
|
||||||
"size": 1,
|
"size": 5,
|
||||||
"sort": [{"datetime": {"order": "desc"}}],
|
"sort": [
|
||||||
|
{"datetime": {"order": "desc"}},
|
||||||
|
{"pressure": {"order": "desc","mode" : "median"}},
|
||||||
|
{"humidity": {"order": "desc","mode" : "median"}},
|
||||||
|
{"temp": {"order": "desc","mode" : "median"}},
|
||||||
|
{"alt": {"order": "desc","mode" : "median"}}
|
||||||
|
],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -188,7 +194,11 @@ def get_telem(event, context):
|
|||||||
results = es_request(payload, path, "POST")
|
results = es_request(payload, path, "POST")
|
||||||
output = {
|
output = {
|
||||||
sonde["key"]: {
|
sonde["key"]: {
|
||||||
data["key_as_string"]: data["1"]["hits"]["hits"][0]["_source"]
|
data["key_as_string"]: dict(data["1"]["hits"]["hits"][0]["_source"],
|
||||||
|
uploaders=[ #add additional uploader information
|
||||||
|
{key:value for key,value in uploader['_source'].items() if key in ["snr","rssi","uploader_callsign"]}
|
||||||
|
for uploader in data["1"]["hits"]["hits"]
|
||||||
|
])
|
||||||
for data in sonde["3"]["buckets"]
|
for data in sonde["3"]["buckets"]
|
||||||
}
|
}
|
||||||
for sonde in results["aggregations"]["2"]["buckets"]
|
for sonde in results["aggregations"]["2"]["buckets"]
|
||||||
|
Loading…
Reference in New Issue
Block a user