Updated stored data
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2021-06-14 03:34:50 +02:00
parent 5b9d982ffc
commit 62f35d53d2

View File

@ -39,19 +39,20 @@ async def on_message(message: IncomingMessage):
r = requests.get(f"http://input-service/sample/{msg_json['tag']}") r = requests.get(f"http://input-service/sample/{msg_json['tag']}")
r.raise_for_status() r.raise_for_status()
fields = {
k: float(v) for k, v in msg_json['all_predictions']
}
fields['_classification_duration'] = float(msg_json['classification_duration'])
point = { point = {
'time': now, 'time': now,
'measurement': 'sturnus', 'measurement': 'sturnus',
'tags': { 'tags': {
'device': r.json()['device_id'] 'device': r.json()['device_id']
}, },
'fields': { 'fields': fields
'probability': float(msg_json['probability']) # This is required because otherwise of the json serialization and de-serialization round values would interpret as ints and influxdb would fail
}
} }
async with InfluxDBClient(username=config.INFLUXDB_USERNAME, password=config.INFLUXDB_PASSWORD, async with InfluxDBClient(username=config.INFLUXDB_USERNAME, password=config.INFLUXDB_PASSWORD,
host=config.INFLUXDB_HOST, port=config.INFLUXDB_PORT, ssl=False, host=config.INFLUXDB_HOST, port=config.INFLUXDB_PORT, ssl=False,
database=config.INFLUXDB_DB) as client: database=config.INFLUXDB_DB) as client: