emodpy-tbhiv documentation#

emodpy-tbhiv is a collection of Python scripts and utilities created to streamline user interactions with EMOD and idmtools for modeling measles. Much of the functionality is inherited from the emod_api package and emodpy package.

Additional information about how to use idmtools can be found at in Welcome to idmtools. Additional information about EMOD TBHIV parameters for modeling tuberculosis can be found in EMOD parameter reference.

See Welcome to idmtools for a diagram showing how idmtools and each of the related packages are used in an end-to-end workflow using EMOD as the disease transmission model.

Contents#

emodpy-tbhiv installation#

Follow the steps below to install emodpy-tbhiv.

Prerequisites#

First, ensure the following prerequisites are met.

  • Windows 10 Pro or Enterprise, Linux, or Mac

  • Python 3.9 64-bit (https://www.python.org/downloads/release)

  • A file that indicates the pip index-url:

    • For Windows, in C:\Users\Username\pip\pip.ini add the following:

      [global]
      index-url = https://packages.idmod.org/api/pypi/pypi-production/simple
      
    • For Linux, in $HOME/.config/pip/pip.conf add the following:

      [global]
      index-url = https://packages.idmod.org/api/pypi/pypi-production/simple
      

Installation instructions#

  1. Open a command prompt and create a virtual environment in any directory you choose. The command below names the environment “v-emodpy-tbhiv”, but you may use any desired name:

    python -m venv v-emodpy-tbhiv
    
  2. Activate the virtual environment:

    • For Windows, enter the following:

      v-emodpy-tbhiv\Scripts\activate
      
    • For Linux, enter the following:

      source v-emodpy-tbhiv/bin/activate
      
  3. Install emodpy-tbhiv packages:

    pip install emodpy-tbhiv
    

    If you are on Linux, also run:

    pip install keyrings.alt
    
  4. When you are finished, deactivate the virtual environment by entering the following at a command prompt:

    deactivate
    

API reference#

emodpy_tbhiv package#

The emodpy-tbhiv module is intended to house scripts and tools that enable disease modelers to work more easily with the IDM EMOD TBHIV model.

Subpackages#
emodpy_tbhiv.demographics package#
Submodules#
emodpy_tbhiv.demographics.TBHIVDemographics module#
class emodpy_tbhiv.demographics.TBHIVDemographics.TBHIVDemographics(pop=None, nodes=None, idref='Gridded world grump2.5arcmin', base_file=None)[source]#

Bases: Demographics

This class is derived from emod_api.demographics’ Demographics class so that we can set certain defaults for TBHIV in construction. Keen observers will note thatt SetDefaultProperties does not look like a TBHIV-specific function. But as we add other disease types the generatlizations and speicfics will become clearer. The architectural point is solid.

SetHIVCoInfectionDistribution()[source]#

Insert some notion of a default HIVCoInfection distribution.

SetHIVTBCoInfectionMortalityDistribution()[source]#

Insert some notion of a default HIVTBCoInfection Mortality distribution.

emodpy_tbhiv.demographics.TBHIVDemographics.fromBasicNode(lat=0, lon=0, pop=1000000.0, name=1, forced_id=1, implicit_config_fns=None)[source]#

This function creates a single-node TBHIVDemographics instance from the params you give it.

emodpy_tbhiv.demographics.TBHIVDemographics.from_template_node(lat=0, lon=0, pop=1000000.0, name=1, forced_id=1)[source]#

Create a single-node TBHIVDemographics instance from the parameters you supply.

Parameters:
  • lat – Latitude of the centroid of the node to create.

  • lon – Longitude of the centroid of the node to create.

  • pop – Human population of the node.

  • name – The name of the node. This may be a characteristic of the node, such as “rural” or “urban”, or an identifying integer.

  • forced_id – The node ID for the single node.

Returns:

A TBHIVDemographics instance.

emodpy_tbhiv.demographics.TBHIVDemographics.fromData(pop=1000000.0, filename_male=None, filename_female=None)[source]#
emodpy_tbhiv.demographics.TBHIVDemographics.from_csv(pop_file, res=0.008333333333333333, id_ref='from_csv', filename_male=None, filename_female=None)[source]#

Create a multi-node TBHIVDemographics instance from a CSV file describing a population.

Parameters:
  • pop_file – The path to the csv file to ingest.

  • res – Resolution.

  • id_ref – A string to identify the file, needs to match other input files.

  • filename_male – Path to male mortality csv.

  • filename_female – Path to female mortality csv.

Returns:

A TBHIVDemographics instance

emodpy_tbhiv.demographics.TBHIVDemographics.from_params(tot_pop=1000000.0, num_nodes=100, frac_rural=0.3, id_ref='from_params', filename_male=None, filename_female=None)[source]#

Create a multi-node TBHIVDemographics instance as a synthetic population based on a few parameters.

Parameters:
  • tot_pop – The total human population in the node.

  • num_nodes – The number of nodes to create.

  • frac_rural – The fraction of the population that is rural.

  • id_ref – Method describing how the latitude and longitude values are created for each of the nodes in a simulation. “Gridded world” values use a grid overlaid across the globe at some arcsec resolution. You may also generate the grid using another tool or coordinate system. For more information, see Metadata.

  • filename_male – Path to male mortality csv.

  • filename_female – Path to female mortality csv.

Returns:

A TBHIVDemographics instance.

emodpy_tbhiv.interventions package#
emodpy_tbhiv.interventions.purge_campaign_event(camp_event)[source]#
Submodules#
emodpy_tbhiv.interventions.active_diagnostic module#
emodpy_tbhiv.interventions.active_diagnostic.ActiveDiagnostic(camp, trigger_treatment_list, active_sensitivity=1.0, active_specificity=1.0, pos_event='TBTestPositive', treatment_fraction=1, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='TB Diagnosis Active Simple')[source]#

Create and return triggered campaign event that issues an ActiveDiagnostic intervention. See ActiveDiagnostic

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • active_sensitivity – Sensitivity. Defaults to 1.0.

  • active_specificity – Specificity. Defaults to 1.0.

  • pos_event – Signal (or trigger) which is broadcast if the test is positive. Defaults to ‘TBTestPositive’,

  • treatment_fraction – Fraction of population testing positive you get the positive result effect.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.active_diagnostic.new_intervention_as_file(camp, start_day=1, filename=None)[source]#
emodpy_tbhiv.interventions.age_targeted_vaccine module#
emodpy_tbhiv.interventions.age_targeted_vaccine.AgeTargetedVaccine(camp, trigger_treatment_list, initial_efficacy=1.0, vaccine_take=1, vtype='AcquisitionBlocking', coverage=1, age_min_yrs=0, age_max_yrs=125, box_duration_yrs=1, immune_decay_yrs=0, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='Vaccine')[source]#

Create and return triggered campaign event that issues a (generalized) Vaccine intervention. See SimpleVaccine

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • initial_efficacy – Initial efficacy of the vaccine. Defaults to 1.0.

  • vaccine_take – Fraction of the population receiving the vaccine for whom it is efficacious. Defaults to 1.0.

  • vtype – … Defaults to “AcquisitionBlocking”

  • age_min_yrs – Lower age bound, in years. Defaults to 0.

  • age_max_yrs – Upper age bound, in years. Defaults to 125.

  • box_duration_yrs – Period of time over which the initial efficacy persists before decay. Defaults to 1 year.

  • immune_decay_yrs – Period of time over which the efficacy decays to 0. Defaults to 0.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optional list of node ids to target. Defaults to all.

  • coverage – Fraction of population to reach.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.age_targeted_vaccine.new_intervention_as_file(camp, filename='vaccine.json')[source]#
emodpy_tbhiv.interventions.art module#
emodpy_tbhiv.interventions.art.ART(camp, trigger_treatment_list, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='ART')[source]#

Create and return triggered campaign event that issues an ART intervention.

Parameters:
  • camp – Centralized campaign module instance.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.art.new_intervention_as_file(camp, filename='art.json')[source]#
emodpy_tbhiv.interventions.bcg module#
emodpy_tbhiv.interventions.bcg.BCG(camp, trigger_treatment_list, initial_efficacy=1.0, vaccine_take=1, age_take_decay=1.0, box_duration_yrs=1, immune_decay_yrs=0, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='Vaccine Health Seeking')[source]#

Create and return triggered campaign event that issues an BCG vaccine intervention.

Parameters:
  • camp – Centralized campaign module instance.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • initial_efficacy – Initial efficacy of the vaccine. Defaults to 1.0.

  • vaccine_take – Fraction of the population receiving the vaccine for whom it is efficacious. Defaults to 1.0.

  • age_take_decay – … Defaults to 1.0.

  • box_duration_yrs – Period of time over which the initial efficacy persists before decay. Defaults to 1 year.

  • immune_decay_yrs – Period of time over which the efficacy decays to 0. Defaults to 0.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.bcg.new_intervention_as_file(camp, filename=None)[source]#
emodpy_tbhiv.interventions.cash module#
emodpy_tbhiv.interventions.cash.triggered_cash(camp, amount=100, coverage=1.0, start_day=1, triggers=['Births'], property_restrictions_list=[], nodeIDs=[], event_name='Seed_Money')[source]#

Create and return scheduled campaign event that supplements individuals’ health care budgets.

Parameters:
  • camp – Centralized campaign module instance.

  • amount – How much money to give them. Just constant for now.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • triggers – Signals upon which to trigger distribution of cash. Default=[“Births”],

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.cash.cash(camp, amount=100, coverage=1.0, start_day=1, property_restrictions_list=[], nodeIDs=[], event_name='Cash')[source]#

Create and return scheduled campaign event that supplements individuals’ health care budgets.

Parameters:
  • camp – Centralized campaign module instance.

  • amount – How much money to give them. Just constant for now.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.cash.new_intervention_as_file(camp, filename='cash.json')[source]#
emodpy_tbhiv.interventions.cd4diag module#
emodpy_tbhiv.interventions.cd4diag.CD4Diag(camp, trigger_treatment_list, event_200='Below200', event_350='Below350', event_500='Below500', event_above_500='Above500', start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='CD4 Diagnostic')[source]#

Create and return triggered campaign event that issues an CD4Diagnostic intervention.

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • event_200

  • event_350

  • event_500

  • event_above_500

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.cd4diag.new_intervention_as_file(camp, filename='cd4.json')[source]#
emodpy_tbhiv.interventions.diag_treat_neg module#
emodpy_tbhiv.interventions.diag_treat_neg.DiagnosticTreatNeg(camp, trigger_treatment_list, base_sensitivity_smearpos=1.0, base_sensitivity_smearneg=1.0, pos_event='TBTestPositive', neg_event='TBTestNegative', def_event='TBTestDefault', treatment_fraction=1, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='TB Diagnosis')[source]#

Create and return triggered campaign event that issues an DiagnosticTreatNeg intervention. See DiagnosticTreatNeg

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • base_sensitivity_smearpos – Sensitivity. Defaults to 1.0.

  • base_sensitivity_smearneg – Specificity. Defaults to 1.0.

  • pos_event – Signal (or trigger) which is broadcast if the test is positive. Defaults to ‘TBTestPositive’,

  • neg_event – Defaults to ‘TBTestNegative’.

  • def_event – Defaults to ‘TBTestDefault’.

  • treatment_fraction – Fraction of population testing positive you get the positive result effect.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.diag_treat_neg.new_intervention_as_file(camp, filename='dtn.json')[source]#
emodpy_tbhiv.interventions.drugs module#
emodpy_tbhiv.interventions.drugs.add_tb_drug_type(config, drug_name, duration, cure_proportion, death_proportion, resistance_proportion, inactivation_proportion, relapse_proportion, reduced_transmit=1, reduced_acquire=1, cure_proportion_hiv=None, death_proportion_hiv=None, resistance_proportion_hiv=None, relapse_proportion_hiv=None, inactivation_proportion_hiv=None, mdr_cure_proportion=None, mdr_death_proportion=None, mdr_inactivation_proportion=None, mdr_relapse_proportion=None)[source]#

Add a drug definition to the simulation. This does not deliver the drug to anyone, and also doesn’t mean we’re going to use it. It’s like putting it in the reference section.

emodpy_tbhiv.interventions.hiv_diag module#
emodpy_tbhiv.interventions.hiv_diag.HIVDiagnostic(camp, trigger_treatment_list, base_sensitivity=1.0, base_specificity=1.0, pos_event='HIVTestedPositive', neg_event='HIVTestedNegative', treatment_fraction=1, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='HIV Diagnostic')[source]#

Create and return triggered campaign event that issues an HIVSimpleDiagnostic intervention. See HIVSimpleDiagnostic

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • base_sensitivity – Sensitivity. Defaults to 1.0.

  • base_specificity – Specificity. Defaults to 1.0.

  • pos_event – Signal (or trigger) which is broadcast if the test is positive. Defaults to ‘HIVTestedPositive’.

  • neg_event – Signal (or trigger) which is broadcast if the test is negative. Defaults to ‘HIVTestedNegative’.

  • treatment_fraction – Fraction of population testing positive you get the positive result effect.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.hiv_diag.new_intervention_as_file(camp, filename=None)[source]#
emodpy_tbhiv.interventions.hiv_seeding module#
emodpy_tbhiv.interventions.hiv_seeding.seed(camp, disease='TB', coverage=0.01, reps=-1, interval=1, start_day=1, nodeIDs=[], time_offset=1, event_name='HIV Incidence')[source]#

Create a scheduled campaign event that issues an OutbreakIndividualTBorHIV intervention. Useful for seeding interventions in TBHIV_SIM.

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • disease – “TB” or “HIV”. Default is “TB” (used to be “HIV”).

  • coverage – Percentage of otherwise qualifying individuals who will be infected.

  • reps – Number of repetitions (integer). Defaults to no repetition.

  • interval – Timesteps between repetitions, if reps is set. Defaults to every day.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • time_offset – … Defaults to 1.

  • event_name – Not used.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.hiv_seeding.new_intervention_as_file(camp, filename='hiv.json')[source]#
emodpy_tbhiv.interventions.hsb module#
emodpy_tbhiv.interventions.hsb.HSB(camp, trigger_treatment_list, output_event, probability_per_step=1.0, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], event_name='HSB', prevent_duplicates=False, fixed_initial_delay=0)[source]#

