def area_by_uid_stop(uid, area_func=fetch_uid_business_data):
    results = area_func(uid)
    invalids = check_error_points(raw_merge_locations_by_date(results))
    results = [x for x in results if (x['location'], x['start_time']) not in invalids]
    locations = merge_locations(results)
    get_delta(locations)
    locations = get_stop(locations, 30)
    return locations
Example #2
0
def area_by_uid_stop(uid, area_func=fetch_uid_business_data):
    results = area_func(uid)
    invalids = check_error_points(raw_merge_locations_by_date(results))
    results = [x for x in results if (x['location'], x['start_time']) not in invalids]
    locations = merge_locations(results)
    get_delta(locations)
    locations = get_stop(locations, 30)
    return locations
def raw_location_by_uid_day(uid, day):
    day = '201312' + day
    cols = ['start_time', 'location']
    db.ping(True)
    cursor = db.cursor()
    prepare_sql = """select start_time, location
                        from location_logs_with_date
                        where uid = %s and log_date = %s order by start_time"""
    cursor.execute(prepare_sql, (uid, day))
    rows = cursor.fetchall()
    results = [dict(list(zip(cols, row))) for row in rows]
    invalids = check_error_points(raw_merge_locations_by_date(results))
    results = [x for x in results if (x['location'], x['start_time']) not in invalids]
    return make_response(dumps(results))
Example #4
0
def raw_location_by_uid_day(uid, day):
    day = '201312' + day
    cols = ['start_time', 'location']
    db.ping(True)
    cursor = db.cursor()
    prepare_sql = """select start_time, location
                        from location_logs_with_date
                        where uid = %s and log_date = %s order by start_time"""
    cursor.execute(prepare_sql, (uid, day))
    rows = cursor.fetchall()
    results = [dict(list(zip(cols, row))) for row in rows]
    invalids = check_error_points(raw_merge_locations_by_date(results))
    results = [x for x in results if (x['location'], x['start_time']) not in invalids]
    return make_response(dumps(results))