T3 - Environment (as a demographics module)

The environment plays a key role in the spread of typhoid. At the moment, the environment is defined as a Starsim Demographic module – as of starsim v1.0.1 the environment is not supported as one of the independent model ingredients we saw before. Watch this space πŸ‘€ – this is architecture is subject to change.

import starsim as ss
import typhoidsim as ty

# Define high-level simulation parameters
pars = dict(
    start    = 2000,  # Starting year
    dur      = 1.0,   # Duration of the simulation in years
    dt       = 1.0/365.0,     # Timestep of 1 day, expressed in years
    verbose  = 0,             # Do not print details of the run
)

# The population
ppl = ss.People(10_000)

# The environment the population is affected by, and can carry the pathogen
environment = ty.EnvironmentalPool()

# The disease 
typhoid = ty.Typhoid()

sim = ss.Sim(
    pars=pars,
    people=ppl, 
    demographics=environment,
    diseases=typhoid,
    )
sim.run()
sim.plot(key=('environmentalpool_cfu_conc'))
Figure(768x576)

sim.results
Results(Sim)
0. timevec: array(start=2000.01.01, stop=2001.01.01)
1. environmentalpool: Results(EnvironmentalPool)
    1.0. timevec: array(start=2000.01.01, stop=2001.01.01)
    1.1. cfu_conc: Result(min=0, mean=615845, max=4.67896e+06)
    1.2. cfu_num: Result(min=0, mean=615845, max=4678956)
2. typhoid: Results(Typhoid)
    2.0. timevec: array(start=2000.01.01, stop=2001.01.01)
    2.1. n_susceptible: Result(min=9171, mean=9240.41, max=9288)
    2.2. n_infected: Result(min=1, mean=5.2377, max=36)
    2.3. n_unexposed: Result(min=711, mean=754.246, max=793)
    2.4. n_prepatent: Result(min=0, mean=1.18306, max=36)
    2.5. n_acute: Result(min=0, mean=0.153005, max=3)
    2.6. n_subclinical: Result(min=0, mean=3.04098, max=28)
    2.7. n_chronic: Result(min=0, mean=0.860656, max=1)
    2.8. n_recovered: Result(min=0, mean=0.10929, max=3)
    2.9. n_infected_ever: Result(min=36, mean=40.6066, max=41)
    2.10. prevalence: Result(min=0.0001, mean=0.00052377, max=0.0036)
    2.11. new_infections: Result(min=0, mean=0.112022, max=36)
    2.12. cum_infections: Result(min=36, mean=40.6066, max=41)
    2.13. new_susceptible: Result(min=711, mean=779.637, max=9964)
    2.14. new_prepatent: Result(min=0, mean=0.0136612, max=2)
    2.15. new_acute: Result(min=0, mean=0.00819672, max=1)
    2.16. cum_acute: Result(min=0, mean=2.91257, max=3)
    2.17. new_subclinical: Result(min=0, mean=0.103825, max=4)
    2.18. new_chronic: Result(min=0, mean=0.00273224, max=1)
    2.19. new_recovered: Result(min=0, mean=0.10929, max=3)
    2.20. new_deaths: Result(min=0, mean=0, max=0)
    2.21. cum_deaths: Result(min=0, mean=0, max=0)
3. n_alive: Result(min=10000, mean=10000, max=10000)
4. n_female: Result(min=4993, mean=4993, max=4993)
5. new_deaths: Result(min=0, mean=0, max=0)
6. new_emigrants: Result(min=0, mean=0, max=0)
7. cum_deaths: Result(min=0, mean=0, max=0)

Environmental dynamics

This model of the environment changes over time: - grows (↑↑) by receiving CFUs from infectious individuals; - decays (↓↓) according to a decay rate that you can specify.