Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
data_series.h
Go to the documentation of this file.
1#pragma once
3
4#include <map>
5#include <string>
6#include <vector>
7
8namespace hgps {
9
17 public:
18 DataSeries() = delete;
19
22 DataSeries(std::size_t sample_size);
23
30 std::vector<double> &operator()(core::Gender gender, const std::string &key);
31
38 std::vector<double> &at(core::Gender gender, const std::string &key);
39
46 const std::vector<double> &at(core::Gender gender, const std::string &key) const;
47
55 std::vector<double> &at(core::Gender gender, core::Income income, const std::string &key);
56
64 const std::vector<double> &at(core::Gender gender, core::Income income,
65 const std::string &key) const;
66
69 const std::vector<std::string> &channels() const noexcept;
70
74 void add_channel(std::string key);
75
79 void add_channels(const std::vector<std::string> &keys);
80
84 void add_income_channels(const std::vector<std::string> &keys);
85
87 void add_income_channels_for_categories(const std::vector<std::string> &keys,
88 const std::vector<core::Income> &income_categories);
89
92 std::size_t size() const noexcept;
93
96 std::size_t sample_size() const noexcept;
97
100 std::vector<core::Income> get_available_income_categories() const;
101
106 bool has_income_category(core::Gender gender, core::Income income) const;
107
109 bool has_income_channel(core::Gender gender, core::Income income, const std::string &key) const;
110
114 std::string income_category_to_string(core::Income income) const;
115
116 private:
117 std::size_t sample_size_;
118 std::vector<std::string> channels_;
119 std::map<core::Gender, std::map<std::string, std::vector<double>>> data_;
120 std::map<core::Gender, std::map<core::Income, std::map<std::string, std::vector<double>>>>
121 income_data_;
122};
123} // namespace hgps
DataSeries()=delete
std::vector< double > & at(core::Gender gender, const std::string &key)
Gets a reference to a channel by Gender and identifier.
Definition data_series.cpp:32
std::size_t sample_size() const noexcept
Gets the channels sample size, number of points per channel.
Definition data_series.cpp:147
void add_channel(std::string key)
Adds a new channel to the collection.
Definition data_series.cpp:70
bool has_income_category(core::Gender gender, core::Income income) const
Checks if an income category exists for a given gender.
Definition data_series.cpp:166
std::vector< core::Income > get_available_income_categories() const
Gets available income categories from the data.
Definition data_series.cpp:149
void add_income_channels_for_categories(const std::vector< std::string > &keys, const std::vector< core::Income > &income_categories)
Adds income-based channels for specific income categories.
Definition data_series.cpp:122
std::size_t size() const noexcept
Gets the size of the channels collection.
Definition data_series.cpp:145
void add_income_channels(const std::vector< std::string > &keys)
Adds income-based channels to the collection.
Definition data_series.cpp:94
const std::vector< std::string > & channels() const noexcept
Gets the collection of channel identifiers.
Definition data_series.cpp:68
void add_channels(const std::vector< std::string > &keys)
Adds multiple channels to the collection.
Definition data_series.cpp:81
std::vector< double > & operator()(core::Gender gender, const std::string &key)
Gets a reference to a channel by Gender and identifier.
Definition data_series.cpp:28
std::string income_category_to_string(core::Income income) const
Converts income category enum to string representation.
Definition data_series.cpp:190
bool has_income_channel(core::Gender gender, core::Income income, const std::string &key) const
True if an income-stratified channel key exists (gender, income, key).
Definition data_series.cpp:176
Top-level namespace for Health-GPS Core C++ API.
Definition analysis.h:7
Gender
Enumerates gender types.
Definition forward_type.h:18
Income
Enumerates income categories.
Definition forward_type.h:51
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:9
Global namespace.
Definition column_iterator.h:123