# -*- coding: utf-8 -*-
# SPDX-FileCopyrightText: 2022-2023 Tanguy Fardet
# SPDX-License-Identifier: GPL-3.0-or-later
# orgmatt/metabolism/diets.py
from dataclasses import dataclass, field
import numpy as np
from ..units import Quantity, ureg
__all__ = ["Diet", "INCA3", "get_diet"]
[docs]
@dataclass
class Diet:
'''
Class storing a diet defined by the daily intakes of an average adult
(18-64 age group).
Attributes
----------
N_adult : Quantity
Daily nitrogen intake for an average adult.
P_adult : Quantity
Daily phosphorus intake for an average adult.
K_adult : Quantity, optional (default: nan gK)
Daily potassium intake for an average adult.
Na_adult : Quantity, optional (default: nan gNa)
Daily sodium intake for an average adult.
water_intake : Quantity, optional (default: 2.5 L)
Total amount of water ingested from solid and liquid intakes.
name : str, optional (default: "Custom")
Name of the diet.
country : str, optional (default: "")
Country associated to the diet.
description : str, optional (default: "")
Description of the diet.
'''
N_adult: Quantity
P_adult: Quantity
K_adult: Quantity = field(default=np.nan * ureg("gK"))
Na_adult: Quantity = field(default=np.nan * ureg("gNa"))
water_intake: Quantity = field(default=2.5 * ureg("L"))
name: str = field(default="Custom")
country: str = field(default="")
description: str = field(default="")
def __str__(self) -> str:
return self.name.copy()
# predefined diets
# when data is available, the adult intake is the average for the 18-64 age group
# French current diet
# https://www.anses.fr/fr/content/inca-3-evolution-des-habitudes-et-modes-de-consommation-de-nouveaux-enjeux-en-mati%C3%A8re-de
INCA3 = Diet(
N_adult=13.46 * ureg("gN"),
P_adult=1260 * ureg("mgP"),
K_adult=3113 * ureg("mgK"),
Na_adult=3187 * ureg("mgNa"),
water_intake=2.522 * ureg("L"),
name="INCA3",
country="FRA",
description="Estimated diet for French people between 2014 and 2015",
)
# Dutch 2012-2016 diet, average for 19-70 age group
# https://www.rivm.nl/publicaties/diet-of-dutch-results-of-dutch-national-food-consumption-survey-2019-2021-on-food
VCP_2012_2016 = Diet(
N_adult=13.39 * ureg("gN"),
P_adult=1518 * ureg("mgP"),
K_adult=3313 * ureg("mgK"),
Na_adult=3139 * ureg("mgNa"),
water_intake=2.886 * ureg("L"),
name="VCP 2012-2016",
country="NLD",
description="Estimated diet for Dutch people between 2012 and 2016",
)
# Dutch 2019-2021 diet
# https://www.rivm.nl/publicaties/diet-of-dutch-results-of-dutch-national-food-consumption-survey-2019-2021-on-food
VCP_2019_2021 = Diet(
N_adult=12.74 * ureg("gN"),
P_adult=1482 * ureg("mgP"),
K_adult=3169 * ureg("mgK"),
Na_adult=2812 * ureg("mgNa"),
water_intake=2.932 * ureg("L"),
name="VCP 2019-2021",
country="NLD",
description="Estimated diet for Dutch people between 2019 and 2021",
)
# Dutch proposal for the Planetary Health Diet
# https://doi.org/10.3390/nu16142219
PHD_NLD = Diet(
N_adult=13.12 * ureg("gN"),
P_adult=1524 * ureg("mgP"),
K_adult=3517 * ureg("mgK"),
Na_adult=1765 * ureg("mgNa"),
name="PHD_NLD",
description="Proposed adaptation of the Planetary Health diet for the Netherlands",
)
# French scenario from Solagro
# https://afterres2050.solagro.org/wp-content/uploads/2021/06/solagro_afterres2050_version2016_english.pdf
Afterres2050 = Diet(
N_adult=11.87 * ureg("gN"),
P_adult=1198 * ureg("mgP"),
K_adult=3529 * ureg("mgK"),
Na_adult=2752 * ureg("mgNa"),
name="Afterres2050",
country="FRA",
description="Sustainable diet for France proposed by the Solagro association",
)
# French environmental agency prospective scenarios
# https://librairie.ademe.fr/societe-et-politiques-publiques/5601-simulation-prospective-du-systeme-alimentaire-et-de-son-empreinte-carbone-sisae.html
ADEME_S1 = Diet(
N_adult=10.86 * ureg("gN"),
P_adult=1218 * ureg("mgP"),
K_adult=2873 * ureg("mgK"),
Na_adult=2286 * ureg("mgNa"),
name="ADEME_S1",
country="FRA",
description="Proposed diet for France in the 'Frugal generation' (S1) scenario of the Transition2050 report from ADEME",
)
ADEME_S2 = Diet(
N_adult=11.17 * ureg("gN"),
P_adult=1199 * ureg("mgP"),
K_adult=2891 * ureg("mgK"),
Na_adult=2406 * ureg("mgNa"),
name="ADEME_S2",
country="FRA",
description="Proposed diet for France in the 'Regional cooperation' (S2) scenario of the Transition2050 report from ADEME",
)
ADEME_S3 = Diet(
N_adult=11.32 * ureg("gN"),
P_adult=1176 * ureg("mgP"),
K_adult=3184 * ureg("mgK"),
Na_adult=2541 * ureg("mgNa"),
name="ADEME_S3",
country="FRA",
description="Proposed diet for France in the 'Green technologies' (S3) scenario of the Transition2050 report from ADEME",
)
ADEME_S4 = Diet(
N_adult=12.83 * ureg("gN"),
P_adult=1285 * ureg("mgP"),
K_adult=3481 * ureg("mgK"),
Na_adult=2757 * ureg("mgNa"),
name="ADEME_S4",
country="FRA",
description="Proposed diet for France in the 'Restoration gamble' (S4) scenario of the Transition2050 report from ADEME",
)
named_diets = {
"INCA3": INCA3,
"VCP 2012-2016": VCP_2012_2016,
"VCP 2019-2021": VCP_2019_2021,
"PHD_NLD": PHD_NLD,
"Afterres2050": Afterres2050,
"ADEME_S1": ADEME_S1,
"ADEME_S2": ADEME_S2,
"ADEME_S3": ADEME_S3,
"ADEME_S4": ADEME_S4,
}
[docs]
def get_diet(diet: str | Diet | tuple[Quantity, ...] | None = None) -> Diet:
'''Return a Diet or the dictionary of all pre-defined diets.'''
if diet is None:
return {
k: Diet(
v.N_adult,
v.P_adult,
v.K_adult,
v.Na_adult,
v.water_intake,
v.name,
)
for k, v in named_diets.items()
}
if isinstance(diet, Diet):
return diet
if isinstance(diet, tuple):
assert diet[0].is_compatible_with("gN"), (
"First quantity should be a nitrogen intake."
)
assert diet[1].is_compatible_with("gP"), (
"Second quantity should be a phosphorus intake."
)
if len(diet) >= 3:
assert diet[2].is_compatible_with("gK"), (
"Third quantity should be the potassium intake."
)
if len(diet) >= 4:
assert diet[3].is_compatible_with("gNa"), (
"Fourth quantity should the sodium intake."
)
if len(diet) == 5:
assert diet[4].is_compatible_with("L"), (
"Fifth quantity should be the water intake in liters."
)
elif len(diet) > 5:
raise ValueError(
"Intake tuple should have a size between 2 and 5: "
"N, P, and K, Na, water intake that are optional."
)
return Diet(*diet)
if diet in named_diets:
return named_diets[diet]
raise ValueError(
f"Unknown diet: {diet}.\nPlease enter a valid diet name or an daily "
f"NP(K) ingestion tuple.\nValid diet names are: {list(named_diets)}."
)