0% found this document useful (0 votes)
6 views

Muskan project report

Uploaded by

Aryan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Muskan project report

Uploaded by

Aryan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

A Project Report

On

“FITNESS TRACKER APP”


Submitted in partial fulfillment of the requirements for the award of the degree
of

Bachelor of Technology
In
Computer Science & Engineering/Information Technology

Submitted to:- Submitted by:-


Ms. Heena Mehta Muskan
Asst. Professor (VCE) 1062058

VAISH COLLEGE OF ENGINEERING


(Affiliated to Maharshi Dayanand University, Rohtak)
ROHTAK – 124001
May-2024
I
Table of Contents

Chapter Number Page No.

Chapter 1 INTRODUCTION ................................................................................................ 1


Introduction............................................................................................................................ 1
1.2 Objective of Automated Fitness Tracker ......................................................................... 2
1.3 Motivation of Automated Fitness Tracker ....................................................................... 2
1.4 Language Used ................................................................................................................ 3
1.5 Technical Requirements .................................................................................................. 4
1.6 Deliverables of Automated Fitness Tracker .................................................................... 4
Chapter 2 AUTOMATED FITNESS TRACKER SDLC ..................................................... 6
2.1 Feasibility Study on Automated Fitness Tracker............................................................. 6
2.2 Requirements on Automated Fitness Tracker.................................................................. 6
2.2.1 Functional Requirements ........................................................................................... 6
2.2.2 Non-Functional Requirements................................................................................... 7
2.3 Use Case Diagram of Automated Fitness Tracker .......................................................... 7
2.4 DFD Diagram of Automated Fitness Tracker.................................................................. 9
2.5 State Transition Diagram of Automated Fitness Tracker .............................................. 11
Chapter 3 LITERATURE SURVEY .................................................................................. 12
3.1 HealthifyMe Android Application ................................................................................. 12
3.2 JEFIT Android Application ........................................................................................... 13
3.3 The Smart Kitchen Concept........................................................................................... 14
3.4 CalculNutri Project ........................................................................................................ 16
3.5 The Caloric Calculator ................................................................................................... 17
Chapter 4 IMPLEMENTATION OF THE MINOR PROJECT ......................................... 19
4.1 Data Set Used in the Automated Fitness Tracker .......................................................... 19
4.1.1 Data Cleaning .......................................................................................................... 20
4.2 Data Set Features ........................................................................................................... 22
4.2.1 Types of Data Set .................................................................................................... 22
4.2.2 Number of Attributes, Field, Description of dataset ............................................... 23
4.3 Design of the problem statement ................................................................................... 25
4.4 Algorithm/ Pseudo code of the Automated Fitness Tracker .......................................... 25
4.4.1 Algorithm ................................................................................................................ 25
4.4.2 Pseudo Code ............................................................................................................ 25

II
4.5 Flow Graph of the Automated Fitness Tracker ............................................................. 26
4.6 About Chatbot ............................................................................................................... 27
4.6.1 Libraries used in our chatbot ................................................................................... 27
4.6.2 Working of the chatbot ............................................................................................ 28
4.6.3 Algorithm/ Pseudo code for the Chatbot ................................................................. 29
4.7 Screen shots of the various stages of Automated Fitness Tracker ................................. 29
4.7.1 Data Cleaning and increasing accuracy ................................................................... 29
4.7.3 Training Model........................................................................................................ 33
4.7.4 Deploying the real-time model ................................................................................ 34
4.7.5 Running Application snippets ................................................................................. 36
4.8 Major Modules used in this Automated Fitness Tracker ............................................... 40
Chapter 5 CONCLUSIONS ................................................................................................ 41
5.1 Discussions on the results achieved............................................................................... 41
5.1.1 Login Page............................................................................................................... 41
5.1.2 Web Application...................................................................................................... 42
5.2 Machine learning algorithm used in Chatbot ................................................................. 43
5.3 Application of Automated Fitness Tracker.................................................................... 44
5.4 Limitations of Automated Fitness Tracker .................................................................... 45
5.5 Future of Automated Fitness Tracker ............................................................................ 45
REFERENCES ......................................................................................................................... 46
1. Websites .......................................................................................................................... 46
2) Journals ........................................................................................................................... 47
3) Articles ............................................................................................................................ 47
4) Datasets ........................................................................................................................... 48
APPENDICES.......................................................................................................................... 49

III
Table of figures:
Figure Name Page No.
Figure 1-1 Python....................................................................................................................... 3
Figure 1-2 Health tracker display ............................................................................................... 5
Figure 2-1Web Application Use Case Diagram of User ............................................................ 7
Figure 2-2 Web Application Use Case Diagram of Admin ....................................................... 8
Figure 2-3 Data Use Case Diagram of automated calorie calculation........................................ 8
Figure 2-4 DFD Diagram for automated calorie calculation .................................................... 10
Figure 2-5 State Transition Diagram for automated calorie calculation .................................. 11
Figure 3-1 HealthifyMe app photo ........................................................................................... 12
Figure 3-2 JEFIT Application .................................................................................................. 13
Figure 3-3 JEFIT interface ....................................................................................................... 13
Figure 3-4 Smart kitchen .......................................................................................................... 14
Figure 3-5 Nutritional score table............................................................................................. 16
Figure 3-6 Nutrition analysis .................................................................................................... 16
Figure -4-1 Database in CSV format (1) .................................................................................. 19
Figure 4-2 Database in CSV format (2) ................................................................................... 20
Figure 4-3 Exercise dataset in csv format ................................................................................ 20
Figure 4-4 Processing backend view ........................................................................................ 21
Figure 4-5 Cleaned Dataset ...................................................................................................... 21
Figure 4-6 Cleaned exercise dataset ......................................................................................... 22
Figure 4-7 JSON data format ................................................................................................... 23
Figure 4-8 Algorithm of the given project ............................................................................... 25
Figure 4-9 Flow graph of the project problem ......................................................................... 26
Figure 4-10 Chatbot hello ........................................................................................................ 27
Figure 4-11 Algorithm for chatbot ........................................................................................... 29
Figure 4-12 Data Cleaning and using Fuzzy Wuzzy Code (1)................................................. 30
Figure 4-13 Data Cleaning and using Fuzzy Wuzzy Code (2)................................................. 30
Figure 4-14 Output of the existing data set .............................................................................. 31
Figure 4-15 Backend output of FuzzyWuzzy module ............................................................. 31
Figure 4-16 Data representation of exercise dataset ................................................................ 31
Figure 4-17 Graphical Data Representation ............................................................................. 32
Figure 4-18 Login page design in HTML ................................................................................ 32

