Infections and Immunity
Overview Structs
GEMS.AgeDependentTransmissionRate
GEMS.AgeDependentTransmissionRate
GEMS.ConstantTransmissionRate
GEMS.TransmissionFunction
Overview Functions
GEMS.disease_progression!
GEMS.estimate_disease_progression
GEMS.infect!
GEMS.spread_infection!
GEMS.transmission_probability
GEMS.try_to_infect!
GEMS.update_individual!
Structs
GEMS.AgeDependentTransmissionRate
— TypeAgeDependentTransmissionRate <: TransmissionFunction
A TransmissionFunction
type that allows to define transmission probabilities for specific age groups.
GEMS.ConstantTransmissionRate
— TypeConstantTransmissionRate <: TransmissionFunction
A TransmissionFunction
type that uses a constant transmission rate.
GEMS.TransmissionFunction
— TypeTransmissionFunction
Abstract type for all transmission functions.
Constructors
GEMS.AgeDependentTransmissionRate
— MethodAgeDependentTransmissionRate(;transmission_rate, ageGroups, ageTransmissions, distribution)
Constructor for the age-dependent transmission rate struct. The parameters for the constructor include:
transmission_rate::Vector
: A vector containing the parameters from which the distribution of thetransmission_rate
is constructed.ageGroups::Vector
: A vector containing the age groups. Should contain a vector for each age group consisting of two integers.ageTransmissions::Vector
: A vector containing the parameters for the distributions of the transmission rates for the specific age groups. Should contain a vector for each age group consisting of as many real number as parameters required for the spec. distribution.distribution::String
: A string that corresponds to a distribution of the distribution package.
Functions
GEMS.disease_progression!
— Methoddisease_progression!(infectee::Individual, pathogen::Pathogen, exposedtick::Int16)
Assigns a disease progression to the infectee
by assigning event ticks based on the exposedtick
.
GEMS.estimate_disease_progression
— Methodestimate_disease_progression(dpr::DiseaseProgressionStrat, indiv::Individual)
Estimates the final status an individual reaches during the progression of a disease.
GEMS.infect!
— Functioninfect!(infectee::Individual, tick::Int16, pathogen::Pathogen;
sim::Union{Simulation, Nothing} = nothing,
infecter_id::Int32 = Int32(-1), setting_id::Int32 = Int32(-1), lon::Float32 = NaN32,
lat::Float32 = NaN32, setting_type::Char = '?', ags::Int32 = Int32(-1),
source_infection_id::Int32 = DEFAULT_INFECTION_ID)
Infect infectee
with the specified pathogen
and calculate time to infectiousness and time to recovery. Optional arguments infecter_id
. setting_id
, and setting_type
can be passed for logging. It's not required to calulate the infection. The infection can only be logged, if Simulation
object is passed (as this object holds the logger).
Parameters
infectee::Individual
: Individual to infecttick::Int16
: Infection tickpathogen::Pathogen
: Pathogen to infect the individual withsim::Simulation
: Simulation object (used to get logger and current tick)sim::Union{Simulation, Nothing} = nothing
(optional) = Simulation object (used to get logger)infecter_id::Int32 = Int32(-1)
(optional): Infecting individualsetting_id::Int32 = Int32(-1)
(optional): ID of setting this infection happens inlon::Float32 = NaN32
(optional): Longitude of the infection infection location (setting)lat::Float32 = NaN32
(optional): Latitude of the infection infection location (setting)setting_type::Char = '?'
(optional): Setting type as char (e.g. "h" forHousehold
)ags::Int32 = Int32(-1)
(optional): Amtlicher Gemeindeschlüssel (community identification number) of the region this infection happened in as Integer valuesource_infection_id::Int32 = DEFAULT_INFECTION_ID
(optional): Current infection ID of the infecting individual
Returns
Int32
: New infection ID
GEMS.spread_infection!
— Methodspread_infection!(setting::Setting, sim::Simulation, pathogen::Pathogen)
Spreads the infection of pathogen
inside the provided setting. This will simulate the infection dynamics at the time tick(sim)
inside setting
within the context of the simulation sim
. This will also update all settings, the individual is part of, if the infection is successful.
Parameters
setting::Setting
: Setting in which the pathogen shall be spreadedsim::Simulation
: Simulation objectpathogen::Pathogen
: Pathogen to spread
GEMS.transmission_probability
— Functiontransmission_probability(transFunc::TransmissionFunction, infecter::Individual, infected::Individual, setting::Setting, tick::Int16)
General function for TransmissionFunction struct. Should be overwritten for newly created structs, as it only serves to catch undefined transmission_probability
functions.
transmission_probability(transFunc::ConstantTransmissionRate, infecter::Individual, infected::Individual, setting::Setting, tick::Int16)
Calculates the transmission probability for the ConstantTransmissionRate
. Returns the transmission_rate
for all individuals who have not been infected in the past. If the individual has already recovered, the function returns 0.0
, assuming full indefinite natural immunity.
Parameters
transFunc::ConstantTransmissionRate
: Transmission function structinfecter::Individual
: Infecting individualinfected::Individual
: Individual to infectsetting::Setting
: Setting in which the infection happenstick::Int16
: Current tick
Returns
Float64
: Transmission probability p (0 <= p <= 1
)
transmission_probability(transFunc::AgeDependentTransmissionRate, infecter::Individual, infected::Individual, setting::Setting, tick::Int16)
Calculates the transmission probability for the AgeDependentTransmissionRate
. Selects the correct distribution dependent on the age of the potentially infected agent from the AgeDependentTransmissionRate
, draws from it and returns the value. If no age group is found for the individual the transmission rate is drawn from the transmission_rate distribution. If the individual has already recovered, the function returns 0.0
, assuming full indefinite natural immunity.
Parameters
transFunc::AgeDependentTransmissionRate
: Transmission function structinfecter::Individual
: Infecting individualinfected::Individual
: Individual to infectsetting::Setting
: Setting in which the infection happenstick::Int16
: Current tick
Returns
Float64
: Transmission probability p (0 <= p <= 1
)
GEMS.try_to_infect!
— Functiontry_to_infect!(infctr::Individual, infctd::Individual, sim::Simulation, pathogen::Pathogen, setting::Setting;
source_infection_id::Int32 = DEFAULT_INFECTION_ID)
Tries to infect the infctd
with the given pathogen
transmitted by infctr
at time tick(sim)
with sim
being the simulation. Success depends on whether the agent is alive, not already infected an whether an infection event was sampled using the provided distribution or probability. Returns true
if infection was successful.
Parameters
infctr::Individual
: Infecting individualinfctd::Individual
: Individual to infectsim::Simulation
: Simulation objectpathogen::Pathogen
: Pathogen to infect the individual withsetting::Setting
: Setting this infection happens insource_infection_id::Int32 = DEFAULT_INFECTION_ID
(optional): Current infection ID of the infecting individual
Returns
Bool
: True if infection was successful, false otherwise
GEMS.update_individual!
— Methodupdate_individual!(indiv::Individual, tick::Int16, sim::Simulation)
Update the individual disease progression, handle its recovery and log its possible death. If the individual is not infected, this function will just return.
Parameters
indiv::Individual
: Individual to updatetick::Int16
: Current ticksim::Simulation
: Simulation object