Create and return triggered campaign event that issues an SimpleHealthSeekingBehavior intervention. See SimpleHealthSeekingBehavior

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • output_event – Signal to broadcast when ‘health’ is ultimately sought (string).

  • probability_per_step – Probability of seeking per timestep, default to 1 which means near instantaneous.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optional list of node ids to target. Defaults to all.

  • prevent_duplicates – If an individual were to get one of these when they already have one, the default behaviour is to proceed addiditively. Use this param to cause the new one to replace the old one. Same-ness is based on same event_name.

  • fixed_initial_delay – Optional param that lets us add a fixed delay before the HSB.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.hsb.new_intervention_as_file(camp, filename='hsb_diag.json')[source]#
emodpy_tbhiv.interventions.peek_camp module#
emodpy_tbhiv.interventions.peek_camp.decorate_actual_iv_impl(iv, signal=None)[source]#
emodpy_tbhiv.interventions.peek_camp.decorate_actual_iv(iv, signal=None)[source]#
emodpy_tbhiv.interventions.ramp_dtn module#
emodpy_tbhiv.interventions.ramp_dtn.RampDTN(camp, trigger_treatment_list, ramp_time=30, base_sensitivity_smearpos=1.0, base_sensitivity_smearneg=1.0, base_sensitivity_smearpos2=1.0, base_sensitivity_smearneg2=1.0, treatment_fraction=1.0, treatment_fraction2=1.0, pos_event='TBTestPositive', neg_event='TBTestNegative', defaulters_event='TBTestDefault', pos_event2='TBTestPositive', neg_event2='TBTestNegative', defaulters_event2='TBTestDefault', start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], black_period=0, black_trigger='Blackout', event_name='RampDTN')[source]#

