Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
relative_risk.h
Go to the documentation of this file.
1 #pragma once
4 #include "gender_table.h"
5 #include "monotonic_vector.h"
6 #include <map>
7 
8 namespace hgps {
9 
16  public:
17  RelativeRiskLookup() = delete;
18 
25  core::FloatArray2D &&values);
26 
29  std::size_t size() const noexcept;
30 
33  std::size_t rows() const noexcept;
34 
37  std::size_t columns() const noexcept;
38 
41  bool empty() const noexcept;
42 
48  float at(const int age, const float value) const;
49 
55  float operator()(const int age, const float value) const;
56 
61  bool contains(const int age, const float value) const noexcept;
62 
63  private:
64  core::FloatArray2D table_;
65  std::map<int, int> rows_index_;
66  std::map<float, int> cols_index_;
67 
68  float lookup_value(const int age, const float value) const noexcept;
69 };
70 
72 using RelativeRiskTableMap = std::map<core::Identifier, FloatAgeGenderTable>;
73 
76  std::map<core::Identifier, std::map<core::Gender, RelativeRiskLookup>>;
77 
79 struct RelativeRisk {
82 
85 };
86 } // namespace hgps
Defines the age and gender lookup table data type.
Definition: gender_table.h:120
Defines a monotonic vector container type.
Definition: monotonic_vector.h:42
Defines the relative risk factors lookup data type.
Definition: relative_risk.h:15
std::size_t size() const noexcept
Gets the number of elements in the lookup dataset.
Definition: relative_risk.cpp:24
float at(const int age, const float value) const
Lookup a value at specific breakpoints with bounds checking.
Definition: relative_risk.cpp:34
bool empty() const noexcept
Checks if the lookup has no data.
Definition: relative_risk.cpp:30
std::size_t rows() const noexcept
Gets the number of rows lookup breakpoints.
Definition: relative_risk.cpp:26
bool contains(const int age, const float value) const noexcept
Checks if the lookup contains a value with specific breakpoints.
Definition: relative_risk.cpp:42
std::size_t columns() const noexcept
Gets the number of columns lookup breakpoints.
Definition: relative_risk.cpp:28
Defines a contiguous storage for two-dimensional numerical data in row-major format.
Definition: array2d.h:15
Array2D< float > FloatArray2D
Contiguous storage for two-dimensional single precision values.
Definition: array2d.h:139
Gender
Enumerates gender types.
Definition: forward_type.h:18
Top-level namespace for Health-GPS C++ API.
Definition: analysis_definition.h:8
std::map< core::Identifier, FloatAgeGenderTable > RelativeRiskTableMap
Defines the relative risk factor table type.
Definition: relative_risk.h:72
std::map< core::Identifier, std::map< core::Gender, RelativeRiskLookup > > RelativeRiskLookupMap
Defines the relative risk factor lookup type.
Definition: relative_risk.h:76
Global namespace.
Definition: jsonparser.h:88
Defines the relative risk factors data type.
Definition: relative_risk.h:79
RelativeRiskLookupMap risk_factors
Risk factor to diseases relative risk values.
Definition: relative_risk.h:84
RelativeRiskTableMap diseases
Disease to diseases relative risk values.
Definition: relative_risk.h:81