Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
demographic.h
Go to the documentation of this file.
1#pragma once
2
5#include "disease.h"
6#include "gender_table.h"
7#include "gender_value.h"
8#include "interfaces.h"
9#include "life_table.h"
10#include "modelinput.h"
11#include "repository.h"
12#include "runtime_context.h"
13
14namespace hgps {
15
17class DemographicModule final : public SimulationModule {
18 public:
20
24 DemographicModule(std::map<int, std::map<int, PopulationRecord>> &&pop_data,
25 LifeTable &&life_table);
26
29 SimulationModuleType type() const noexcept override;
30
33 const std::string &name() const noexcept override;
34
38 std::size_t get_total_population_size(int time_year) const noexcept;
39
43 const std::map<int, PopulationRecord> &get_population_distribution(int time_year) const;
44
47 void initialise_population(RuntimeContext &context) override;
48
52 void update_population(RuntimeContext &context, const DiseaseModule &disease_host);
53
57 const std::map<core::Identifier, std::map<core::Gender, std::map<std::string, double>>>
58 &region_data);
59
63 const std::map<core::Identifier,
64 std::map<core::Gender, std::map<std::string, std::map<std::string, double>>>>
65 &ethnicity_data);
66
67 private:
68 std::map<int, std::map<int, PopulationRecord>> pop_data_;
69 LifeTable life_table_;
70 GenderTable<int, double> birth_rates_;
71 GenderTable<int, double> residual_death_rates_;
72
74 std::map<core::Identifier, std::map<core::Gender, std::map<std::string, double>>>
75 region_prevalence_;
76
78 std::map<core::Identifier,
79 std::map<core::Gender, std::map<std::string, std::map<std::string, double>>>>
80 ethnicity_prevalence_;
81
82 std::string name_{"Demographic"};
83
84 void initialise_birth_rates();
85
90 void initialise_region(RuntimeContext &context, Person &person, Random &random);
91
97 void initialise_ethnicity(RuntimeContext &context, Person &person, Random &random);
98
99 double get_total_deaths(int time_year) const noexcept;
100 std::map<int, DoubleGenderValue> get_age_gender_distribution(int time_year) const noexcept;
101 DoubleGenderValue get_birth_rate(int time_year) const noexcept;
102 double get_residual_death_rate(int age, core::Gender gender) const noexcept;
103
104 GenderTable<int, double> create_death_rates_table(int time_year);
105 GenderTable<int, double> calculate_residual_mortality(RuntimeContext &context,
106 const DiseaseModule &disease_host);
107
108 void update_residual_mortality(RuntimeContext &context, const DiseaseModule &disease_host);
109 static double calculate_excess_mortality_product(const Person &entity,
110 const DiseaseModule &disease_host);
111 int update_age_and_death_events(RuntimeContext &context, const DiseaseModule &disease_host);
112};
113
118std::unique_ptr<DemographicModule> build_population_module(Repository &repository,
119 const ModelInput &config);
120
121} // namespace hgps
Implements the population demographic module data type.
Definition demographic.h:17
const std::string & name() const noexcept override
Gets the module name.
Definition demographic.cpp:242
const std::map< int, PopulationRecord > & get_population_distribution(int time_year) const
Gets the population age distribution at a specific point in time.
Definition demographic.cpp:267
void update_population(RuntimeContext &context, const DiseaseModule &disease_host)
Updates the virtual population status.
Definition demographic.cpp:399
void set_ethnicity_prevalence(const std::map< core::Identifier, std::map< core::Gender, std::map< std::string, std::map< std::string, double > > > > &ethnicity_data)
Sets the ethnicity prevalence data for assignment.
Definition demographic.cpp:832
SimulationModuleType type() const noexcept override
Gets the module type identifier.
Definition demographic.cpp:238
void set_region_prevalence(const std::map< core::Identifier, std::map< core::Gender, std::map< std::string, double > > > &region_data)
Sets the region prevalence data for assignment.
Definition demographic.cpp:826
std::size_t get_total_population_size(int time_year) const noexcept
Gets the total population at a specific point in time.
Definition demographic.cpp:244
void initialise_population(RuntimeContext &context) override
Initialises the virtual population status.
Definition demographic.cpp:310
Defines the disease module container to hold disease models.
Definition disease.h:11
Defines the gender column lookup table data type.
Definition gender_table.h:15
Defines the population life table data type.
Definition life_table.h:29
General purpose Random number generator algorithms.
Definition random_algorithm.h:8
Defines the Simulation runtime context data type.
Definition runtime_context.h:22
Simulation modules interface.
Definition interfaces.h:31
Gender
Enumerates gender types.
Definition forward_type.h:18
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:8
SimulationModuleType
Health GPS simulation modules types enumeration.
Definition interfaces.h:13
std::unique_ptr< DemographicModule > build_population_module(Repository &repository, const ModelInput &config)
Builds a new instance of the DemographicModule using the given data infrastructure.
Definition demographic.cpp:839
Global namespace.
Definition column_iterator.h:123
Defines a virtual population person data type.
Definition person.h:39
Define the population record data type for the demographic dataset.
Definition interfaces.h:71