Infection Class Reference

CPP API: mio::abm::Infection Class Reference

#include <infection.h>

Collaboration diagram for mio::abm::Infection:

Public Member Functions

auto default_serialize ()
 This method is used by the default serialization feature. More...
 
InfectionState get_infection_state (TimePoint t) const
 Get the InfectionState of the Infection. More...
 
TimePoint get_start_date () const
 
ScalarType get_viral_load (TimePoint t) const
 Gets the ViralLoad of the Infection at a given TimePoint. More...
 
ScalarType get_viral_shed (TimePoint t) const
 Get viral shed at a specific time. More...
 
VirusVariant get_virus_variant () const
 : Get VirusVariant. More...
 
 Infection (PersonalRandomNumberGenerator &rng, VirusVariant virus, AgeGroup age, const Parameters &params, TimePoint init_date, InfectionState init_state, const InitialInfectionStateDistribution &init_state_dist, ProtectionEvent latest_protection={ProtectionType::NoProtection, TimePoint(0)}, bool detected=false)
 Create an Infection for a single Person with a time spent in the given initial state that is drawn from the given distribution. More...
 
 Infection (PersonalRandomNumberGenerator &rng, VirusVariant virus, AgeGroup age, const Parameters &params, TimePoint start_date, InfectionState start_state=InfectionState::Exposed, ProtectionEvent latest_protection={ProtectionType::NoProtection, TimePoint(0)}, bool detected=false)
 Create an Infection for a single Person. More...
 
bool is_detected () const
 
void set_detected ()
 Set the Infection to detected. More...
 

Private Member Functions

ScalarType calculate_death_probability (AgeGroup age, const Parameters &params) const
 Calculate the overall death probability for the infection. More...
 
TimePoint draw_infection_course_backward (PersonalRandomNumberGenerator &rng, AgeGroup age, const Parameters &params, TimePoint init_date, InfectionState init_state)
 Determine Infection course prior to the given InfectionState start_state. More...
 
void draw_infection_course_forward (PersonalRandomNumberGenerator &rng, AgeGroup age, const Parameters &params, TimePoint init_date, InfectionState init_state, ProtectionEvent latest_protection)
 Determine Infection course subsequent to the given InfectionState start_state. More...
 
StateTransition get_backward_transition (PersonalRandomNumberGenerator &rng, AgeGroup age, const Parameters &params, InfectionState current_state) const
 Get the backward transition from a given infection state. More...
 
StateTransition get_dead_backward_transition (PersonalRandomNumberGenerator &rng, AgeGroup age, const Parameters &params) const
 Get the backward transition from dead state. More...
 
StateTransition get_forward_transition (PersonalRandomNumberGenerator &rng, AgeGroup age, const Parameters &params, InfectionState current_state, TimePoint current_time, ProtectionEvent latest_protection) const
 Get the forward transition from a given infection state. More...
 
StateTransition get_recovered_backward_transition (PersonalRandomNumberGenerator &rng, AgeGroup age, const Parameters &params) const
 Get the backward transition from recovered state. More...
 
ScalarType get_severity_protection_factor (const Parameters &params, ProtectionEvent latest_protection, AgeGroup age, TimePoint current_time) const
 Get the severity protection factor based on latest protection. More...
 
 Infection ()=default
 
void initialize_viral_load (PersonalRandomNumberGenerator &rng, VirusVariant virus, AgeGroup age, const Parameters &params, ProtectionEvent latest_protection)
 Initialize the viral load parameters for the infection. More...
 
void initialize_viral_shed (PersonalRandomNumberGenerator &rng, VirusVariant virus, AgeGroup age, const Parameters &params)
 Initialize the viral shed parameters and individual factor for the infection. More...
 

Private Attributes

friend DefaultFactory< Infection >
 
bool m_detected
 Whether an Infection is detected or not. More...
 
ScalarType m_individual_viral_shed_factor
 Individual viral shed factor. More...
 
std::vector< std::pair< TimePoint, InfectionState > > m_infection_course
 Start date of each InfectionState. More...
 
ScalarType m_log_norm_alpha
 
ScalarType m_log_norm_beta
 Parameters for the viral shed mapping, which is modelled through an invlogit function. More...
 
ViralLoad m_viral_load
 ViralLoad of the Infection. More...
 
VirusVariant m_virus_variant
 Variant of the Infection. More...
 

Constructor & Destructor Documentation

◆ Infection() [1/3]

mio::abm::Infection::Infection ( PersonalRandomNumberGenerator rng,
VirusVariant  virus,
AgeGroup  age,
const Parameters params,
TimePoint  start_date,
InfectionState  start_state = InfectionState::Exposed,
ProtectionEvent  latest_protection = {ProtectionType::NoProtectionTimePoint(0)},
bool  detected = false 
)

Create an Infection for a single Person.

Draws a random infection course.

