intakeinformer.visualization
Module Contents
Functions
Loads the combined DRI DataFrame from a pickle file. |
|
|
Generates and displays a bar chart for comparing the calorie content of selected food items. |
|
Generates and displays a bar chart comparing actual nutrient intake against |
Attributes
- intakeinformer.visualization.load_dri_combined()
Loads the combined DRI DataFrame from a pickle file.
Ensure df_combined is loaded from the pickle file installed alongside all other dependencies and available for use when needed.
- Returns:
The DataFrame containing combined DRI data.
- Return type:
pandas.DataFrame
- intakeinformer.visualization.df_combined
- intakeinformer.visualization.plot_calorie_comparison(calorie_data)
Generates and displays a bar chart for comparing the calorie content of selected food items.
Serves as an important visualization helper function for IntakeInformer’s functionality One - calculating calorie intakes
- Parameters:
calorie_data (dict) – A dictionary where keys are food item names and values are their corresponding calorie content per 100g. It should also contain a ‘total’ key for the sum of calories.
- Returns:
This function displays a bar chart.
- Return type:
None
Examples
>>> calorie_data = {'BANANA FREEZE DRIED FRUIT': 2000.0, 'GALA APPLES': 28.57, 'ORGANIC VALENCIA ORANGES': 29.22, 'total': 2057.79} >>> plot_calorie_comparison(calorie_data) # This will display a bar chart comparing the calorie content of the listed food items.
- intakeinformer.visualization.plot_nutrient_comparison(actual_nutrients, df_combined, life_stage_info)
Generates and displays a bar chart comparing actual nutrient intake against Dietary Reference Intake (DRI) recommendations for a specific life stage.
Serves as an essential helper function for IntakeInformer’s functionality Two - benchmarking against DRI nutrition allowances.
- Parameters:
actual_nutrients (dict) – A dictionary containing the actual nutrient values of the selected food item. Each key-value pair corresponds to a nutrient and its intake value.
df_combined (pandas.DataFrame) – A DataFrame consolidating DRI values for various nutrients across different life stages.
life_stage_info (tuple) – A tuple containing the life stage category (e.g., ‘Children’) and the specific age range (e.g., ‘1–3 y’) for which DRI values are to be compared.
- Returns:
Displays a bar chart visualization but does not return any value.
- Return type:
None
Examples
>>> actual_nutrients = {'Carbohydrate(g/d)': 30, 'Proteinb(g/d)': 15, 'Fat(g/d)': 10} >>> life_stage_info = ('Children', '1–3 y') >>> plot_nutrient_comparison(actual_nutrients, df_combined, life_stage_info) [Bar chart is displayed showing the comparison between actual nutrient intake and DRI]