Interventions are one of the most critical parts of HPVsim. This tutorial shows how to implement standard interventions, as well as how to define your own custom interventions.
Click here to open an interactive version of this notebook.
Products and interventions
HPVsim contains products, which can be thought of as the actual test, diagnostic, treatment, or vaccine product being used, as well as interventions, which are responsible for delivering the products to the population. Information about the default products included with HPVsim (e.g. attributes like test positivity and efficacy) are available in the hpvsim/data/products_*.csv files. Specifically:
Screening products (VIA, Pap smears, liquid-based cytology, HPV testing, and HPV16/18 testing): hpvsim/data/products_dx.csv
Treatment products (ablation, excision, and therapeutic vaccines): hpvsim/data/products_tx.csv
Custom products can be made for diagnostics and vaccination in the same way. The efficacy of some products varies by genotype, in which case efficacy values for each genotype can be entered as separate dataframe rows.
Most of the time, it isn’t necessary to create your own products if you just want to use one of the standard options. When setting up screening, triage, or treatment interventions, it’s possible to pass in a string that will create a standard default product.
Screening and treatment interventions
Screening and treatment is implemented in HPVsim as a flexible set of interventions that can be mixed and matched. By specifying how each of the components link together, it’s possible to create quite complex algorithms. This is illustrated in the following example:
# Define a series of interventions to screen, triage, assign treatment, and administer treatmentprob =0.6screen = hpv.routine_screening(start_year=2015, prob=prob, product='via', label='screen') # Routine screeningto_triage =lambda sim: sim.get_intervention('screen').outcomes['positive'] # Define who's eligible for triagetriage = hpv.routine_triage(eligibility=to_triage, prob=prob, product='hpv', label='triage') # Triage peopleto_treat =lambda sim: sim.get_intervention('triage').outcomes['positive'] # Define who's eligible to be assigned treatmentassign_tx = hpv.routine_triage(eligibility=to_treat, prob=prob, product='tx_assigner', label='assign_tx') # Assign treatmentto_ablate =lambda sim: sim.get_intervention('assign_tx').outcomes['ablation'] # Define who's eligible for ablation treatmentablation = hpv.treat_num(eligibility=to_ablate, prob=prob, product='ablation') # Administer ablationto_excise =lambda sim: sim.get_intervention('assign_tx').outcomes['excision'] # Define who's eligible for excisionexcision = hpv.treat_delay(eligibility=to_excise, prob=prob, product='excision') # Administer excision# Define the parameterspars =dict( n_agents =20e3, # Population size n_years =35, # Number of years to simulate verbose =0, # Don't print details of the run rand_seed =2, # Set a non-default seed genotypes = [16, 18], # Include the two genotypes of greatest general interest)# Create the sim with and without interventionsorig_sim = hpv.Sim(pars, label='Baseline')sim = hpv.Sim(pars, interventions = [screen, triage, assign_tx, ablation, excision], label='With screen & treat')# Run and plotmsim = hpv.parallel(orig_sim, sim)msim.plot();
Loading location-specific demographic data for "nigeria"
Loading location-specific demographic data for "nigeria"
A few things to note here:
By default, interventions are shown with vertical dashed lines. You can turn this off by passing do_plot=False to the intervention.
Note that like other “parameters”, you can either pass interventions to the sim directly or as part of the pars dictionary; the examples below illustrate these options.
Several of the interventions above are defined as routine interventions, e.g. hpv.routine_screening() and hpv.routine_triage(). In general, most interventions exist as both routine and campaign versions. The difference between the two comes down to how the dates are interpreted:
hpv.routine_screening(start=2020, end=2030, prob=0.2) implies that the intervention will be in place each year between 2020-2030;
hpv.campaign_screening(years=[2020,2030], prob=0.2) implies that the intervention will be delivered twice: once in 2020 and once in 2030.
The script examples/t05_screen_algorithms.py shows how to set up each of the seven algorithms recommended by in the WHO’s guidelined for screening and treatment of cervical pre-cancer lesions (see https://www.ncbi.nlm.nih.gov/books/NBK572308/).
Prophylactic vaccination
Prophylactic vaccination within HPVsim simply targets a vaccine product towards a subset of the population.
vx = hpv.routine_vx(prob=prob, start_year=2015, age_range=[9,10], product='bivalent')# Create the sim with and without interventionsorig_sim = hpv.Sim(pars, label='Baseline')sim = hpv.Sim(pars, interventions = vx, label='With vaccination')# Run and plotmsim = hpv.parallel(orig_sim, sim)msim.plot();
Loading location-specific demographic data for "nigeria"
Loading location-specific demographic data for "nigeria"
Note that probabilities passed to interventions are annual probabilities, not total.
Therapeutic vaccination
Therapeutic vaccination can be included in a few different formats/use cases:
Loading location-specific demographic data for "nigeria"
Loading location-specific demographic data for "nigeria"
Loading location-specific demographic data for "nigeria"