IV
Figure 4-19 Registering account design in HTML................................................................... 32
Figure 4-20 Creating account ................................................................................................... 33
Figure 4-21 Figure 4 20 Login page display ............................................................................ 33
Figure 4-22 Figure 4 19 Sign in page display .......................................................................... 33
Figure 4-23 Training models backend ..................................................................................... 33
Figure 4-24 py.manage file ...................................................................................................... 34
Figure 4-25 models.py file ....................................................................................................... 34
Figure 4-26 decoators.py file ................................................................................................... 35
Figure 4-27 view.py file ........................................................................................................... 35
Figure 4-28 PowerShell working ............................................................................................. 36
Figure 4-29 Main page (i) ........................................................................................................ 36
Figure 4-30 Main page (ii) ....................................................................................................... 36
Figure 4-31 Nutrition Table (i)................................................................................................. 37
Figure 4-32 Nutrition Table (ii)................................................................................................ 37
Figure 4-33 Addition of meals ................................................................................................. 38
Figure 4-34 Chatbot ................................................................................................................. 38
Figure 4-35 Figure 4 34 Calorie Burned Tracker ..................................................................... 39
Figure 4-36 Searching food item.............................................................................................. 39
Figure 4-37 Workout tracker interface ..................................................................................... 39
Figure 5-1 Sign up.................................................................................................................... 41
Figure 5-2 Login ...................................................................................................................... 41
Figure 5-3 Create a new account .............................................................................................. 41
Figure 5-4 Running Application............................................................................................... 42
Figure 5-5 Various food items.................................................................................................. 43
Figure 6-1 decorators.py file .................................................................................................... 49
Figure 6-2 urls.py file ............................................................................................................... 50
Figure 6-3 forms.py file ........................................................................................................... 51
Figure 6-4 manage.py file ........................................................................................................ 51

V
Tables:
Table Name Page No.

Table 1 Key for DFD diagram given above ............................................................................. 10


Table 2 Data set attributes ........................................................................................................ 23
Table 3 Exercises targeting particular muscle.......................................................................... 24
Table 4 Modules used .............................................................................................................. 40

VI
Chapter 1 INTRODUCTION

Introduction
In this chapter we will learn about the objective of our major project and the environment
used to develop our project. Here the basic frame of the project will be discussed.

As, we all our aware of the fact that our country is going under a serious pandemic and in this
situation, we are constantly being told by our administration and health workers to have a
strong immunity and be healthy. In this hour of need when all of the platforms are going
online everyone has started to work upon their health and fitness. They need to track the
constant activity of their meals and exercises so some free and accurate fitness calculators
should be provided to our people so that they can track down their meals and activities and
move a step closer towards their fitness. The calorie tracker must be able to tell the user about
every macro nutrient (e.g., proteins, carbohydrates, fats, fibre, etc.) in their meal and then let
the user decide that whether it’s healthy or not

There also occurs a main feature function nowadays “Chatbot”, many here ask the question
that what is a chatbot and what are its various functionalities, we can say that a chatbot is a
robotic version of human helper as when we go in a shop there our various workers helping
us in getting our desired stuff similarly, in a computer application a chatbot is the one who
helps you in running the application, talks about the variety of features and guides you
anywhere you’re stuck. A chatbot is created to reduce the wastage of human energy in some
basic and common queries which a lot of people have, e.g., in a shopping application query
related to delivery and return etc.

The Fitness Tracker tracks your all-daily activities and meals which shows us that how much
calories we have taken and exhausted in a day. The calorie measures should be correct and
precise in order to be a better substitute than other applications in the market. We tend to
incorporate our fitness tracker with functionalities like sleep, water intake, stress and
heartbeat measures.

So, in this project we have tried to give our most so that this can be make possible and
everyone should be able to track down their daily intake amount and quality of meals and the
calories burned during a day. We have used various data cleaning and refining processes for
our data according to our needs. Python pandas, NumPy, SciPy and other libraries are used to

1
create the data frames and to improve the accuracy of the data set. Python FuzzyWuzzy
library is used to improve the search results and to store the desired result. We have used
python module Keras [6] and TensorFlow [7] for testing and training our chatbot and nltk [5]
for making it more realistic. PythonSQL is used to manage our database and html.py, css.py
and Django are used to design, style and run the application over the server.

1.2 Objective of Automated Fitness Tracker


Automated Fitness Tracker is a utility used to calculate energy and tells the quantity of carbs,
proteins, fibres and fat in their meals and it also tells us the number of calories burned. It
facilitates the customers to track down their food and to discover what they're ingesting and
what kind of food they're ingesting, i.e., it offers the excellent and exact amount evaluation of
our food. It tells about the daily eating habits of an individual and guides them toward a
healthful lifestyle. This accurately describes the number of calories one burns during a
workout. This application is able to make the quantity analysis and to check the grade of the
food items in our meal. And by the addition of chatbot it makes people more attracted
towards this and they find it easier and more useful than the other application which have
paid subscriptions.

The knowledge of workouts and diet plans are only limited to the gym trainers, dieticians and
professional athletes and coaches but not to the public so here we decided to share this
knowledge to everyone whether they are professional or not. This is a field where nowadays
most of the youth and as well as elders are also attracted to move towards a healthy lifestyle.
By this application everyone will be able to get to know about the distribution of the macro
nutrients and the muscle tear down and recovery process to prevent any injury and bad eating
habits.

