Skip to content

Main Functions for BurnOut

rishi2019194 edited this page Nov 27, 2023 · 1 revision

login()

  • This function is used for login by the user
  • Using email ID and passoword is validated and the user is directed to home

logout()

  • This function is used for logout by the user
  • logout() function just clears the session

register()

  • This function is used for registering new users
  • Details of new users are stored in the database and the user is redirected to login page

homePage()

  • This function renders the home page

send_email()

  • This function is used to send an email to user's friends containing calorie history of user
  • The user will fill a textarea with their friends email IDs (comma seperated if multiple)

calories()

  • This function will add calories consumed/burned for the data selected.

profile()

  • This function is used to store/display user's profile details such as height, weight and goal weight

history()

  • This function displays user's historical calorie consumption and burnout at date level. Also it helps to calculate the graph functionality features

friends()

  • This function allows user to accept friend requests and display all friends

yoga()/swim()/abbs()/belly()/core()/gym()/walk()/dance()/hrx()

  • This function allows user to enroll in different plans

plans()

  • This function displays the user's enrolled plans and also a dynamic progress bar

bmi_calci()

  • This function fetches the user age, weight and height to calculate the BMI and display it by rendering to the HTML page

chatbot()

  • This function simply renders to the chatbot.html page

get_bot_response()

  • This function computes the answer to the user-query using OpenAI API call and renders it to the html page

get_countries()

  • This function populate countries in the bmi_cal.html dropdown from mongodb

get_average_bmi()

  • This function fetches the average bmi values from database

chatcompletion()

  • Function to complete chat input using OpenAI's GPT-3.5 Turbo

chat()

  • Function to handle user chat input

get_response()

  • Function to get a response from the chatbot

calc_bmi()

  • Function that calculates BMI for a user based on age, weight and height

get_bmi_catgeory()

  • Function that computes the BMI category corresponding to the found BMI value

get_entries_for_email()

  • Function to fetch the user calories consumed and burnt over time and then returning them which can be shared via the email feature

total_calories_to_burn()

  • Function to compute total calories user need to burn/gain from start till end date

calories_to_burn()

  • Function to compute total calories user need to burn/gain from a given date till the end date
  • This file simply transfers the food-calorie data and the BMI data to the MongoDB server

test_history.py

  • This file has 3 test cases to check whether number of calories that need to burnt are calculated correctly or not

test_utilities.py

  • This file has various test cases for email feature, chatbot feature, graph feature and the bmi feature(we have added failing cases as well)