Exemplo n.º 1
0
    def __init__(self, scenario):
        if isinstance(scenario, str):
            self.scenario = EpiScenario(scenario)
        elif isinstance(scenario, EpiScenario):
            self.scenario = scenario

        self.modelname = self.scenario.modelname
        self.total_days = 0
        self.r0 = self.scenario.parameters['initial_r0']
        self.beta = None
        self.population = self.scenario.totalpop

        self.susceptible = ProbState(period=0,
                                     count=self.scenario.init_susceptible,
                                     name='susceptible')
        self.incubating = ProbState(period=self.scenario.incubation_period,
                                    count=self.scenario.init_infected,
                                    name='incubating')
        self.infectious = ProbState(period=self.scenario.prediagnosis,
                                    count=self.scenario.init_infectious,
                                    name='infectious')
        self.isolated_holding = ProbState(period=90, name='isolated_holding')

        self.incubating.add_exit_state(self.infectious, 1)
        self.incubating.normalize_states_over_period()

        self.infectious.add_exit_state(self.isolated_holding, 1)
        self.infectious.normalize_states_over_period()

        self.subgroups = dict()
        for key, value in self.scenario.subgrouprates.items():
            self.subgroups[key] = AgeGroup(value, name=key)
Exemplo n.º 2
0
    def __init__(self):
        self.r0 = 2.65
        self.total_days = 0
        self.population = POP_DENVER
        self.beta = None

        self.susceptible = ProbState(period=0,
                                     count=self.population - 1,
                                     name='susceptible')
        self.incubating = ProbState(period=3, name='incubating')
        self.infectious = ProbState(period=3.8, count=1, name='infectious')
        self.isolated_holding = ProbState(period=90, name='isolated_holding')

        self.incubating.add_exit_state(self.infectious, 1)
        self.incubating.normalize_states_over_period()

        self.infectious.add_exit_state(self.isolated_holding, 1)
        self.infectious.normalize_states_over_period()

        self.subgroups = dict()
        for key, value in AGE_DISTRIBUTION.items():
            self.subgroups[key] = AgeGroup(SubgroupRates(ICD[key], value),
                                           name=key)

        self.sum_isolated = None
        self.sum_noncrit = None
        self.sum_icu = None
        self.sum_icu_vent = None
        self.sum_recovered = None
        self.sum_deceased = None
	def __init__(self, subgroupstats, name=None):

		self.name = name
		self.stats = subgroupstats
		# Variables to store state changes

		# Probability states
		if self.name is not None:
			self.isolated = ProbState(14,  name=f"{self.name}: isolated")
		else:
			self.isolated = ProbState(14)
		self.h_noncrit  = ProbState(8)
		self.h_post_icu = ProbState(6)
		self.h_icu      = ProbState(10)
		self.h_icu_vent = ProbState(10)
		self.recovered  = ProbState(1000)
		self.deceased   = ProbState(1000)

		self.isolated.add_exit_state(self.recovered, 1)
		self.isolated.normalize_states_over_period()

		self.h_noncrit.add_exit_state(self.recovered, 1)
		self.h_noncrit.normalize_states_over_period()

		self.h_icu.add_exit_state(self.deceased,   self.stats.p_icu_death)
		self.h_icu.add_exit_state(self.h_post_icu, self.stats.p_icu_recovery)
		self.h_icu.normalize_states_over_period()

		self.h_icu_vent.add_exit_state(self.deceased,   self.stats.p_icu_death)
		self.h_icu_vent.add_exit_state(self.h_post_icu, self.stats.p_icu_recovery)
		self.h_icu_vent.normalize_states_over_period()

		self.h_post_icu.add_exit_state(self.recovered, 1)
		self.h_post_icu.normalize_states_over_period()
Exemplo n.º 4
0
    def __init__(self):
        self.r0 = 2.65
        self.total_days = 0
        self.population = POP_DENVERMETRO - 1
        self.beta = None

        self.susceptible = ProbState(period=0, count=self.population)
        self.incubating = ProbState(period=3)
        self.infectious = ProbState(period=3.8, count=1)
        self.isolated = ProbState(period=14)
        self.unhospitalized = ProbState(period=14)
        self.h_noncritical = ProbState(period=8)
        self.h_critical = ProbState(period=6)
        self.h_icu = ProbState(period=10)
        self.recovered = ProbState(period=10000)
        self.dead = ProbState(period=10000)

        self.incubating.add_exit_state(self.infectious, 1)
        self.incubating.normalize_states_over_period()

        self.isolated.add_exit_state(self.recovered, 1)
        self.isolated.normalize_states_over_period()

        self.unhospitalized.add_exit_state(self.recovered, .25)
        self.unhospitalized.add_exit_state(self.dead, .75)
        self.unhospitalized.normalize_states_over_period()

        self.infectious.add_exit_state(self.isolated, .85)
        self.infectious.add_exit_state(self.h_noncritical, .11)
        self.infectious.add_exit_state(self.h_critical, .4)
        self.infectious.normalize_states_over_period()

        self.h_noncritical.add_exit_state(self.recovered, 1)
        self.h_noncritical.normalize_states_over_period()

        self.h_critical.add_exit_state(self.recovered, 1)
        self.h_critical.normalize_states_over_period()

        self.h_icu.add_exit_state(self.recovered, .75)
        self.h_icu.add_exit_state(self.dead, .25)
        self.h_icu.normalize_states_over_period()
Exemplo n.º 5
0
    def __init__(self, subgroupstats, name=None):

        self.name = name
        self.stats = subgroupstats
        # Variables to store state changes

        # Probability states
        self.isolated = ProbState(TIMINGS['days home isolation'],
                                  name=f"{self.name}: isolated")

        self.nevercrit = ProbState(TIMINGS['days noncrit'],
                                   name=f"{self.name}: nevercrit")
        self.pre_icu = ProbState(TIMINGS['days preicu'],
                                 name=f"{self.name}: pre_icu")
        self.icu_novent = ProbState(TIMINGS['days icu nonvent'],
                                    name=f"{self.name}: icu")
        self.icu_vent = ProbState(TIMINGS['days icu vent'],
                                  name=f"{self.name}: icu_vent")
        self.post_icu = ProbState(TIMINGS['days posticu'],
                                  name=f"{self.name}: post_icu")
        # Recovered and dead are presumed permanent
        self.recovered = ProbState(1000, name=f"{self.name}: recovered")
        self.deceased = ProbState(1000, name=f"{self.name}: deceased")

        self.isolated.add_exit_state(self.recovered, 1)
        self.isolated.normalize_states_over_period()

        self.nevercrit.add_exit_state(self.recovered, 1)
        self.nevercrit.normalize_states_over_period()

        self.pre_icu.add_exit_state(self.icu_novent, self.stats.p_icu_nonvent)
        self.pre_icu.add_exit_state(self.icu_vent, self.stats.p_icu_vent)
        self.pre_icu.normalize_states_over_period()

        self.icu_novent.add_exit_state(self.deceased, self.stats.p_icu_death)
        self.icu_novent.add_exit_state(self.post_icu,
                                       self.stats.p_icu_recovery)
        self.icu_novent.normalize_states_over_period()

        self.icu_vent.add_exit_state(self.deceased, self.stats.p_icu_death)
        self.icu_vent.add_exit_state(self.post_icu, self.stats.p_icu_recovery)
        self.icu_vent.normalize_states_over_period()

        self.post_icu.add_exit_state(self.recovered, 1)
        self.post_icu.normalize_states_over_period()