interventions.bcg
interventions.bcg
BCG vaccination: Product + Delivery following the Starsim Vx pattern.
BCGVx — vaccine product (biological effect, per-agent state) BCGRoutine — delivery intervention (thin wrapper over TBProductRoutine)
Classes
| Name | Description |
|---|---|
| BCGRoutine | Routine BCG vaccination delivery. |
| BCGVx | BCG vaccine product. |
BCGRoutine
interventions.bcg.BCGRoutine(product=None, pars=None, **kwargs)Routine BCG vaccination delivery.
Thin wrapper over :class:TBProductRoutine with pediatric defaults (age 0–5, 50 % coverage). Creates a :class:BCGVx product automatically if none is provided.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| product | BCGVx | The BCG vaccine product (created automatically if not provided). | None |
| pars | dict | Overrides for delivery parameters (coverage, age_range, start, stop). |
None |
Example::
import starsim as ss
import tbsim
from tbsim.interventions.bcg import BCGRoutine
tb = tbsim.TB(name='tb')
bcg = BCGRoutine()
sim = ss.Sim(diseases=tb, interventions=bcg, pars=dict(start='2000', stop='2020'))
sim.run()
Methods
| Name | Description |
|---|---|
| update_results | Record number of currently protected individuals. |
update_results
interventions.bcg.BCGRoutine.update_results()Record number of currently protected individuals.
BCGVx
interventions.bcg.BCGVx(pars=None, **kwargs)BCG vaccine product.
Handles immunological take, per-agent modifier sampling, protection duration tracking, and per-step modifier application to disease rr_activation, rr_clearance, and rr_death arrays.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| disease | str | Key of the disease module to target (default 'tb'). |
required |
| p_take | ss.bernoulli |
Probability of immunological response post-vaccination. | required |
| dur_immune | ss.Dist |
Duration of protection (sampled per individual). | required |
| activation_modifier / clearance_modifier / death_modifier | ss.Dist |
Per-individual risk-modifier distributions. | required |
Methods
| Name | Description |
|---|---|
| administer | Administer BCG to uids (already accepted by the delivery intervention). |
| apply_protection | Multiply rr_* arrays for all currently protected agents. |
| update_roster | Expire protection for agents past their expiry time. |
administer
interventions.bcg.BCGVx.administer(people, uids)Administer BCG to uids (already accepted by the delivery intervention).
Applies p_take filter, samples per-agent modifiers, and sets protection expiry. Does not touch rr_* arrays — that happens in :meth:apply_protection each step.
Returns
| Name | Type | Description |
|---|---|---|
| ss.uids: UIDs of agents who responded immunologically. |
apply_protection
interventions.bcg.BCGVx.apply_protection()Multiply rr_* arrays for all currently protected agents.
update_roster
interventions.bcg.BCGVx.update_roster()Expire protection for agents past their expiry time.