Impacts result reporting package

Module contents

class reporting.reporting.ProductImpactReport(barcode=None, product=None, barcode_similar=None, ciqual_AGB_similar=None, impact_categories=None, main_impact_category=None, product_mass=1000, language='french', use_nutritional_info=True)[source]

Bases: object

Class used to generate reports for Open Food Facts products impacts.

_compute_impact()[source]
_generate_figure(plotting_function, figure_name)[source]
_generate_figures()[source]

Generating the figures png files

_generate_html()[source]

Generate the html version of the report

categorize_ingredients(ingredient_or_product)[source]
impact_per_ingredient_plot()[source]

Stacked bar showing the impacts shares related to each ingredient.

impact_per_step_plot()[source]

Stacked bar showing the impacts shares related to each production step. Only possible if the product is linked to an Agribalyse reference

impacts_data()[source]
main_impact_plot()[source]

Boxplot of the main impact

mass_per_ingredient_plot()[source]

Stacked bar showing the mass shares related to each ingredient.

off_categories()[source]

Getting the names of the OFF categories in the desired language.

off_ingredients()[source]

Get a nested list of dictionaries containing the ingredients of the product and custom attributes

recipe_ingredients_in_list_order()[source]
Returns a list containing the names of the ingredients of the recipe in the order in which they first appear

in the ingredients list.

to_html(filename=None)[source]

Export the report to html