Health-GPS 3.0.0.0
Global Health Policy Simulation model (Health-GPS)
Loading...
Searching...
No Matches
hgps::Person Struct Reference

Defines a virtual population person data type. More...

#include <person.h>

Public Member Functions

 Person ()
 Initialise a new instance without an assigned ID (unassigned_id).
 
 Person (const core::Gender gender) noexcept
 Initialise a new instance with gender; ID remains unassigned_id until Population placement.
 
 Person (std::size_t id) noexcept
 Initialise a new instance with an explicit ID (Population initial cohort / entrants).
 
 Person (const core::Gender gender, std::size_t id) noexcept
 Initialise a new instance with gender and explicit ID (Population newborns).
 
void set_id (std::size_t id) noexcept
 Set the person identifier (Population use when placing or recycling slots).
 
bool has_assigned_id () const noexcept
 Whether Population has assigned a lifetime ID to this instance.
 
std::size_t id () const noexcept
 Gets this instance unique identifier.
 
bool is_alive () const noexcept
 Determine if a Person is current alive.
 
bool has_emigrated () const noexcept
 Determine if a Person has emigrated from the population.
 
unsigned int time_of_death () const noexcept
 Gets the time of death, for dead, non-alive individuals only.
 
unsigned int time_of_migration () const noexcept
 Gets the time of migration, for emigrated individuals only.
 
bool is_active () const noexcept
 Gets a value indicating whether a Person is current active in the population.
 
double get_risk_factor_value (const core::Identifier &key) const
 Gets a risk factor current value.
 
float gender_to_value () const
 Gets the gender enumeration as a number for analysis.
 
std::string gender_to_string () const
 Gets the gender enumeration name string.
 
bool over_18 () const noexcept
 Check if person is an adult (18 or over)
 
float sector_to_value () const
 Gets the sector enumeration as a number.
 
float income_to_value () const
 Gets the income enumeration as a number.
 
float region_to_value () const
 Gets the region as a numeric value for analysis.
 
float ethnicity_to_value () const
 Gets the ethnicity as a numeric value for analysis.
 
void emigrate (const unsigned int time)
 Emigrate this instance from the virtual population.
 
void die (const unsigned int time)
 Mark this instance as dead.
 

Static Public Member Functions

static float gender_to_value (core::Gender gender)
 Gets the gender enumeration as a number for analysis.
 

Public Attributes

core::Gender gender {core::Gender::unknown}
 The assigned gender.
 
unsigned int age {}
 Current age in years.
 
core::Sector sector {core::Sector::unknown}
 Sector (region) assigned value.
 
std::string region {"unknown"}
 Region category (dynamically assigned from CSV)
 
std::string ethnicity {"unknown"}
 Ethnicity category (dynamically assigned from CSV)
 
core::Income income {core::Income::unknown}
 Income category.
 
double income_continuous {0.0}
 Continuous income value (for FINCH approach)
 
std::size_t income_adjustment_stratum {0}
 Income adjustment stratum index (0..N-1) for optional stratum-specific factors mean.
 
bool has_income_adjustment_stratum {false}
 Whether income_adjustment_stratum has been assigned for this simulation step.
 
double physical_activity {0.0}
 Physical activity level.
 
double ses {}
 Social-economic status (SES) assigned value.
 
std::map< core::Identifier, double > risk_factors
 Current risk factors values.
 
std::map< core::Identifier, Diseasediseases
 Diseases history and current status.
 

Static Public Attributes

static constexpr std::size_t unassigned_id = 0
 Sentinel returned by default constructors until Population assigns an ID.
 

Detailed Description

Defines a virtual population person data type.

Constructor & Destructor Documentation

◆ Person() [1/4]

hgps::Person::Person ( )
default

Initialise a new instance without an assigned ID (unassigned_id).

◆ Person() [2/4]

hgps::Person::Person ( const core::Gender  gender)
noexcept

Initialise a new instance with gender; ID remains unassigned_id until Population placement.

Parameters
genderThe new person gender

◆ Person() [3/4]

hgps::Person::Person ( std::size_t  id)
noexcept

Initialise a new instance with an explicit ID (Population initial cohort / entrants).

Parameters
idLifetime-unique identifier assigned by Population.

◆ Person() [4/4]

hgps::Person::Person ( const core::Gender  gender,
std::size_t  id 
)
noexcept

Initialise a new instance with gender and explicit ID (Population newborns).

Parameters
genderThe new person gender
idLifetime-unique identifier assigned by Population.

Member Function Documentation

◆ die()

void hgps::Person::die ( const unsigned int  time)

Mark this instance as dead.

Parameters
timeDeath time
Exceptions
std::logic_errorfor attempting to set to non-active individuals.
Here is the call graph for this function:

◆ emigrate()

void hgps::Person::emigrate ( const unsigned int  time)

Emigrate this instance from the virtual population.

Parameters
timeMigration time
Exceptions
std::logic_errorfor attempting to set to non-active individuals.
Here is the call graph for this function:

◆ ethnicity_to_value()

float hgps::Person::ethnicity_to_value ( ) const

Gets the ethnicity as a numeric value for analysis.

Returns
The ethnicity value converted to a number based on CSV order
Exceptions
HgpsExceptionif ethnicity is unknown