Parameters
[in,out]rngPersonalRandomNumberGenerator of the Person.
[in]virusVirus type of the Infection.
[in]ageAgeGroup to determine the ViralLoad course.
[in]paramsParameters of the Model.
[in]init_dateDate of initializing the Infection.
[in]init_state[Default: InfectionState::Exposed] InfectionState at time of initializing the Infection.
[in]latest_protection[Default: {ProtectionType::NoProtection, TimePoint(0)}] The pair value of last ProtectionType (previous Infection/Vaccination) and TimePoint of that protection.
[in]detected[Default: false] If the Infection is detected.

◆ Infection() [2/3]

mio::abm::Infection::Infection ( PersonalRandomNumberGenerator rng,
VirusVariant  virus,
AgeGroup  age,
const Parameters params,
TimePoint  init_date,
InfectionState  init_state,
const InitialInfectionStateDistribution init_state_dist,
ProtectionEvent  latest_protection = {ProtectionType::NoProtectionTimePoint(0)},
bool  detected = false 
)

Create an Infection for a single Person with a time spent in the given initial state that is drawn from the given distribution.

Parameters
[in,out]rngPersonalRandomNumberGenerator of the Person.
[in]virusVirus type of the Infection.
[in]ageAgeGroup to determine the ViralLoad course.
[in]paramsParameters of the Model.
[in]init_dateDate of initializing the Infection.
[in]init_stateInfectionState at time of initializing the Infection.
[in]init_state_distDistribution to draw the relative time spent in the initial state from. Values have to be within [0, 1].
[in]latest_protectionThe pair value of last ProtectionType (previous Infection/Vaccination) and TimePoint of that protection.
[in]detectedIf the Infection is detected.

◆ Infection() [3/3]

mio::abm::Infection::Infection ( )
privatedefault

Member Function Documentation

◆ calculate_death_probability()

ScalarType mio::abm::Infection::calculate_death_probability ( AgeGroup  age,
const Parameters params 
) const
private

Calculate the overall death probability for the infection.

Parameters
[in]ageAgeGroup of the Person.
[in]paramsParameters of the Model.
Returns
The probability of death for this infection.

◆ default_serialize()

auto mio::abm::Infection::default_serialize ( )
inline

This method is used by the default serialization feature.

◆ draw_infection_course_backward()

TimePoint mio::abm::Infection::draw_infection_course_backward ( PersonalRandomNumberGenerator rng,
AgeGroup  age,
const Parameters params,
TimePoint  init_date,
InfectionState  init_state 
)
private

Determine Infection course prior to the given InfectionState start_state.

From the start_state, a random path through the InfectionState tree is chosen backwards, until Susceptible is reached. For more detailed information, refer to draw_infection_course_forward.

Parameters
[in,out]rngPersonalRandomNumberGenerator of the Person.
[in]ageAgeGroup of the person.
[in]paramsParameters of the Model.
[in]init_dateDate of initializing the Infection.
[in]init_stateInfectionState at time of initializing the Infection.
Returns
The starting date of the Infection.

◆ draw_infection_course_forward()

void mio::abm::Infection::draw_infection_course_forward ( PersonalRandomNumberGenerator rng,
AgeGroup  age,
const Parameters params,
TimePoint  init_date,
InfectionState  init_state,
ProtectionEvent  latest_protection 
)
private

Determine Infection course subsequent to the given InfectionState start_state.

From the start_state, a random path through the InfectionState tree is chosen, that is Susceptible -> InfectedNoSymptoms, InfectedNoSymptoms -> InfectedSymptoms or InfectedNoSymptoms -> Recovered, InfectedSymptoms -> Infected_Severe or InfectedSymptoms -> Recovered, InfectedSevere -> InfectedCritical or InfectedSevere -> Recovered or InfectedSevere -> Dead, InfectedCritical -> Recovered or InfectedCritical -> Dead, until either Recoverd or Dead is reached. The duration in each InfectionState is taken from the respective parameter.

Parameters
[in,out]rngPersonalRandomNumberGenerator of the Person.
[in]ageAgeGroup of the Person.
[in]paramsParameters of the Model.
[in]init_dateDate of initializing the Infection.
[in]init_stateInfectionState at time of initializing the Infection.
[in]latest_protectionLatest protection against Infection, has an influence on transition probabilities.

◆ get_backward_transition()

StateTransition mio::abm::Infection::get_backward_transition ( PersonalRandomNumberGenerator rng,
AgeGroup  age,
const Parameters params,
InfectionState  current_state 
) const
private

Get the backward transition from a given infection state.

Parameters
[in,out]rngPersonalRandomNumberGenerator of the Person.
[in]ageAgeGroup of the Person.
[in]paramsParameters of the Model.
[in]current_stateCurrent infection state.
Returns
StateTransition representing the previous transition.

◆ get_dead_backward_transition()

StateTransition mio::abm::Infection::get_dead_backward_transition ( PersonalRandomNumberGenerator rng,
AgeGroup  age,
const Parameters params 
) const
private

Get the backward transition from dead state.

Parameters
[in,out]rngPersonalRandomNumberGenerator of the Person.
[in]ageAgeGroup of the Person.
[in]paramsParameters of the Model.
Returns
StateTransition representing the transition that led to death.

◆ get_forward_transition()

