Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
analysis_module.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "analysis_definition.h"
4 #include "interfaces.h"
5 #include "modelinput.h"
6 #include "repository.h"
7 #include "result_message.h"
8 #include "runtime_context.h"
9 #include "weight_model.h"
10 
11 namespace hgps {
12 
14 class AnalysisModule final : public UpdatableModule {
15  public:
16  AnalysisModule() = delete;
17 
23  AnalysisModule(AnalysisDefinition &&definition, WeightModel &&classifier,
24  const core::IntegerInterval age_range, unsigned int comorbidities);
25 
26  SimulationModuleType type() const noexcept override;
27 
28  const std::string &name() const noexcept override;
29 
30  void initialise_population(RuntimeContext &context) override;
31 
32  void update_population(RuntimeContext &context) override;
33 
34  private:
35  AnalysisDefinition definition_;
36  WeightModel weight_classifier_;
37  DoubleAgeGenderTable residual_disability_weight_;
38  std::vector<std::string> channels_;
39  unsigned int comorbidities_;
40  std::string name_{"Analysis"};
41 
42  double calculate_residual_disability_weight(const int &age, const core::Gender gender,
43  const DoubleAgeGenderTable &expected_sum,
44  const IntegerAgeGenderTable &expected_count);
45 
46  void publish_result_message(RuntimeContext &context) const;
47  void calculate_historical_statistics(RuntimeContext &context, ModelResult &result) const;
48  double calculate_disability_weight(const Person &entity) const;
49  DALYsIndicator calculate_dalys(Population &population, unsigned int max_age,
50  unsigned int death_year) const;
51 
52  void calculate_population_statistics(RuntimeContext &context, DataSeries &series) const;
53  void classify_weight(hgps::DataSeries &series, const hgps::Person &entity) const;
54  void initialise_output_channels(RuntimeContext &context);
55 };
56 
62 std::unique_ptr<AnalysisModule> build_analysis_module(Repository &repository,
63  const ModelInput &config);
64 } // namespace hgps
Burden of diseases (BoD) analysis module definition data type.
Definition: analysis_definition.h:11
Implements the burden of diseases (BoD) analysis module.
Definition: analysis_module.h:14
void update_population(RuntimeContext &context) override
Updates the virtual population status.
Definition: analysis_module.cpp:67
const std::string & name() const noexcept override
Gets the module name.
Definition: analysis_module.cpp:27
void initialise_population(RuntimeContext &context) override
Initialises the virtual population.
Definition: analysis_module.cpp:29
SimulationModuleType type() const noexcept override
Gets the module type identifier.
Definition: analysis_module.cpp:23
Defines the Simulation results container for time series data.
Definition: data_series.h:16
Defines the virtual population data type.
Definition: population.h:14
Defines the Simulation runtime context data type.
Definition: runtime_context.h:21
Generic disease module interface to host multiple diseases model.
Definition: interfaces.h:71
Weight classification model polymorphic wrapper class.
Definition: weight_model.h:12
Numeric interval representation data type.
Definition: interval.h:10
Gender
Enumerates gender types.
Definition: forward_type.h:18
Top-level namespace for Health-GPS C++ API.
Definition: analysis_definition.h:8
std::unique_ptr< AnalysisModule > build_analysis_module(Repository &repository, const ModelInput &config)
Builds a new instance of the AnalysisModule using the given data infrastructure.
Definition: analysis_module.cpp:391
SimulationModuleType
Health GPS simulation modules types enumeration.
Definition: interfaces.h:11
Global namespace.
Definition: jsonparser.h:88
Defines the DALYs indicator result data type.
Definition: model_result.h:22
Defines the model results data type.
Definition: model_result.h:34
Defines a virtual population person data type.
Definition: person.h:40