Logger

Overview Structs

Overview Functions

Structs

GEMS.CustomLoggerType
CustomLogger <: TickLogger

Struct to specify custom logging mechanisms. The constructor takes an arbitrary number of keyworded arguments that are each a function with exactly one argument (the Sim-object)

Example

This instance of the CustomLogger would extract the number of infected inividuals, each time the log!-function is called.

cl = CustomLogger(infected = sim -> count(infected, sim |> population))
log!(cl, sim)

Result

    1×2 DataFrame
     Row │ infected  tick 
         │ Any       Any  
    ─────┼────────────────
       1 │ 106       0

Note

The function that fires the loggers fire_custom_loggers(sim::Simulation) is defined in the simulation methods script as the simulation object needs to be "known" for "all access".

GEMS.DeathLoggerType
DeathLogger <: EventLogger

A logging structure specifically for deaths. A death event is given by all entrys of the field-vectors at a given index.

Fields

  • id::Vector{Int32}: Identifiers of the agents that died
  • tick::Vector{Int16}: Ticks of death
  • lock::ReentrantLock: A lock for parallelised code to use to guarantee data race free conditions when working with this setting.
GEMS.EventLoggerType

Supertype for all Loggers, which are logging certain events

GEMS.InfectionLoggerType
InfectionLogger <: EventLogger

A logging structure specifically for infections. An infection event is given by all entries of the field-vectors at a given index.

Fields

  • id_a::Vector{Int32}: Identifiers of the agents that are infecting
  • id_b::Vector{Int32}: Identifiers of the agents to be infected
  • infectious_tick::Vector{Int16}: Ticks of infected to become infectious
  • symptoms_tick::Vector{Int16}: Tick at which infectee develops symptoms (-1 if not at all)
  • severeness_tick::Vector{Int16}: Tick at which infectee develops severe symptoms (-1 if not at all)
  • hospital_tick::Vector{Int16}: Tick at which infectee is admitted to the hospital (-1 if not at all)
  • icu_tick::Vector{Int16}: Tick at which infectee is admitted to the icu (-1 if not at all)
  • ventilation_tick::Vector{Int16}: Tick at which infectee needs ventilation (-1 if not at all)
  • removed_tick::Vector{Int16}: Ticks of agents to be recovered
  • death_tick::Vector{Int16}: Ticks of death (if caused by this infection)
  • symptom_category::Vector{Int8}: Symptom Category of the disease progression of the infection
  • tick::Vector{Int16}: Ticks of infections
  • setting_id::Vector{Int32}: Identifiers of settings where the infections happened
  • setting_type::Vector{Char}: Types of settings where the infections happened
  • lat::Float32: Latitude of infection event location
  • lon::Float32: Longitude of infection event location
  • ags::Vector{Int32}: AGS of the settings where the infections happened
  • lock::ReentrantLock: A lock for parallelised code to use to guarantee data race free conditions when working with this logger.
GEMS.PoolTestLoggerType
PoolTestLogger <: EventLogger

A logging structure specifically for pool tests. Pool tests take multiple individuals and evaluate whether at least one of them is infected. A test event is given by all entries of the field-vectors at a given index.

Fields

  • setting_id::Vector{Int32}: Identifiers of the setting this pooled test happened
  • setting_type{Char}: Setting type where this pool test was applied
  • test_tick::Vector{Int16}: Ticks of test
  • test_result::Vector{Boolean}: Result of the test
  • no_of_individuals::Vector{Int32}: Number of tested individuals
  • no_of_infected::Vector{Int32}: Number of actually infected individuals
  • test_type::Vector{String}: Type of the applied test
  • lock::ReentrantLock: A lock for parallelised code to use to guarantee data race free conditions when working with this logger.
GEMS.QuarantineLoggerType
QuarantineLogger <: TickLogger

A logging structure to track the number of quarantined individuals stratified by occupation status (worker, school, all).

Fields

  • tick::Vector{Int16}: Simulation tick
  • quarantined::Vector{Int64}: Overall number of quarantined individuals at the given tick
  • students::Vector{Int64}: Number of quarantined students at the given tick
  • workers::Vector{Int64}: Number of quarantined workers at the given tick
  • lock::ReentrantLock: A lock for parallelised code to use to guarantee data race free conditions when working with this logger.
GEMS.TestLoggerType
TestLogger <: EventLogger

A logging structure specifically for tests. A test event is given by all entries of the field-vectors at a given index.

Fields

  • id::Vector{Int32}: Identifiers of the agents that got testet
  • test_tick::Vector{Int16}: Ticks of test
  • test_result::Vector{Bool}: Result of the test
  • infected::Vector{Bool}: Actual infection state
  • infection_id::Vector{Int32}: ID of current infection (if infected)
  • test_type::Vector{String}: Type of the applied test
  • reportable::Vector{Bool}: Flag whether this test will be considered for the "detected" cases (i.e. "reported")
  • lock::ReentrantLock: A lock for parallelised code to use to guarantee data race free conditions when working with this logger.