1.3 Motivation of Automated Fitness Tracker


There are already many prebuilt health calculators in the market and they are achieving a
great success but many of them have inaccurate results and the one’s having accurate results
and other premium functionalities have paid subscriptions. We want to provide our users with
a free health calculator with all the latest functionalities which give accurate results and is
easy to access so that everyone can have proper training and diet plans, and be fit and healthy
without paying unnecessarily for subscriptions to the other applications. Also, everyone

2
should be focused on their health so that we can move towards a healthy India which will
make our county grow in every sector as it says a healthy country is a developed country.

This project is completed with full devotion so that in this distress situation of COVID 19
everyone should take care of their health and be able to seek the correct food items in their
diet plan which will help them build immunity and make their body able to fight with this
disease. Many families have been ruined by this disease so we tried to contribute a little for
us all to keep a track of our daily habits and to figure out the faults in our daily diet and
workout plans. This situation made us more motivated towards our goal to provide everyone
with this project as soon as possible. We wish that our project may help everyone who desires
to use such an application and provide them with good knowledge about the food items we
should consume and the workouts we can plan for being strong and healthy enough in this
distress situation.

1.4 Language Used


Many languages had been used in the designing of this project undertaking beneath the
python work environment.

Figure 1-1 Python

Python work environment: It is a virtual environment used to create python projects by


providing them with an isolated unique space for working.

3
Python: It is a HLL (High Level Language) used for object-oriented programming. It is one
of the vastest languages aside from JAVA and have feature extraordinarily libraries and
modules which makes its code simple and clean to be comprehensible even by a layman [1].

Rest of the languages used on this undertaking are:

i. PythonSQL (Structured Query Language): SQL language for working our data set;
ii. JSON: Retrieving data for the chatbot [9];
iii. Hypertext Markup Language (HTML): Used for frontend designing;
iv. Cascading Style Sheets (CSS): Used for styling the frontend;
v. Django web framework: Helps in strolling the network application;
vi. Bootstrap: It creates the web user interface.

1.5 Technical Requirements


To run this project, one should have a machine specification of:

i. Python latest version – PyCharm 1.19 -> PyCharm 2.31


ii. Django latest modules – Django-Filters
iii. PC of RAM – 6GB
iv. Window PowerShell ISE

Whereas, there is no need of the technical hardware requirements as it is a software-based


project.

1.6 Deliverables of Automated Fitness Tracker


The project delivers an application using a web interface to reflect its output. It tells us about
our daily calorie limit, total calories consumed and calories left. Search bar for searching
different items and the total number of items consumed in a day. It also depicts the number of
calories burned by performing some specific workouts so that the user can track both the
calorie intake and calories exhausted during a day which helps in the calculation of weight
loss or gain.

4
Figure 1-2 Health tracker display

5
Chapter 2 AUTOMATED FITNESS TRACKER SDLC

2.1 Feasibility Study on Automated Fitness Tracker


There has not been just an idea of the project but some researches have also been done to
assess the success rate of this project. First of all, a basic assessment was taken to understand
the need of this project with respect to stakeholders. As, there are other advanced calculators
present too, so we need to know where does our prototype stands among them. But this
project has the potential to grow more than them in a short span of time as we have already
known on which points to focus and what improvements they need. The main objective is to
provide those upgraded functionalities to the user without paying for the huge subscriptions.

The market for this kind of product is going quite vast just because everyone is moving
towards healthy lifestyles and for that they need such applications which doesn’t cost them
much and provide with the accurate facts and results.

2.2 Requirements on Automated Fitness Tracker


2.2.1 Functional Requirements:
Here we use PyCharm community to run and edit our project requirements. Many python
libraries and modules are combined to provide a solid backend. The functions and classes are
simple to read and understand to work upon, moreover python provides us with very easy
functionalities for object-oriented programming (where we can convert our raw code to
implement real world models) for creating real-time working model [1].

The frontend is provided by html, CSS and Django written inside the PyCharm community
itself and thus, helping all the code to be written and debugged under a single platform and
not perplexing the user. Html provides with the designing of our web application whereas
CSS helps in styling our application and at last Django provides with the run-server for the
application [2].

Dataset is stored in the form of SQLlite3 and is provided with very vast items or in simple
words is a very large data set to work upon. Data cleaning and modifying is done to remove
out all the invalid data in order to increase the accuracy of the results.

The backend has been handled by various python modules such as NumPy, nltk, pandas, etc.
for creating a strong base of the project which we are deploying.

6
2.2.2 Non-Functional Requirements:
When we come to see where we can run our project, then it appears to be more satisfying that
no specific paid hardware and software requirements are required and the project can simply
run on your personal computers, tablets and laptops without any fuss. we just need to have a
PyCharm software and any windows above 7, no additional system requirements are
necessary.

Our project can be linked with the hardware such as smart watches and smart bands to track
the activity of our project but this is beyond the scope of this current project.

2.3 Use Case Diagram of Automated Fitness Tracker


Use cases are used to depict the application in the form of diagrams to be able to understand
the working of project very easily and effectively.

1. Use Case for User:

This use case diagram is depicting the user privileges in our project. As we can see
there are various functionalities available for the user and can be used very easily.

Figure 2-1Web Application Use Case Diagram of User

7
2. Use Case for Admin:

This use case diagram is depicting the admin privileges in our project. There are many
functionalities for the admin and these cannot be handled carelessly.

Figure 2-2 Web Application Use Case Diagram of Admin

3. Data set use case diagram:


This use case diagram is for the data set and training of our model. This is depicting
the true process of our data refining and training of our model. The diagram depicts
the flow of the data cleaning and model training.

Figure 2-3 Data Use Case Diagram of automated calorie calculation

8
▪ Firstly, the data set should be cleaned and a refined data set should be formed
▪ Searching happens now in the refined data set.
▪ Then comes the test data extraction and traversing.
▪ The next step is to train the model which is fulfilled easily by the Django framework.
▪ Then queries are updated and data is manipulated
▪ And at last, the result is shown.

