def user_status(uid): logs = fetch_uid_location_data(uid) results = merge_locations(logs) get_delta(results) moves = get_moves(results) stops = get_stop(results) return make_response(dumps(get_status(moves, stops)))
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 run(outputfile): cols = ['uid', 'data'] f = open(outputfile, 'w') writer = DictWriter(f, cols) writer.writeheader() db = DB(dbconfig) for uid in fetch_users(db): logs = fetch_user_location_logs(uid, db) results = merge_locations(logs) get_delta(results) moves = get_moves(results) stops = get_stop(results) user_status = generate_status_matrix(moves, stops) writer.writerow({'uid': uid, 'data': json.dumps(user_status)})
def run(outputfile): cols = ['uid', 'data'] f = open(outputfile, 'w') writer = DictWriter(f, cols) writer.writeheader() db = DB(dbconfig) for uid in fetch_users(db): logs = fetch_user_location_logs(uid, db) results = merge_locations(logs) get_delta(results) moves = get_moves(results) stops = get_stop(results) user_status = generate_status_matrix(moves, stops) writer.writerow({ 'uid': uid, 'data': json.dumps(user_status) })
def _location_by_uid_stop(uid): results = fetch_uid_location_data(uid) locations = merge_locations(results) get_delta(locations) locations = get_stop(locations, 30) return locations