emod_api.interventions.common module

emod_api.interventions.common.BroadcastEvent(camp, Event_Trigger: str = 'Births')

Wrapper function to create and return a BroadcastEvent intervention.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • Event_Trigger – A valid trigger/event/signal.

Returns

Schema-based smart dictionary representing a new BroadastEvent intervention ready to be added to a campaign.

Return type

ReadOnlyDict

emod_api.interventions.common.BroadcastEventToOtherNodes(camp, Event_Trigger, Node_Selection_Type='DISTANCE_ONLY', Max_Distance_To_Other_Nodes_Km=- 1, Include_My_Node=1)

Wrapper function to create and return a BroadcastEventToOtherNodes intervention.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • Event_Trigger – A valid trigger/event/signal.

  • Node_Selection_Type – TBD.

  • Max_Distance_To_Other_Nodes_Km – TBD.

  • Include_My_Node – TBD.

Returns

Schema-based smart dictionary representing a new BroadastEvent intervention ready to be added to a campaign.

Return type

ReadOnlyDict

emod_api.interventions.common.MultiInterventionDistributor(camp, Intervention_List)

Wrapper function to create and return a MultiInterventionDistributor intervention.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • Intervention_List – List of 1 or more valid intervention dictionaries to be

  • together. (distributed) –

Returns

Schema-based smart dictionary representing a new MultiInterventionDistributor intervention ready to be added to a campaign.

Return type

ReadOnlyDict

emod_api.interventions.common.DelayedIntervention(camp, Configs, Delay_Dict=None)

Wrapper function to create and return a DelayedIntervention intervention.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • Config – Valid intervention config.

  • Delay_Dict – Dictionary of 1 or 2 params that are the literal Delay_Distribution

  • but without the distribution, which is inferred. E.g., (parameters,) –

  • "Delay_Period_Exponential" ({) – 5 }

Returns

Schema-based smart dictionary representing a new DelayedIntervention intervention ready to be added to a campaign.

Return type

ReadOnlyDict

emod_api.interventions.common.HSB(camp, Event_Or_Config='Event', Config=None, Event='NoTrigger', Tendency=1.0, Single_Use=True, Name='HSB')

Wrapper function to create and return a HealthSeekingBehaviour intervention.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • Event_Or_Config – “Event” or “Config”.

  • Config – Complete, valid intervention configuration to be distributed.

  • Event – Event/Trigger/Signal to be broadcast, alternative to an intervention.

  • Tendency – Daily probability of ‘seeking care’ aka distributing payload intervention.

  • Single_Use – One-and-done, or continuous?

  • Name – Intervention Name. Useful if you want to provide uniqueness and not worry about

  • intervention management. (duplicate) –

Returns

Schema-based smart dictionary representing a new HSB intervention ready to be added to a campaign.

Return type

ReadOnlyDict

emod_api.interventions.common.NLHTI(camp, Triggers, Interventions, Property_Restrictions=None, Demographic_Coverage=1.0, Target_Age_Min=0, Target_Age_Max=45625, Target_Gender='All', Target_Residents_Only=1, Duration=- 1, Blackout_Event_Trigger=None, Blackout_Period=None, Blackout_On_First_Occurrence=None, Disqualifying_Properties=None)

Wrapper function to create and return a NodeLevelHealthTriggeredIntervention intervention.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • Triggers – List of Triggers/Events/Signals

  • Interventions – List of interventions to distrbute when signal is heard.

  • Property_Restrictions – Individual Properties that an agent must have to qualify for intervention.

  • Demographic_Coverage – Percentage of individuals to receive intervention.

  • Target_Age_Min – Minimum age (in years).

  • Target_Age_Max – Maximum age (in years).

  • Target_Gender – All, Male, or Female.

  • Target_Residents_Only – Not used.

  • Duration – How long this listen-and-distribute should last.

  • Blackout_Event_Trigger – Not used.

  • Blackout_Period – Not used.

  • Blackout_On_First_Occurrence – Not used.

  • Disqualifying_Properties – Not used.

Returns

Schema-based smart dictionary representing a new NLHTI intervention ready to be added to a campaign.

Return type

ReadOnlyDict

