diseases.sti

diseases.sti

Template class for SEIS-type STIs Used for chlamydia, gonorrhea, and trich

Classes

Name Description
BaseSTI Base class for sexually transmitted infections.
BaseSTIPars Base parameters shared by all STI disease modules.
SEIS SEIS (Susceptible-Exposed-Infectious-Susceptible) disease template.
STIPars Parameters for SEIS-type STI models.

BaseSTI

diseases.sti.BaseSTI(
    name=None,
    pars=None,
    init_prev_data=None,
    age_range=None,
    age_bins=default_age_bins,
    sex_keys=default_sex_keys,
    **kwargs,
)

Base class for sexually transmitted infections.

Extends ss.Infection with STI-specific transmission logic, including network-specific beta values, condom efficacy, and initial prevalence by sex and risk group. All STIsim disease modules inherit from this class.

Parameters

Name Type Description Default
name str Module name used for results and parameter routing. None
pars dict Override default parameters from BaseSTIPars. None
init_prev_data Initial prevalence data (float or DataFrame by age/sex/risk group). None
age_range list Age range used for the main (adult) prevalence results. Default: [15, 50]. None
age_bins list Bin edges for age-stratified results; None skips them entirely. default_age_bins
sex_keys dict Sex strata for results, mapping result suffix to a people attribute; None skips sex-stratified results, keeping only the whole-population ones. default_sex_keys
**kwargs Additional parameters passed to update_pars. {}

Attributes

Name Description
treatable Assume infected people are treatable, can be overwritten in subclasses

Methods

Name Description
agehist Return an age histogram
init_results Initialize results
make_init_prev Initialize prevalence by sex and risk group
set_outcomes Set prognoses for newly infected agents and track transmission routes.
step Override to pass network indices to set_outcomes for MTCT tracking
validate_beta Map disease-specific transmission parameters onto the betamap.
agehist
diseases.sti.BaseSTI.agehist(a)

Return an age histogram

init_results
diseases.sti.BaseSTI.init_results()

Initialize results

make_init_prev
diseases.sti.BaseSTI.make_init_prev(uids=None, data=None, active=True)

Initialize prevalence by sex and risk group

set_outcomes
diseases.sti.BaseSTI.set_outcomes(uids, sources, net_ids=None)

Set prognoses for newly infected agents and track transmission routes.

Parameters
Name Type Description Default
uids UIDs of agents newly infected this timestep (not all agents) required
sources UIDs of the agents who transmitted to each new case required
net_ids array of network indices indicating which network each infection came from (used to distinguish prenatal vs postnatal MTCT). Passed from step() via infect(). None
step
diseases.sti.BaseSTI.step()

Override to pass network indices to set_outcomes for MTCT tracking

validate_beta
diseases.sti.BaseSTI.validate_beta()

Map disease-specific transmission parameters onto the betamap.

The parent class (ss.Infection) builds a betamap keyed by standardized network name, with [beta_p1→p2, beta_p2→p1] per network. Here we override entries for STI-specific networks using disease parameters:

- structuredsexual: beta_m2f (and rel_beta_f2m for female→male)
- maternal: beta_m2c (prenatal MTCT)
- breastfeeding: beta_breastfeed (postnatal MTCT, HIV only)
- msm: beta_m2m (bidirectional)

BaseSTIPars

diseases.sti.BaseSTIPars(**kwargs)

Base parameters shared by all STI disease modules.

Holds transmission parameters (beta values, condom efficacy), timestep settings, and initial prevalence configuration.

SEIS

diseases.sti.SEIS(
    pars=None,
    name=None,
    init_prev_data=None,
    age_range=None,
    age_bins=default_age_bins,
    sex_keys=default_sex_keys,
    **kwargs,
)

SEIS (Susceptible-Exposed-Infectious-Susceptible) disease template.

Provides the standard natural history framework for bacterial STIs: latent exposure period, sex-stratified symptom onset, symptomatic care-seeking, PID complications in females, and natural clearance. Used as the base class for chlamydia, gonorrhea, and trichomoniasis.

Naming follows starsim’s ss.SEIR: exposed and infectious are the literal E and I compartments, and infected is derived as E plus I, so n_infected and prevalence count everyone carrying the infection while transmission depends on infectious alone. Correspondingly, ti_exposed is the time of acquisition and ti_infectious the time of becoming infectious; ti_infected is not defined, since it is too easily confused with ti_infectious. Only ti_exposed is written exactly once per infection, so incidence is counted off that (see BaseSTI.update_results). Unlike ss.SEIR, step_state() below snaps ti_infectious forward to the timestep the transition actually happens, so it stays a truthful record of onset even when dur_exp is a fraction of a timestep.

Parameters

Name Type Description Default
pars dict Override default parameters from STIPars. None
name str Module name used for results and parameter routing. None
init_prev_data Optional initial prevalence data by age/sex. None
age_range list Age range used for the main (adult) prevalence results. Default: [15, 65]. None
age_bins list Bin edges for age-stratified results; None skips them entirely. default_age_bins
sex_keys dict Sex strata for results; None skips sex-stratified results. default_sex_keys
**kwargs Additional parameters passed to update_pars. {}

Methods

Name Description
init_results Initialize results
set_prognoses Set initial prognoses for adults newly infected
step_state Updates for this timestep
wipe_dates Clear all previous dates
init_results
diseases.sti.SEIS.init_results()

Initialize results

set_prognoses
diseases.sti.SEIS.set_prognoses(uids, sources=None)

Set initial prognoses for adults newly infected

step_state
diseases.sti.SEIS.step_state()

Updates for this timestep

wipe_dates
diseases.sti.SEIS.wipe_dates(uids)

Clear all previous dates

STIPars

diseases.sti.STIPars(**kwargs)

Parameters for SEIS-type STI models.

Extends BaseSTIPars with natural history parameters including symptom probabilities, care-seeking behavior, PID progression, and clearance durations. Used as the default parameter set for chlamydia, gonorrhea, and trichomoniasis.