2.4 DFD Diagram of Automated Fitness Tracker


DFD (Data Flow Diagrams) are used to depict the flow of the data in a given project i.e., to
check how the data will be handled under the project and what the flaws should be.

In the figure given below we learn that:

i. We have two login interfaces one for the user and other for the admin.
ii. And there is another option for users to create new accounts
iii. The password checking process takes place and then the next panel is opened if
password is correct and if incorrect, they are reverted back to the login page to try
again.
iv. After that admin and user functionalities are shown in which they can edit their
database, operate the chatbot, calculate calories and perform other functions.
v. After that result is shown on the screen and then we can log out.

9
Figure 2-4 DFD Diagram for automated calorie calculation

Table 1 Key for DFD diagram given above

SNo. Shape Operation


1. It depicts the starting point.

2. It tells us about the various processes.

3. It is used to check the conditions.

4. These shows the state transitions.

5. It depicts the termination.

6. It tells about the loop limit.

7. It tells us about the database.

8. It tells us about the input data.

10
2.5 State Transition Diagram of Automated Fitness Tracker
There are eight states in our program as depicted below, one start state q0, six intermediate
states (q1, q2, q3, q4, q5, q6, q7, q8) and at last one final state qf.

q0-> Initial stage is the start state;

q1-> Login state; q2-> Admin privileges; q3-> Edit database; q4->chatbot

functionalities; q5-> User privileges; q6-> Calorie calculation; q7-> Chatbot experience; q8-
>Output;

qf-> Final state is the end state.

Figure 2-5 State Transition Diagram for automated calorie calculation

11
Chapter 3 LITERATURE SURVEY

3.1 HealthifyMe Android Application


Author: CEO Tushar Vashisht, Mathew Cherian, Sachin Shenoy

Publication: HealthifyMe

Figure 3-1 HealthifyMe app photo

About:

• HealthifyMe is a health calculator for calculating calories and it also provides


personal trainers and coaches for dieting and workout plans. It is developed for
Android and iOS platforms.
• These premium features of personal trainers and plans are only for the members with
its subscription. It also provides various paid therapies by the world’s best therapists
and trainers,
• It also provides with an AI- driven nutritionist Ria for assistance.
• It syncs our footsteps and calorie expenditure via fitness bands and phone sensors
also.
• It also provides us with medals and other functionalities if we achieve some
milestones for boosting the confidence of an individual and making him strive harder
for the more success.
• Nowadays it is also providing tracking of sleep, water, oxygen level, heartbeat, etc.
using your mobile phones fingerprint sensors and various health bands.

12
• It also tracks workouts like running, swimming, bicycling, strength training and
durability training exercises, etc...

3.2 JEFIT Android Application:


Author: CEO Ying Len

Publication: JEFIT app

Figure 3-2 JEFIT Application

Figure 3-3 JEFIT interface

13
About:

• It helps one to track out their workouts easily and effectively.


• Here we can track our workout with the best options like the amount of time a
workout is performed, the number of sets and repetition in a particular workout,
etc…
• It gives a full graph analysis of our daily, weekly and monthly workouts which
tells us the number of calories burned, our highest weight repetition and lowest
weight repetition the amount of time in performing a particular exercise.
• It also has videos attached with particular exercises which helps us in performing
an exercise accurately without any injury.
• Its visual representations help user identify the muscle breakdown and growth in a
particular week.
• It also depicts the total amount of time required for the recovery of a particular
muscle.

3.3 The Smart Kitchen Concept


Author: P. Chi, J. Chen, H. Chu and J. Lo

Publication: Lecture Notes in Computer Science, vol 5033. Springer, Berlin, Heidelberg

Figure 3-4 Smart kitchen

14
About:

• It was created as a concept of health calculators but they tried to do some invention
getting them a huge success. This concept was one of a exciting features in Japan,
China, USA and many more developed countries as it helped almost everyone in
finding the proper amount of nutrition in their diets, even those who didn’t knew
cooking and ate ready to eat food only are now cooking their diet themselves with the
help of this smart kitchen concept.
• The nutrition in daily dietary is targeted here. The simpler concept was to find out the
healthy way in cooking good meals. They focused on AI technologies, sensors and
other equipment’s in order to find out the nutritional value of the item just by
weighing and screening it.
• It is focused on the nutritional value of the ingredients used in the meal. It focuses in
providing more healthy fats, proteins and fibres with an adequate amount of
carbohydrates to support the energy expenditure.
• The development of Ubi Comp technology to find out the proper nutritional values of
the food items and accordingly calculate the calorie of each different meals we
prepare instead of following the traditional way of common caloric parameters on the
internet.
• Kitchen sensors are used to track the number of calories in food ingredients, and then
providing real-time feedback to users on these values through an awareness display by
which they can find out that how much amount is required for their desired calorie
meal.
• It is most suitable for the sportspersons and gym lovers who love to cook their meal
themselves as they don’t need to worry about proteins, fibers, sodium, good and bad
fats, carbohydrates and other nutritional values in their meal to have great growth.
• This also focus on people struggling in weight loss, obesity, diabetes, thyroid and
other health related issues as they can now have the proper nutritional values in their
diet which will help them in fighting against such diseases.
• The result of this study suggests that bringing calorie awareness can be an effective
means in helping family cooks maintain the healthy level of calories in their prepared
meals.

15
3.4 CalculNutri Project
Author: Thierry Maillard (IT) and Perrine Maillard (Dietician)

Publication: Journal of Food and Search 7(1):33-40

Figure 3-5 Nutritional score table

Figure 3-6 Nutrition analysis

16
About:

• CalculNutri is a food Calculator based on official food composition tables: CIQUAL


2017 and USDA SR 28.
• It targets the users which want to make their own recipe's and those who want to
found out the nutritional value of their food.
• Using a simple and easy graphical user interface it can be used by highly qualified
dieticians as well as by small children above 12 years of age.
• Custom tables and specific unit conversions are used to get through new portions.
• It is able to track the nutritional value of food given to patients.

