def read_data(uuid=None, size=None, old=True): db = edb.get_trip_db() if not old: logging.debug("not old") trips = esda.get_entries(esda.RAW_TRIP_KEY, uuid, time_query=None, geo_query=None) return trips if old: data = [] trip_db = db if uuid: trips = trip_db.find({'user_id' : uuid, 'type' : 'move'}) else: trips = trip_db.find({'type' : 'move'}) for t in trips: try: trip = Trip.trip_from_json(t) except: continue if not (trip.trip_start_location and trip.trip_end_location and trip.start_time): continue data.append(trip) if size: if len(data) == size: break return data
def read_data(uuid=None, size=None, old=True): data = [] trip_db = edb.get_trip_db() if not old: trip_db = edb.get_trip_new_db() trips = trip_db.find({"user_id": uuid}) else: if uuid: trips = trip_db.find({'user_id': uuid, 'type': 'move'}) else: trips = trip_db.find({'type': 'move'}) for t in trips: try: trip = Trip.trip_from_json(t) except: continue if not (trip.trip_start_location and trip.trip_end_location and trip.start_time): continue data.append(trip) if size: if len(data) == size: break return data return [ecwt.Trip(trip) for trip in trips]
def read_data(uuid=None, size=None, old=True): db = edb.get_trip_db() if not old: logging.debug("not old") trips = esda.get_entries(esda.RAW_TRIP_KEY, uuid, time_query=None, geo_query=None) return trips if old: data = [] trip_db = db if uuid: trips = trip_db.find({'user_id': uuid, 'type': 'move'}) else: trips = trip_db.find({'type': 'move'}) for t in trips: try: trip = Trip.trip_from_json(t) except: continue if not (trip.trip_start_location and trip.trip_end_location and trip.start_time): continue data.append(trip) if size: if len(data) == size: break return data
def read_data(uuid=None,size=None): data = [] db = edb.get_trip_db() if uuid: trips = db.find({'user_id' : uuid, 'type' : 'move'}) else: trips = db.find({'type' : 'move'}) if trips.count() == 0: return [] for t in trips: try: trip = Trip.trip_from_json(t) except: continue if not (trip.trip_start_location and trip.trip_end_location and trip.start_time): continue data.append(trip) if size: if len(data) == size: break if len(data) == 0: return [] return data
def read_data(uuid=None, size=None, old=True): data = [] trip_db = edb.get_trip_db() if not old: trip_db = edb.get_trip_new_db() trips = trip_db.find({"user_id" : uuid}) else: if uuid: trips = trip_db.find({'user_id' : uuid, 'type' : 'move'}) else: trips = trip_db.find({'type' : 'move'}) for t in trips: try: trip = Trip.trip_from_json(t) except: continue if not (trip.trip_start_location and trip.trip_end_location and trip.start_time): continue data.append(trip) if size: if len(data) == size: break return data return [ecwt.Trip(trip) for trip in trips]