emod_api.interventions.common.PropertyValueChanger(camp, Target_Property_Key, Target_Property_Value, Daily_Probability=1.0, Maximum_Duration=1, Revert=- 1, Intervention_Name='', Event_Trigger_Distributed='', Event_Trigger_Expired='')

Wrapper function to create and return a PropertyValueChanger intervention.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • The key part of the new key-value pair of the IP. (Target_Property_Key.) –

  • The value part of the new key-value pair of the IP. (Target_Property_Value.) –

  • Optional IP key (New_Property_Value..) – value part to be set, common to all interventions.

  • The daily probability that an individual will move to the Target_Property_Value. (Daily_Probability.) –

  • The maximum amount of time individuals have to move to a new group. This timing works in conjunction with Daily_Probability. (Maximum_Duration.) –

  • The number of days before an individual moves back to their original group. (Revert.) –

  • Optional Intervention_Name. Useful if managing a replacement policy. (Intervention_Name.) –

  • Optional broadcast trigger to be published when PVC is distributed. (Event_Trigger_Distributed.) –

  • Optional broadcast trigger to be published when PVC is expired. (Event_Trigger_Expired.) –

Returns

Schema-based smart dictionary representing a new PropertyValueChanger intervention ready to be added to a campaign.

Return type

ReadOnlyDict

emod_api.interventions.common.ScheduledCampaignEvent(camp, Start_Day: int, Node_Ids=None, Nodeset_Config=None, Number_Repetitions: int = 1, Timesteps_Between_Repetitions: int = - 1, Event_Name: str = 'Scheduled_Campaign_Event', Property_Restrictions=None, Demographic_Coverage: float = 1.0, Target_Age_Min=0, Target_Age_Max=45625, Target_Gender: str = 'All', Intervention_List=None)

Wrapper function to create and return a ScheduledCampaignEvent intervention. The alternative to a ScheduledCampaignEvent is a TriggeredCampaignEvent.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • Start_Day – When to start.

  • Event_Name – Name for overall campaign event, of no functional meaning. Not in schema and not yet used.

  • Node_Ids – Nodes to target with this intervenion

  • Nodeset_Config

    Nodes to target with this intervenion, return from utils.do_nodes().

    Deprecated since version 2.x: Use parameter Node_Ids instead

  • Property_Restrictions – Individual Properties a person must have to receive the intervention(s).

  • Number_Repetitions – N/A

  • Timesteps_Between_Repetitions – N/A

  • Demographic_Coverage – Percentage of individuals to receive intervention.

  • Target_Age_Min – Minimum age (in years).

  • Target_Age_Max – Maximum age (in years).

  • Target_Gender – All, Male, or Female.

  • Intervention_List – List of 1 or more valid intervention dictionaries to be

  • together. (distributed) –

Returns

Schema-based smart dictionary representing a new ScheduledCampaignEvent intervention ready to be added to a campaign.

Return type

ReadOnlyDict

emod_api.interventions.common.TriggeredCampaignEvent(camp, Start_Day: int, Event_Name: str, Triggers: List[str], Intervention_List: List[dict], Node_Ids=None, Nodeset_Config=None, Node_Property_Restrictions=None, Property_Restrictions=None, Number_Repetitions: int = 1, Timesteps_Between_Repetitions: int = - 1, Demographic_Coverage: float = 1.0, Target_Age_Min=0, Target_Age_Max=45625, Target_Gender: str = 'All', Target_Residents_Only=1, Duration=- 1, Blackout_Event_Trigger: str = None, Blackout_Period=0, Blackout_On_First_Occurrence=0, Disqualifying_Properties=None, Delay=None)

