def show_user_profile(login): if 'authenticated' in request.args: user_id = user_traces_db.get_user_id_from_temp_login(login) print("user_id: %s" % user_id) return render_template('user.html', login=login, authenticated=True, exists=(user_id is not None)) else: user_id = user_traces_db.get_user_id_from_temp_login(login) user = user_traces_db.get_all_info_user(user_id) return render_template('user.html', login=login, user=user, authenticated=False, exists=(user_id is not None))
def raw_trace(): user_id = "" if 'login' in request.args: login = request.args.get('login') user_id = user_traces_db.get_user_id_from_temp_login(login) elif 'userid' in request.args: user_id = request.args.get('userid') if 'day' in request.args: day = request.args.get('day') start = utils.start_of_day_str(day) end = utils.end_of_day_str(day) return json.dumps( db.get_raw_trace(user_id, start, end, type=request.args.get('type'), utc=False)) start = request.args.get('start') end = request.args.get('end') return json.dumps( db.get_raw_trace(user_id, start, end, type=request.args.get('type'), utc=True))
def show_user_dashboard(login): user_id = user_traces_db.get_user_id_from_temp_login(login) user = user_traces_db.get_all_info_user(user_id) print("user_id: %s, user info: %s" % (user_id, user)) return render_template('dashboard.html', login=login, page='dashboard', user=user)
def get_authenticated_user_places(): login = request.args.get('login') user_id = user_traces_db.get_user_id_from_temp_login(login) print("user_id: %s" % user_id) study.add_trackingadvisor_id(session['sid'], user_id) places = user_traces_db.load_all_foursquare_user_places(user_id) print("Got %s places" % places) return json.dumps(places)
def show_user_map(login): user_id = user_traces_db.get_user_id_from_temp_login(login) visits = db.get_all_visits_user_geojson(user_id) user = user_traces_db.get_all_info_user(user_id) print("user_id: %s, number of visits: %s" % (user_id, len(visits))) return render_template('map.html', login=login, visits=visits, user=user, page='map')
def full_trace(): user_id = "" if 'login' in request.args: login = request.args.get('login') user_id = user_traces_db.get_user_id_from_temp_login(login) elif 'userid' in request.args: user_id = request.args.get('userid') if 'day' in request.args: day = request.args.get('day') start = utils.start_of_day_str(day) end = utils.end_of_day_str(day) raw_trace = db.get_raw_trace(user_id, start, end, type=request.args.get('type'), utc=False) raw_visits = db.get_raw_visits(user_id, day, type=request.args.get('type')) return json.dumps({"points": raw_trace, "visits": raw_visits}) return json.dumps({})
def export_user_data(login): user_id = user_traces_db.get_user_id_from_temp_login(login) zipfile = db.export_user_data(user_id) print("send zipfile %s" % zipfile) return send_file(zipfile, as_attachment=True)
def sign_out(): login = request.args.get('login') user_id = user_traces_db.get_user_id_from_temp_login(login) user_traces_db.create_temp_login(user_id, "") print("sign out with login: %s" % login) return json.dumps({"status": "ok"})
def show_user_modal(login): user_id = user_traces_db.get_user_id_from_temp_login(login) print("show modal for login %s" % login) return render_template('export-modal.html', login=login)