emodpy_hiv.campaign.distributor module#

emodpy_hiv.campaign.distributor.add_intervention_scheduled(campaign: <module 'emod_api.campaign' from '/home/docs/checkouts/readthedocs.org/user_builds/institute-for-disease-modeling-emodpy-hiv/envs/latest/lib/python3.9/site-packages/emod_api/campaign.py'>, intervention_list: list[emodpy.campaign.base_intervention.IndividualIntervention] | list[emodpy.campaign.base_intervention.NodeIntervention], start_day: float | None = None, start_year: float | None = None, event_name: str | None = None, node_ids: ~typing.List[int] | None = None, target_demographics_config: ~emodpy_hiv.campaign.common.TargetDemographicsConfig | None = None, delay_distribution: ~emodpy_hiv.utils.distributions.BaseDistribution | None = None, repetition_config: ~emodpy_hiv.campaign.common.RepetitionConfig | None = None, property_restrictions: ~emodpy_hiv.campaign.common.PropertyRestrictions | None = None, targeting_config: ~emodpy_hiv.utils.targeting_config.AbstractTargetingConfig | None = None) None#

Add the intervention(s) to the campaign at scheduled time with the given parameters.

This function distributes individual-level or node-level interventions to a specified fraction of individuals or nodes within a node set using node_ids argument.

When distributing individual-level interventions, users can target specific demographics using the target_demographics_config and specify the individual_property_restrictions in the PropertyRestrictions object. Users can further refine the selection of individuals by using the targeting_config argument to target criteria such as whether they have a particular intervention or are in a relationship.

The target_demographics_config, property_restrictions with individual_property_restrictions, and targeting_config do not apply when distributing node-level interventions.

Recurring campaigns can be created by specifying the number of times distributions should occur and the time between repetitions using repetition_config argument.

It can add a delay between when the individual-level interventions are distributed to the individual and when they receive the actual intervention using delay_distribution argument.

Parameters:
  • campaign (api_campaign, required) –

    • The campaign object to which the event will be added. This should be an instance of the emod_api.campaign class.

  • intervention_list (Union[list[IndividualIntervention], list[NodeIntervention]], required) –

    • A list of IndividualIntervention or NodeIntervention objects. It should contain only one type of intervention.

    • Refer to the emodpy(_’disease’).campaign.individual_intervention module for available IndividualIntervention derived classes.

    • Refer to the emodpy(_’disease’).campaign.node_intervention module for available NodeIntervention derived classes.

  • start_day (float, optional) –

    • The day when the event starts.

    • Either start_day or start_year is required, but not both.

    • Defaults to None.

  • start_year (float, optional) –

    • The year when the event starts.

    • Either start_day or start_year is required, but not both.

    • Defaults to None.

  • event_name (str, optional) –

    • The name of the event.

    • Defaults to None.

  • node_ids (Optional[List[int]], optional) –

    • A list of node IDs where the event will be applied.

    • If None, the event applies to all nodes.

    • Defaults to None.

  • target_demographics_config (TargetDemographicsConfig, optional) –

    • a TargetDemographicsConfig to define the demographics related parameters.

    • Defaults to None which target everyone with 100% coverage.

  • delay_distribution (BaseDistribution, optional) –

    • a Distribution to define the delay distribution for the IndividualIntervention.

    • It only applies when intervention_list contains IndividualIntervention.

    • Defaults to None which has no delay.

  • repetition_config (RepetitionConfig, optional) –

    • a RepetitionConfig to define the Number_Repetitions and Timesteps_Between_Repetitions parameters.

    • If None (default), then there is no repetition.

  • property_restrictions (PropertyRestrictions, optional) –

    • a PropertyRestrictions to define the Individual or Node Property_Restrictions in the coordinator.

    • If None (default), then there is no property restrictions.

  • targeting_config (AbstractTargetingConfig, optional) –

    • a TargetingConfig to targeting individuals.

    • Please refer to the emodpy.utils.targeting_config module for more information.

    • If None (default), then there is not extra targeting.

Returns:

None, add the configuration to the campaign.

Example

>>> from emodpy.campaign.distributor import add_intervention_scheduled
>>> from emodpy.campaign.common import TargetDemographicsConfig, RepetitionConfig, PropertyRestrictions, TargetGender
>>> from emodpy.campaign.individual_intervention import BroadcastEvent, OutbreakIndividual
>>> from emodpy.utils.distributions import UniformDistribution
>>> from emodpy.utils.targeting_config import IsPregnant
>>> from emod_api import campaign as api_campaign
>>> my_campaign = api_campaign
>>> my_campaign.set_schema('path_to_schema.json')
>>> # Create a list of interventions containing a BroadcastEvent and an OutbreakIndividual
>>> my_intervention_list = [BroadcastEvent(my_campaign, broadcast_event="received_outbreak"),
>>>                         OutbreakIndividual(my_campaign)]
>>> # Create a UniformDistribution for the delay_distribution
>>> uniform_distribution = UniformDistribution(0, 365)
>>> # Create an IsPregnant targeting config
>>> is_pregnant = IsPregnant()
>>> # Add the event to the campaign, please note that only the first 2 arguments and start_day or start_year are required.
>>> add_intervention_scheduled(
>>>     campaign=my_campaign,
>>>     intervention_list=my_intervention_list,
>>>     # Distribute the interventions on January 1st, 1990.
>>>     start_year=1990,
>>>     event_name="test_event",
>>>     # Distribute the interventions to nodes (or the people there in) 1, 2, 3
>>>     node_ids=[1, 2, 3],
>>>     # Distribute the interventions twice with 365 timesteps between repetitions
>>>     repetition_config=RepetitionConfig(number_repetitions=2, timesteps_between_repetitions=365),
>>>     # Target 70% of female individuals whose Risk is High and are pregnant
>>>     target_demographics_config=TargetDemographicsConfig(demographic_coverage=0.7, target_gender=TargetGender.FEMALE),
>>>     property_restrictions=PropertyRestrictions(individual_property_restrictions=[["Risk:High"]]),
>>>     targeting_config=is_pregnant,
>>>     # Add a uniform delay (from 0 to 365 days) before the actual intervention is distributed
>>>     delay_distribution=uniform_distribution
>>> )
emodpy_hiv.campaign.distributor.add_intervention_triggered(campaign: <module 'emod_api.campaign' from '/home/docs/checkouts/readthedocs.org/user_builds/institute-for-disease-modeling-emodpy-hiv/envs/latest/lib/python3.9/site-packages/emod_api/campaign.py'>, intervention_list: list[emodpy.campaign.base_intervention.IndividualIntervention] | list[emodpy.campaign.base_intervention.NodeIntervention], triggers_list: list[str], start_day: int | None = None, start_year: float | None = None, duration: float = -1, event_name: str | None = None, node_ids: ~typing.List[int] | None = None, delay_distribution: ~emodpy_hiv.utils.distributions.BaseDistribution | None = None, target_demographics_config: ~emodpy_hiv.campaign.common.TargetDemographicsConfig | None = None, property_restrictions: ~emodpy_hiv.campaign.common.PropertyRestrictions | None = None, targeting_config: ~emodpy_hiv.utils.targeting_config.AbstractTargetingConfig | None = None) None#

Configure the campaign to distribute an intervention to an individual when that individual broadcasts an event. For example, you might want to distribute a vaccine to an individual when they broadcast the EighteenMonthsOld event. The triggered events are specified as triggers_list.

When distributing individual-level interventions, users can target specific demographics using the target_demographics_config and specify the individual_property_restrictions in the PropertyRestrictions object. Users can further refine the selection of individuals by using the targeting_config argument to target criteria such as whether they have a particular intervention or are in a relationship.

