june.infection.health_index¶
-
class
june.infection.health_index.
HealthIndexGenerator
(hosp_cases: dict, hosp_cases_ch: dict, icu_hosp: dict, death_hosp: dict, death_home: dict, death_home_ch: dict, asymptomatic_ratio=0.2, comorbidity_multipliers: Optional[dict] = None, prevalence_reference_population: Optional[dict] = None, male_care_home_ratios: Optional[List] = None, female_care_home_ratios: Optional[List] = None)¶ Computes probabilities for (asymptomatic, mild symptoms, severe symptoms, hospitalisation, intensive care, fatality), using the age and sex of the subject. The probablities of hospitalisation,death and ICU are taken taken from fits made by Miguel Icaza to the England data taken from several sources. We will assume that the symptomatic cases that do not need hospitalisation have either mild symptoms or penumonia-like symptoms the percentage of those are distrubuted according to the ratios in the RKI publication (table 1/column 2 of https://www.rki.de/DE/Content/Infekt/EpidBull/Archiv/2020/Ausgaben/17_20.pdf?__blob=publicationFile)
Parameters: - poli_hosp,poli_icu,poli_deaths:
Each of this arrays contains 2 lists of 4 elements. The first element of the list correpdons to males and the second to females. The elements are the indexes C,C1,C2,C3 of the polynomial fit defined to be the probability of being hospitalised, sent to an ICU unit or dying
the probaility (P) is computed as P=10**(C+C1*Age+C2*Age**2+C3*Age**3) The 10 exponent is requiered as the fits where done in logarithmic space.
asimpto_ratio: The percentage of the population that will be asymptomatic, we fixed it to 43% and assume that is age-independent. This assumptions comes from Vo et al 2019 ( https://doi.org/10.1101/2020.04.17.20053157 ).
-
__init__
(hosp_cases: dict, hosp_cases_ch: dict, icu_hosp: dict, death_hosp: dict, death_home: dict, death_home_ch: dict, asymptomatic_ratio=0.2, comorbidity_multipliers: Optional[dict] = None, prevalence_reference_population: Optional[dict] = None, male_care_home_ratios: Optional[List] = None, female_care_home_ratios: Optional[List] = None)¶ Parameters: - poli_hosp,poli_icu,poli_deaths:
Each of this arrays contains 2 lists of 4 elements. The first element of the list correpdons to males and the second to females. The elements are the indexes C,C1,C2,C3 of the polynomial fit defined to be the probability of being hospitalised, sent to an ICU unit or dying
the probaility (P) is computed as P=10**(C+C1*Age+C2*Age**2+C3*Age**3) The 10 exponent is requiered as the fits where done in logarithmic space.
asimpto_ratio: The percentage of the population that will be asymptomatic, we fixed it to 43% and assume that is age-independent. This assumptions comes from Vo et al 2019 ( https://doi.org/10.1101/2020.04.17.20053157 ).
-
adjust_for_comorbidities
(probabilities: list, comorbidity: str, age: int, sex: str)¶ Compute adjusted probabilities for a person with given comorbidity, age and sex. Parameters ———- probabilities:
list with probability values for the 8 different outcomes (has len 7, but 8th value can be inferred from 1 - probabilities.sum())
- comorbidity:
comorbidty type that the person has
- age:
age group to compute average multiplier
- sex:
sex group to compute average multiplier
probabilities adjusted for comorbidity
-
adjust_hospitalisation
(probabilities, person, male_care_home_ratio, female_care_home_ratio)¶
-
adjust_probabilities_for_comorbidities
(probabilities, effective_multiplier)¶ Compute adjusted probabilities given an effective multiplier Parameters ———- probabilities:
list with probability values for the 8 different outcomes (has len 7, but 8th value can be inferred from 1 - probabilities.sum())
- effective_multiplier:
factor that amplifies severe outcomes
adjusted probabilities
-
classmethod
from_file
(hosp_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/infection/health_index/cases_hosp.dat'), icu_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/infection/health_index/ICU_hosp.dat'), death_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/infection/health_index/Death_hosp.dat'), death_home_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/infection/health_index/percent_deaths_home.dat'), death_home_ch_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/infection/health_index/frac_deaths_home_smoothed.dat'), hosp_cases_ch_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/infection/health_index/hosp_over_cases_care_home.dat'), asymptomatic_ratio=0.2, comorbidity_multipliers=None, prevalence_reference_population=None, care_home_ratios_filename: Optional[str] = None) → june.infection.health_index.HealthIndexGenerator¶ Initialize the Health index from path to data frame, and path to config file Parameters: - filename:
polinome_filename: path to the file where the coefficients of the fits to the spanish data are stored.
- Returns:
Interaction instance
-
classmethod
from_file_with_comorbidities
(multipliers_path: str, male_prevalence_path: str, female_prevalence_path: str, hosp_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/infection/health_index/cases_hosp.dat'), icu_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/infection/health_index/ICU_hosp.dat'), death_filename: str = PosixPath('/home/sadie/JUNE/configs/defaults/infection/health_index/Death_hosp.dat'), asymptomatic_ratio: float = 0.2) → june.infection.health_index.HealthIndexGenerator¶ Initialize the Health index from path to data frame, and path to config file Parameters: - filename:
polinome_filename: path to the file where the coefficients of the fits to the spanish data are stored.
- Returns:
Interaction instance
-
get_multiplier_from_reference_prevalence
(age: int, sex: str) → float¶ Compute mean comorbidity multiplier given the prevalence of the different comorbidities in the reference population (for example the UK). It will be used to remove effect of comorbidities in the reference population Parameters ———- prevalence_reference_population:
nested dictionary with prevalence of comorbidity by comorbodity, age and sex cohort
- age:
age group to compute average multiplier
- sex:
sex group to compute average multiplier
- weighted_multiplier:
weighted mean of the multipliers given prevalence
-
make_list
(age, death_home, hosp_cases, icu_hosp, death_hosp)¶ Computes the probability of having all 7 posible outcomes for all ages between 0 and 120. And for male and female
- Retruns:
3D matrix of dimensions 2 X 120 X 7. With all the probabilities of all 6 outcomes for 120 ages and the 2 sex.
For each gender and age there are 7 numbers to define: [N_1,N_2,N3,N4,N_5,N_6,N_7]. The idea is to select a random number, r, between 0 and 1. Depending on how this random number compares with our 7 numbers, different outcomes will happen - if 0<r<N_1 Asymptomatic - if N_1<r<N_2 Mild symptoms - if N_2<r<N_3 Stays at home with pneoumonia symptoms and survives. - if N_3<r<N_4 Goes to the hospital but not to ICU and survives. - if N_4<r<N_5 Goes to ICU ans survives. - if N_5<r<N_6 Stays at home with severe and dies. - if N_6<r<N_7 Goes to the hospital but not to ICU and dies. - if N_7<r<1 Goes to ICU and dies.
-
june.infection.health_index.
convert_comorbidities_prevalence_to_dict
(prevalence_female, prevalence_male)¶
-
june.infection.health_index.
read_comorbidity_csv
(filename: str)¶