GEMS.TickLoggerType

Supertype for all Loggers, which are logging per tick

Functions

GEMS.dataframeMethod
dataframe(cl::CustomLogger)

Returns the internal dataframe of the CustomLogger.

GEMS.dataframeMethod
dataframe(deathlogger::DeathLogger)

Return a DataFrame holding the informations of the logger.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Tick of the death event
idInt32Individual id
GEMS.dataframeMethod
dataframe(logger::InfectionLogger)

Return a DataFrame holding the informations of the logger.

Returns

  • DataFrame with the following columns:
NameTypeDescription
infection_idInt32Identifier of this infection event
tickInt16Tick of the infection event
id_aInt32Infecter id
id_bInt32Infectee id
infectious_tickInt16Tick at which infectee becomes infectious
symptoms_tickInt16Tick at which infectee develops symptoms (-1 if not at all)
removed_tickInt16Tick at which infectee becomes removed (recovers)
death_tickInt16Tick at which infectee dies
symptom_categoryInt8Last state of disease progression before recovery
setting_idInt32Id of setting in which infection happens
setting_typeCharsetting type of the infection setting
agsInt32AGS of the infection setting
source_infection_idInt32Id of the infecter's infection event
GEMS.dataframeMethod
dataframe(poollogger::PoolTestLogger)

Return a DataFrame holding the informations of the logger.

Returns

  • DataFrame with the following columns:
NameTypeDescription
test_tickInt16Tick of the test event
setting_idInt32Setting id of the tested pool
setting_typeInt32Setting type
test_resultBoolTest result (pos./neg.)
no_of_individualsInt32Number of tested individuals
no_of_infectedInt32Number of actually infected individuals
test_typeStringName of test type
GEMS.dataframeMethod
dataframe(quarantinelogger::QuarantineLogger)

Return a DataFrame holding the informations of the logger.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Simulation tick
quarantinedInt64Total quarantined individuals
studentsInt64Quarantined students
workersInt64Quarantined workers
GEMS.dataframeMethod
dataframe(testlogger::TestLogger)

Return a DataFrame holding the informations of the logger.

Returns

  • DataFrame with the following columns:
NameTypeDescription
test_idInt32ID of test in this logger
tickInt16Tick of the test
idInt32Individual id
test_resultBoolTest result (pos./neg.)
infectedBoolActual infection state
infection_idInt32ID of current infection (if infected)
test_typeStringName of test type
reportableBoolIf true, this test causes the case to be "reported"
GEMS.dataframeMethod
dataframe(vacclogger::VaccinationLogger)

Return a DataFrame holding the informations of the logger.

Returns

  • DataFrame with the following columns:
NameTypeDescription
tickInt16Tick of the vaccination event
idInt32Individual id
GEMS.duplicateMethod
duplicate(cl::CustomLogger)

Creates a new CustomLogger instance with the same parameters of the argument CustomLogger.

GEMS.get_infections_betweenMethod
get_infections_between(logger::InfectionLogger, infecter::Int32, start_tick::Int16, end_tick::Int16)

Returns the id of infected individuals who's infection time t is start_tick <= t <= end_tick)

Parameters

  • logger::InfectionLogger: Logger instance
  • infecter::Int32: ID of infecter individual that is used to filter secondary infections
  • start_tick::Int16: Lower bound (time)
  • end_tick::Int16: Upper bound (time)

Returns

  • Vector{Int32}: List of IDs of infected individuals
GEMS.infectionloggerMethod
infectionlogger(simulation)

Returns the InfectionLogger of the simulation.

Base.lengthFunction
length(logger::InfectionLogger)

Returns the number of entries in a InfectionLogger.

length(logger::VaccinationLogger)

Returns the number of entries in a VaccinationLogger.

length(logger::DeathLogger)

Returns the number of entries in a DeathLogger.

length(logger::TestLogger)

Returns the number of entries in a TestLogger.

length(logger::PoolTestLogger)

Returns the number of entries in a PoolTestLogger.

length(logger::QuarantineLogger)

Returns the number of entries in a QuarantineLogger.

length(logger::CustomLogger)

Returns the number of entries in a CustomLogger.

length(eq::EventQueue)

Returns the number of Events in the EventQueue.

GEMS.log!Function
log!(logger::InfectionLogger, a::Int32, b::Int32, tick::Int16, infectious_tick::Int16,
symptoms_tick::Int16, severeness_tick::Int16, hospital_tick::Int16, icu_tick::Int16,
ventilation_tick::Int16, removed_tick::Int16, death_tick::Int16, symptom_category::Int8,
setting_id::Int32, setting_type::Char, lat::Float32, lon::Float32, ags::Int32,
source_infection_id::Int32)

Logs an infection event into the specified InfectionLogger. Returns a new infection_id for the newly added infection.

