Skip to content

Grauda123/Orbital_view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 

Repository files navigation

gotEat

Table of Contents

General Information

Is there someone u know who always skips meals because they are too preoccupied with their work? Do you have a friend that always asks you what to eat during lunch? The objective of this project is to develop a Telegram bot that assists individuals in building and maintaining healthy eating habits. Our project aims to address the common dilemma of deciding what to have for lunch by providing personalized meal recommendations and guidance and also the challenge of diet procrastination and meal skipping. We chose to create a telegram bot because of the ease of use and accessibility, where users do not need to download another application.

Motivation

I have bad eating habits. As a student, I tend to be so occupied with my assignments, tutorials and classes that I will skip meals or even forget them. When my friend sees me, she will always ask "u got eat?". Unfortunately, skipping meals is also quite a common occurrence in this busy Singapore. I hope to use this opportunity to help fellow meal forgotters and myself to build a healthy eating habit, along with the added extension of this application to build a healthier lifestyle.

User stories

  • I am a user who wants to log meals so that I can keep track of what I eat.
  • I am an indecisive user who wants to get recommendations for what to eat so that I do not need to spend time everyday thinking “what should I eat”
  • I am a user who wants to improve my eating habits.I will be able to see my meal analytics so that I can make changes to my diet.
  • I am a user who wants to improve my eating habits, I will be able to daily reminders for when to eat and drink water so that I will not forget to skip my meals and hydrate even when I am busy with work.

Features

  • Log Meal
  • View Past Meals
  • Meal Analytics
  • Set daily reminders
  • Food Recommendations
  • Cancellation

Technologies Used

  • python 3.11
  • mysql
  • db4free (for mysql hosting)
  • UptimeRobot for continuous polling.

Setup

Creating the telegram bot: In telegram chat, search for BotFather and choose the one with the tick.

Alt text

Create the telegram bot with the /newbot command and name the telegram bot.

Alt text

Here are the steps to follow before starting gotEat:

Create an account on db4free

Create your own database credentials and create the account.

Alt text

After successful creation of the account, go to phpmyAdmin from the side navigation.

Alt text

The database created can be accessed from the side panel with the value from the MySQL database name in the signup.

Alt text

Create an account on UptimeRobot

Alt text

After log in, add a new monitor which can be found in the top left

Alt text

Details for the new Monitor:

  • For the Monitor type: select HTTP(s).

  • Friendly Name: Choose any name you would like to call your Monitor.

  • URL (or IP): enter your web server link. In the example below, we used the online IDE, replit.

    Alt text

  • Monitoring Interval and Monitor timeout: Default values

  • Tick the alert notify checkbox. This is to notify you via email in the event when your server is down or ran into any problems.

    Alt text

Overall this would be how it would look like. Click the Create Monitor button at the bottom. Now you would be able to monitor the status of the telegram bot. Alt text

Import the various packages

python telegram

pip install python-telegram-bot

mysql module to run mysql statements

pip install mysql-connector-python

apsheduler to schedule reminders

pip install apscheduler

Usage

Starting page

  • to ensure that you are at the right bot, refer to the two pictures below.
    Landing page After 'Start'
    Alt text Alt text

    /logmeal

    Alt text

    "Are you having your meal now?"

    if you selected Nope

    • select the date of entry for the meal you would like to log. Ranges -3 days from the current date. Alt text

    • Input the time of the meal in the HH:MM format (24- hour clock)

    Log time Log time confirmation
    Alt text Alt text

    if you selected Yup! or finished inputing your time, you will be presented the next set of queries

    "Please select the type of the meal:"

    • There are four options: "Breakfast", "Lunch", "Dinner" or "Snack"
    • Select one of the four options that best describe the meal you want to log

    Alt text

    • Your option is successfully recorded when you see "You have selected (option)"

    "What have you eaten today?"

    • input the meal that you are eating

      Alt text

    • gotEat will find the option closest to the name of meal entered

    • select the option presented

    • "Meal entry logged successfully!"

    /cancel

    This feature allows user to cancel during the middle of their queries, restarting their entry Alt text

    • user can go back to the start and log their meals

    /View_past_meals

    This feature allows user to visit your entries of your previously logged meals. Users are able to choose based on categories.

    Alt text

    /View_meal_analytics

    This feature allows user to see analytical data from the recorded meals. Items in the analytics include:

    • Total Number of meals eaten
    • Breakdown of meals
    • Average Meal time of each category
    • Favourite Food (Food with highest frequency)

    Alt text

    /setreminder

    This feature allows user to set daily reminders either to eat or to drink water. Frequency of reminder sent are defined by the user. All reminders for the day will be stopped at 11pm.

    Alt text

    /recommend

    This feature allows user to be recommended. Recommendation is based on

    • Category which has 3 options: (Dessert, Snack, Main)
    • Halal preferrence

    Alt text

    Test cases

    Test case for /logmeal

    Test Case for logmeal Expected Output Actual Output Pass/Fail
    User input of meal in /logmeal.
    Test cases: 24:10, 24:01, -00:00
    12:345, -1:00
    Invalid time format. Please enter the time in HH:MM format (24-hour clock). Alt text Alt text Pass
    /Cancel anytime when logging meal Conversation Cancelled Alt text Pass

    Test case for /setreminder

    Test Case for /setreminder Expected Output Actual Output Pass/Fail
    User input of meal in /setreminder to eat.

    Test cases: 0h 5min
    “It's time to eat! Don't forget to have a meal~” Alt text Pass
    User input of meal in /setreminder to drink.

    Test cases tested: 0hr1minutes, 0hrs 1mins, 0h1m.
    “It's time to drink water! Don't forget to stay hydrated~” Alt text Pass

    Test case for /recommend

    Test Case for /recommend Expected Output Actual Output Pass/Fail
    Desert:
    Halal
    Not Halal
    “Hmm... for Dessert how about trying xxx ?” Alt text Pass
    Snack:
    Halal
    Not Halal
    Hmm... for Snack how about trying xxx? Alt text Pass
    Main:
    Halal
    Not Halal
    Hmm... for Main how about trying xxx? Alt text Pass

    Updates from last milestone

    In Mile-Stone 3, we managed to complete most of the items that we set out to accomplish from MS2

    To do for MS3

    • Fix Database design. User can only log one entry of meal due to database schema.
      • subsequent entry leads to primary key duplicate error.
    • Fix set reminders feature.
      • user can set meal reminders and reminder to take a break.
      • This is optional to the user.
    • Fix recommendation for users.
    • Add the option to view and delete records for users.
    • Fix invalid time in logmeal
    • send telegram stickers
    • user statistics
      • download a summary of what the user has eaten during a predefined interval from the database.
    • Improve on the search of possible food.

    Updates for MS1 to MS2

    • We have made significant updates to our database hosting.
    • Previously, our users had to download a hosting solution, which essentially transformed their own computers into servers. Our database was also local for each user.
    • Currently, we have now transitioned to an online hosting platform. Our database is also available online.
    • As part of this update, we have replaced XAMMP, the previous hosting tool, with PHPAdmin.
    • Improved the functions for easier user interation
    • For example:
      • custom calender
      • inline keyboards to minimise user activity.
      • Searching for possible food when user input what they ate.

    Acknowledgements

    • This project was inspired by our everyday busy life in NUS and our unhealthy eating habits
    • This project was based many tutorials.
    • Many thanks to our advisor

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages