Health-GPS  1.2.2.0
Global Health Policy Simulation model (Health-GPS)
hgps::data::DataManager Class Reference

Implements Health-GPS back-end data store interface using a file-based storage. More...

#include <datamanager.h>

Inheritance diagram for hgps::data::DataManager:
[legend]
Collaboration diagram for hgps::data::DataManager:
[legend]

Public Member Functions

 DataManager ()=delete
 
 DataManager (const std::filesystem::path root_directory, VerboseMode verbosity=VerboseMode::none)
 Initialises a new instance of the hgps::data::DataManager class. More...
 
std::vector< Countryget_countries () const override
 Gets the full collection of countries in the store. More...
 
std::optional< Countryget_country (std::string alpha) const override
 Gets a single country by the alpha code. More...
 
std::vector< PopulationItemget_population (Country country) const
 
std::vector< PopulationItemget_population (Country country, const std::function< bool(const unsigned int &)> time_filter) const override
 Gets the population growth trend for a country filtered by time. More...
 
std::vector< MortalityItemget_mortality (Country country) const
 
std::vector< MortalityItemget_mortality (Country country, const std::function< bool(const unsigned int &)> time_filter) const override
 Gets the population mortality trend for a country filtered by time. More...
 
std::vector< DiseaseInfoget_diseases () const override
 Gets the collection of diseases information in the store. More...
 
std::optional< DiseaseInfoget_disease_info (core::Identifier code) const override
 Gets a single disease information by identifier. More...
 
DiseaseEntity get_disease (DiseaseInfo code, Country country) const override
 Gets a disease full definition by identifier for a country. More...
 
RelativeRiskEntity get_relative_risk_to_disease (DiseaseInfo source, DiseaseInfo target) const override
 Gets the relative risk effects for disease to disease interactions. More...
 
RelativeRiskEntity get_relative_risk_to_risk_factor (DiseaseInfo source, Gender gender, core::Identifier risk_factor_key) const override
 Gets the relative risk effects for risk factor to disease interactions. More...
 
CancerParameterEntity get_disease_parameter (DiseaseInfo info, Country country) const override
 Gets the parameters required by cancer type diseases for a country. More...
 
DiseaseAnalysisEntity get_disease_analysis (const Country country) const override
 Gets the Burden of Diseases (BoD) analysis dataset for a country. More...
 
std::vector< BirthItemget_birth_indicators (const Country country) const
 
std::vector< BirthItemget_birth_indicators (const Country country, const std::function< bool(const unsigned int &)> time_filter) const override
 Gets the population birth indicators for a country filtered by time. More...
 
std::vector< LmsDataRowget_lms_parameters () const override
 Gets the LMS (lambda-mu-sigma) parameters for childhood growth charts. More...
 
- Public Member Functions inherited from hgps::core::Datastore
virtual ~Datastore ()=default
 Destroys a Datastore instance. More...
 

Detailed Description

Implements Health-GPS back-end data store interface using a file-based storage.

The storage is based on a folder structure and indexed by a file, index.json, with a versioned schema defining the storage sub-folders structure, file names, data limits, metadata, and rules for accessing the stored contents.

Note
To avoid storing disease-disease interaction files filled with a default value representing no relative risk effect, the default value is defined in the index file, and the respective dataset populated at run-time with the default value when the an associated file does not exists in the store.
See also
https://imperialchepi.github.io/healthgps/datamodel for the Data Model details.

Constructor & Destructor Documentation

◆ DataManager() [1/2]

hgps::data::DataManager::DataManager ( )
delete

◆ DataManager() [2/2]

hgps::data::DataManager::DataManager ( const std::filesystem::path  root_directory,
VerboseMode  verbosity = VerboseMode::none 
)
explicit

Initialises a new instance of the hgps::data::DataManager class.

Parameters
root_directoryThe store root folder containing the index.json file.
verbosityThe terminal logging verbosity mode to use.
Exceptions
std::invalid_argumentif the given folder does exists or contains the index.json file.
std::runtime_errorfor invalid or unsupported index.json file schema version.

Member Function Documentation

◆ get_birth_indicators() [1/2]

std::vector< BirthItem > hgps::data::DataManager::get_birth_indicators ( const Country  country) const

◆ get_birth_indicators() [2/2]

std::vector< BirthItem > hgps::data::DataManager::get_birth_indicators ( const Country  country,
const std::function< bool(const unsigned int &)>  time_filter 
) const
overridevirtual

Gets the population birth indicators for a country filtered by time.

Parameters
countryThe target country definition
time_filterThe time filter predicate, e.g. years range
Returns
The resulting list of birth indicator items

Implements hgps::core::Datastore.

◆ get_countries()

std::vector< Country > hgps::data::DataManager::get_countries ( ) const
overridevirtual

