ppu4hash
parent
9980ef5677
commit
60562643b3
|
@ -4,6 +4,7 @@ from tpmcqr_service.models.gtfs import QRDev, Lineas, Shapes, Paraderos, Trips,
|
|||
import time
|
||||
import pickle
|
||||
import math
|
||||
import xxhash
|
||||
|
||||
def parada_ruta_expediciones(redis_id, parada_id, lineacode):
|
||||
|
||||
|
@ -168,11 +169,12 @@ def calcula_distancias_parada(redis_id, parada_id):
|
|||
|
||||
return 200, salida_parada
|
||||
|
||||
|
||||
def estima_llegada(parada_distance, expedicion):
|
||||
ts = int(time.time())
|
||||
data_keys = ['trip_traveled', 'ppu', 'trip_lat', 'trip_lon', 'trip_pos', 'ts']
|
||||
trip_info = dict(zip(data_keys, expedicion))
|
||||
trip_info['bus_id'] = xxhash.xxh32(data_keys['ppu'], seed=data_keys['id_linea']).hexdigest()
|
||||
|
||||
trip_info['drift'] = int(trip_info['ts']) - ts
|
||||
trip_info['trip_distance'] = parada_distance - int(trip_info['trip_traveled'])
|
||||
estimator = int(trip_info['trip_distance'] / 5) # 18 Km/h promedio -> 5 m/s
|
||||
|
|
|
@ -6,3 +6,4 @@ flask-redis
|
|||
psycopg2-binary
|
||||
requests
|
||||
geoalchemy2
|
||||
xxhash
|
||||
|
|
Loading…
Reference in New Issue