Infections and Immunity

Overview Structs

Overview Functions

Structs

GEMS.AgeDependentTransmissionRateType
AgeDependentTransmissionRate <: TransmissionFunction

A TransmissionFunction type that allows to define transmission probabilities for specific age groups.

GEMS.ConstantTransmissionRateType
ConstantTransmissionRate <: TransmissionFunction

A TransmissionFunction type that uses a constant transmission rate.

Constructors

GEMS.AgeDependentTransmissionRateMethod
AgeDependentTransmissionRate(;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 the transmission_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!Method
disease_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_progressionMethod
estimate_disease_progression(dpr::DiseaseProgressionStrat, indiv::Individual)

Estimates the final status an individual reaches during the progression of a disease.

GEMS.infect!Function
infect!(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 infect
  • tick::Int16: Infection tick
  • pathogen::Pathogen: Pathogen to infect the individual with
  • sim::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 individual
  • setting_id::Int32 = Int32(-1) (optional): ID of setting this infection happens in
  • lon::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" for Household)
  • ags::Int32 = Int32(-1) (optional): Amtlicher Gemeindeschlüssel (community identification number) of the region this infection happened in as Integer value
  • source_infection_id::Int32 = DEFAULT_INFECTION_ID (optional): Current infection ID of the infecting individual

Returns

  • Int32: New infection ID
GEMS.spread_infection!Method
spread_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 spreaded
  • sim::Simulation: Simulation object
  • pathogen::Pathogen: Pathogen to spread
GEMS.transmission_probabilityFunction
transmission_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 struct
  • infecter::Individual: Infecting individual
  • infected::Individual: Individual to infect
  • setting::Setting: Setting in which the infection happens
  • tick::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 struct
  • infecter::Individual: Infecting individual
  • infected::Individual: Individual to infect
  • setting::Setting: Setting in which the infection happens
  • tick::Int16: Current tick

Returns

  • Float64: Transmission probability p (0 <= p <= 1)
GEMS.try_to_infect!Function
try_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 infctrat 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 individual
  • infctd::Individual: Individual to infect
  • sim::Simulation: Simulation object
  • pathogen::Pathogen: Pathogen to infect the individual with
  • setting::Setting: Setting this infection happens in
  • source_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!Method
update_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 update
  • tick::Int16: Current tick
  • sim::Simulation: Simulation object