Create and return triggered campaign event that (TBD).

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • active_sensitivity – Sensitivity. Defaults to 1.0.

  • active_specificity – Specificity. Defaults to 1.0.

  • pos_event – Signal (or trigger) which is broadcast if the test is positive. Defaults to ‘TBTestPositive’,

  • treatment_fraction – Fraction of population testing positive you get the positive result effect.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.ramp_dtn.new_intervention_as_file(camp, filename='ramp.json')[source]#
emodpy_tbhiv.interventions.resist_diag module#
emodpy_tbhiv.interventions.resist_diag.ResistanceDiagnostic(camp, trigger_treatment_list, sensitivity=1.0, specificity=1.0, pos_event='TBMDRTestPositive', neg_event='TBMDRTestNegative', def_event='TBMDRTestDefault', treatment_fraction=1, treatment_fraction_negative_test=1, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='TB Diagnosis MDR')[source]#

Create and return triggered campaign event that issues an ResistanceDiagnostic intervention.

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • sensitivity – Sensitivity. Defaults to 1.0.

  • specificity – Specificity. Defaults to 1.0.

  • pos_event – Signal (or trigger) which is broadcast if the test is positive. Defaults to ‘TBMDRTestPositive’.

  • neg_event – Signal (or trigger) which is broadcast if the test is negative. Defaults to ‘TBMDRTestNegative’.

  • def_event – Signal (or trigger) which is broadcast if the test is default. Defaults to ‘TBMDRTestDefault’.

  • treatment_fraction – Fraction of population testing positive you get the positive result effect. Defaults to 1.

  • treatment_fraction_negative_test – … Defaults to 1.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.resist_diag.new_intervention_as_file(camp, filename='resist_diag.json')[source]#