The target_demographics_config, property_restrictions with individual_property_restrictions, and targeting_config do not apply when distributing node-level interventions.

It can add a delay between when the individual-level interventions are distributed to the individual and when they receive the actual intervention using delay_distribution argument.

Parameters:
  • campaign (api_campaign, required) –

    • The campaign object to which the event will be added. This should be an instance of the emod_api.campaign class.

  • intervention_list (Union[list[IndividualIntervention], list[NodeIntervention]], required) –

    • A list of IndividualIntervention or NodeIntervention objects. It should contain only one type of intervention.

    • Refer to the emodpy(_’disease’).campaign.individual_intervention module for available IndividualIntervention derived classes.

    • Refer to the emodpy(_’disease’).campaign.node_intervention module for available NodeIntervention derived classes.

  • triggers_list (list[str], required) –

    • A list of individual-level events that trigger the distribution of the intervention_list.

    • For HIV, see Event list, and for malaria, Event list for events already used in EMOD or use your own custom from elsewhere in the campaign.

    • It can not be an empty list.

  • start_day (int, optional) –

    • The day when the event starts.

    • Either start_day or start_year is required, but not both.

    • Defaults to None.

  • start_year (float, optional) –

    • The year when the event starts.

    • Either start_day or start_year is required, but not both.

    • Defaults to None.

  • duration (float, optional) –

    • The duration of days to listen for the events in the “triggers_list”.

    • A value of -1 (the default) listens for the events and distributes the intervention until the simulation ends.

    • Minimum value: -1

    • Maximum value: 3.40282e+38

  • event_name (str, optional) –

    • The name of the event.

    • Defaults to None.

  • node_ids (Optional[List[int]], optional) –

    • A list of node IDs where the node will be listening for the events from the people in that node.

    • If None, then all nodes will be listening for the events and distributing the intervention.

    • Defaults to None.

  • delay_distribution (BaseDistribution, optional) –

    • a Distribution to define the delay distribution for the intervention.

    • It only applies when intervention_list contains IndividualIntervention.

    • If None (defalt), there is no delay.

  • target_demographics_config (TargetDemographicsConfig, optional) –

    • a TargetDemographicsConfig to define the demographics related parameters.

    • Defaults to None which target everyone with 100% coverage.

  • property_restrictions (PropertyRestrictions, optional) –

    • a PropertyRestrictions to define the Individual or Node Property_Restrictions in the coordinator.

    • Defaults to None which has no restrictions.

  • targeting_config (AbstractTargetingConfig, optional) –

    • a TargetingConfig to targeting individuals.

    • Please refer to the emodpy.utils.targeting_config module for more information.

    • If None (default), then there is not extra targeting.

Example

>>> from emodpy.campaign.distributor import add_intervention_triggered
>>> from emodpy.campaign.common import TargetDemographicsConfig, RepetitionConfig, PropertyRestrictions, TargetGender
>>> from emodpy.campaign.individual_intervention import BroadcastEvent, OutbreakIndividual
>>> from emodpy.utils.distributions import ExponentialDistribution
>>> from emodpy.utils.targeting_config import IsPregnant
>>> from emod_api import campaign as api_campaign
>>> my_campaign = api_campaign
>>> my_campaign.set_schema('path_to_schema.json')
>>> # Create a list of interventions containing a BroadcastEvent and an OutbreakIndividual
>>> my_intervention_list = [BroadcastEvent(my_campaign, broadcast_event="received_outbreak"),
>>>                         OutbreakIndividual(my_campaign)]
>>> # Create an ExponentialDistribution for the delay_distribution with a mean of 10 timesteps
>>> exponential_distribution = ExponentialDistribution(10)
>>> # Create an is not pregnant targeting config
>>> is_not_pregnant = ~IsPregnant()
>>> # Add the event to the campaign, please note that only the first 3 arguments and start_day or start_year are required.
>>> add_intervention_triggered(my_campaign,
>>>                            my_intervention_list,
>>>                            # Trigger the distribution of the intervention when either of the events: "trigger1" or "trigger2" are broadcast.
>>>                            triggers_list=["trigger1", "trigger2"],
>>>                            # Listen to the triggers for 30 days.
>>>                            duration=30,
>>>                            # Start the event at the 730th timestep.
>>>                            start_day=730,
>>>                            event_name="test_event",
>>>                            # Have nodes 1, 2, 3 listen for the event and distribute the intervention to the people in those nodes.
>>>                            node_ids=[1, 2, 3],
>>>                            # Add a delay between the trigger and the actual intervention
>>>                            delay_distribution=exponential_distribution,
>>>                            # Target 70% of female individual from age 10 to 20 whose Risk is High and are not pregnant
>>>                            target_demographics_config=TargetDemographicsConfig(demographic_coverage=0.7,
>>>                                                                                target_gender=TargetGender.FEMALE,
>>>                                                                                target_age_min=10,
>>>                                                                                target_age_max=20),
>>>                            property_restrictions=PropertyRestrictions(individual_property_restrictions=[["Risk:High"]])
>>>                            targeting_config=is_not_pregnant
>>> )
Returns:

None, add the configuration to the campaign.

emodpy_hiv.campaign.distributor.add_intervention_nchooser_df(campaign: <module 'emod_api.campaign' from '/home/docs/checkouts/readthedocs.org/user_builds/institute-for-disease-modeling-emodpy-hiv/envs/latest/lib/python3.9/site-packages/emod_api/campaign.py'>, intervention_list: list[emodpy.campaign.base_intervention.IndividualIntervention], distribution_df: ~pandas.core.frame.DataFrame, property_restrictions: ~emodpy_hiv.campaign.common.PropertyRestrictions | None = None, target_disease_state: list[list[emodpy_hiv.utils.emod_enum.TargetDiseaseState]] | None = None, target_disease_state_has_intervention_name: str | None = None, event_name: str | None = None, node_ids: list[int] | None = None) None[source]#

# Overview:

Distributes a list of individual-level interventions to exactly N people of a targeted demographic in HIV simulations. This contrasts with other event coordinators that distribute an intervention to a percentage of the population, not to an exact count.

# Population Scaling:

‘N’ is assumed to be a number that is for the non-scaled population. This means you can make it the number actually used in the real world. The ‘N’ values entered will be multiplied by the config parameter x_Base_Population.

For example:
  • If you wanted to model how the real world distributed 2,000 male circumcisions in 1990 when the total population was 400,000, and your demographic parameters are configured such that EMOD has about 400,000 people in 1990, you would distribute 2,000 male circumcisions.

  • If the simulation is taking a long time, and you change config.x_Base_Population to 0.5 to cut the agents in the simulation in half, you would also want to reduce the number of male circumcisions being distributed. This feature will automatically adjust the number being targeted by config.x_Base_Population to only hand out 1,000 male circumcisions.

# Distribution Over Time:

NChooser will also spread out the number of interventions being distributed over the entire time period.

For example:
  • Let’s assume that you are trying to distribute MaleCircumcision to 9 men over five update periods. NChooser will give out two interventions the first four update periods and one during the last update period.

# DataFrame Requirements:

This function takes in a DataFrame containing the distribution data:
  • Required columns: year, min_age, max_age

  • At least one of the following columns is required: num_targeted, num_targeted_female, num_targeted_male

The data in the DataFrame is used to create a list of NChooserTargetedDistributionHIV objects specifying:
  • When: with the year data

  • To whom: with the min_age and max_age data

  • How many interventions are distributed: with the num_targeted data, or the num_targeted_female for female individuals and num_targeted_male for male individuals

