API details.

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.

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.

source for the formulas: https://www.verywellfit.com/how-many-calories-do-i-need-each-day-2506873 source for the MET values: https://golf.procon.org/met-values-for-800-activities/

setup_logger[source]

setup_logger(loggerName='calorie_count_logger', logFile='log/calorie_count.log')

Returns a logger with the specified name or "calorie_count_logger", if loggerName is None. Generated logs will be stored in the specified file or in log/calorie_count.log, if logFile is None

Parameters:

loggerName: string
a name for logger, that is used in getLogger

logFile: string
file name, where logs are stored

Return:

logger
logger used in the calorie_count functions

input_body_parameters[source]

input_body_parameters()

returns a dictionary with user input of body parameters: height, weight, age, gender and activity level

Raises:

AssertError: if inputs of type int are negative

AssertError: if inputs of type string are not 'w' or 'm'

Return:

dict
a dictionary with body parameters as keys and their values as values

calculate_bmr_amr[source]

calculate_bmr_amr(body_parameters)

returns basal metabolic rate (bmr) and active metabolic rate (amr)

Parameters:

body_parameters: dict
dictionary with body parameters as keys and their values as values

Returns:

float
basal metabolic rate (bmr)

float
active metabolic rate (amr)

calculate_burned_calories[source]

calculate_burned_calories(body_parameters)

Returns the amount of calories burned during activity and during the day apart of activity.

To calculate calories for specific activity its MET value is chosen from the table. To assign MET user should type in the name of her activity for the search. If user doesn't provide this information, activity is considered to be standing and light effort with MET of 1.4 Calories burned during rest of the day are calculated with standard MET of 1.2.

Parameters:

body_parameters: dict
dictionary with body parameters as keys and their values as values

Returns:

float
amount of calories burned during activity

float
amount of calories burned during the day apart of activity

class NotionSync[source]

NotionSync(db_token, db_id)

extract_data_to_df[source]

extract_data_to_df(data_json)

Returns a DataFrame with all activities from data base and respective time.

Parameters: data_json data from the data base

Returns: DataFrame a DataFrame with columns activity and time with a row for each entry in the data base

get_activity_sum[source]

get_activity_sum(df)

Returns a DataFrame with summed time for each activity and number of user, who did it, in the data base.

Parameters: df DataFrame with activity information, must contain columns 'activity', 'time'

Result: df_sum DataFrame with columns activity, time, number_user

show_hist[source]

show_hist(df_sum)

Returns a barplot with all activities from the data base and overall time for each of these activities

Parameters: df_sum DataFrame with activities and respective summed times

Returns: plotly.graph_objs._figure.Figure a barplot plotly figure