Wrapper function to create and return a TriggeredCampaignEvent intervention. The alternative to a TriggeredCampaignEvent is a ScheduledCampaignEvent.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • Start_Day – When to start.

  • Event_Name – Name for overall campaign event, of no functional meaning. Not in schema and not yet used.

  • Node_Ids – Nodes to target with this intervenion

  • Nodeset_Config

    Nodes to target with this intervenion, return from utils.do_nodes().

    Deprecated since version 2.x: Use parameter Node_Ids instead

  • Triggers – List of triggers/events/signals to listen to in order to trigger distribution.

  • Intervention_List – List of 1 or more valid intervention dictionaries to be

  • together. (distributed) –

  • Node_Property_Restrictions – N/A.

  • Property_Restrictions – Individual Properties a person must have to receive the intervention(s).

  • Demographic_Coverage – Percentage of individuals to receive intervention.

  • Target_Age_Min – Minimum age (in years).

  • Target_Age_Max – Maximum age (in years).

  • Target_Gender – All, Male, or Female.

  • Target_Residents_Only – Not used.

  • Duration – How long this listen-and-distribute should last.

  • Blackout_Event_Trigger – Not used.

  • Blackout_Period – Not used.

  • Blackout_On_First_Occurrence – Not used.

  • Disqualifying_Properties – Not used.

  • delay – Optional delay between trigger and actual distribution.

Returns

Schema-based smart dictionary representing a new TriggeredCampaignEvent intervention ready to be added to a campaign.

Return type

ReadOnlyDict

emod_api.interventions.common.StandardDiagnostic(camp, Base_Sensitivity: float = 1.0, Base_Specificity: float = 1.0, Days_To_Diagnosis: float = 0.0, Event_Trigger_Distributed: str = None, Event_Trigger_Expired: str = None, Positive_Diagnosis_Intervention=None, Positive_Diagnosis_Event: str = 'PositiveResult', Negative_Diagnosis_Intervention=None, Negative_Diagnosis_Event: str = 'NegativeResult', Treatment_Fraction: float = 1.0)

Wrapper function to create and return a StandardDiagnostic intervention.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • Base_Sensitivity – base sensitivity [0..1]

  • Base_Specificity – base specificity [0..1]

  • Days_To_Diagnosis – days to diagnosis

  • Event_Trigger_Distributed – A trigger that is fired when intervention was distributed

  • Event_Trigger_Expired – A trigger that is fired when intervention has expired

  • Positive_Diagnosis_Intervention – Intervention that is distributed in case of a positive diagnosis. If set, no events may be configured.

  • Positive_Diagnosis_Event – A trigger that is fired in case of a positive diagnosis

  • Negative_Diagnosis_Intervention – Intervention that is distributed in case of a Negative diagnosis. If set, no events may be configured. Not used outside of Malaria-Ongoing yet.

  • Negative_Diagnosis_Event – A trigger that is fired in case of a Negative diagnosis. Not used outside of Malaria-Ongoing yet.

  • Treatment_Fraction – treatment fraction [0..1]

Returns

Schema-based smart dictionary representing a new MultiInterventionDistributor intervention ready to be added to a campaign.

Return type

ReadOnlyDict

emod_api.interventions.common.triggered_campaign_delay_event(camp, start_day, trigger, delay, intervention, ip_targeting=[], coverage=1.0)

Create and return a campaign event that responds to a trigger after a delay with an intervention.

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • start_day – When to start.

  • delay – Dictionary of 1 or 2 params that are the literal Delay_Distribution parameters,

  • without the distribution, which is inferred. E.g., { "Delay_Period_Exponential" (but) – 5 }.

  • trigger – E.g., “NewInfection”.

  • intervention – List of 1 or more valid intervention dictionaries to be distributed together.

  • ip_targeting – Optional Individual Properties required for someone to receive the intervntion(s).

Returns

Campaign event.

emod_api.interventions.common.change_individual_property_at_age(camp, new_ip_key, new_ip_value, change_age_in_days, revert_in_days, ip_targeting_key, ip_targeting_value, coverage=1.0)

Create and return a campaign event that changes a person’s Individual Properties once they turns a certain age. e.g., change_individual_property_at_age(cb, ‘ForestGoing’, ‘LovesForest’, coverage=0.6, change_age_in_days=15*365, revert=20*365)

Parameters
  • camp – emod_api.campaign object with schema_path set.

  • new_ip_key – The new IP key.

  • new_ip_value – The new IP value.

  • change_age_in_days – The age at which the individual transitions (in units of days).

  • revert_in_days – How many days they remain with the new property.

  • ip_targeting_key – The IP key a person must have to receive this.

  • ip_targeting_value – The IP value a person must have to receive this.

  • coverage – Optional fraction to limit this to a subset of the target population.

Returns

Campaign event.