Parameters

  • logger::InfectionLogger: Logger instance
  • a::Int32: ID of infecting individual
  • b::Int32: ID of infected individual
  • tick::Int16: Current simultion tick
  • infectious_tick::Int16: Tick of individual becoming infectious
  • symptoms_tick::Int16: Tick of individual becoming symptomatic
  • severeness_tick::Int16: Tick of individual becoming a severe case
  • hospital_tick::Int16: Tick of individual being hospitalized
  • icu_tick::Int16: Tick of individual being admitted to ICU
  • ventilation_tick::Int16: Tick of individual being admitted to ventilation
  • removed_tick::Int16: Tick of individual recovering/dying
  • death_tick::Int16: Tick of individual death (if died)
  • symptom_category::Int8: Symptom category
  • setting_id::Int32: ID of setting this infection happend in
  • setting_type::Char: Setting type as char (e.g. "h" for Household)
  • lat::Float32: Latitude of infection location (obatained from the setting)
  • lon::Float32: Longitude of infection location (obatained from the setting)
  • ags::Int32: Amtlicher Gemeindeschlüssel (community identification number) of the region this infection happened in
  • source_infection_id::Int32: Current infection ID of the infecting individual

Returns

  • Int32: New infection ID
log!(vacclogger::VaccinationLogger, id::Int32, tick::Int16)

Logs a vaccination event into the specified VaccinationLogger.

Parameters

  • vacclogger::VaccinationLogger: Logger instance
  • id::Int32: ID of the vaccinated individual
  • tick::Int16: Time of vaccination
log!(deathlogger::DeathLogger, id::Int32, tick::Int16)

Logs a death event into the specified DeathLogger.

Parameters

  • deathlogger::DeathLogger: Logger instance
  • id::Int32: ID of deceased individual
  • tick::Int16: Time of death
log!(testlogger::TestLogger, id::Int32, test_tick::Int16, test_result::Bool,
    infected::Bool, infection_id::Int32, test_type::String, reportable::Bool)

Logs a test event into the specified TestLogger.

Parameters

  • testlogger::TestLogger: Logger instance
  • id::Int32: ID of individual that is being tested
  • test_tick::Int16: Time of test
  • test_result::Bool: Test result
  • infected::Bool: Actual infection state
  • infection_id::Int32: ID of infection
  • test_type::String: Name of the respective TestType (e.g., "PCR")
  • reportable::Bool: Flag whether a positive test result will be reported
log!poollogger::PoolTestLogger, setting_id::Int32, setting_type::Char, test_tick::Int16,
    test_result::Bool, no_of_individuals::Int16, no_of_infected::Int16, test_type::String)

Logs a test event into the specified PoolTestLogger.

Parameters

  • poollogger::PoolTestLogger: Logger instance
  • setting_id::Int32: ID of setting that is being pool-tested
  • setting_type::Char: Setting type as char (e.g. "h" for Household)
  • test_tick::Int16: Time of test
  • test_result::Bool: Test result
  • no_of_individuals::Int16: Number of individuals n the tested set of inividuals
  • no_of_infected::Int16: Actual number of infected individuals in the tested set of individuals
  • test_type::String: Name of the respective TestType (e.g., "PCR")
log!(quarantinelogger::QuarantineLogger, tick::Int16,
    quarantined::Int64, students::Int64, workers::Int64)

Logs a the number of quarantined individuals stratified by occupation in a QuarantineLogger.

Parameters

  • quarantinelogger::QuarantineLogger: Logger instance
  • tick::Int16: Current tick
  • quarantined::Int64: Overall number of quarantined individuals
  • students::Int64: Number of quarantined students
  • workers::Int64: Number of quarantined workers
GEMS.lognowFunction
lognow()

Returns the current time in HH:MM:SS format for logging purposes.

GEMS.saveMethod
save(deathlogger::DeathLogger, path::AbstractString)

Save the logger to a CSV-file at the specified path.

GEMS.saveMethod
save(logger::InfectionLogger, path::AbstractString)

Save the logger to a CSV-file at the specified path.

GEMS.saveMethod
save(poollogger::PoolTestLogger, path::AbstractString)

Save the logger to a CSV-file at the specified path.

GEMS.saveMethod
save(testlogger::TestLogger, path::AbstractString)

Save the logger to a CSV-file at the specified path.

GEMS.save_JLD2Function
save_JLD2(logger::InfectionLogger, path::AbstractString)

Save the logger to a JLD2 file.

save_JLD2(vacclogger::VaccinationLogger, path::AbstractString)

Save the vaccination logger to a JLD2 file.

save_JLD2(deathlogger::DeathLogger, path::AbstractString)

Save the death logger to a JLD2 file.

save_JLD2(testlogger::TestLogger, path::AbstractString)

Save the test logger to a JLD2 file.

save_JLD2(poollogger::PoolTestLogger, path::AbstractString)

Save the pool test logger to a JLD2 file.

GEMS.ticksMethod
ticks(logger::InfectionLogger)

Returns a vector of ticks with logging events.