StateTransition mio::abm::Infection::get_forward_transition ( PersonalRandomNumberGenerator rng,
AgeGroup  age,
const Parameters params,
InfectionState  current_state,
TimePoint  current_time,
ProtectionEvent  latest_protection 
) const
private

Get the forward transition from a given infection state.

Parameters
[in,out]rngPersonalRandomNumberGenerator of the Person.
[in]ageAgeGroup of the Person.
[in]paramsParameters of the Model.
[in]current_stateCurrent infection state.
[in]current_timeCurrent time point.
[in]latest_protectionLatest protection against Infection.
Returns
StateTransition representing the next transition.

◆ get_infection_state()

InfectionState mio::abm::Infection::get_infection_state ( TimePoint  t) const

Get the InfectionState of the Infection.

Parameters
[in]tTimePoint of the querry.
Returns
InfectionState at the given TimePoint.

◆ get_recovered_backward_transition()

StateTransition mio::abm::Infection::get_recovered_backward_transition ( PersonalRandomNumberGenerator rng,
AgeGroup  age,
const Parameters params 
) const
private

Get the backward transition from recovered state.

Parameters
[in,out]rngPersonalRandomNumberGenerator of the Person.
[in]ageAgeGroup of the Person.
[in]paramsParameters of the Model.
Returns
StateTransition representing the transition that led to recovery.

◆ get_severity_protection_factor()

ScalarType mio::abm::Infection::get_severity_protection_factor ( const Parameters params,
ProtectionEvent  latest_protection,
AgeGroup  age,
TimePoint  current_time 
) const
private

Get the severity protection factor based on latest protection.

Parameters
[in]paramsParameters of the Model.
[in]latest_protectionLatest protection against Infection.
[in]ageAgeGroup of the Person.
[in]current_timeCurrent time point.
Returns
The protection factor against severe outcomes.

◆ get_start_date()

TimePoint mio::abm::Infection::get_start_date ( ) const
Returns
Get the start date of the infection.

◆ get_viral_load()

ScalarType mio::abm::Infection::get_viral_load ( TimePoint  t) const

Gets the ViralLoad of the Infection at a given TimePoint.

Parameters
[in]tTimePoint of querry.

◆ get_viral_shed()

ScalarType mio::abm::Infection::get_viral_shed ( TimePoint  t) const

Get viral shed at a specific time.

Computed depending on current ViralLoad and individual invlogit function of each Person corresponding to https://www.science.org/doi/full/10.1126/science.abi5273 The mapping corresponds to Fig. 2 C. Formula of invlogit function can be found here: https://github.com/VirologyCharite/SARS-CoV-2-VL-paper/tree/main in ExtendedMethods.html, Section 3.1.2.1.

◆ get_virus_variant()

VirusVariant mio::abm::Infection::get_virus_variant ( ) const

: Get VirusVariant.

Returns
VirusVariant of the Infection.

◆ initialize_viral_load()

void mio::abm::Infection::initialize_viral_load ( PersonalRandomNumberGenerator rng,
VirusVariant  virus,
AgeGroup  age,
const Parameters params,
ProtectionEvent  latest_protection 
)
private

Initialize the viral load parameters for the infection.

Parameters
[in,out]rngPersonalRandomNumberGenerator of the Person.
[in]virusVirus type of the Infection.
[in]ageAgeGroup of the Person.
[in]paramsParameters of the Model.
[in]latest_protectionLatest protection against Infection.

◆ initialize_viral_shed()

void mio::abm::Infection::initialize_viral_shed ( PersonalRandomNumberGenerator rng,
VirusVariant  virus,
AgeGroup  age,
const Parameters params 
)
private

Initialize the viral shed parameters and individual factor for the infection.

Parameters
[in,out]rngPersonalRandomNumberGenerator of the Person.
[in]virusVirus type of the Infection.
[in]ageAgeGroup of the Person.
[in]paramsParameters of the Model.

◆ is_detected()

bool mio::abm::Infection::is_detected ( ) const
Returns
Get the detected state.

◆ set_detected()

void mio::abm::Infection::set_detected ( )

Set the Infection to detected.

Member Data Documentation

◆ DefaultFactory< Infection >

friend mio::abm::Infection::DefaultFactory< Infection >
private

◆ m_detected

bool mio::abm::Infection::m_detected
private

Whether an Infection is detected or not.

◆ m_individual_viral_shed_factor

ScalarType mio::abm::Infection::m_individual_viral_shed_factor
private

Individual viral shed factor.

◆ m_infection_course

std::vector<std::pair<TimePoint, InfectionState> > mio::abm::Infection::m_infection_course
private

Start date of each InfectionState.

◆ m_log_norm_alpha

ScalarType mio::abm::Infection::m_log_norm_alpha
private

◆ m_log_norm_beta

ScalarType mio::abm::Infection::m_log_norm_beta
private

Parameters for the viral shed mapping, which is modelled through an invlogit function.

◆ m_viral_load

ViralLoad mio::abm::Infection::m_viral_load
private

◆ m_virus_variant

VirusVariant mio::abm::Infection::m_virus_variant
private

Variant of the Infection.