Interventions
Overview Structs
GEMS.CancelSelfIsolationGEMS.ChangeContactMethodGEMS.CloseSettingGEMS.CustomIMeasureGEMS.CustomSMeasureGEMS.FindSettingGEMS.FindSettingMembersGEMS.HandoverGEMS.HospitalizationTriggerGEMS.IMeasureEventGEMS.IStrategyGEMS.ITickTriggerGEMS.IsOpenGEMS.OpenSettingGEMS.PoolTestGEMS.SMeasureEventGEMS.SStrategyGEMS.STickTriggerGEMS.SelfIsolationGEMS.SymptomTriggerGEMS.TestGEMS.TestAllGEMS.TestTypeGEMS.TraceInfectiousContacts
Overview Functions
GEMS.conditionGEMS.durationGEMS.follow_upGEMS.measure_logicGEMS.measuresGEMS.nameGEMS.nameGEMS.nameGEMS.nameGEMS.nameGEMS.nameGEMS.negative_followupGEMS.nonselfGEMS.positive_followupGEMS.process_measureGEMS.reportableGEMS.reportableGEMS.sample_fractionGEMS.sample_sizeGEMS.sampling_methodGEMS.selectionfilterGEMS.sensitivityGEMS.specificityGEMS.strategyGEMS.success_rateGEMS.switch_tickGEMS.type
Triggers
Structs
GEMS.HospitalizationTrigger — Type
HospitalizationTrigger <: ITriggerA struct defining an IStrategy that shall be fired upon an individual's admittance to hospital.
GEMS.ITickTrigger — Type
ITickTrigger <: TickTriggerA struct defining an IStrategy with timed execution for all individuals in the model. The switch_tick sets a threshold for the onset of strategy execution based on the current tick. The interval defines a reoccurence (optional). If no switch_tick is given, the strategy will be fired in each tick. If only the interval is given, the strategy will be fired from tick 1 onwards in the specified interval. An optional condition predicate can be used to suppress firing entirely (e.g. based on simulation-wide state), regardless of switch_tick/interval.
Parameters
strategy::IStrategy: Strategy that will be triggeredswitch_tick::Int16 = Int16(-1)(optional): Threshold for the strategy onsetinterval::Int16 = Int16(-1)(optional): Trigger strategy in reoccuring intervalscondition::Function = sim -> true(optional): Predicate function on theSimulationthat can be used to suppress this trigger from firing at all
Examples
ITickTrigger(my_daily_testing_strategy)will trigger my_daily_testing_strategy each tick for each individuals.
ITickTrigger(my_home_office_strategy, switch_tick = Int16(20), interval = Int16(7))will trigger my_home_office_strategy from tick 20 in a 7-tick interval for each individuals.
ITickTrigger(my_lockdown_strategy, switch_tick = Int16(50)will trigger the my_lockdown_strategy once on tick 50.
ITickTrigger(my_surveillance_strategy, switch_tick = Int16(10), interval = Int16(7),
condition = is_disease_active)will trigger my_surveillance_strategy from tick 10 in a 7-tick interval, but only while the disease is still active, so the trigger stops firing (and the simulation can go dormant) once it has died out.
GEMS.STickTrigger — Type
STickTrigger <: TickTriggerA struct defining an SStrategy with timed execution for all settings of a specified settingtype in the model. The switch_tick sets a threshold for the onset of strategy execution based on the current tick. The interval defines a reoccurence (optional). If no switch_tick is given, the strategy will be fired in each tick. If only the interval is given, the strategy will be fired from tick 1 onwards in the specified interval. An optional condition predicate can be used to suppress firing entirely (e.g. based on simulation-wide state), regardless of switch_tick/interval.
Parameters
settingtype::DataType: Type of settings (e.g.Household) that the triggered strategy will be applied tostrategy::SStrategy: Strategy that will be triggeredswitch_tick::Int16 = Int16(-1)(optional): Threshold for the strategy onsetinterval::Int16 = Int16(-1)(optional): Trigger strategy in reoccuring intervalscondition::Function = sim -> true(optional): Predicate function on theSimulationthat can be used to suppress this trigger from firing at all
Examples
STickTrigger(School, my_daily_testing_strategy)will trigger my_daily_testing_strategy each tick for each school.
STickTrigger(Office, my_pool_testing_strategy, switch_tick = Int16(20), interval = Int16(7))will trigger my_pool_testing_strategy from tick 20 in a 7-tick interval for each office.
STickTrigger(School, my_schhool_closure_strategy, switch_tick = Int16(50)will trigger the my_schhool_closure_strategy once on tick 50 for all schools.
GEMS.SymptomTrigger — Type
SymptomTrigger <: ITriggerA struct defining an IStrategy that shall be fired upon an individual experiencing symptoms.
Functions
GEMS.strategy — Function
strategy(trigger::SymptomTrigger)Returns the IStrategy object associated with a SymptomTrigger.
strategy(trigger::HospitalizationTrigger)Returns the IStrategy object associated with a HospitalizationTrigger.
strategy(trigger::TickTrigger)Returns the intervention strategy associated with a TickTrigger.
GEMS.switch_tick — Function
switch_tick(trigger::TickTrigger)Returns the switch_tick associated with a TickTrigger.
Strategies
Constructors
GEMS.IStrategy — Method
IStrategy(name::String, sim::Simulation; condition::Function = x -> true)Creates an IStrategy object.
Parameters
name::String: Name of the strategysim::Simulation: Simulation object (required to interlink test with simulation)condition::Function = x -> true(optional): Predicate function than can be used to limit the execution of this strategy to only cerain individuals.
Examples
my_str = IStrategy("self-isolation", sim)
add_measure!(my_str, SelfIsolation(14))
s_trigger = SymptomTrigger(my_str)
add_symptom_trigger!(sim, s_trigger) The above code will create a new strategy called, 'self-isolation'. Using the add_measure! function, you can now begin to populate your strategy with specific intervention measures, e.g. with a SelfIsolation measure. The second part creates a SymptomTrigger that will now fire your strategy once an individual experiences symptoms.
If you want to limit the execution of your strategy to only certain individuals e.g. based on their age, you can do that be adding a condition predicate function, such as:
my_str = IStrategy("self-isolation", sim, condition = i -> age(i) > 65)
add_measure!(my_str, SelfIsolation(14))
s_trigger = SymptomTrigger(my_str)
add_symptom_trigger!(sim, s_trigger) The added condition will cause the strategy only to be executed for individuals who experience symptoms and are 65 or older.
GEMS.SStrategy — Method
SStrategy(name::String, sim::Simulation; condition::Function = x -> true)Creates an SStrategy object.
Parameters
name::String: Name of the strategysim::Simulation: Simulation object (required to interlink test with simulation)condition::Function = x -> true(optional): Predicate function than can be used to limit the execution of this strategy to only cerain settings.
Examples
my_str = SStrategy("close-offices", sim)
add_measure!(my_str, CloseSetting())
t_trigger = STickTrigger(Office, my_str, switch_tick = Int16(20))
add_tick_trigger!(sim, t_trigger)The above code will create a new strategy called, 'close-offices'. Using the add_measure! function, you can now begin to populate your strategy with specific intervention measures, e.g. with a CloseSetting measure. The second part creates a STickTrigger for the setting type Office and the switch_tick 20. Therefore, this trigger will call your strategy for all settings of type Office at tick 20, closing them indefinitely.
If you want to limit the execution of your strategy to only certain settings e.g. based on their size, you can do that be adding a condition predicate function, such as:
my_str = SStrategy("close-offices", sim, condition = s -> size(s) > 10)
add_measure!(my_str, CloseSetting())
t_trigger = STickTrigger(Office, my_str, switch_tick = Int16(20))
add_tick_trigger!(sim, t_trigger)The added condition will cause the strategy only to be executed for settings that have more than 10 individuals associated.
Functions
GEMS.condition — Function
condition(me::MeasureEntry)Returns the condition function associated with a MeasureEntry.
condition(str::Strategy)Returns the condition function of a Strategy.
condition(trigger::TickTrigger)Returns the trigger-level condition predicate associated with a TickTrigger. This is separate from the per-individual/per-setting condition on the trigger's strategy; it is consulted (alongside switch_tick/interval) to decide whether the trigger fires at all.
Missing docstring for delay(::MeasureEntry). Check Documenter's build log for details.
Missing docstring for measure(::MeasureEntry). Check Documenter's build log for details.
GEMS.measures — Method
measures(str::Strategy)Returns the measures encapsulated in a Strategy; A vector of MeasureEntrys
GEMS.name — Method
name(str::Strategy)Returns the name of a Strategy.
Missing docstring for offset(::MeasureEntry). Check Documenter's build log for details.
Measures
Constructors
GEMS.CancelSelfIsolation — Type
CancelSelfIsolation <: IMeasureIntervention struct to cancel an individual's (household isolation).
Example
my_str = IStrategy("cancel-isolation", sim)
add_measure!(my_str, CancelSelfIsolaton())The above example creates an IStrategy called 'my_str' and adds an instance of the CancelSelfIsolation measure to the strategy.
GEMS.ChangeContactMethod — Type
ChangeContactMethod <: SMeasureIntervention struct to replace a setting's contact sampling method. Needs to be initialized with an argument of type ContactSamplingMethod.
Example
my_str = SStrategy("reduce-contacts", sim)
add_measure!(my_str, ChangeContactMethod(ContactparameterSampling(1)))The above example creates an SStrategy called 'my_str' and adds an instance of the ChangeContactMethod measure that should change the contact sampling method to a ContactparameterSampling method with 1 contact per tick. We call this strategy 'reduce-contacts', of course assuming that the previous contact sampling methdod generated more contacts per tick (which of course depends on your particular initial configuration)
GEMS.CloseSetting — Type
CloseSetting <: SMeasureIntervention struct to close a setting, effectively preventing all contacts from happening during closure.
Example
my_str = SStrategy("close-school", sim)
add_measure!(my_str, CloseSetting())The above example creates an SStrategy called 'my_str' and adds an instance of the CloseSetting measure which will close the respective setting once called. You can, for example, use an STickTrigger to close all schools at a given simulation time. The following code would close all schools at tick 20:
stt = STickTrigger(SchoolClass, my_str, switch_tick = Int16(20))
add_tick_trigger!(sim, stt)GEMS.CustomIMeasure — Type
CustomIMeasure <: IMeasureIntervention struct to apply custom logic to an indivudal when this measure is executed. The field measure_logic must contain a two-argument function where the first argument is an Individual and the second argument is the Simulation struct. Upon execution of the measure, this function will be called with these two arguments.
Example
my_str = IStrategy("change-risk-behavior", sim)
add_measure!(my_str, CustomIMeasure((i, simobj) -> mandate_compliance!(i, .8)))The above example creates an IStrategy called 'my_str' and adds an instance of the CustomIMeasure measure that is being instantiated with a function changing an individual's mandate_compliance attribute to 80%. This could, for example, be used to model changing risk perceptions over time. While the above example does not require the Simulation object, it is still being passed, to make the whole simulation state available at all times.
GEMS.CustomSMeasure — Type
CustomSMeasure <: SMeasureIntervention struct to apply custom logic to a setting when this measure is executed. The field measure_logic must contain a two-argument function where the first argument is a Setting and the second argument is the Simulation struct. Upon execution of the measure, this function will be called with these two arguments.
Example
my_str = SStrategy("close-large-settings", sim)
add_measure!(my_str, CustomSMeasure((s, simobj) -> (size(s) > 50 ? close!(s) : nothing)))The above example creates an SStrategy called 'my_str' and adds an instance of the CustomSMeasure measure that is being instantiated with a function closing the setting if it contains more than 50 individuals. While the above example does not require the Simulation object, it is still being passed, to make the whole simulation state available at all times. The example above contains conditioned logic to demonstrate how the CustomSMeasure works. You can, of course, achieve the same effect as in the example, if you use a regular CloseSetting measure and limit its execution to large settings by supplying the condition keyword to the add_measure! function.
GEMS.FindSetting — Type
FindSetting <: IMeasureIntervention struct to detect a particular setting of an individual and apply follow-up strategy to the respective setting. This measure effecively allows to switch between IStrategy and SStrategy.
Example
close_str = SStrategy("close-office", sim)
add_measure!(close_str, CloseSetting())
my_str = IStrategy("find-office", sim)
add_measure!(my_str, FindSetting(Office, close_str))
s_trigger = SymptomTrigger(my_str)
add_symptom_trigger!(sim, s_trigger) The above example first creates a setting strategy (SStrategy) called 'close_str' and adds an instance of the CloseSetting measure which will close the respective setting indefinitely if excuted. It then creates an IStrategy called 'my_str' and adds an instance of the FindSetting measure that detects the individual's office setting and calls the previously defined 'close_str' on it. Lastly, a SymptomTrigger is defined to run this cascade of strategy once an individual experiences symptoms. The example will close the office an individual is associated with if it experiences symptoms.
GEMS.FindSettingMembers — Type
FindSettingMembers <: IMeasureIntervention struct that returns members of a setting which is associated with an index-individual, e.g., 'People I know at work'. It requires a settingtype, defining which of the individual's settings shall be quieried, as well as a follow_up IStrategy that will be applied to all found setting members. An optional nonself boolean flag indicates whether this measure shall also return the index individual.
Examples
my_str = IStrategy("identify-household-members", sim)
add_measure!(my_str, FindSettingMembers(Household, my_other_strategy, nonself = true))The above example creates an IStrategy called 'my_str' and adds an instance of the FindSettingMembers measure that should return all household members except the index individual (all people that the individual lives with). It will trigger the follow-up strategy 'my_other_strategy' for all members.
my_str = IStrategy("identify-household-members", sim)
add_measure!(my_str, FindSettingMembers(Office, my_other_strategy))The above example creates an IStrategy called 'my_str' and adds an instance of the FindSettingMembers measure that should return all Office members including the index individual. It will trigger the follow-up strategy 'my_other_strategy' for everyone in that office.
GEMS.IsOpen — Type
IsOpen <: SMeasureIntervention struct to differentiate follow-up setting strategies for currently open or currently closed settings. You can pass a positive_followup- or a negative_followup stategy via the respective optional arguments.
Example
isolate_str = IStrategy("self-isolation", sim)
add_measure!(isolate_str, SelfIsolation(14))
find_coworkers_str = SStrategy("find-coworkers", sim)
add_measure!(find_coworkers_str, FindMembers(isolate_str))
my_str = SStrategy("is-open?", sim)
add_measure!(my_str, IsOpen(positive_followup = find_coworkers_str)))The above example first creates an individual strategy (IStrategy) called 'isolate_str' and adds an instance of the SelfIsolation measure which will send the respective individual in self-isolation if excuted. It then creates an SStrategy called 'find_coworkers_str' and adds an instance of the FindMembers measure that detects the setting's members and calls the previously defined 'isolate_str' on all of them. We now only want to send all co-workers, if the setting is open (and thus might have induced infectious conctacts). Therefore, another SStrategy called 'my_str' is instantiated and an instance of the IsOpen measure is added with the 'find_coworkers_str' strategy being the positive follow-up.
GEMS.OpenSetting — Type
OpenSetting <: SMeasureIntervention struct to open a setting, effectively re-enabling the setting and allow contacts.
Example
my_str = SStrategy("reopen-school", sim)
add_measure!(my_str, OpenSetting())The above example creates an SStrategy called 'my_str' and adds an instance of the OpenSetting measure which will open the respective setting once called. You can, for example, use an STickTrigger to reopen all schools at a given simulation time (after they were closed earlier). The following code would open all schools at tick 20:
stt = STickTrigger(SchoolClass, my_str, switch_tick = Int16(20))
add_tick_trigger!(sim, stt)GEMS.PoolTest — Type
PoolTest <: SMeasureIntervention struct to apply a pathogen pool test to all individuals in a specified setting. Instantiate a PoolTest measure with a name and a type. A PoolTest will return a positive result if at least one of the individuals present at a given setting is infected. The name will determine the labeling of the test series in the logger and can be chosen arbitrarily. The type must be a TestType object that you need to define beforehand. It contains information, e.g., about the sensitivity and specificity of the respective test type.
The PoolTest measure is different from the TestAll measure as the former just uses one test to evaluate whether any of the individuals is infected and the latter applies a separate test to all individuals.
Optional Arguments
positive_followup::SStrategy: What to do with the setting if the test is positivenegative_followup::SStrategy: What to do with the setting if the test is negative
Example
pcr_test = TestType("PCR Test", first_pathogen(sim), sim)
my_str = SStrategy("school-pool-test", sim)
add_measure!(my_str, PoolTest("pool-test", pcr_test, positive_followup = my_close_school_str))The above example first instantiates a TestType for the pathogen registered in the Simulation object, creates an SStrategy called 'my_str' and adds an instance of the PoolTest measure to the strategy. The PoolTest measure has a follow-up strategy called 'my_close_school_str' in case the test result is positive. A follow-up strategy could, for example, be a school-closure strategy. While the above example does not have a follow-up strategy for a negative test, you can ofcouse have both.
GEMS.SelfIsolation — Type
SelfIsolation <: IMeasureIntervention struct to put an individual into self-isolation (household isolation) for the time (in ticks) specified in duration
Example
my_str = IStrategy("self-isolation", sim)
add_measure!(my_str, SelfIsolation(14))The above example creates an IStrategy called 'my_str' and adds an instance of the SelfIsolation measure that should last for 14 days to the strategy.
GEMS.Test — Type
Test <: IMeasureIntervention struct to apply a pathogen test to an individual. Instantiate a Test measure with a name and a type. The name will determine the labeling of the test series in the logger and can be chosen arbitrarily. The type must be a TestType object that you need to define beforehand. It contains information, e.g., about the sensitivity and specificity of the respective test type. Tests are generally separated into 'reportable' tests that contribute to the statistics of 'detected cases' or non-'reportable' which might still change an individual's behavior (such as a rapid-self-test at home) but will not be reported to the authorities.
Optional Arguments
positive_followup::IStrategy: What to do with the individual if the test is positivenegative_followup::IStrategy: What to do with the individual if the test is negativereportable::Bool: Whether a positive result should contribute to the statistics of 'detected cases'. The default istrue.
Example
antigen_test = TestType("Antigen Test", first_pathogen, sim)
my_str = IStrategy("self-test", sim)
add_measure!(my_str, Test("self-test", antigen_test, positive_followup = my_other_strategy))The above example first instantiates a TestType for the pathogen registered in the Simulation object, creates an IStrategy called 'my_str' and adds an instance of the Test measure to the strategy. The Test measure has a follow-up strategy called 'my_other_strategy' in case the test result is positive. A follow-up strategy could, for example, be a self-isolation strategy. While the above example does not have a follow-up strategy for a negative test, you can of couse have both.
GEMS.TestAll — Type
TestAll <: SMeasureIntervention struct to apply a pathogen test to each individual in a specified setting. Instantiate a TestAll measure with a name and a type. A TestAll will return a positive result if at least one of the individuals present at a given setting has a positive test result. However, the logger will contain test results for each of the individuals. The name will determine the labeling of the test series in the logger and can be chosen arbitrarily. The type must be a TestType object that you need to define beforehand. It contains information, e.g., about the sensitivity and specificity of the respective test type.
The TestAll measure is different from the PoolTest measure as the latter just uses one test to evaluate whether any of the individuals is infected and the former applies a separate test to all individuals.
Optional Arguments
positive_followup::SStrategy: What to do with the setting if the test is positivenegative_followup::SStrategy: What to do with the setting if the test is negativereportable::Bool: Whether a positive result should contribute to the statistics of 'detected cases'. The default istrue.
Example
pcr_test = TestType("PCR Test", first_pathogen(sim), sim)
my_str = SStrategy("test-household-members", sim)
add_measure!(my_str, TestAll("pcr-test", pcr_test, positive_followup = my_isolate_household_str))The above example first instantiates a TestType for the pathogen registered in the Simulation object, creates an SStrategy called 'my_str' and adds an instance of the PoolTest measure to the strategy. The PoolTest measure has a follow-up strategy called 'my_isolate_household_str' in case the test result is positive. A follow-up strategy could, for example, be a hosuehold-isolation strategy. While the above example does not have a follow-up strategy for a negative test, you can of couse have both.
GEMS.TestType — Type
TestType <: AbstractTestTypeA type to specify a type of pathogen test (e.g. 'PCR Test') and its parameterization.
Fields
name::String: Name of the test (e.g. 'Rapid Test' or 'PCR Test')pathogen_id::Int8: Pathogen that this test will detectsensitivity::Float64 = 1.0: Probability (0-1) that this test will positively identify an infection (true positive rate)specificity::Float64 = 1.0: Probability (0-1) that this test will negatively identify a non-infection (true negative rate)
GEMS.TraceInfectiousContacts — Type
TraceInfectiousContacts <: IMeasureIntervention struct to trace individuals that have been infected by the index individual, this measure is called with. The follow_up argument provides an IStrategy that is being exceuted for all detected contacts. The optional success_rate (0-1) argument can be used to model sub-perfect tracing (the default is 100%).
Example
my_str = IStrategy("contact-tracing", sim)
add_measure!(my_str, TraceInfectiousContacts(my_other_str, success_rate = 0.5))The above example creates an IStrategy called 'my_str' and adds an instance of the TraceInfectiousContacts measure that will trigger the 'my_other_str' for all detected infections. The success_rate is 50%.
Functions
GEMS.duration — Method
duration(si::SelfIsolation)Returns the duration attribute from a SelfIsolation struct.
GEMS.follow_up — Function
follow_up(h::Handover)Returns the follow-up strategy associated with a Handover struct.
follow_up(fs::FindSetting)Returns the follow_up strategy attribute from a FindSetting struct.
follow_up(fsm::FindSettingMembers)Returns the follow_up strategy attribute from a FindSettingMembers struct.
follow_up(tic::TraceInfectiousContacts)Returns the follow_up strategy attribute from a TraceInfectiousContacts struct.
follow_up(m::Vaccinate)Returns the follow-up IStrategy triggered after vaccination, or nothing.
follow_up(fs::FindMembers)Returns the follow_up strategy attribute of a FindMembers measure struct.
GEMS.measure_logic — Function
measure_logic(measure::CustomIMeasure)Returns the measure_logic (function) attribute from a CustomIMeasure struct.
measure_logic(measure::CustomSMeasure)Returns the measure_logic (function) attribute from a CustomSMeasure struct.
GEMS.name — Method
name(t::PoolTest)Returns the name of a test-series from a PoolTest measure struct.
GEMS.name — Method
name(t::TestAll)Returns the name of a test-series from a TestAll measure struct.
GEMS.name — Method
name(tt::TestType)Returns the TestType's name.
GEMS.name — Method
name(t::Test)Returns the name of a test-series from a Test measure struct.
GEMS.name — Method
name(tt::TestSeroprevalenceTestTypeType)Returns the SeroprevalenceTestType's name.
GEMS.negative_followup — Function
negative_followup(t::Test)Returns the negative_followup strategy from a Test measure struct.
negative_followup(t::IsOpen)Returns the negative_followup strategy attribute of an IsOpen measure struct.
negative_followup(t::PoolTest)Returns the negative_followup strategy from a PoolTest measure struct.
negative_followup(t::TestAll)Returns the negative_followup strategy from a TestAll measure struct.
GEMS.nonself — Method
nonself(fsm::FindSettingMembers)Returns the nonself strategy attribute from a FindSettingMembers struct.
GEMS.positive_followup — Function
positive_followup(t::Test)Returns the positive_followup strategy from a Test measure struct.
positive_followup(t::IsOpen)Returns the positive_followup strategy attribute of an IsOpen measure struct.
positive_followup(t::PoolTest)Returns the positive_followup strategy from a PoolTest measure struct.
positive_followup(t::TestAll)Returns the positive_followup strategy from a TestAll measure struct.
GEMS.process_measure — Function
Abstract wrapper function for intervention processing. Requires contrete subtype implementation
Abstract wrapper function for intervention processing. Requires contrete subtype implementation
process_measure(sim::Simulation, ind::Individual, cancel::CancelSelfIsolation)Cancels an individuals self-isolation (household isolation) by setting the individual's quarantine_release_tick to 'now'.
Parameters
sim::Simulation: Simulation objectind::Individual: Individual that this measure will be applied to (focus individual)cancel::CancelSelfIsolation: Measure instance
process_measure(sim::Simulation, ind::Individual, custom::CustomIMeasure)Applies a custom logic to the individual as specified in the CustomIMeasure's measure_logic field.
Parameters
sim::Simulation: Simulation objectind::Individual: Individual that this measure will be applied to (focus individual)custom::CustomIMeasure: Measure instance
process_measure(sim::Simulation, ind::Individual, measure::FindSetting)Detects a particular setting (specified by the FindSetting measure's settingtype attribute) for an individual and hands over a follow_up strategy for the respective setting object.
Parameters
sim::Simulation: Simulation objectind::Individual: Individual that this measure will be applied to (focus individual)measure::FindSetting: Measure instance
Returns
Nothing: Triggers thefollow_upstrategy for the detected setting.
process_measure(sim::Simulation, ind::Individual, measure::FindSettingMembers)Finds all members of one of the settings an individual is associated with. the measure's field settingtype specifies which kind of setting shall be queried, the nonself boolean flag indicates whether the index individual shall be among the returning members. The follow_up strategy is handed over to all found members (and enqueued in the EventQueue in a subsequent step)
Parameters
sim::Simulation: Simulation objectind::Individual: Individual that this measure will be applied to (focus individual)measure::FindSettingMembers: Measure instance
Returns
Nothing: Triggers thefollow_upstrategy for each found member (skipping the focal individual whennonselfis set).
process_measure(sim::Simulation, ind::Individual, isolation::SelfIsolation)Puts an individual into self-isolation (household isolation) for the time (in ticks) specified in the SelfIsolation's duration attribute.
Parameters
sim::Simulation: Simulation objectind::Individual: Individual that this measure will be applied to (focus individual)isolation::SelfIsolation: Measure instance
process_measure(sim::Simulation, ind::Individual, test::Test)Apply a test of TestType (as specified in the Test measure) to an individual. The test will automatically be logged in the Simulation's internal loggers. If a follow-up strategy is set (for either positive or negative results), the follow-up strategy is handed over to the EventQueue for this individual.
Parameters
sim::Simulation: Simulation objectind::Individual: Individual that this measure will be applied to (focus individual)test::Test: Measure instance
Returns
Nothing: Triggers the positive or negative follow-up strategy (depending on the test result) forind.
process_measure(sim::Simulation, ind::Individual, measure::TraceInfectiousContacts)Detects individuals that have been infected by the index individual. The TraceInfectiousContacts measure's success_rate argument can be used to model sub-perfect tracing (the default is 100%). The follow_up strategy of the TraceInfectiousContacts measure is handed over to all detected contacts.
Parameters
sim::Simulation: Simulation objectind::Individual: Individual that this measure will be applied to (focus individual)measure::TraceInfectiousContacts: Measure instance
Returns
Nothing: Triggers thefollow_upstrategy for each successfully traced infectee.
process_measure(sim::Simulation, ind::Individual, m::Vaccinate)Administers the vaccine carried by m to ind and triggers the configured follow_up strategy (if any) for ind.
Parameters
sim::Simulation: The running simulation.ind::Individual: The individual to vaccinate.m::Vaccinate: The measure instance.
Returns
Nothing: Triggers the configuredfollow_upstrategy (if any) forind.
process_measure(sim::Simulation, s::Setting, measure::ChangeContactMethod)Replaces the contact sampling method in the setting that was passed with a new sampling method specified in the ChangeContactMethod measure.
Parameters
sim::Simulation: Simulation objects::Setting: Setting that this measure will be applied to (focus setting)measure::ChangeContactMethod: Measure instance
process_measure(sim::Simulation, s::Setting, close::CloseSetting)Closes the passed setting s indefinitely, effectively preventing all contacts.
Parameters
sim::Simulation: Simulation objects::Setting: Setting that this measure will be applied to (focus setting)close::CloseSetting: Measure instance
process_measure(sim::Simulation, s::Setting, custom::CustomSMeasure)Applies a custom logic to the setting as specified in the CustomSMeasure's measure_logic field.
Parameters
sim::Simulation: Simulation objects::Setting: Setting that this measure will be applied to (focus setting)custom::CustomSMeasure: Measure instance
process_measure(sim::Simulation, s::Setting, measure::FindMembers)Returns the individuals (members) associated with setting s and hands over the follow_up strategy as specified in the FindMembers measure. The sample_size, sample_fraction, and selectionfilter attributes of the FindMembers measure can be used to condition or limit the results.
Parameters
sim::Simulation: Simulation objects::Setting: Setting that this measure will be applied to (focus setting)measure::FindMembers: Measure instance
Returns
Nothing: Triggers thefollow_upstrategy for each found member (or sampled subset).
process_measure(sim::Simulation, s::Setting, measure::IsOpen)Evaluates whether the setting s is currently open and hands over the respective follow-up strategies as specified in the IsOpen measure.
Parameters
sim::Simulation: Simulation objects::Setting: Setting that this measure will be applied to (focus setting)measure::IsOpen: Measure instance
Returns
Nothing: Triggers the positive or negative follow-up strategy (depending on whether the setting is open) fors.
process_measure(sim::Simulation, s::Setting, close::OpenSetting)(Re-)Opens the passed setting s indefinitely, again allowing contacts to happen.
Parameters
sim::Simulation: Simulation objects::Setting: Setting that this measure will be applied to (focus setting)close::OpenSetting: Measure instance
process_measure(sim::Simulation, s::Setting, measure::PoolTest)Apply a test of TestType (as specified in the PoolTest measure) to a setting. The test will automatically be logged in the Simulation's internal loggers. If a follow-up strategy is set (for either positive or negative results), the follow-up strategy is handed over to the EventQueue for this setting.
Parameters
sim::Simulation: Simulation objects::Setting: Setting that this measure will be applied to (focus setting)measure::PoolTest: Measure instance
Returns
Nothing: Triggers the positive or negative follow-up strategy (depending on the test result) fors.
process_measure(sim::Simulation, s::Setting, measure::TestAll)Apply a test of TestType (as specified in the TestAll measure) to each individual of a setting. The test results will automatically be logged in the Simulation's internal loggers. If a follow-up strategy is set (for either positive or negative results), the follow-up strategy is handed over to the EventQueue for this setting.
Parameters
sim::Simulation: Simulation objects::Setting: Setting that this measure will be applied to (focus setting)measure::TestAll: Measure instance
Returns
Nothing: Triggers the positive or negative follow-up strategy (depending on whether at least one test was positive) fors.
GEMS.reportable — Method
reportable(t::Test)Returns the reportable boolean flag from a Test measure struct.
GEMS.reportable — Method
reportable(t::TestAll)Returns the reportable boolean flag from a TestAll measure struct.
GEMS.sample_fraction — Method
sample_fraction(fs::FindMembers)Returns the sample_fraction attribute of a FindMembers measure struct.
GEMS.sample_size — Method
sample_size(fs::FindMembers)Returns the sample_size attribute of a FindMembers measure struct.
GEMS.sampling_method — Method
sampling_method(measure::ChangeContactMethod)Returns the sampling_method attribute from a ChangeContactMethod struct.
GEMS.selectionfilter — Method
selectionfilter(fs::FindMembers)Returns the selectionfilter attribute of a FindMembers measure struct.
GEMS.sensitivity — Method
sensitivity(tt::TestType)Returns the TestType's sensitivity.
GEMS.specificity — Method
specificity(tt::TestType)Returns the TestType's specificity.
GEMS.success_rate — Method
success_rate(tic::TraceInfectiousContacts)Returns the success_rate attribute from a TraceInfectiousContacts struct.
GEMS.type — Function
type(t::Test)Returns the test type from a Test measure struct.
type(t::PoolTest)Returns the test type from a PoolTest measure struct.
type(t::TestAll)Returns the test type from a TestAll measure struct.
Event Handling
Constructors
GEMS.Handover — Type
HandoverThe Handover struct provides a standard data structure for handling outputs of the process_measure() functions. It is being used to pass follow-up strategies to focal objects that are being determined within the process_measure() functions. The Handovers organize how follow-up strategies are passed to the event queue. There is no application for Handovers outside of process_measure() functions.
Fields
focal_objects::Union{Vector{Individual},Vector{<:Setting}}: List of focal objects (either allIndividuals or allSettings)follow_up::Union{<:Strategy, Nothing}: Strategy that shall be triggered for all focus objects in thefocal_objectslist
Examples
The code below defines how a Test measure shall be processed. First, the passed individual ind is being tested. The function then returns a new Handover with the focus object (the individual) and the either positive- or negative-follow-up stategy that are defined in the Test measure.
function process_measure(sim::Simulation, ind::Individual, test::Test)
test_pos = apply_test!(ind, test |> type, sim, test |> reportable)
return Handover(ind, test_pos ? test |> positive_followup : test |> negative_followup)
endThe handovers can be instantiated with single focal objects (Individuals or Settings) as well as vectors of focal objects (Vector{Individual} or Vector{Setting}). It's also possible to instantiate a Handover with nothing as the follow_up strategy which is sometimmes helpful if you don't know whether there will be a subsequent strategy or not.
Here are some more examples on how to instantiate Handovers:
i1 = Indiviual(...)
i2 = Indiviual(...)
s = Household(...)
istr = IStrategy("my_istr", sim)
sstr = SStrategy("my_sstr", sim)
h1 = Handover(i1, istr)
h2 = Handover([i1, i2], istr)
h3 = Handover(s, nothing)
h4 = Handover([s], sstr)Note: Naturally, A Handover must either have all Individuals and an IStrategy or all Settingss and an SStrategy.
GEMS.IMeasureEvent — Type
IMeasureEvent <: EventStruct associate a specific Individual with a specific IMeasure which is stored in the intervention event queue.
GEMS.SMeasureEvent — Type
SMeasureEvent <: EventStruct associate a specific Setting with a specific SMeasure which is stored in the intervention event queue.
Functions
Missing docstring for dequeue!(::EventQueue). Check Documenter's build log for details.