◆ gender_to_string()

std::string hgps::Person::gender_to_string ( ) const

Gets the gender enumeration name string.

Returns
The gender name
Exceptions
HgpsExceptionif gender is unknown

◆ gender_to_value() [1/2]

float hgps::Person::gender_to_value ( ) const

Gets the gender enumeration as a number for analysis.

Returns
The gender associated value
Exceptions
HgpsExceptionif gender is unknown
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gender_to_value() [2/2]

float hgps::Person::gender_to_value ( core::Gender  gender)
static

Gets the gender enumeration as a number for analysis.

Parameters
genderThe gender to convert to a value
Returns
The gender associated value
Exceptions
HgpsExceptionif gender is unknown

◆ get_risk_factor_value()

double hgps::Person::get_risk_factor_value ( const core::Identifier key) const

Gets a risk factor current value.

Parameters
keyThe risk factor identifier
Returns
Current risk factor value, if found
Exceptions
std::out_of_rangefor unknown risk factor
Here is the call graph for this function:
Here is the caller graph for this function:

◆ has_assigned_id()

bool hgps::Person::has_assigned_id ( ) const
inlinenoexcept

Whether Population has assigned a lifetime ID to this instance.

◆ has_emigrated()

bool hgps::Person::has_emigrated ( ) const
noexcept

Determine if a Person has emigrated from the population.

Returns
true for current emigrated; otherwise, false.

◆ id()

std::size_t hgps::Person::id ( ) const
noexcept

Gets this instance unique identifier.

Note
Unique for the person's lifetime within one Population (simulation run). IDs are not reused after death or emigration. Default-constructed persons return unassigned_id until placed by Population.
Returns
Unique identifier
Here is the caller graph for this function:

◆ income_to_value()

float hgps::Person::income_to_value ( ) const

Gets the income enumeration as a number.

Returns
The income value (low = 1, middle = 2, high = 3)
Exceptions
HgpsExceptionif income is unknown

◆ is_active()

bool hgps::Person::is_active ( ) const
noexcept

Gets a value indicating whether a Person is current active in the population.

Note
A person is active only if still alive and has not emigrated.
Returns
true for active; otherwise, false.
Here is the caller graph for this function:

◆ is_alive()

bool hgps::Person::is_alive ( ) const
noexcept

Determine if a Person is current alive.

Returns
true for alive; otherwise, false

◆ over_18()

bool hgps::Person::over_18 ( ) const
noexcept

Check if person is an adult (18 or over)

Returns
true if person is 18 or over; else false

◆ region_to_value()

float hgps::Person::region_to_value ( ) const

Gets the region as a numeric value for analysis.

Returns
The region value converted to a number based on CSV order
Exceptions
HgpsExceptionif region is unknown

◆ sector_to_value()

float hgps::Person::sector_to_value ( ) const

Gets the sector enumeration as a number.

Returns
The sector value (0 for urban, 1 for rural)
Exceptions
HgpsExceptionif sector is unknown

◆ set_id()

void hgps::Person::set_id ( std::size_t  id)
noexcept

Set the person identifier (Population use when placing or recycling slots).

Parameters
idLifetime-unique identifier; must not reuse a previously assigned population ID.

◆ time_of_death()

unsigned int hgps::Person::time_of_death ( ) const
noexcept

Gets the time of death, for dead, non-alive individuals only.

Returns
Time of death value

◆ time_of_migration()

unsigned int hgps::Person::time_of_migration ( ) const
noexcept

Gets the time of migration, for emigrated individuals only.

Returns
Time of emigration value

Member Data Documentation

◆ age

unsigned int hgps::Person::age {}

Current age in years.

◆ diseases

std::map<core::Identifier, Disease> hgps::Person::diseases

Diseases history and current status.

◆ ethnicity

std::string hgps::Person::ethnicity {"unknown"}

Ethnicity category (dynamically assigned from CSV)

◆ gender

core::Gender hgps::Person::gender {core::Gender::unknown}

The assigned gender.

◆ has_income_adjustment_stratum

bool hgps::Person::has_income_adjustment_stratum {false}

Whether income_adjustment_stratum has been assigned for this simulation step.

◆ income

core::Income hgps::Person::income {core::Income::unknown}

Income category.

◆ income_adjustment_stratum

std::size_t hgps::Person::income_adjustment_stratum {0}

Income adjustment stratum index (0..N-1) for optional stratum-specific factors mean.

This is separate from final income categories (3/4) used for reporting.

◆ income_continuous

double hgps::Person::income_continuous {0.0}

Continuous income value (for FINCH approach)

◆ physical_activity

double hgps::Person::physical_activity {0.0}

Physical activity level.

◆ region

std::string hgps::Person::region {"unknown"}

Region category (dynamically assigned from CSV)

◆ risk_factors

std::map<core::Identifier, double> hgps::Person::risk_factors

Current risk factors values.

◆ sector

core::Sector hgps::Person::sector {core::Sector::unknown}

Sector (region) assigned value.

◆ ses

double hgps::Person::ses {}

Social-economic status (SES) assigned value.

◆ unassigned_id

constexpr std::size_t hgps::Person::unassigned_id = 0
staticconstexpr

Sentinel returned by default constructors until Population assigns an ID.


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