3.5 The Caloric Calculator


Author: Y. Claire Wang, Amber Hasiao, C. Tracy Orleans, Steven L. Gortmaker

Publication: American Journal of Preventive Medicine

About:

• Obesity in small children is increasing more often as their calorie intake is more as
compared to their calorie expenditure. Also, the quality of calories they intake is not
balanced as they take more fats, carbohydrates and focus less on the other nutritional
components of food. Binge eating is also a major problem among youngsters that
should be treated well and before an outburst of obese epidemic.

17
• In this report the authors are quite determined in finding an Average Caloric Impact
(ACI), which would serve as a common parameter to map out the calories needs and
intake among youngsters.
• The literature was reviewed from 1996 to 2012 and various parameters were found
out about the young health such as their diets, energy expenditure, activity levels and
weight.
• The ACIs were calculated based on the intensity, frequency duration and average
body weight of a group of a particular age and gender from the 2009-2010 National
Health and Nutrition Examination Survey.
• The Caloric Calculator was later on invented to be able to estimate the ACIs of
specific target groups by taking care of the energy gap reductions required to reach
the Healthy Populations childhood obesity.
• The Caloric Calculator was successful as it used the most common metric unit ACI
and it emerged as a guiding pathway for the modernized calculators.

18
Chapter 4 IMPLEMENTATION OF THE MINOR PROJECT

4.1 Data Set Used in the Automated Fitness Tracker


• Data Set used in this project is taken from the World Food Programme (WFP), it is a
vast dataset of nutrition composition of various food items. This dataset initially
comprised of many nutrition components which can be merged with major nutrients
like carbohydrates, proteins, sugars, fats and fibres for calories calculation. No doubt
all nutrient components are responsible to provide a healthy lifestyle but when it
comes to burn and count the calories, then only some of these major nutrient
components are required.
• We also converted most of this information in the JSON format for the use of our
chatbot.
• Dataset used for exercises have been taken from the Manitoba government physical
health education and it comprises of 650 of total exercises. This data is refined and
cleaned by using various python tools and packages for being able to be used by us
for our calorie burned tracker.

Figure -4-1 Database in CSV format (1)

19
Figure 4-2 Database in CSV format (2)

Figure 4-3 Exercise dataset in csv format

4.1.1 Data Cleaning

i. Removing Useless Irrelevant Data: This is the first approach of moving towards a
refined data set. The removal of irrelevant values such as other minor nutrient
components (like chlorine, phosphorous, potassium, etc.) which are not required in
counting calories. And the removal of joints, modality which were not necessary in the
scope of this current project were removed.

ii. Removing Duplicating Values: The duplicating values in our dataset has been
removed by using pandas [3] module drop_duplicates () and other functionalities. The
result is a more refined dataset.

20
iii. Avoiding Typos and Converting Data Types: These can be cleared using various
algorithms and functionalities. Uniformity in the data types is on focus here and to do
the same data types should remain same and specific data types shouldn’t be changed.

iv. Editing Missing Values: All the missing values are changed and converted here. It has
been done manually and by removing null values using various functionalities and
many other algorithms. Also, the calorie burned were also precisely added in the file
which has been checked from the JEFIT android application database.

Figure 4-4 Processing backend view

This is the newly refined and cleaned dataset of our food items which is used in the current
project.

Figure 4-5 Cleaned Dataset

21
This is the newly refined and cleaned dataset of exercises which is used for the current
project.

Figure 4-6 Cleaned exercise dataset

4.2 Data Set Features


This data set is used for calculating the original major nutrient value of an edible item
through which we are able to find about the calories (in Kcal).

4.2.1 Types of Data Set


Here there are different datasets for different functions:

i. Dataset of food items: Main dataset used for calculation and display
ii. Dataset of exercises: Dataset used for calculating calories burned and display
iii. Tables of customer_ids: Store ids of customers
iv. Tables of superuser_ids: Store ids of admins
v. JSON file data of chatbot

22
Figure 4-7 JSON data format

4.2.2 Number of Attributes, Field, Description of dataset


There are several datasets in our project but for:

I. the chatbot and calorie calculation the dataset attributes used are provided by 7
columns starting with:
i. Id number;
ii. Name of the item;
iii. Amount of fat in the given item;
iv. Amount of carbohydrate in the given item;
v. Amount of protein in the given item;
vi. Amount of fibre in the given item;
vii. And at last, the calculated calories of the given item.

Table 2 Data set attributes

SNo. Name Fats Carbohydrates Protein Fibres Calories


1. Cheese 12.0 30.0 10.0 20.0 150

2. Pork 45.0 150.0 25.2 32.4 220

3. Bread 15.0 70.0 2.5 30.4 70


4. Butter 55.0 120.54 1.5 4.9 140

5. Milk 25.0 100.89 5.6 0.5 90

6. Chocolate 59.6 147.7 6.1 8.2 150

7. Rice 32.4 97.6 3.5 20.6 125

23
II. The workout tracker and calorie burned calculator provided by 7 columns starting
with:
i. Id number;
ii. Muscle Group;
iii. Exercise;
iv. Level;
v. U/L/C;
vi. Push/Pull;
vii. Calories.

Table 3 Exercises targeting particular muscle

SNo. Muscle Group Exercise Level U/L/C Push/Pull Calories


1. Abdominals-Lower Full Advanced Core Push 45
Reverse
Crunch
2. Abdominals - Decline Advanced Core Push 35
Obliques Sit-Up w/
Twist
3. Back - Latissimus Assisted Beginner Upper Pull 26
Dorsi Pull-Up
4. Back - Bent-Over Intermediate Upper Pull 56
Lat.Dorsi/Rhomboids Dumbbell
Row
5. Biceps Alternating Advanced Upper Pull 60
Dumbbell
Curl
6. Chest - Pectoralis Alternating Intermediate Upper Push 70
Dumbbell
Bench
Press
7. Legs - Quadriceps Lateral Advanced Lower Push 65
Barbell
Step-Up
8. Shoulders- Pec Deck Beginner Upper Push 46
Delts/Traps Real Delt
Extensions
9. Triceps Triceps Advanced Upper Push 44
Pushdown

