Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
hgps::input::DataManager Class Reference

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

#include <datamanager.h>

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

Public Member Functions

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

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::input::DataManager::DataManager ( )
delete

◆ DataManager() [2/2]

hgps::input::DataManager::DataManager ( std::filesystem::path  data_path,
VerboseMode  verbosity = VerboseMode::none 
)
explicit

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

Parameters
data_pathThe path to the directory containing the data.
verbosityThe terminal logging verbosity mode to use.
Exceptions
std::invalid_argumentif the root directory or index.json is missing.
std::runtime_errorfor invalid or unsupported index.json file schema version.

Member Function Documentation

◆ get_birth_indicators() [1/2]

std::vector< BirthItem > hgps::input::DataManager::get_birth_indicators ( const Country country) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_birth_indicators() [2/2]

std::vector< BirthItem > hgps::input::DataManager::get_birth_indicators ( const Country country,
std::function< bool(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::input::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()

Country hgps::input::DataManager::get_country ( const 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

Implements hgps::core::Datastore.

Here is the call graph for this function:

◆ get_disease()

DiseaseEntity hgps::input::DataManager::get_disease ( const DiseaseInfo info,
const 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

Implements hgps::core::Datastore.

Here is the call graph for this function:

◆ get_disease_analysis()

DiseaseAnalysisEntity hgps::input::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

Implements hgps::core::Datastore.

◆ get_disease_info()

DiseaseInfo hgps::input::DataManager::get_disease_info ( const core::Identifier code) const
overridevirtual

Gets a single disease information by identifier.

Parameters
codeThe target disease identifier
Returns
The disease information

Implements hgps::core::Datastore.

Here is the call graph for this function:

◆ get_disease_parameter()

CancerParameterEntity hgps::input::DataManager::get_disease_parameter ( const DiseaseInfo info,
const 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
Exceptions
std::out_of_rangefor unknown disease parameter file type.

Implements hgps::core::Datastore.

◆ get_diseases()

std::vector< DiseaseInfo > hgps::input::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::input::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::input::DataManager::get_mortality ( const Country country) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_mortality() [2/2]

std::vector< MortalityItem > hgps::input::DataManager::get_mortality ( const Country country,
std::function< bool(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_pif_data()

std::optional< PIFData > hgps::input::DataManager::get_pif_data ( const DiseaseInfo disease_info,
const Country country,
const nlohmann::json &  pif_config 
) const

Gets PIF data for a specific disease.

Parameters
disease_infoThe disease information
countryThe country
pif_configPIF configuration from config.json
Returns
PIF data for the disease, or std::nullopt if not available
Here is the call graph for this function:

◆ get_population() [1/2]

std::vector< PopulationItem > hgps::input::DataManager::get_population ( const Country country) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_population() [2/2]

std::vector< PopulationItem > hgps::input::DataManager::get_population ( const Country country,
std::function< bool(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()

std::optional< RelativeRiskEntity > hgps::input::DataManager::get_relative_risk_to_disease ( const DiseaseInfo source,
const 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 or std::nullopt if file doesn't exist or only contains default values

Implements hgps::core::Datastore.

Here is the call graph for this function:

◆ get_relative_risk_to_risk_factor()

std::optional< RelativeRiskEntity > hgps::input::DataManager::get_relative_risk_to_risk_factor ( const DiseaseInfo source,
Gender  gender,
const 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 or std::nullopt if data missing

Implements hgps::core::Datastore.

Here is the call graph for this function:

◆ get_root_path()

const std::filesystem::path & hgps::input::DataManager::get_root_path ( ) const
inlinenoexcept

Get the root data directory path.

Returns
The root data directory path

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