Logger
Overview Structs
GEMS.CustomLogger
GEMS.DeathLogger
GEMS.EventLogger
GEMS.InfectionLogger
GEMS.Logger
GEMS.PoolTestLogger
GEMS.QuarantineLogger
GEMS.TestLogger
GEMS.TickLogger
Overview Functions
Base.length
GEMS.dataframe
GEMS.dataframe
GEMS.dataframe
GEMS.dataframe
GEMS.dataframe
GEMS.dataframe
GEMS.dataframe
GEMS.duplicate
GEMS.get_infections_between
GEMS.infectionlogger
GEMS.log!
GEMS.lognow
GEMS.save
GEMS.save
GEMS.save
GEMS.save
GEMS.save_JLD2
GEMS.ticks
Structs
GEMS.Logger
— TypeSupertype for all Loggers
GEMS.CustomLogger
— TypeCustomLogger <: 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.DeathLogger
— TypeDeathLogger <: 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 diedtick::Vector{Int16}
: Ticks of deathlock::ReentrantLock
: A lock for parallelised code to use to guarantee data race free conditions when working with this setting.
GEMS.EventLogger
— TypeSupertype for all Loggers, which are logging certain events
GEMS.InfectionLogger
— TypeInfectionLogger <: 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 infectingid_b::Vector{Int32}
: Identifiers of the agents to be infectedinfectious_tick::Vector{Int16}
: Ticks of infected to become infectioussymptoms_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 recovereddeath_tick::Vector{Int16}
: Ticks of death (if caused by this infection)symptom_category::Vector{Int8}
: Symptom Category of the disease progression of the infectiontick::Vector{Int16}
: Ticks of infectionssetting_id::Vector{Int32}
: Identifiers of settings where the infections happenedsetting_type::Vector{Char}
: Types of settings where the infections happenedlat::Float32
: Latitude of infection event locationlon::Float32
: Longitude of infection event locationags::Vector{Int32}
: AGS of the settings where the infections happenedlock::ReentrantLock
: A lock for parallelised code to use to guarantee data race free conditions when working with this logger.
GEMS.PoolTestLogger
— TypePoolTestLogger <: 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 happenedsetting_type{Char}
: Setting type where this pool test was appliedtest_tick::Vector{Int16}
: Ticks of testtest_result::Vector{Boolean}
: Result of the testno_of_individuals::Vector{Int32}
: Number of tested individualsno_of_infected::Vector{Int32}
: Number of actually infected individualstest_type::Vector{String}
: Type of the applied testlock::ReentrantLock
: A lock for parallelised code to use to guarantee data race free conditions when working with this logger.
GEMS.QuarantineLogger
— TypeQuarantineLogger <: TickLogger
A logging structure to track the number of quarantined individuals stratified by occupation status (worker, school, all).
Fields
tick::Vector{Int16}
: Simulation tickquarantined::Vector{Int64}
: Overall number of quarantined individuals at the given tickstudents::Vector{Int64}
: Number of quarantined students at the given tickworkers::Vector{Int64}
: Number of quarantined workers at the given ticklock::ReentrantLock
: A lock for parallelised code to use to guarantee data race free conditions when working with this logger.
GEMS.TestLogger
— TypeTestLogger <: 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 testettest_tick::Vector{Int16}
: Ticks of testtest_result::Vector{Bool}
: Result of the testinfected::Vector{Bool}
: Actual infection stateinfection_id::Vector{Int32}
: ID of current infection (if infected)test_type::Vector{String}
: Type of the applied testreportable::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.TickLogger
— TypeSupertype for all Loggers, which are logging per tick
Functions
GEMS.dataframe
— Methoddataframe(cl::CustomLogger)
Returns the internal dataframe of the CustomLogger
.
GEMS.dataframe
— Methoddataframe(deathlogger::DeathLogger)
Return a DataFrame holding the informations of the logger.
Returns
DataFrame
with the following columns:
Name | Type | Description |
---|---|---|
tick | Int16 | Tick of the death event |
id | Int32 | Individual id |
GEMS.dataframe
— Methoddataframe(logger::InfectionLogger)
Return a DataFrame holding the informations of the logger.
Returns
DataFrame
with the following columns:
Name | Type | Description |
---|---|---|
infection_id | Int32 | Identifier of this infection event |
tick | Int16 | Tick of the infection event |
id_a | Int32 | Infecter id |
id_b | Int32 | Infectee id |
infectious_tick | Int16 | Tick at which infectee becomes infectious |
symptoms_tick | Int16 | Tick at which infectee develops symptoms (-1 if not at all) |
removed_tick | Int16 | Tick at which infectee becomes removed (recovers) |
death_tick | Int16 | Tick at which infectee dies |
symptom_category | Int8 | Last state of disease progression before recovery |
setting_id | Int32 | Id of setting in which infection happens |
setting_type | Char | setting type of the infection setting |
ags | Int32 | AGS of the infection setting |
source_infection_id | Int32 | Id of the infecter's infection event |
GEMS.dataframe
— Methoddataframe(poollogger::PoolTestLogger)
Return a DataFrame holding the informations of the logger.
Returns
DataFrame
with the following columns:
Name | Type | Description |
---|---|---|
test_tick | Int16 | Tick of the test event |
setting_id | Int32 | Setting id of the tested pool |
setting_type | Int32 | Setting type |
test_result | Bool | Test result (pos./neg.) |
no_of_individuals | Int32 | Number of tested individuals |
no_of_infected | Int32 | Number of actually infected individuals |
test_type | String | Name of test type |
GEMS.dataframe
— Methoddataframe(quarantinelogger::QuarantineLogger)
Return a DataFrame holding the informations of the logger.
Returns
DataFrame
with the following columns:
Name | Type | Description |
---|---|---|
tick | Int16 | Simulation tick |
quarantined | Int64 | Total quarantined individuals |
students | Int64 | Quarantined students |
workers | Int64 | Quarantined workers |
GEMS.dataframe
— Methoddataframe(testlogger::TestLogger)
Return a DataFrame holding the informations of the logger.
Returns
DataFrame
with the following columns:
Name | Type | Description |
---|---|---|
test_id | Int32 | ID of test in this logger |
tick | Int16 | Tick of the test |
id | Int32 | Individual id |
test_result | Bool | Test result (pos./neg.) |
infected | Bool | Actual infection state |
infection_id | Int32 | ID of current infection (if infected) |
test_type | String | Name of test type |
reportable | Bool | If true, this test causes the case to be "reported" |
GEMS.dataframe
— Methoddataframe(vacclogger::VaccinationLogger)
Return a DataFrame holding the informations of the logger.
Returns
DataFrame
with the following columns:
Name | Type | Description |
---|---|---|
tick | Int16 | Tick of the vaccination event |
id | Int32 | Individual id |
GEMS.duplicate
— Methodduplicate(cl::CustomLogger)
Creates a new CustomLogger
instance with the same parameters of the argument CustomLogger
.
GEMS.get_infections_between
— Methodget_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 instanceinfecter::Int32
: ID of infecter individual that is used to filter secondary infectionsstart_tick::Int16
: Lower bound (time)end_tick::Int16
: Upper bound (time)
Returns
Vector{Int32}
: List of IDs of infected individuals
GEMS.infectionlogger
— Methodinfectionlogger(simulation)
Returns the InfectionLogger of the simulation.
Base.length
— Functionlength(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 Event
s in the EventQueue
.
GEMS.log!
— Functionlog!(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 instancea::Int32
: ID of infecting individualb::Int32
: ID of infected individualtick::Int16
: Current simultion tickinfectious_tick::Int16
: Tick of individual becoming infectioussymptoms_tick::Int16
: Tick of individual becoming symptomaticsevereness_tick::Int16
: Tick of individual becoming a severe casehospital_tick::Int16
: Tick of individual being hospitalizedicu_tick::Int16
: Tick of individual being admitted to ICUventilation_tick::Int16
: Tick of individual being admitted to ventilationremoved_tick::Int16
: Tick of individual recovering/dyingdeath_tick::Int16
: Tick of individual death (if died)symptom_category::Int8
: Symptom categorysetting_id::Int32
: ID of setting this infection happend insetting_type::Char
: Setting type as char (e.g. "h" forHousehold
)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 insource_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 instanceid::Int32
: ID of the vaccinated individualtick::Int16
: Time of vaccination
log!(deathlogger::DeathLogger, id::Int32, tick::Int16)
Logs a death event into the specified DeathLogger
.
Parameters
deathlogger::DeathLogger
: Logger instanceid::Int32
: ID of deceased individualtick::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 instanceid::Int32
: ID of individual that is being testedtest_tick::Int16
: Time of testtest_result::Bool
: Test resultinfected::Bool
: Actual infection stateinfection_id::Int32
: ID of infectiontest_type::String
: Name of the respectiveTestType
(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 instancesetting_id::Int32
: ID of setting that is being pool-testedsetting_type::Char
: Setting type as char (e.g. "h" forHousehold
)test_tick::Int16
: Time of testtest_result::Bool
: Test resultno_of_individuals::Int16
: Number of individuals n the tested set of inividualsno_of_infected::Int16
: Actual number of infected individuals in the tested set of individualstest_type::String
: Name of the respectiveTestType
(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 instancetick::Int16
: Current tickquarantined::Int64
: Overall number of quarantined individualsstudents::Int64
: Number of quarantined studentsworkers::Int64
: Number of quarantined workers
GEMS.lognow
— Functionlognow()
Returns the current time in HH:MM:SS format for logging purposes.
GEMS.save
— Methodsave(deathlogger::DeathLogger, path::AbstractString)
Save the logger to a CSV-file at the specified path.
GEMS.save
— Methodsave(logger::InfectionLogger, path::AbstractString)
Save the logger to a CSV-file at the specified path.
GEMS.save
— Methodsave(poollogger::PoolTestLogger, path::AbstractString)
Save the logger to a CSV-file at the specified path.
GEMS.save
— Methodsave(testlogger::TestLogger, path::AbstractString)
Save the logger to a CSV-file at the specified path.
GEMS.save_JLD2
— Functionsave_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.ticks
— Methodticks(logger::InfectionLogger)
Returns a vector of ticks with logging events.