terra.models.v2.nutrition
1# Copyright 2022 Terra Enabling Developers Limited 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14import dataclasses 15import typing 16 17from terra.models import base_model 18from terra.models.v2.samples import DrinkSample 19 20__all__ = ["Nutrition"] 21 22 23@dataclasses.dataclass 24class Metadata(base_model.TerraDataModel): 25 start_time: typing.Optional[str] = dataclasses.field(default=None) 26 end_time: typing.Optional[str] = dataclasses.field(default=None) 27 28 29@dataclasses.dataclass 30class Macros(base_model.TerraDataModel): 31 calories: typing.Optional[float] = dataclasses.field(default=None) 32 protein_g: typing.Optional[float] = dataclasses.field(default=None) 33 carbohydrates_g: typing.Optional[float] = dataclasses.field(default=None) 34 fat_g: typing.Optional[float] = dataclasses.field(default=None) 35 trans_fat_g: typing.Optional[float] = dataclasses.field(default=None) 36 saturated_fat_g: typing.Optional[float] = dataclasses.field(default=None) 37 sugar_g: typing.Optional[float] = dataclasses.field(default=None) 38 cholesterol_mg: typing.Optional[float] = dataclasses.field(default=None) 39 fiber_g: typing.Optional[float] = dataclasses.field(default=None) 40 sodium_mg: typing.Optional[float] = dataclasses.field(default=None) 41 alcohol_g: typing.Optional[float] = dataclasses.field(default=None) 42 43 44@dataclasses.dataclass 45class Micros(base_model.TerraDataModel): 46 biotin_mg: typing.Optional[float] = dataclasses.field(default=None) 47 caffeine_mg: typing.Optional[float] = dataclasses.field(default=None) 48 chloride_mg: typing.Optional[float] = dataclasses.field(default=None) 49 chromium_mg: typing.Optional[float] = dataclasses.field(default=None) 50 copper_mg: typing.Optional[float] = dataclasses.field(default=None) 51 calcium_mg: typing.Optional[float] = dataclasses.field(default=None) 52 folate_mg: typing.Optional[float] = dataclasses.field(default=None) 53 folic_acid_mg: typing.Optional[float] = dataclasses.field(default=None) 54 iodine_mg: typing.Optional[float] = dataclasses.field(default=None) 55 iron_mg: typing.Optional[float] = dataclasses.field(default=None) 56 magnesium_mg: typing.Optional[float] = dataclasses.field(default=None) 57 manganese_mg: typing.Optional[float] = dataclasses.field(default=None) 58 molybdenum_mg: typing.Optional[float] = dataclasses.field(default=None) 59 monounsaturated_fat_g: typing.Optional[float] = dataclasses.field(default=None) 60 niacin_mg: typing.Optional[float] = dataclasses.field(default=None) 61 pantothenic_acid_mg: typing.Optional[float] = dataclasses.field(default=None) 62 phosphorus_mg: typing.Optional[float] = dataclasses.field(default=None) 63 polyunsaturated_fat_g: typing.Optional[float] = dataclasses.field(default=None) 64 potassium_mg: typing.Optional[float] = dataclasses.field(default=None) 65 riboflavin_mg: typing.Optional[float] = dataclasses.field(default=None) 66 selenium_mg: typing.Optional[float] = dataclasses.field(default=None) 67 thiamin_mg: typing.Optional[float] = dataclasses.field(default=None) 68 vitamin_A_mg: typing.Optional[float] = dataclasses.field(default=None) 69 vitamin_B12_mg: typing.Optional[float] = dataclasses.field(default=None) 70 vitamin_B6_mg: typing.Optional[float] = dataclasses.field(default=None) 71 vitamin_C_mg: typing.Optional[float] = dataclasses.field(default=None) 72 vitamin_D_mg: typing.Optional[float] = dataclasses.field(default=None) 73 vitamin_E_mg: typing.Optional[float] = dataclasses.field(default=None) 74 vitamin_K_mg: typing.Optional[float] = dataclasses.field(default=None) 75 zinc_mg: typing.Optional[float] = dataclasses.field(default=None) 76 77 78@dataclasses.dataclass 79class Quantity(base_model.TerraDataModel): 80 unit: typing.Optional[int] = dataclasses.field(default=None) 81 amount: typing.Optional[float] = dataclasses.field(default=None) 82 83 84@dataclasses.dataclass 85class Meal(base_model.TerraDataModel): 86 name: typing.Optional[str] = dataclasses.field(default=None) 87 id: typing.Optional[str] = dataclasses.field(default=None) 88 timestamp: typing.Optional[str] = dataclasses.field(default=None) 89 type: typing.Optional[int] = dataclasses.field(default=0) 90 quantity: Quantity = dataclasses.field(default_factory=Quantity) 91 macros: Macros = dataclasses.field(default_factory=Macros) 92 micros: Micros = dataclasses.field(default_factory=Micros) 93 94 95@dataclasses.dataclass 96class NutritionSummary(base_model.TerraDataModel): 97 water_ml: typing.Optional[float] = dataclasses.field(default=None) 98 macros: Macros = dataclasses.field(default_factory=Macros) 99 drink_ml: typing.Optional[float] = dataclasses.field(default=None) 100 micros: Micros = dataclasses.field(default_factory=Micros) 101 102 103@dataclasses.dataclass 104class Nutrition(base_model.TerraDataModel): 105 metadata: Metadata = dataclasses.field(default_factory=Metadata) 106 summary: NutritionSummary = dataclasses.field(default_factory=NutritionSummary) 107 meals: typing.List[Meal] = dataclasses.field(default_factory=list) 108 drink_samples: typing.List[DrinkSample] = dataclasses.field(default_factory=list)
104@dataclasses.dataclass 105class Nutrition(base_model.TerraDataModel): 106 metadata: Metadata = dataclasses.field(default_factory=Metadata) 107 summary: NutritionSummary = dataclasses.field(default_factory=NutritionSummary) 108 meals: typing.List[Meal] = dataclasses.field(default_factory=list) 109 drink_samples: typing.List[DrinkSample] = dataclasses.field(default_factory=list)
Nutrition(metadata: terra.models.v2.nutrition.Metadata =
Nutrition( metadata: terra.models.v2.nutrition.Metadata = <factory>, summary: terra.models.v2.nutrition.NutritionSummary = <factory>, meals: List[terra.models.v2.nutrition.Meal] = <factory>, drink_samples: List[terra.models.v2.samples.DrinkSample] = <factory>)