Project for SOF2 LAB
Project description
Calorie count
The aim of the project is to build a web application, where users can type in their body parameters and get an estimation of their recommended daily calories intake. In the second step users can provide information about the type of their sport activity and time they were doing it and get a calculation of spent calories during this activity.
Documentation is available at https://hexann666.github.io/calorie_count/
Online version is available at https://share.streamlit.io/hexann666/calorie_count/app.py
Install
pip install calorie_count
Run app
streamlit run app.py
If you deploy the app by yourself, you need to input the secrets for Notion API to be able to connect with Notion database. When deploying the streamlit app, go to Advanced settings and type in your secrets with keys db_token and db_id.
Releases (defined according to the Lab's formal requirements)
Release 1
- git repository available on GitLab/Hub
- git structure with readme, docs, tests
- documentation
- unit tests
- pip package
Release 2
- Web-Application with Streamlit (Web-UI)
Release 3 (to define)
- Data bank with Notion ("Datawarehouse")
- docker container
- (Optional) Kubernetes (eg. Okteto)
- (Optional) Worfklow in MLops-Stil
Technical requirements
- System shall provide input fields for the input parameters (height, weight, age, gender, activity level).
- User should input the body parameters in the order, in which system will request them and confirm that the input is complete.
- System should store the variables provided by user until the end of transaction.
- If all input variables are valid, system should calculate calorie intake recommendation and show it on the screen.
- System shall provide input fields for the activity name and time.
- User should enter her activity name in the field and confirm that the input is complete.
- After the input was confirmed by user, system shall look up the input string in the data base in the column activity_name.
- It there is no search result, system shall show a message 'Please type again', wait for the new input and repeat the serach as soon as the new input is confirmed.
- If there is only one match result, system shall keep the value from the column "METs".
- If there is more than one result, system shall show all results.
- If system provides to user multiple results, she should choose her activity from the provided list and type in the respective number. System should keep the value from the column "METs" for the row number, that was typed in by the user.
- If MET value is saved and body parameters are available from the previous step, system shall calculate the spent calories and total calories for the day.
- If calculation step succeeded, system shall print the result on the screen.
- the input variables and results shall not be stored after the last result is displayed.
How to use
First you will provide your height, weight and age and calculate your Basal Metabolic Rate, the number of calories required to keep your body functioning at rest.
After choosing your usual level of activity the Active Metabolic Rate, the number of calories that we consume on a daily basis depending on our height, gender, age, weight and entered activity level whilst maintaining current weight, will be calculated. Output of the function should be stored in a variable to pass it to the next function.
Than you will be asked to type in the activity you were doing today. If there are more than one activities matching your input, you will select one from the lst that matches your search pattern. Additionally you will enter the time you were doing this activity.
import calorie_count.core as cc
body_parameters = cc.input_body_parameters()
cc.calculate_bmr_amr(body_parameters)
cc.calculate_burned_calories(body_parameters)
Note 1
Pip is doing canonicalization while processing Setup.py to a package and automatically changes dots and underscore to dashes. That's why during installation the name of the package is shown as calorie-count and calorie-count-version-nr, although in all the documentation the name of the package is specified as calorie_count.
Note 2
Currently there is a bug in nbdev, when it generates links to the GitHub sourc files from documentation on the GitPages, so it leads to an non-existent link to core.py instead of https://github.com/hexann666/calorie_count/blob/master/calorie_count/core.py. The link specified in settings.ini in git_url is not converted properly.
Sources:
for the formulas: https://www.verywellfit.com/how-many-calories-do-i-need-each-day-2506873
for the MET values: https://golf.procon.org/met-values-for-800-activities/
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file calorie_count-0.0.4.tar.gz
.
File metadata
- Download URL: calorie_count-0.0.4.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 243dbd359b7c2553399baee8aefbc524c5fe84a690b1019cef35dd013147b804 |
|
MD5 | 9ff2a62d2a00bd45509b24adab1769f6 |
|
BLAKE2b-256 | 9e86e540c7864debaa661190c89d492ba957ba480e4076c23fbcd1b037d9a1fd |