24
4.3 Design of the problem statement
The idea is to create a fully develop application to calculate calories eaten and burned with a
built-in chatbot but for now a highly functional prototype is ready to be deployed. The main
focus is to check the speed and accuracy of the calculator and the chatbot. It is created in such
a way that we can keep a track of our every meal and also calculate the number of calories
burned in a day and to find the details of our every meal using the chatbot. It is designed in
such a way that it should be capable of adjusting and training itself to the likes of our user.

4.4 Algorithm/ Pseudo code of the Automated Fitness Tracker


4.4.1 Algorithm:

Figure 4-8 Algorithm of the given project

4.4.2 Pseudo Code:


▪ The user/ admin will login or sign in the application.
▪ Or they can create a new account.
▪ Passwords will be checked and then the application will be proceeded further.
▪ Then the user privileges and admin privileges can be provoked.

25
▪ The output will be shown.
▪ Then they can exit the application.

4.5 Flow Graph of the Automated Fitness Tracker

Figure 4-9 Flow graph of the project problem

▪ We enter the server created through the Django module of the python and then we use
that to create and run our application on the server provided by the Django [2].
▪ The user log themselves in or create a new account and then they use the applications
functionalities independently and based on what they can access.
▪ In the end the results are displayed on the output screen and then user exits the
application, at this point he can either use the application again or can exit the
application server.

26
4.6 About Chatbot
A chatbot is an application used to conduct a communication with a client via an online
platform in order to provide him with the help he seeks and sort out the other functionalities
for him similarly to a live human agent.

The idea to deploy chatbot into our application came up with the modernization of the society
and the increase in new technologies in the market. So, to keep our project in competition
with the other projects we have to deploy such technologies in our project. We have kept in
mind the compatibility of our project in with upcoming technologies so that our project
doesn’t fade away. With the help of chatbot now it is simpler and easier to find out the flaws
and suggestions for our applications.

Figure 4-10 Chatbot hello

4.6.1 Libraries used in our chatbot


1. NLTK: It is called Natural Language toolkit, it us used to process Natural language
and give us the desired output. It helps in preprocessing the natural language data into
useful terms for the chatbot.

27
2. Keras: It evaluated our model and helped in developing the training and testing
models of our project using tensor flow applications.
3. Pickle: The pickle library in python is used to convert the python object into stream
of bytes and store it in file. It is used for storing the multiple python objects.
4. NumPy: It is a python library which is used to perform operation on various entities
like n- dimensional arrays and matrices. It is used to perform multiple numerical and
other tests over our models.
5. JSON: JSON library in python is used to connect are code to JSON file which helps
fetch, manipulate data from the file. In JSON format we have converted our data so
that the chatbot can convert the data more accurately and quickly. It is easy to locate
data while it is in the JSON format instead of looking into a key and then retrieving
data from there.
6. Tkinter: Tkinter is a GUI for python projects. It is used to create a dialog box for
chatbot that display the conversation between user and the chatbot.

4.6.2 Working of the chatbot


1. To open chatbot firstly click on the green chatbot button this is below search
button.
2. Now separate Tkinter window appears that is split into two parts
a. Upper part of dialog box is used to display our message and how chatbot
responds to it.
b. The lower part is used by user to write his/her message along with send
button.
3. Now the user types his/her message i.e., name of food item and clicks send button
4. Now the chatbot takes users request it searches users requests through tags in
JSON file and gives out the appropriate response i.e., Nutritional values of food
item written by user

28
4.6.3 Algorithm/ Pseudo code for the Chatbot

➢ Algorithm:

Figure 4-11 Algorithm for chatbot

➢ Pseudo Code:
8. Greet the user.
9. Read the query of user and accordingly perform analysis.
10. If he wants to know about the functionalities tell him about all of them.
11. If he wants to know about the ingredients of a food item read it carefully and perform
analysis.
12. Return result

4.7 Screen shots of the various stages of Automated Fitness Tracker


4.7.1 Data Cleaning and increasing accuracy:
Here we’ve used python pandas and NumPy module for cleaning the data by using
various algorithms and functionalities to remove null values and other irrelevant data
[5].
Data cleaning process is a huge process where we have to find every flaw in our data
and clean it with the help of various methods provided by the python environment and

29
the pandas module. After cleaning we have to reduce the redundancy to increase the
processing speed of our data.

Figure 4-12 Data Cleaning and using Fuzzy Wuzzy Code (1)

For increasing accuracy, we use the FuzzyWuzzy module which helps us in


increasing the searching speed and provide us with more accurate results with the help
of its various functionalities [4].

Figure 4-13 Data Cleaning and using Fuzzy Wuzzy Code (2)

30
❖ Output of the above provided snippets:

Figure 4-14 Output of the existing data set

Figure 4-15 Backend output of FuzzyWuzzy module

Figure 4-16 Data representation of exercise dataset

31
Figure 4-17 Graphical Data Representation

4.7.2 Designing of the web application:

It is done under various steps by creating various designs individually for new pages
for example: login page, signup page, main home screen, search screen, etc. under the
folder name templates in the python project environment. CSS and Django bootstrap
is used in the beautifying and styling of the html pages [2].

Figure 4-18 Login page design in HTML

32
Figure 4-19 Registering account design in HTML
❖ Output of the above provided snippet:

Figure 4-22 Figure 4 19 Sign in page display Figure 4-21 Figure 4 20 Login page display

Figure 4-20 Creating account

4.7.3 Training Model:


The training of the web model is put on work here with the help of the Django which
makes it very easier because of its flexible toolkits which helps in training the real-
time models very efficiently [2].

Figure 4-23 Training models backend

33
4.7.4 Deploying the real-time model:
By starting the manage.py file on windows PowerShell we will be able to see all the
functionalities of our project and by running the py.runserver command the server will

Figure 4-24 py.manage file

load up on which the application will run and then we can use our application [1].

Figure 4-25 models.py file

34
Figure 4-26 decoators.py file

Figure 4-27 view.py file

35
Figure 4-28 PowerShell working

4.7.5 Running Application snippets:

Figure 4-29 Main page (i)

Figure 4-30 Main page (ii)

36
Figure 4-31 Nutrition Table (i)

Figure 4-32 Nutrition Table (ii)

37
Figure 4-33 Addition of meals

Figure 4-34 Chatbot

38
Figure 4-36 Searching food item

Figure 4-35 Figure 4 34 Calorie Burned Tracker

Figure 4-37 Workout tracker interface

39
4.8 Major Modules used in this Automated Fitness Tracker

Table 4 Modules used

SNo Name of the Definition


module

1. Pandas This python module is very efficient module for data science as it
helps in creating, editing and deleting huge databases very easily.
Data frames are created so that the whole database isn’t altered
under the processing. Its vast functionalities and database editing
powers are very helpful in refining and cleaning the data. It helps in
cleaning a huge set of databases in no time [3].

2. NumPy It is a python module used to do mathematical calculation and helps


in removing irrelevant data with its vast set of functionalities. It
helps in easy manipulation of the data set [5].

3. FuzzyWuzzy: This python module helps in speedy diagnose of the dataset and
provide with more efficient results [4].
4. Django It is a high-level web framework provided to create online web
Framework: applications without any fuss and provides us with excellent python
functionalities [2].
5. NLTK It is called Natural Language toolkit. It helps applications to work
with natural processing languages. It uses the concept of
. tokenization (in which we divide our data into tokens and then get
information about it), classification, etc. [6].
6. Keras It is used for developing and evaluating deep learning models and
performs as an interface for artificial neural networks [7].

7. TensorFlow It is widely used in artificial intelligence and deep learning concepts


as it performs classification, perception, understanding, discovering,
prediction and creation. It performs fast numerical computations
[8].
8. Pickle The pickle library in python is used to convert the python object
into stream of bytes and store it in file. It is used for storing the
multiple python objects [9].

9. JSON JSON library in python is used to connect are code to JSON file
which helps fetch, manipulate data from the file. It holds the power
of conversion of objects into strings. It is very much similar to
dictionary data type but it browses data more quickly and
conventionally [10].
10. Tkinter Tkinter provides a wide variety of functionalities for developing
Graphical User Interface for python projects. It is very simple and
faster way to create a GUI in python [11].
11. Random It is used to generate random seeds which our used in our train and
test models in order to gather more information and improve the
accuracy of our resulting models [12].

40
Chapter 5 CONCLUSIONS

5.1 Discussions on the results achieved


5.1.1 Login Page:
This is our login page; in this you need to enter your details such as username and password
if you don’t have one you need to click on below register button to open the new user
registration page in this you need to enter following details:

1. Your unique username


2. And then you need to enter your email id
3. And at last, enter your 8-digit password
4. Then click on register now button to create your account’
5. Now you will receive a message on your screen that you have successfully created
your account.
6. Again, you will see a login page now enter your username and password and you will
be logged into our web application.

Figure 5-1 Login Figure 5-2 Sign up

Figure 5-3 Create a new account

41
5.1.2 Web Application:
1. Now once you have logged in you will see our web application been launched.
2. Now you will see various list of food items below like apple,
3. Mango, Banana and various other things along with that you will find the fat, calories,
proteins and carbohydrate composition on right side of name of food items
4. Above the food composition table, you will find the search button through which you
can search your food item and select the item. Now you will see once you have
selected required food item you will see that the selected food item is displayed in the
tracker now as an average human consumes 2000 calories so are tracker keeps the
count of calories you have consumed and the item you have eaten in a day which
helps one to follow a healthy routine by keeping track of fats, proteins and
carbohydrate that one consumes in a day.
5. Now there this a add items button below the tracker table that helps you to add more
items in your daily calorie calculator tracker and automatically updates the total
calorie consumption.
6. A green chatbot button will open the chatbot window through which we can start our
conversation with the chatbot. Here we can find out how to use our application and
can ask about all the ingredients of any particular items instead of searching it in the
whole database. Also, it tells us whether the item is healthy or not.

Figure 5-4 Running Application

42
Figure 5-5 Various food items

7. When we go to track our calories, we have to enter the following details:


• Name of user
• Summary of what user has done in his entire day like type exercises user has done,
type diet user has taken etc.
• Third option is exercises user has done in his entire day.
• We have to select the date and then select the workout plan accordingly.

5.2 Machine learning algorithm used in Chatbot:


By creating our chatbot we got know a lot about the supervised and unsupervised machine
learning algorithms. The learning process of a chatbot is based on learning a lot by Natural
Language Processing (NLP) of the input we give to it.

Figure 5-6 graph of chatbot application use in various sectors over time

43
Chatbot is the new future of our society as it will surely takes upon the unnecessary work
burden over the helping desks of many MNCs and many online shopping applications like
flipkart, amazon, etc. but it is also being used in various other applications such as health
calculators, social media platforms, Spotify, android and iOS systems etc.

Thus, the use of these robotic helping hands in the market is increasing nowadays with an
annual growth rate of 24.3% according to the Grand View Research report. This also means
that the updated and more modern chatbots are much in need which can be made from
artificial intelligence and by applying machine learning algorithms over the training models
of such chatbots to provide us with some superb models.

Chatbot are made from a more sophisticated branch of machine learning which is based on
artificial neural networks, which replicates working of the human brain. We use many types
of architectures here like Deep Neural Network, Deep belief Network and Recurrent.

5.3 Application of Automated Fitness Tracker


1. Now during this time of Covid crisis as everyone is concerned about their health
calorie calculator can come in very handy as everyone can keep track of their
proteins, fats etc.
2. Now as many food apps are now concerned about their customers health, they can
implement a health tracker so that as person can keep track of what person orders.
3. Calorie calculator comes handy for a gym person so that he knows how much calories
he needs to consume and how much he needs to burn.
4. Calorie calculator can come in use for a ill person as he can know the items to eat
with good health benefits.
5. Calorie calculator users can check their food consumption according to their taste, age
etc. and keep a daily monitor of it.
6. It helps in finding workouts of professional athletes, coaches and trainers without
paying for any subscription.
7. User gets perfect workout plans and are able to perform such exercises without any
injury.

44
5.4 Limitations of Automated Fitness Tracker
1. Calorie calculator doesn’t work on cooked food and that is major drawback of calorie
calculator for e.g., everyone has their own style and ingredients of making sandwich
which results in different composition of fats, proteins, carbohydrates etc.
2. Calorie calculator being a web application one needs to have a proper internet
connection to access the calorie calculator.
3. As the fat, protein of various things depends on the quantity and quality of product
used which can lead to more far approximations so that’s the major drawback of
calorie calculator.
4. As, it is under development process so there are many bugs which are needed to be
fixed causing disrupt in smooth running of the application.

5.5 Future of Automated Fitness Tracker


1. Calorie calculator can be improvised with a SMS alarm system which can give a
person alert if he exceeds his daily calorie limit.
2. Calorie calculator can have a different gym section in which a gym going person
can maintain his logs and can find out how much progress they are making.
3. Calorie calculator can be real time health tracker which can be upgraded so that
person can input his health conditions and our app can suggest him items that can
help him improve his health.
4. Calorie calculator can be modified with a calorie burn feature that suggest
exercises according to calories person want to burn.

45
REFERENCES

1. Websites:

[1] S. Yegulalp, "What is Python? Powerful, intuitive programming", InfoWorld,


2022. [Online]. Available: https://www.infoworld.com/article/3204016/what-is-
python-powerful-intuitive-programming.html. [Accessed: 15- May- 2022].

[2] "Django introduction - Learn web development | MDN", Developer.mozilla.org,


2022. [Online]. Available: https://developer.mozilla.org/en-
US/docs/Learn/Server-side/Django/Introduction. [Accessed: 15- May- 2022].

[3] "A Brief Introduction to Pandas", mygreatlearning.com, 2022. [Online].


Available: https://www.mygreatlearning.com/blog/python-pandas-tutorial/.
[Accessed: 15- May- 2022].

[4] "Fuzzy String Matching in Python", Medium, 2022. [Online]. Available:


https://towardsdatascience.com/fuzzy-string-matching-in-python-68f240d910fe.
[Accessed: 15- May- 2022].

[5] “Array programming with NumPy”, Harris, C. R., 2020. [Online]. Available:
https://www.nature.com/articles/s41586-020-2649-2. [Accessed: 15- May- 2022].

[6] “Introduction to Deep Learning with Keras - Towards Data Science”, Tanner, G.,
2019 [Online]. Available: https://towardsdatascience.com/introduction-to-deep-
learning-with-keras-17c09e4f0eb2. [Accessed: 15- May- 2022].

[7] “What is TensorFlow? The machine learning library explained”, Yegulalp, S.,
2019[Online]. Available: https://www.infoworld.com/article/3278008/what-is-
tensorflow-the-machine-learning-library-explained.html. [Accessed: 15- May-
2022].

46
[8] “Understanding Python Pickling with example”, GeeksforGeeks, 2019[Online].
Available: https://www.geeksforgeeks.org/understanding-python-pickling-
example/. [Accessed: 15- May- 2022].

[9] “NLTK: A Beginners Hands-on Guide to Natural Language Processing”,


Analytics Vidhya M, S., 2021[Online]. Available:
https://www.analyticsvidhya.com/blog/2021/07/nltk-a-beginners-hands-on-guide-
to-natural-language-processing/. [Accessed: 15- May- 2022].

2) Journals:

[1] R. Bierbrier, V. Lo and R. Wu, "Evaluation of the Accuracy of Smartphone


Medical Calculation Apps", Journal of Medical Internet Research, vol. 16, no. 2,
p. e32, 2014. Available: 10.2196/jmir.3062.

[2] S. Dorman, "Web-Based Health Calculators", Journal of School Health, vol. 71,
no. 10, pp. 500-501, 2001. Available: 10.1111/j.1746-1561. 2001.tb07291. x.

3) Articles:

[1] “How to handle JSON in Python? - Towards Data Science”, Prabhu, T. N., 2020
[Online]. Available: https://towardsdatascience.com/how-to-handle-json-in-
python-d877125df39b. [Accessed: 15- May- 2022].

[2] “Python GUI – tkinter”, GeeksforGeeks, 2020[Online]. Available:


https://www.geeksforgeeks.org/python-gui-tkinter/. [Accessed: 15- May- 2022].

[3] “Python Random Module”, GeeksforGeeks, 2021[Online]. Available:


https://www.geeksforgeeks.org/python-random-module/. [Accessed: 15- May-
2022].

47
[4] "Chatbot Market Size Worth $2,485.7 Million By
2028", Grandviewresearch.com, 2022. [Online]. Available:
https://www.grandviewresearch.com/press-release/global-chatbot-market.
[Accessed: 15- May- 2022].

4) Datasets:

[1] "World Food Programme", wfp.org, 2022. [Online]. Available:


https://data.humdata.org/organization/wfp. [Accessed: 15- May- 2022].

[2] "Physical Education/Health Education | Manitoba Education and Early


Childhood Learning", Edu.gov.mb.ca, 2022. [Online]. Available:
https://www.edu.gov.mb.ca/k12/cur/physhlth/. [Accessed: 15- May- 2022].

48
APPENDICES
SOURCE CODE SNIPPETS:

Figure 0-1 decorators.py file

49
Figure 0-2 urls.py file

50
Figure 0-3 forms.py file

Figure 0-4 manage.py file

51

You might also like