System for Calculating and Managing Kilocalories Consumed and
Spent through Various Domestic, Physical and Sports Activities
Rui Claudino, Pedro Passos and Gonçalo Mendonça
Human Kinetics Faculty, University of Lisbon, Estrada da Costa, 1499, 002 Cruz Quebrada, Dafundo, Portugal
Keywords: Consumption, Energy Expenditure, Food Composition, Motor Activity, Body Mass, Information System,
Responsive Webapp, Single-Page-Application, MVC Framework Pattern.
Abstract: In times like the ones we are experiencing in the present year of 2020, motor activity is limited, predisposing
to sedentary lifestyle and the imbalance between caloric consumption / energy expenditure, favoring the
obesogenic phenomenon. To alleviate these circumstances, each individual must be able to obtain information
on energy intake and energy expenditure on a daily basis, to control the caloric value of each meal and
determine the daily energy expenditure of motor activity. The information on the caloric value of foods can
be obtained from the food composition table (Regulation - EU, no. 1669/2011). Information on the caloric
expenditure of motor activities is also characterized (Ainsworth, Haskell, Herrmann, Meckes, Bassett, Tudor-
Locke et al., 2011). It is only necessary to consider the duration of activities and body mass. To obtain these
values and establish, in real time, a comparison between the energy intake and the energy expenditure, we
created a system, represented by a responsive WebApp, with the possibility of being accessed by several
devices, as well as tablets and mobile phones. The WebApp uses Ajax, jQuery, PHP, SQL and JSON
technologies and a MySQL database. The system also includes a backend, supported by a proprietary Model-
View-Controller framework, for parameterization.
1 INTRODUCTION
In times of recollection, as we experience today, our
motor activity is quite limited, due to the confinement
of the small dwelling spaces where we live in. These
constraints make us more sedentary, with all the
resulting consequences related to the health and well-
being of each one of us.
In parallel with the decrease of daily physical
activity, we maintained (in some cases, even
increased) daily food consumption, which affects the
caloric consumption / energy expenditure balance.
This behavior may have undesirable consequences
for health, individual well-being and overall quality
of life. Last instance it is a driven force linked to the
obesogenic factor.
One way to alleviate the previous problems would
be to obtain information on daily food consumption
and, in parallel, obtain information on energy
expenditure through motor activities of a domestic
nature, physical activity practices, or even sports
practices, that each of us perform during the day.
This information can help to control the caloric
food consumption of each single meal and help to
translate that into daily energy expenditure associated
with the different daily activities. Thus, allowing each
one to decide what to eat and what to engage with
motor, physical and sports activities.
The information on caloric consumption can be
obtained by calculating the kilocalories existing in the
most varied foods, multiplying it by the amount
consumed, using solid and / or liquid volume units.
The information on energy expenditure is obtained by
calculating the kilocalories resulting from the
expenditure of metabolic units per minute, for several
motor, physical and sports activities, already
characterized at this level (Ainsworth, Haskell,
Herrmann, Meckes, Bassett, Tudor -Locke et al.,
2011). For these activities, the total caloric
expenditure will be calculated by multiplying the
referred values by the duration of each motor activity,
taking into account the individual body mass.
As there is not an easy and accessible way to
obtain these values and establish, in real time, a
comparison between energy input and expenditure,
we decided to create an information system to support
the process of collecting, storing, calculating,
presenting and comparing the results. This makes it
152
Claudino, R., Passos, P. and Mendonça, G.
System for Calculating and Managing Kilocalories Consumed and Spent through Various Domestic, Physical and Sports Activities.
DOI: 10.5220/0010112101520155
In Proceedings of the 8th International Conference on Sport Sciences Research and Technology Support (icSPORTS 2020), pages 152-155
ISBN: 978-989-758-481-7
Copyright
c
2020 by SCITEPRESS Science and Technology Publications, Lda. All rights reserved
possible not only to obtain the data, but also to
manage the information and use it to make final
decisions about which foods to eat and what motor
tasks to perform.
In order to operationalize this system and allow it
to go into production, a frontend was developed,
represented by a Web application, specifically a
WebApp, supported by a responsive single-page
application (SPA). This feature allows access to both
a desktop computer and a laptop, as well as mobile
devices such as tablets and mobile phones. The
WebApp uses Ajax technology, combined with the
jQuery JavaScript library, the PHP programming
language, the SQL language, to query the database
and objects in JSON format, for interoperability
between the database and the HTML markup
language.
The system also includes a backend component,
for the corresponding management and
administration. The implementation of this
component was made using a proprietary framework,
supported by a Model-View-Controller (MVC)
pattern, which was assigned the name Agon and
where the entire system is parameterized. To support
the two components of the system, a MySQL
database was created where all foods were inserted,
as well as physical and sport activities, in the
respective data model tables, defined for this purpose.
Bearing in mind that the system is intended to
reach the largest number of users, it offers the
possibility to use both Portuguese and English
languages, depending on the user preference.
Currently, the system does not yet allow several
meals per multiple days to be saved. In the future it
will be necessary to create a feature to register users
and allow them to access their reserved areas. At this
point, we expect the users to be able to keep a record
of the energy supply, as well as the caloric
expenditure and therefore monitor the respective
evolution, during the intervals of time they consider
necessary. To make the system even more
international and global, more languages are expected
to be included further on.
2 METHODOLOGY
2.1 Variables
To calculate the caloric intake, the nutritional
information of each food was used, as defined in the
table of food composition, according to the EU,
Regulation N.º 1669/2011. For each 100 g or 100 ml,
this table characterizes food using, all together 40
constituent elements, including the energy value
expressed in terms of calories.
For the calculation of energy expenditure, we are
using the codes and metabolic units (MET) indicated
by Ainsworth, Haskell, Herrmann, Meckes, Bassett,
Tudor-Locke, et al (2011), as established for motor,
physical and sports activities. For a personalized
energy expenditure, the authors also refer the need to
take into account not only body mass (BM), but also
the total duration (TD) of the activity in minutes.
2.2 Processing of Food Data
Processing of food data. Through the WebApp
frontend component, each user can choose the foods
ingested or to be ingested, from a total of one
thousand and one hundred and forty-six (1146)
possible foods, previously saved in a MySQL
database.
For this, the user must press the button to add the
food and following that a form will appear, as a
modal. Then the user must enter in the search field at
least the two initial characters of the desired food.
When executing this operation, the system triggers
the well-known typeahead functionality, showing in
the next field of the form, a list, with all the food
options registered in the database that begins with the
characters typed or that are being typed. For this to
happen in real time, the WebApp uses Ajax
technology, combined with the jQuery JavaScript
library, the PHP programming language, the SQL
language, to query the database, and objects in JSON
format, to exchange the data between the database
and the HTML markup language. From the presented
list of foods, the user selects only one.
The following field is numerical and is intended
to be filled by the user with the amount consumed of
the previously selected food.
The final field must be filled with the type of
measurement unit used in the previous field. Here, the
user has the possibility to choose between grams,
kilograms, liters, deciliters and milliliters, by
selecting the corresponding radio button.
To register the data associated with the selected
food, the user must submit the form by pressing the
'add' button and thus sending the data to the database.
With this operation, a food is added to the database
table associated with the user.
After submitting the form, a data table is
presented on the same screen, with the associated
records of the submitted data and also with the energy
value of the chosen food, calculated accordingly to
the amount eaten and presented in the form of
calories.
System for Calculating and Managing Kilocalories Consumed and Spent through Various Domestic, Physical and Sports Activities
153
For each submission of a new food, a line is
added. As soon as this data table has two or more
rows, the total calories consumed is calculated and
displayed at the bottom of the data table in question.
If the user finds that he does not want to consider one
of the records, he has submitted, he can delete it, by
simply choosing the corresponding food button which
is located at the last column of the data table. He can
also delete all food records to calculate a new meal
and related calories.
2.3 Processing of Physical Activity
Data
To determine the energy expenditure associated with
motor, physical and sports activities, the user
proceeds in a similar way as he did previously for
food. However, the user will have to select the
activities option at the menu to use the corresponding
features.
As soon as the user enters this part of the
WebApp, for the first time, the system detects that he
has not yet indicated the respective body mass and
requests the necessary information. For that purpose,
he is going to use a form with a single field, which
appears again as a modal. Right after the form
submission, the body mass value is stored in a session
variable created when the user accessed the WebApp.
The body mass value remains stored in this session
variable until the user leaves the WebApp, closes the
browser or intentionally changes the body mass
value, using the same procedure.
After this first procedure, the user can choose one
of the activities, previously introduced in the
databases.
Here, the procedures are very similar to food
registration, but much simpler and less technically
demanding.
Thus, to register an activity already performed or
to be performed, the user needs to press the button to
add the activity. A form will appear again, but with
only two (2) fields to fill in. The first will present the
list of physical activities and one of them must be
selected. Then, in the second field, the duration of this
activity in minutes must be indicated.
After filling in these two fields, the form must be
submitted, pressing the corresponding 'add' button, so
that the data associated with the activity can be
registered in the database.
As for food, whenever the form submission is
successful, a data table appears on the same screen,
where the lines represent the characteristics of the
activities submitted, namely: i) the value of the
metabolic units; ii) the calories expended per minute
of activity (according to the value of the metabolic
units); iii) the duration of the activity in minutes; and
iv) in the last column of the data table the calories,
calculated accordingly to the previous values when
combined with the user's body mass.
For each submission of a new activity, a line is
added to this second data table and also here,
whenever it presents two or more lines, the sum of the
duration of activities and the total sum of calories
expended in the registered activities are calculated
and presented.
The procedure for eliminating registered activities
can also be carried out by choosing the button
corresponding to the activity to be deleted that is
located at the last column. There is also the option, to
delete all records of previously registered activities,
in order to calculate the kilocalories spent on another
set of activities.
3 OUTPUTS
In addition to the data and information presented in
the referred data tables, it is also possible to present a
small dashboard, where only the values of calories
ingested through food and calories spent through
physical activities are placed, to check to what extent
there is a balance between the two. These values are
updated in real time, whenever the user adds more
food or activity.
Hopefully with these results the users can become
more aware of their eating habits and physical
behaviors. They can also make decisions about the
need to increase or decrease food intake and increase
or decrease the need for physical activities, to
maintain the balance between energy input /
expenditure, so necessary for maintaining a good
health, quality of life and individual well-being.
4 LIMITATIONS AND FUTURE
DEVELOPMENTS
The present system also has some limitations. First
being the reduced number of activities mainly
physical and sports activities. Future versions will
significantly increase the range of other activities.
The impossibility of maintaining a history of the
records is another issue in development. Our option
for this first version was to create a light, agile system
without many features, to keep it easy to use at the
expense of other features (e.g., maintaining the
historical record). In addition, the need to develop it
icSPORTS 2020 - 8th International Conference on Sport Sciences Research and Technology Support
154
in a very short time frame so that it becomes available
and useful during the times we are living, influenced
this limitation.
Another issue under development, is the lack of a
personal reserved area, through a username and
password that will have to be created, precisely to
allow historical records, among other features.
The possibility of historical records, allows the
creation of time series that provide indications of the
user's behavior, not only in real time, but also at
different time frames.
The representation of data on the form of data
graphical visualization and information, as well as the
possibility of creating detailed reports, are also one of
the handicaps at the current version of this system.
In terms of design and graphic concept, there is still a
significant amount of developments in progress,
namely in the creation of interfaces oriented to the
concept of user centered design, which should be
combined with greater efficiency not only in terms of
usability, but also of user experience (UX), while
trying to facilitate the application use.
The lack of languages other than Portuguese and
English somewhat limits the globalization and
internationalization of the system, by a wider
audience.
The small number of tests is still a limiting factor
in order to obtain a more robust WebApp, capable of
moving towards other levels of maturity. To mitigate
this limitation, updating the application is something
that we will do frequently in the future.
The backend part, intended for administration,
will also have to undergo the corresponding changes
and developments in order to support the features
now stated.
To complement this WebApp, we still need to
develop a hybrid or by preference a native app, to
install on mobile devices with MAC OSX and
Android operating systems, thus taking advantage of
the possibilities from the graphic components offered
by the operative system resources.
REFERENCES
Ainsworth B. E., Haskell, W. L., Herrmann, S. D., Meckes,
N., Bassett, D. R., Jr., Tudor-Locke, C., et al. (2011).
Compendium of Physical Activities: a second update of
codes and MET values. Medicine and science in sports
and exercise. 2011 Aug; 43 (8): 1575-81. DOI:
10.1249/MSS.0b013e31821ece12
Regulation (EU) N.º 1169/2011 of the European Parliament
and of the Council of 25 October 2011.
System for Calculating and Managing Kilocalories Consumed and Spent through Various Domestic, Physical and Sports Activities
155