Gets the full collection of countries in the store.

Returns
The list of countries

Implements hgps::core::Datastore.

Here is the caller graph for this function:

◆ get_country()

std::optional< Country > hgps::data::DataManager::get_country ( std::string  alpha) const
overridevirtual

Gets a single country by the alpha code.

Parameters
alphaThe country alpha 2 or 3 format code to search
Returns
The country's definition, if found, otherwise empty

Implements hgps::core::Datastore.

Here is the call graph for this function:

◆ get_disease()

DiseaseEntity hgps::data::DataManager::get_disease ( DiseaseInfo  info,
Country  country 
) const
overridevirtual

Gets a disease full definition by identifier for a country.

Parameters
infoThe target disease information
countryThe target country definition
Returns
The disease definition, check empty() = true for missing data.

Implements hgps::core::Datastore.

Here is the call graph for this function:

◆ get_disease_analysis()

DiseaseAnalysisEntity hgps::data::DataManager::get_disease_analysis ( const Country  country) const
overridevirtual

Gets the Burden of Diseases (BoD) analysis dataset for a country.

Parameters
countryThe target country definition
Returns
The BoD analysis data, check empty() = true for missing data.

Implements hgps::core::Datastore.

◆ get_disease_info()

std::optional< DiseaseInfo > hgps::data::DataManager::get_disease_info ( core::Identifier  code) const
overridevirtual

Gets a single disease information by identifier.

Parameters
codeThe target disease identifier
Returns
The disease information, if found, otherwise empty

Implements hgps::core::Datastore.

Here is the call graph for this function:

◆ get_disease_parameter()

CancerParameterEntity hgps::data::DataManager::get_disease_parameter ( DiseaseInfo  info,
Country  country 
) const
overridevirtual

Gets the parameters required by cancer type diseases for a country.

Parameters
infoThe disease of type cancer information
countryThe target country definition
Returns
The cancer parameters, check empty() = true for missing data.
Exceptions
std::out_of_rangefor unknown disease parameter file type.

Implements hgps::core::Datastore.

◆ get_diseases()

std::vector< DiseaseInfo > hgps::data::DataManager::get_diseases ( ) const
overridevirtual

Gets the collection of diseases information in the store.

Returns
The list of diseases defined

Implements hgps::core::Datastore.

Here is the call graph for this function:

◆ get_lms_parameters()

std::vector< LmsDataRow > hgps::data::DataManager::get_lms_parameters ( ) const
overridevirtual

Gets the LMS (lambda-mu-sigma) parameters for childhood growth charts.

Returns
The parameters for the LMS model

Implements hgps::core::Datastore.

◆ get_mortality() [1/2]

std::vector< MortalityItem > hgps::data::DataManager::get_mortality ( Country  country) const

◆ get_mortality() [2/2]

std::vector< MortalityItem > hgps::data::DataManager::get_mortality ( Country  country,
const std::function< bool(const unsigned int &)>  time_filter 
) const
overridevirtual

Gets the population mortality trend for a country filtered by time.

Parameters
countryThe target country definition
time_filterThe time filter predicate, e.g., years range
Returns
The resulting list of mortality trend items

Implements hgps::core::Datastore.

◆ get_population() [1/2]

std::vector< PopulationItem > hgps::data::DataManager::get_population ( Country  country) const

◆ get_population() [2/2]

std::vector< PopulationItem > hgps::data::DataManager::get_population ( Country  country,
const std::function< bool(const unsigned int &)>  time_filter 
) const
overridevirtual

Gets the population growth trend for a country filtered by time.

Parameters
countryThe target country definition
time_filterThe time filter predicate, e.g., years range
Returns
The resulting list of population trend items

Implements hgps::core::Datastore.

◆ get_relative_risk_to_disease()

RelativeRiskEntity hgps::data::DataManager::get_relative_risk_to_disease ( DiseaseInfo  source,
DiseaseInfo  target 
) const
overridevirtual

Gets the relative risk effects for disease to disease interactions.

Parameters
sourceThe source disease information
targetThe target disease information
Returns
The disease-disease effects, check empty() = true for missing data.

Implements hgps::core::Datastore.

Here is the call graph for this function:

◆ get_relative_risk_to_risk_factor()

RelativeRiskEntity hgps::data::DataManager::get_relative_risk_to_risk_factor ( DiseaseInfo  source,
Gender  gender,
core::Identifier  risk_factor_key 
) const
overridevirtual

Gets the relative risk effects for risk factor to disease interactions.

Parameters
sourceThe disease information
genderThe gender enumeration
risk_factor_keyThe risk factor identifier
Returns
The risk factor-disease effects, check empty() = true for missing data.

Implements hgps::core::Datastore.

Here is the call graph for this function:

The documentation for this class was generated from the following files: