Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
energy_balance_model.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "interfaces.h"
4 #include "mapping.h"
5 
6 #include <optional>
7 
8 namespace hgps {
9 
14  public:
22  const std::unordered_map<core::Identifier, double> &energy_equation,
23  const std::unordered_map<core::Identifier, std::pair<double, double>> &nutrient_ranges,
24  const std::unordered_map<core::Identifier, std::map<core::Identifier, double>>
25  &nutrient_equations,
26  const std::unordered_map<core::Identifier, std::optional<double>> &food_prices,
27  const std::unordered_map<core::Gender, std::vector<double>> &age_mean_height);
28 
29  HierarchicalModelType type() const noexcept override;
30 
31  std::string name() const noexcept override;
32 
35  void generate_risk_factors(RuntimeContext &context) override;
36 
37  void update_risk_factors(RuntimeContext &context) override;
38 
39  private:
40  const std::unordered_map<core::Identifier, double> &energy_equation_;
41  const std::unordered_map<core::Identifier, std::pair<double, double>> &nutrient_ranges_;
42  const std::unordered_map<core::Identifier, std::map<core::Identifier, double>>
43  &nutrient_equations_;
44  const std::unordered_map<core::Identifier, std::optional<double>> &food_prices_;
45  const std::unordered_map<core::Gender, std::vector<double>> &age_mean_height_;
46 
51  double bounded_nutrient_value(const core::Identifier &nutrient, double value) const;
52 
53  std::map<core::Identifier, double> get_current_risk_factors(const HierarchicalMapping &mapping,
54  Person &entity,
55  int time_year) const;
56 };
57 
60  public:
69  std::unordered_map<core::Identifier, double> energy_equation,
70  std::unordered_map<core::Identifier, std::pair<double, double>> nutrient_ranges,
71  std::unordered_map<core::Identifier, std::map<core::Identifier, double>> nutrient_equations,
72  std::unordered_map<core::Identifier, std::optional<double>> food_prices,
73  std::unordered_map<core::Gender, std::vector<double>> age_mean_height);
74 
77  std::unique_ptr<HierarchicalLinearModel> create_model() const override;
78 
79  private:
80  std::unordered_map<core::Identifier, double> energy_equation_;
81  std::unordered_map<core::Identifier, std::pair<double, double>> nutrient_ranges_;
82  std::unordered_map<core::Identifier, std::map<core::Identifier, double>> nutrient_equations_;
83  std::unordered_map<core::Identifier, std::optional<double>> food_prices_;
84  std::unordered_map<core::Gender, std::vector<double>> age_mean_height_;
85 };
86 
87 } // namespace hgps
Defines the energy balance model data type.
Definition: energy_balance_model.h:59
std::unique_ptr< HierarchicalLinearModel > create_model() const override
Construct a new EnergyBalanceModel from this definition.
Definition: energy_balance_model.cpp:142
EnergyBalanceModelDefinition(std::unordered_map< core::Identifier, double > energy_equation, std::unordered_map< core::Identifier, std::pair< double, double >> nutrient_ranges, std::unordered_map< core::Identifier, std::map< core::Identifier, double >> nutrient_equations, std::unordered_map< core::Identifier, std::optional< double >> food_prices, std::unordered_map< core::Gender, std::vector< double >> age_mean_height)
Initialises a new instance of the EnergyBalanceModelDefinition class.
Definition: energy_balance_model.cpp:115
Implements the energy balance model type.
Definition: energy_balance_model.h:13
EnergyBalanceModel(const std::unordered_map< core::Identifier, double > &energy_equation, const std::unordered_map< core::Identifier, std::pair< double, double >> &nutrient_ranges, const std::unordered_map< core::Identifier, std::map< core::Identifier, double >> &nutrient_equations, const std::unordered_map< core::Identifier, std::optional< double >> &food_prices, const std::unordered_map< core::Gender, std::vector< double >> &age_mean_height)
Initialises a new instance of the EnergyBalanceModel class.
Definition: energy_balance_model.cpp:8
void generate_risk_factors(RuntimeContext &context) override
Generates the initial risk factors for a population and newborns.
Definition: energy_balance_model.cpp:42
void update_risk_factors(RuntimeContext &context) override
Update risk factors for population.
Definition: energy_balance_model.cpp:46
std::string name() const noexcept override
Gets the model name.
Definition: energy_balance_model.cpp:40
HierarchicalModelType type() const noexcept override
Gets the model type identifier.
Definition: energy_balance_model.cpp:36
Hierarchical linear model interface.
Definition: interfaces.h:137
Defines the hierarchical model mapping data type.
Definition: mapping.h:128
Risk factor model definition interface.
Definition: interfaces.h:160
Defines the Simulation runtime context data type.
Definition: runtime_context.h:21
Gender
Enumerates gender types.
Definition: forward_type.h:18
Top-level namespace for Health-GPS C++ API.
Definition: analysis_definition.h:8
HierarchicalModelType
Health GPS risk factor module types enumeration.
Definition: interfaces.h:29
Defines a virtual population person data type.
Definition: person.h:40
Entity unique identifier data type.
Definition: identifier.h:17