Ejemplo n.º 1
0
def steps_week_chart():
  current_user_id = current_user.id
  all_user_activity = model.session.query(Activity).order_by(Activity.date.desc()).filter(Activity.user_id == current_user_id).limit(7)
  weekly_steps_data = util.patients_weekly_steps(all_user_activity)
  weekly_floors_data = util.patients_weekly_floors(all_user_activity)
  weekly_miles_data = util.patients_weekly_miles(all_user_activity)
  return render_template("steps_weekly.html",
                        weekly_steps_data=weekly_steps_data,
                        weekly_floors_data=weekly_floors_data,
                        weekly_miles_data=weekly_miles_data)
Ejemplo n.º 2
0
def weekly_miles_chart():
  current_user_id = current_user.id
  weekly_miles_data = util.patients_weekly_miles(current_user_id)
  miles_list = []
  for element in weekly_miles_data:
    miles_list.append(element.distance)
  x_axis = [0,1,2,3,4,5,6]
  mile_tuples = zip(x_axis, miles_list)
  dates_list = []
  for element in weekly_miles_data:
    dates_list.append(element.date.strftime('%m'+'.'+'%d'))
  date_tuples = zip(x_axis, dates_list)
  return render_template("miles_weekly.html",
                        title="Miles",
                        weekly_miles_data=weekly_miles_data,
                        mile_tuples=mile_tuples,
                        date_tuples=date_tuples)
Ejemplo n.º 3
0
def therapist_weekly_miles():
  patient_id = session.get('patient')
  weekly_miles_data = util.patients_weekly_miles(patient_id)
  miles_list = []
  for element in weekly_miles_data:
    miles_list.append(element.distance)
  x_axis = [0,1,2,3,4,5,6]
  mile_tuples = zip(x_axis, miles_list)
  dates_list = []
  for element in weekly_miles_data:
    dates_list.append(element.date.strftime('%m'+'.'+'%d'))
  date_tuples = zip(x_axis, dates_list)
  return render_template("therapist_weekly_miles.html",
                        title="Miles",
                        weekly_miles_data=weekly_miles_data,
                        mile_tuples=mile_tuples,
                        date_tuples=date_tuples)
Ejemplo n.º 4
0
def therapists_patient_view():
  therapist_id = current_user.id
  patient_info = model.session.query(Users).filter(Users.therapist == therapist_id).all()
  # query for patient's id
  patient_id = request.args.get('patient_id', 0)
  # activity = patient_info[0].activities
  patient = model.session.query(Users).filter(Users.id == patient_id).first()
  name = patient.first_name
  all_user_activity = model.session.query(Activity).order_by(Activity.date.desc()).filter(Activity.user_id == patient_id).limit(7)
  weekly_steps_data = util.patients_weekly_steps(all_user_activity)
  weekly_floors_data = util.patients_weekly_floors(all_user_activity)
  weekly_miles_data = util.patients_weekly_miles(all_user_activity)
  days_activity = model.session.query(Activity).order_by(Activity.date.desc()).filter(Activity.user_id == patient_id).first()
  daily_data = util.day_view(days_activity)
  return render_template("therapists_patient_view.html", title = "Patient Info",
                        weekly_steps_data=weekly_steps_data,
                        weekly_floors_data=weekly_floors_data,
                        weekly_miles_data=weekly_miles_data,
                        daily_data=daily_data,
                        name=name,
                        patient_id=patient_id)