emodpy_tbhiv.interventions.smear_diag module#
emodpy_tbhiv.interventions.smear_diag.SmearDiagnostic(camp, trigger_treatment_list, base_sensitivity_smearpos=1.0, base_sensitivity_smearneg=1.0, pos_event='TestPositiveOnSmear', treatment_fraction=1, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='TB Diagnosis Smear Simple')[source]#

Create and return triggered campaign event that issues an SmearDiagnostic intervention.

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • base_sensitivity_smearpos – Sensitivity. Defaults to 1.0.

  • base_sensitivity_smearneg – Specificity. Defaults to 1.0.

  • pos_event – Signal (or trigger) which is broadcast if the test is positive. Defaults to ‘TBTestPositiveOnSmear’.

  • treatment_fraction – Fraction of population testing positive you get the positive result effect.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.smear_diag.new_intervention_as_file(camp, filename='smear_diag.json')[source]#
emodpy_tbhiv.interventions.tb_treat_basic module#
emodpy_tbhiv.interventions.tb_treat_basic.TBDrugTreatment(camp, trigger_treatment_list, drug_name='DOTS', inactivation_rate=0, mortality_rate=0, clearance_rate=0, resistance_rate=0, relapse_rate=0, reduced_transmit=1.0, start_day=1, treatment_duration=180, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='TBDrugTreatment')[source]#

Create and return triggered campaign event that issues an AntiTBDrug intervention. See AntiTBDrug

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • drug_name – … Defaults to ‘DOTS’,

  • inactivation_rate – … Defaults to 0,

  • mortality_rate – … Defaults to 0,

  • clearance_rate – … Defaults to 0,

  • resistance_rate – … Defaults to 0,

  • relapse_rate – … Defaults to 0,

  • reduced_transmit – … Defaults to 1.0,

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.tb_treat_basic.new_intervention_as_file(camp, filename=None)[source]#
emodpy_tbhiv.interventions.tbhiv_treat module#
emodpy_tbhiv.interventions.tbhiv_treat.TBHIVDrugTreatment(camp, trigger_treatment_list, drug_name, latent_multiplier=1.0, active_multiplier=1.0, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='TBHIVDrugTreatment')[source]#

Create and return triggered campaign event that issues a ‘TBHIVConfigurableTBdrug’ intervention. See TBHIVConfigurableTBdrug

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • drug_name

  • latent_multiplier – … Defaults to 1.0.

  • active_multiplier – … Defaults to 1.0.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.tbhiv_treat.new_intervention_as_file(camp, filename='tb_drug_treat.json')[source]#
emodpy_tbhiv.interventions.triggered_pvc module#
emodpy_tbhiv.interventions.triggered_pvc.TPVC(camp, trigger_treatment_list, property_to_change, final_prop_value, revert=0, daily_prob=1, start_day=1, duration=-1, coverage=1.0, property_restrictions_list=[], nodeIDs=[], black_period=0, black_trigger='Blackout', event_name='PropertyValueChanger')[source]#

Create and return triggered campaign event that issues an PropertyValueChanger intervention. See PropertyValueChanger

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • property_to_change – Individual Property key (string).

  • final_prop_value – New Individual Property value (string).

  • revert – … Defaults to 0.

  • daily_prob – Daily probabilty of changing. Defaults to 1.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • coverage – Fraction of qualifiers who receive intervention. Defaults to 1.0 (100%).

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.triggered_pvc.new_intervention_as_file(camp, filename='tpvc.json')[source]#
emodpy_tbhiv.interventions.vaccine module#
emodpy_tbhiv.interventions.vaccine.Vaccine(camp, trigger_treatment_list, initial_efficacy=1.0, vaccine_take=1, vtype='AcquisitionBlocking', box_duration_yrs=1, immune_decay_yrs=10, start_day=1, duration=-1, property_restrictions_list=[], nodeIDs=[], cost=0, black_period=0, black_trigger='Blackout', event_name='Vaccine')[source]#

Create and return triggered campaign event that issues a (generalized) Vaccine intervention. See SimpleVaccine

Parameters:
  • camp – The emod_api.campaign module instance which serves as the campaign accumulator.

  • trigger_treatment_list – List of 1 or more triggers (or events or signals) which are listened to and trigger the distribution of the intervention. There is no default.

  • initial_efficacy – Initial efficacy of the vaccine. Defaults to 1.0.

  • vaccine_take – Fraction of the population receiving the vaccine for whom it is efficacious. Defaults to 1.0.

  • vtype – … Defaults to “AcquisitionBlogking”

  • box_duration_yrs – Period of time over which the initial efficacy persists before decay. Defaults to 1 year.

  • immune_decay_yrs – Period of time over which the efficacy decays to 0. Defaults to 10 years.

  • start_day – The timestep when this campaign event takes effect. Defaults to 1.

  • duration – How long the campaign event remains in effect. Defaults to forever.

  • property_restrictions_list – Optiional list of Individual Properties to limit the intervention to.

  • nodeIDs – Optiona list of node ids to target. Defaults to all.

  • cost – Per unit ‘price’ of each intervention.

  • black_period – Undocumented.

  • black_trigger – Undocumented.

  • event_name – Undocumented.

Returns:

New campaign event that can be added to the campaign.

emodpy_tbhiv.interventions.vaccine.new_intervention_as_file(camp, filename='vaccine.json')[source]#
emodpy_tbhiv.reporters package#
Submodules#
emodpy_tbhiv.reporters.plugin module#
class emodpy_tbhiv.reporters.plugin.Report_TBHIV_ByAge(name: str = 'Report_TBHIV_ByAge', Enabled: bool = True, Reports: list = <factory>, dll_file: str = 'libreport_TBHIV_ByAge.dll')[source]#

Bases: CustomReporter

name: str = 'Report_TBHIV_ByAge'#
dll_file: str = 'libreport_TBHIV_ByAge.dll'#
configure_report(camp, max_age_yrs, min_age_yrs, start_year, stop_year, events=None)[source]#
Submodules#
emodpy_tbhiv.standard_drugs module#
emodpy_tbhiv.standard_drugs.bootstrap(config)[source]#

Frequently asked questions#

As you get started with emodpy-tbhiv, you may have questions. The most common questions will be added below. For questions related to functionality in related packages, see the following documentation: