def one_time_step_results(self): """ Get results from one time step """ results = {} results["time"] = self.c_model.time results["lockdown"] = self.c_params.lockdown_on results["test_on_symptoms"] = self.c_params.test_on_symptoms results["app_turned_on"] = self.c_params.app_turned_on results["total_infected"] = ( int(covid19.utils_n_total(self.c_model, covid19.PRESYMPTOMATIC)) + int( covid19.utils_n_total(self.c_model, covid19.PRESYMPTOMATIC_MILD)) + int(covid19.utils_n_total(self.c_model, covid19.ASYMPTOMATIC))) for age in AgeGroupEnum: key = f"total_infected{age.name}" results[key] = sum([ covid19.utils_n_total_age(self.c_model, ty, age.value) for ty in [ covid19.PRESYMPTOMATIC, covid19.PRESYMPTOMATIC_MILD, covid19.ASYMPTOMATIC ] ]) results["total_case"] = covid19.utils_n_total(self.c_model, covid19.CASE) for age in AgeGroupEnum: key = f"total_case{age.name}" value = covid19.utils_n_total_age(self.c_model, covid19.CASE, age.value) results[key] = value results["total_death"] = covid19.utils_n_total(self.c_model, covid19.DEATH) for age in AgeGroupEnum: key = f"total_death{age.name}" value = covid19.utils_n_total_age(self.c_model, covid19.DEATH, age.value) results[key] = value results["n_presymptom"] = covid19.utils_n_current( self.c_model, covid19.PRESYMPTOMATIC) + covid19.utils_n_current( self.c_model, covid19.PRESYMPTOMATIC_MILD) results["n_asymptom"] = covid19.utils_n_current( self.c_model, covid19.ASYMPTOMATIC) results["n_quarantine"] = covid19.utils_n_current( self.c_model, covid19.QUARANTINED) results["n_tests"] = covid19.utils_n_daily(self.c_model, covid19.TEST_RESULT, int(self.c_model.time) + 1) results["n_symptoms"] = covid19.utils_n_current( self.c_model, covid19.SYMPTOMATIC) + covid19.utils_n_current( self.c_model, covid19.SYMPTOMATIC_MILD) results["n_hospital"] = covid19.utils_n_current( self.c_model, covid19.HOSPITALISED) results["n_critical"] = covid19.utils_n_current( self.c_model, covid19.CRITICAL) results["n_death"] = covid19.utils_n_current(self.c_model, covid19.DEATH) results["n_recovered"] = covid19.utils_n_current( self.c_model, covid19.RECOVERED) return results
def one_time_step_results(self): """ Get results from one time step """ results = {} results["time"] = self.c_model.time results["lockdown"] = self.c_params.lockdown_on results["test_on_symptoms"] = self.c_params.test_on_symptoms results["app_turned_on"] = self.c_params.app_turned_on results["total_infected"] = ( int(covid19.utils_n_total(self.c_model, covid19.PRESYMPTOMATIC)) + int(covid19.utils_n_total(self.c_model, covid19.PRESYMPTOMATIC_MILD)) + int(covid19.utils_n_total(self.c_model, covid19.ASYMPTOMATIC)) ) for age in AgeGroupEnum: key = f"total_infected{age.name}" results[key] = sum( [ covid19.utils_n_total_age(self.c_model, ty, age.value) for ty in [ covid19.PRESYMPTOMATIC, covid19.PRESYMPTOMATIC_MILD, covid19.ASYMPTOMATIC, ] ] ) results["total_case"] = covid19.utils_n_total(self.c_model, covid19.CASE) for age in AgeGroupEnum: key = f"total_case{age.name}" value = covid19.utils_n_total_age(self.c_model, covid19.CASE, age.value) results[key] = value results["total_death"] = covid19.utils_n_total(self.c_model, covid19.DEATH) for age in AgeGroupEnum: key = f"total_death{age.name}" value = covid19.utils_n_total_age(self.c_model, covid19.DEATH, age.value) results[key] = value results["daily_death"] = covid19.utils_n_daily( self.c_model, covid19.DEATH, self.c_model.time ) for age in AgeGroupEnum: key = f"daily_death{age.name}" value = covid19.utils_n_daily_age(self.c_model, covid19.DEATH, self.c_model.time, age.value) results[key] = value results["n_presymptom"] = covid19.utils_n_current( self.c_model, covid19.PRESYMPTOMATIC ) + covid19.utils_n_current(self.c_model, covid19.PRESYMPTOMATIC_MILD) results["n_asymptom"] = covid19.utils_n_current( self.c_model, covid19.ASYMPTOMATIC ) results["n_quarantine"] = covid19.utils_n_current( self.c_model, covid19.QUARANTINED ) results["n_tests"] = covid19.utils_n_total_by_day( self.c_model, covid19.TEST_RESULT, int(self.c_model.time) ) results["n_symptoms"] = covid19.utils_n_current( self.c_model, covid19.SYMPTOMATIC ) + covid19.utils_n_current(self.c_model, covid19.SYMPTOMATIC_MILD) results["n_hospital"] = covid19.utils_n_current( self.c_model, covid19.HOSPITALISED ) results["n_hospitalised_recovering"] = covid19.utils_n_current( self.c_model, covid19.HOSPITALISED_RECOVERING ) results["n_critical"] = covid19.utils_n_current(self.c_model, covid19.CRITICAL) results["n_death"] = covid19.utils_n_current(self.c_model, covid19.DEATH) results["n_recovered"] = covid19.utils_n_current( self.c_model, covid19.RECOVERED ) if self.nosocomial: results["hospital_admissions"] = covid19.utils_n_daily( self.c_model, covid19.GENERAL, self.c_model.time ) results["hospital_admissions_total"] = covid19.utils_n_total( self.c_model, covid19.GENERAL ) results["hospital_to_critical_daily"] = covid19.utils_n_daily( self.c_model, covid19.CRITICAL, self.c_model.time ) results["hospital_to_critical_total"] = covid19.utils_n_total( self.c_model, covid19.CRITICAL ) else: results["hospital_admissions"] = covid19.utils_n_daily( self.c_model, covid19.TRANSITION_TO_HOSPITAL, self.c_model.time ) results["hospital_admissions_total"] = covid19.utils_n_total( self.c_model, covid19.TRANSITION_TO_HOSPITAL ) results["hospital_to_critical_daily"] = covid19.utils_n_daily( self.c_model, covid19.TRANSITION_TO_CRITICAL, self.c_model.time ) results["hospital_to_critical_total"] = covid19.utils_n_total( self.c_model, covid19.TRANSITION_TO_CRITICAL ) results["n_quarantine_infected"] = self.c_model.n_quarantine_infected results["n_quarantine_recovered"] = self.c_model.n_quarantine_recovered results["n_quarantine_app_user"] = self.c_model.n_quarantine_app_user results["n_quarantine_app_user_infected"] = self.c_model.n_quarantine_app_user_infected results["n_quarantine_app_user_recovered"] = self.c_model.n_quarantine_app_user_recovered results["n_quarantine_events"] = self.c_model.n_quarantine_events results["n_quarantine_release_events"] = self.c_model.n_quarantine_release_events results["n_quarantine_events_app_user"] = self.c_model.n_quarantine_events_app_user results["n_quarantine_release_events_app_user"] = \ self.c_model.n_quarantine_release_events_app_user results["R_inst"] = covid19.calculate_R_instanteous( self.c_model, self.c_model.time, 0.5 ) results["R_inst_05"] = covid19.calculate_R_instanteous( self.c_model, self.c_model.time, 0.05 ) results["R_inst_95"] = covid19.calculate_R_instanteous( self.c_model, self.c_model.time, 0.95 ) return results