emodpy_hiv.interventions.prep module

emodpy_hiv.interventions.prep.new_intervention(camp, efficacy_times=[0, 365], efficacy_values=[0.5, 0])[source]

Create a new PrEP (Pre-Exposure Prophylaxis) intervention.

This function creates and configures a new PrEP intervention using the provided efficacy times and values.

Parameters:
  • camp (emod_api.campaign) – The central campaign builder object.

  • efficacy_times (list of float) – A list of times at which the PrEP efficacy changes. Times must be > 0 and in ascending order.

  • efficacy_values (list of float) – A list of efficacy values corresponding to the times. Values must be between 0 and 1.

Returns:

A new PrEP intervention with the specified efficacy configuration, which can be passed to a scheduled or triggered campaign event function.

Raises:
  • ValueError – If the lengths of efficacy_times and efficacy_values do not match.

  • ValueError – If any time value in efficacy_times is not greater than 0.

  • ValueError – If the time values in efficacy_times are not in ascending order.

  • ValueError – If any value in efficacy_values is not between 0 and 1.

Example:

camp.set_schema("path/to/schema.json")
times = [1, 2, 3, 4, 5, 6, 7]
values = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7]
intervention = new_intervention(camp, times, values)
emodpy_hiv.interventions.prep.new_intervention_event(camp, efficacy_times=[0, 365], efficacy_values=[0.5, 0], start_day=1, coverage=1.0, node_ids=None)[source]

Create a new PrEP (Pre-Exposure Prophylaxis) intervention as complete (scheduled) event.

This function creates and configures a new PrEP intervention using the provided efficacy times and values, and adds it to a scheduled event. You need to add it to the campaign.

Parameters:
  • camp (emod_api.campaign) – The central campaign builder object.

  • efficacy_times (list of float) – A list of times at which the PrEP efficacy changes. Times must be > 0 and in ascending order.

  • efficacy_values (list of float) – A list of efficacy values corresponding to the times. Values must be between 0 and 1.

  • start_day (int) – When this campaign event should occur.

  • coverage (float) – Who should get this – i.e., what percentage of the population.

  • node_ids (list of integers) – Where this campaign event should be distributed. Leave as default if ‘everywhere’.

Returns:

A new PrEP intervention with the specified efficacy configuration, which can be passed to a scheduled or triggered campaign event function.

Raises:
  • ValueError – If the lengths of efficacy_times and efficacy_values do not match.

  • ValueError – If any time value in efficacy_times is not greater than 0.

  • ValueError – If the time values in efficacy_times are not in ascending order.

  • ValueError – If any value in efficacy_values is not between 0 and 1.

Example:

camp.set_schema("path/to/schema.json")
times = [1, 2, 3, 4, 5, 6, 7]
values = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7]
event = new_intervention_event(camp, times, values, start_day=730, coverage=0.33, node_ides[ 1, 4, 5 ])
emodpy_hiv.interventions.prep.new_intervention_as_file(camp, start_day, filename=None)[source]