Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
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
8namespace hgps {
9
16 public:
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
60 bool contains_age(const int age) const noexcept;
61
66 bool contains(const int age, const float value) const noexcept;
67
68 private:
69 core::FloatArray2D table_;
70 std::map<int, int> rows_index_;
71 std::map<float, int> cols_index_;
72
73 float lookup_value(const int age, const float value) const;
74};
75
78
81 std::map<core::Identifier, std::map<core::Gender, RelativeRiskLookup>>;
82
91float require_relative_risk(const RelativeRiskLookup &lookup, const core::Identifier &factor,
92 int age, core::Gender gender, float value);
93
102} // namespace hgps
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:40
bool contains_age(const int age) const noexcept
True when the table has a row for this age.
Definition relative_risk.cpp:58
float at(const int age, const float value) const
Lookup a value at specific breakpoints with bounds checking.
Definition relative_risk.cpp:50
bool empty() const noexcept
Checks if the lookup has no data.
Definition relative_risk.cpp:46
std::size_t rows() const noexcept
Gets the number of rows lookup breakpoints.
Definition relative_risk.cpp:42
bool contains(const int age, const float value) const noexcept
Checks if the lookup contains a value with specific breakpoints.
Definition relative_risk.cpp:62
std::size_t columns() const noexcept
Gets the number of columns lookup breakpoints.
Definition relative_risk.cpp:44
Top-level namespace for Health-GPS Core C++ API.
Definition analysis.h:7
Array2D< float > FloatArray2D
Contiguous storage for two-dimensional single precision values.
Definition array2d.h:139
Top-level namespace for Health-GPS Console host application.
Definition command_options.cpp:9
std::map< core::Identifier, std::map< core::Gender, RelativeRiskLookup > > RelativeRiskLookupMap
Defines the relative risk factor lookup type.
Definition relative_risk.h:80
float require_relative_risk(const RelativeRiskLookup &lookup, const core::Identifier &factor, int age, core::Gender gender, float value)
Read one relative-risk cell, or throw a message that names the factor, age, and sex.
Definition relative_risk.cpp:70
std::map< core::Identifier, FloatAgeGenderTable > RelativeRiskTableMap
Defines the relative risk factor table type.
Definition relative_risk.h:77
AgeGenderTable< float > FloatAgeGenderTable
Age and Gender lookup table for single precision floating-point values.
Definition gender_table.h:180
Global namespace.
Definition column_iterator.h:123
Defines the relative risk factors data type.
Definition relative_risk.h:95
RelativeRiskLookupMap risk_factors
Risk factor to diseases relative risk values.
Definition relative_risk.h:100
RelativeRiskTableMap diseases
Disease to diseases relative risk values.
Definition relative_risk.h:97