Parameters:
  • campaign (emod_api.campaign, required) –

    • The campaign object to which the event will be added.

    • This should be an instance of the emod_api.campaign class.

  • intervention_list (list[IndividualIntervention], required) –

    • A list of IndividualIntervention objects. NodeIntervention is not supported in this feature.

    • Refer to the emodpy_hiv.campaign.individual_intervention module for available IndividualIntervention derived classes.

  • distribution_df (pd.DataFrame, required) –

    • A DataFrame containing the data for these columns: year, min_age, max_age, num_targeted, num_targeted_female, num_targeted_male.

    • The first three columns are required, and at least one of the last three columns is required.

    • num_targeted: The number of individuals to be targeted, gender-agnostic. It can’t be used with num_targeted_female or num_targeted_male.

    • num_targeted_female: The number of female individuals to be targeted. It can’t be used with num_targeted.

    • num_targeted_male: The number of male individuals to be targeted. It can’t be used with num_targeted.

  • target_disease_state (list[list[TargetDiseaseState]], optional) –

    • A two-dimensional list of disease states using the TargetDiseaseState enum.

    • To qualify for the intervention, an individual must match at least one of the inner lists of disease states.

    • Each entry in the inner array is an “and” requirement, meaning an individual must match all states in one inner list to qualify.

    • Each inner list is combined with an “or” relationship with other inner list, meaning an individual needs to match at least one of the inner list to qualify.

    • Possible values: Refer to the TargetDiseaseState enum for the possible values.

    • Default value: None.

  • target_disease_state_has_intervention_name (str, optional) –

    • The name of the intervention to look for in an individual when targeting specific disease states.

    • It’s required when using TargetDiseaseState.HAS_INTERVENTION or TargetDiseaseState.NOT_HAS_INTERVENTION in target_disease_state.

  • property_restrictions (PropertyRestrictions, optional) –

    • A PropertyRestrictions to define the individual-level property restrictions in the coordinator.

    • Please note that node property restrictions are not supported in this feature.

    • Default value: None.

  • event_name (str, optional) –

    • The name of the campaign event.

    • Default value: None

  • node_ids (list[int], optional) –

    • A list of node IDs where the event will be applied.

    • If None, the event applies to all nodes.

    • Default value: None.

Returns:

This function does not return anything. It modifies the campaign object in place.

Return type:

None

Examples

Example 1: This example demonstrates how to distribute a MaleCircumcision intervention to male individuals who are HIV positive and do not have the intervention already. The intervention is distributed based on the distribution data provided in a DataFrame.

>>> import emod_api
>>> from emodpy_hiv.campaign.distributor import add_intervention_nchooser_df
>>> from emodpy_hiv.campaign.individual_intervention import MaleCircumcision
>>> from emodpy_hiv.campaign.common import CommonInterventionParameters as CIP
>>> from emodpy_hiv.utils.emod_enum import TargetDiseaseState
>>> import pandas as pd
>>>
>>> campaign_obj = emod_api.campaign
>>> campaign_obj.schema_path = 'path_to_schema'
>>> # Initialize a MaleCircumcision intervention with intervention_name: 'MaleCircumcision'
>>> intervention_name='MaleCircumcision'
>>> mc = MaleCircumcision(campaign_obj, common_intervention_parameters=CIP(intervention_name=intervention_name)
>>> # Create a DataFrame with the distribution data: year, min_age, max_age, num_targeted_male
>>> # The intervention will be distributed to MALE individuals with the following values:
>>> #    for the year 2010, age ranges: [1, 14.999), [15, 49.999), the number of targeted MALE individuals are: [200, 1300].
>>> #    for the year 2011, age ranges: [1, 14.999), [15, 49.999), the number of targeted MALE individuals are: [290, 1490].
>>> data = {'year': [2010, 2010, 2011, 2011],
>>>         'min_age': [1, 15, 1, 15],
>>>         'max_age': [14.999, 49.999, 14.999, 49.999],
>>>         'num_targeted_male': [200, 1300, 290, 1490]}
>>> distributions_df = pd.DataFrame.from_dict(data)
>>> # Distribute the MaleCircumcision intervention to the campaign with the distribution data. The targeted
>>> # individuals should be male, HIV negative and don't have an intervention called 'MaleCircumcision' already.
>>> add_intervention_nchooser_df(campaign_obj,
>>>                              intervention_list=[mc],
>>>                              target_disease_state=[[TargetDiseaseState.HIV_POSITIVE, TargetDiseaseState.NOT_HAVE_INTERVENTION]],
>>>                              target_disease_state_has_intervention_name=intervention_name,
>>>                              distribution_df=distributions_df)

Example 2: This example demonstrates the usage of “And” and “Or” relationship in the target_disease_state parameter. With the following target_disease_state parameter, the MaleCircumcision intervention will be distributed to individuals who don’t have the intervention already and are either HIV positive or tested positive.

>>> add_intervention_nchooser_df(campaign_obj,
>>>                              intervention_list=[mc],
>>>                              target_disease_state=[[TargetDiseaseState.HIV_POSITIVE, TargetDiseaseState.NOT_HAVE_INTERVENTION],
>>>                                                   [TargetDiseaseState.TESTED_POSITIVE, TargetDiseaseState.NOT_HAVE_INTERVENTION]],
>>>                              target_disease_state_has_intervention_name=intervention_name,
>>>                              distribution_df=distributions_df)

Raises:

emodpy_hiv.campaign.distributor.add_intervention_reference_tracking(campaign: <module 'emod_api.campaign' from '/home/docs/checkouts/readthedocs.org/user_builds/institute-for-disease-modeling-emodpy-hiv/envs/latest/lib/python3.9/site-packages/emod_api/campaign.py'>, intervention_list: list[emodpy.campaign.base_intervention.IndividualIntervention], time_value_map: ~emodpy_hiv.campaign.common.ValueMap, tracking_config: ~emodpy_hiv.utils.targeting_config.AbstractTargetingConfig, start_year: float, end_year: float = 2200, update_period: float = 365, target_demographics_config: ~emodpy_hiv.campaign.common.TargetDemographicsConfig = <emodpy_hiv.campaign.common.TargetDemographicsConfig object>, property_restrictions: ~emodpy_hiv.campaign.common.PropertyRestrictions | None = None, targeting_config: ~emodpy_hiv.utils.targeting_config.AbstractTargetingConfig | None = None, event_name: str | None = None, node_ids: list[int] | None = None) None[source]#

Distribute interventions to the population such that a user determined coverage of an attribute is maintained over time.

This function creates a “tracker” that will track the prevalence of a specific attribute in the population and distribute interventions to achieve the desired coverage. The tracker will periodically poll the population to determine the current prevalence of the attribute and distribute the number of interventions needed to get prevalence up to the desired value. If prevalence is higher than the desired value, then no interventions will be distributed. Other things outside of this tracker (like expiration timers in the intervention) maybe needed to cause the coverage to stay down to the desired coverage.

Parameters:
  • campaign (api_campaign, required) –

    • The campaign object to which the intervention will be added.

  • intervention_list (list[IndividualIntervention], required) –

    • A list of IndividualIntervention objects. NodeIntervention is not supported in this feature.

    • Refer to the emodpy_hiv.campaign.individual_intervention module for available IndividualIntervention derived classes.

  • time_value_map (ValueMap, required) –

    • A ValueMap object that defines the target coverage levels over time.

  • tracking_config (AbstractTargetingConfig, required) –

    • An AbstractTargetingConfig object that defines the attribute to be tracked within the targeted group.

    • The number of individuals with this attribute is used as the numerator for coverage calculations.

    • The number of individual selected via targeting_config, target_demographics, and property_restrictions determine the denominator.

    • Please refer to the emodpy_hiv.utils.targeting_config module for more information.

  • start_year (float, required) –

    • The year to start distributing the intervention.

    • Defines the start of the time period over which the intervention will be distributed.

    • Minimum value: 1900,

    • Maximum value: 2200.

  • end_year (float, optional) –

    • The year to stop distributing the intervention.

    • Defines the end of the time period over which the intervention will be distributed.

    • Minimum value: 1900,

    • Maximum value: 2200,

    • Default value: 2200.

  • update_period (float, optional) –

    • The time period in days between when the tracker polls the population and determines if it should distribute more interventions.

    • Minimum value: 1,

    • Maximum value: 3650,

    • Default value: 365.

  • target_demographics_config (TargetDemographicsConfig, optional) –

    • A TargetDemographicsConfig to define the demographic characteristics of individuals targeted by the intervention.

    • Please refer to the emodpy_hiv.campaign.common.TargetDemographicsConfig module for more information.

    • Please note that the demographic_coverage is not used in this coordinator. Use TargetDemographicsConfig(demographic_coverage=None) to avoid errors.

    • Default value: TargetDemographicsConfig(demographic_coverage=None).

  • property_restrictions (PropertyRestrictions, optional) –

    • A PropertyRestrictions object that defines individual-level property restrictions for the intervention.

    • Node property restrictions are not supported.

    • Default value: None.

  • targeting_config (AbstractTargetingConfig, optional) –

    • An AbstractTargetingConfig to define who to target individuals with the intervention besides the target_demographics_config and property_restrictions.

    • Please note that when defining the target group, you do NOT want to specify the negative what you want to track. because the number of people in the target group is your denominator when calculating coverage. For example, if you want the tracker to have 50% of men circumcised, then you need men who are both circumcised and not circumcised in the denominator and only the number circumcised men in the numerator.

    • Please refer to the emodpy_hiv.utils.targeting_config module for more information.

    • Default value: None.

  • event_name (str, optional) –

    • The name of the campaign event.

    • Default value: None.

  • node_ids (list[int], optional) –

    • A list of node IDs to which the intervention should be applied.

    • If None, the intervention is applied to all nodes.

    • Default value: None.

Returns:

This function does not return anything. It modifies the campaign object in place.

Return type:

None

Examples

Use a reference tracker to ensure that the fraction of medium risk men that are circumcised meets certain levels each year from 1960 through 1965 where the tracker is updating who is circumcised every 6 months (182 days) If coverage is below the target level at the time of polling, apply the MaleCircumcision intervention to uncircumcised men to reach the target coverage.

Please note that you don’t need to specify the negative of what you want to track(~IsCircumcised()) in the targeting_config. See more details in the targeting_config argument description.

>>> import emod_api
>>> from emodpy_hiv.campaign.distributor import add_intervention_reference_tracking
>>> from emodpy_hiv.campaign.individual_intervention import MaleCircumcision
>>> from emodpy_hiv.campaign.common import (ValueMap, TargetGender, CommonInterventionParameters as CIP,
>>>                                        TargetDemographicsConfig as TDC)
>>> from emodpy_hiv.utils.targeting_config import IsCircumcised, HasIP
>>>
>>> campaign_obj = emod_api.campaign
>>> campaign_obj.schema_path = 'path_to_schema'
>>> mc = MaleCircumcision(campaign_obj,
>>>                       distributed_event_trigger='VMMC_1')
>>> time_value_map = ValueMap(times=[1960,  1961,   1962,   1963,   1964],
>>>                          values=[0.25,  0.375,  0.4,    0.4375, 0.46875])
>>> targeting_config = HasIP(ip_key_value="Risk:MEDIUM")
>>> tracking_config = IsCircumcised()
>>> add_intervention_reference_tracking(campaign_obj,
>>>                                     intervention_list=[mc],
>>>                                     time_value_map=time_value_map,
>>>                                     tracking_config=tracking_config,
>>>                                     targeting_config=targeting_config,
>>>                                     start_year=1960,
>>>                                     end_year=1965,
>>>                                     update_period=182,
>>>                                     target_demographics_config=TDC(target_gender=TargetGender.MALE))