emodpy_hiv.interventions.cascade_helpers module#

emodpy_hiv.interventions.cascade_helpers.reset(camp)[source]#

Utility function to clear out the campaign object, mostly useful to test. This function is not auto-imported with the module like the rest of the functions in this submodule. Caller has to explicitly import emodpy_hiv.interventions.cascade_helpers. :param camp: emod_api.campaign object.

Returns:

None.

emodpy_hiv.interventions.cascade_helpers.seed_infection(camp, timestep, coverage)[source]#

Seed an infection by time and %age of population infected.

emodpy_hiv.interventions.cascade_helpers.triggered_event_common(camp, in_trigger, out_iv, coverage=1.0, target_sex='All', property_restrictions: List[str] | None = None, event_name='', node_ids: List[int] | None = None, start_day: int = 1, target_age_min: float = 0, target_age_max: float = 73000, delay: float | None = None, duration: float = -1.0)[source]#

Parameterized utility function used by rest of functions in this submodule; listens for a trigger (signal) and distributes an intervention (or list thereof) as a result, based on coverage and targeting.

Parameters:
  • camp – The central campaign accumulator, from emod_api.campaign.

  • in_trigger – The trigger aka signal for the event. E.g., “NewInfection”

  • out_iv – The output intervention of the event.

  • coverage (float) – The coverage of the event (default is 1.0).

  • target_sex (str) – The target sex for the event (default is “All”).

  • property_restrictions (list[str]) – A list of IP restrictions in “Risk:HIGH” format. None means no restrictions.

  • event_name (str) – The name of the event (default is an empty string).

  • node_ids – (list[int]) A list of node ids to apply the event to. None means all nodes.

  • start_day – (int) The model simulation time to start the event.

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

Returns:

New campaign event.

emodpy_hiv.interventions.cascade_helpers.add_triggered_event(camp, in_trigger, out_iv, coverage=1.0, target_sex='All', property_restrictions: List[str] | None = None, event_name='', node_ids: List[int] | None = None, start_day: int = 1, target_age_min: float = 0, target_age_max: float = 73000, delay: float | None = None, duration: float = -1.0)#

Parameterized utility function used by rest of functions in this submodule; listens for a trigger (signal) and distributes an intervention (or list thereof) as a result, based on coverage and targeting.

Parameters:
  • camp – The central campaign accumulator, from emod_api.campaign.

  • in_trigger – The trigger aka signal for the event. E.g., “NewInfection”

  • out_iv – The output intervention of the event.

  • coverage (float) – The coverage of the event (default is 1.0).

  • target_sex (str) – The target sex for the event (default is “All”).

  • property_restrictions (list[str]) – A list of IP restrictions in “Risk:HIGH” format. None means no restrictions.

  • event_name (str) – The name of the event (default is an empty string).

  • node_ids – (list[int]) A list of node ids to apply the event to. None means all nodes.

  • start_day – (int) The model simulation time to start the event.

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

Returns:

New campaign event.

emodpy_hiv.interventions.cascade_helpers.add_scheduled_event(camp, out_iv, coverage=1.0, target_sex='All', property_restrictions: List[str] | None = None, event_name='', node_ids: List[int] | None = None, start_day: int = 1)[source]#
emodpy_hiv.interventions.cascade_helpers.add_reference_tracked_event(camp, out_iv, time_value_map: dict, event_name: str = '', target_min_age: float = 0, target_max_age: float = 200, target_sex: str = 'All', target_disease_state: str | None = None, update_period: float = 30.4166666666667, start_day: float = 1960.5, node_ids: List[int] | None = None)[source]#
emodpy_hiv.interventions.cascade_helpers.add_choice(camp, sympto_signal='NewlySymptomatic', get_tested_signal='GetTested')[source]#

Listen for a trigger. Defaults to ‘NewlySymptomatic’. Then toss a fair coin; in case of heads, Distribute diagnostic (and publish signal – default is ‘GetTested’; tails maybe it’s just a cold (‘Ignore’).

Parameters:
  • camp – The central campaign accumulator, from emod_api.campaign.

  • sympto_signal (str) – The signal or trigger we are listening for. Doesn’t have to be anything to do with

symptomaticity but defaults to “NewlySymptomatic”.

get_tested_signal (str): The signal/trigger published if coin toss is heads and person gets tested.

emodpy_hiv.interventions.cascade_helpers.add_test(camp, get_tested_signal='GetTested')[source]#

Listen for get_tested_signal signal (defaults to “GetTested”). Then give HIV RapidDiagnostic test after a delay of 30 days. Publish ‘HIVPositiveTest’ on +ve or ‘HIVNegativeTest’ on -ve.

emodpy_hiv.interventions.cascade_helpers.trigger_art_from_pos_test(camp, input_signal='HIVPositiveTest', output_signal='StartTreatment', lag_time=30)[source]#

Listen for HIVPositiveTest trigger. Then Trigger ART. Note that Trigger ART isn’t same as starting it.

emodpy_hiv.interventions.cascade_helpers.add_art_from_trigger(camp, signal='StartTreatment')[source]#

Actually distribute ART if a StartTreatment signal/trigger is observed. Broadcast a StartedART signal synchronously.

emodpy_hiv.interventions.cascade_helpers.trigger_art(camp, timestep, coverage, trigger='StartTreatment')[source]#

Schedule a broadcast of StartTreatment (or equivalent), not based on any observed signals.