Disease Object¶
Info
Disease object is implemented on disease.py
.
The disease object provides means for modelling the infection spread of the disease in the community. The modelling consists of labelling particles according to their category in the infection chain pictured in the Figure below. The particles go through the stages of the disease in terms of probabilities, calculated from experimental data. Therefore, the infection spread can be seen as a more elaborated stochastic version of the SEIR models for ODES.
Diagram of transitions between states.
The several portions of the population in the infection chain have the following meaning:
- S the susceptible portion of individuals in the population. Particles in this category are labeled by the
STATE_S
infection state. This portion of the population comprehends persons that had never had contact with the disease, and therefore they are susceptible to an infection. - E the exposed (or incubating) portion of individuals in the population. Particles in this category are labeled by the
STATE_E
infection state. Individuals in this scenario have already had contact with the disease, but are still in the incubation stage of the disease. This means that they had been infected but are not infectious. - P_s the pre-symptomatic portion of individuals in the population. Particles in this category are labeled by the
STATE_I
infection state and by theSYMPT_NYET
symptomatic state. Silent particles have already become infectious, but they have not yet developed a viral load large enough to show symptoms. - A_s the asymptomatic portion of individuals in the population. Particles in this category are labeled by the
STATE_I
infection state and by theSYMPT_NO
symptomatic state. This type of particle has passed activation of the disease, but will never show symptoms. However, they are still infectious. - S_y and S_s the symptomatic portion of individuals in the population. Particles in this category are labeled by the
STATE_I
infection state and by theSYMPT_YES
orSYMPT_SEVERE
symptomatic states. The population in this portion are those infectious that show symptoms, either softly or severely. - R: the recovered portion of individuals in the population. Particles in this category are labeled by the
STATE_R
infection state. The recovered particles have gone through all the stages of the disease, and that had overcome the disease. - D: the deceased portion of individuals in the population. Particles in this category are labeled by the
STATE_D
infection state. The deceased particles have gone through all the stages of the disease, developed severe symptoms and that have died due to it.
Susceptible particles may become exposed when getting in contact with an infectious particle. When the encounter happens, the infection will spread according to some probability. Therefore the infection depends on the social activity of the community, which can generate more or less encounters according to the time step and social restrictions being imposed (such as quarantine, for example). However, after the infection occurred, the life cycle of the disease in the exposed particle depends only on the disease itself. Thus, we see that the change from susceptible to exposed depends on the encounters between the particles, while the change from one stage to the other from that point on depends only on the time the individual has the disease being developed in its system. The probability values that influence the life cycle of the disease are configured in the dictionary variable passed to the community
object. Below we describe each of these probabilities and how to set them in the dictionary variable:
- S \to E: susceptible particles may become exposed if they encounter an infectious one (P_s, A_s, S_y or S_s). That is, if the susceptible particle distances lesser than
inf_radii
keyword's value from the infectious one. The probability that this infectious encounter generates an exposed particle is given by the susceptibility of the susceptible particle multiplied by the probability of infection of the infectious one. The parameters that control these values aresusceptibility_by_age
andinf_probability
keywords. - E \to P_s: exposed particles eventually become infectious after the incubation period. This value, given in days, is set by the
inf_incubation
keyword's value. As a result, the chance that an exposed particle becomes pre-symptomatic is given by the inverse of this value (1/inf_incubation
). - P_s \to A_s: after particles become pre-symptomatic, it takes some time to determine if they are asymptomatic or if they have symptoms. This time, given in days, is set by the
inf_sympt_timeto
keyword's value. After that time, particles either develop symptoms or stay asymptomatic until the end of the life cycle of the disease. The probability that such particles become symptomatic is then given by theinf_prob_sympt
keyword's value. - P_s \to S_y and P_s \to S_s: the change from pre-symptomatic to symptomatic is almost identical to the change from pre-symptomatic to asymptomatic. However, particles that have had the infection for more than
inf_sympt_timeto
days have become symptomatic with a chance given by the complementary ofinf_prob_sympt
keyword's value (1-inf_prob_sympt
). Symptomatic particles may be softly symptomatic or severely symptomatic. The chance that they have severe symptoms is given by theinf_severe_sympt_prob
keyword's value. - P_s \to R, A_s \to R or S_y \to R: after a particle reaches the infection duration period all particles, except those that developed severe symptoms, will recover. The mean value for such period, given in days, is set by the
inf_duration
keyword's value. The probability that a asymptomatic, symptomatic or asymptomatic particle becomes a recovered one is therefore given by the inverse of this quantity (1/inf_duration
). - S_s \to R or S_s \to D: similar to the other symptoms level, the infection duration of particles that developed severe symptoms is determined by the infection duration period, with probability
1/inf_duration
. After the end of the infection particles with severe symptoms may recover or die, the chance for those particles to die is given by theinf_severe_death_prob
keyword's value.
The disease object interfaces with the update_states()
method from the population
object trough a series of methods that generates binary mask arrays that are used to make all changes in particles states:
mask_new_infections()
,mask_to_infectious()
andmask_to_recovered()
are methods responsible to generate masks used to change the infection state of particles. These masks are influenced by theinf_prob
,inf_incubation
andinf_duration
parameters.mask_to_symptoms()
is the method that generates masks used to determine the symptom states of each particle. The parameters that influence the creation of theses masks areinf_sympt_timeto
,inf_prob_sympt
andinf_severe_sympt_prob
.
Alternative disease mechanics¶
Warning
The disease
object will is in need of a rewrite, this will not affect the overall behavior but will enhance the internal mechanics, some of the alternative mechanics listed below might be already broken, removed or can be removed in the future.
Some alternative mechanics are in development, among with the following are still in the experimental stage:
Probability Distribution¶
It generates inf_probability
for all particles in a given distribution instead of a fixed value for all particles. It can be set by replacing the inf_probability
value by a dictionary with two entries: distribution
, a numpy.random distribution method and arguments
, the arguments for the distribution in a string, all available distributions and it's parameters can be viewed in the numpy documentation. Example:
Example
1 2 3 4 5 6 7 8 9 |
|
Virulence¶
This replaces all state change masks to a simple biological model instead of a purely probabilistic one. At the moment of infection all particles are assigned with a viral load curve and all the changes in states and symptoms are determined by the viral load value for each particle. In this model at the moment of infection the viral load curve for each particle is determined and it's state is changed to exposed, when the viral load goes above vir_threshold_assymptomatic
the particle became infectious and when it drops below vir_threshold_recovered
the particle becomes recovered. Symptoms are also determined by the viral load value, if the viral load goes above vir_threshold_symptomatic
the particle traditions from asymptomatic to symptomatic and if it goes above vir_threshold_severe
the particle develops severe symptoms (used for hospitalization). At the moment the viral load curve is just a step function generated with the same probabilities as the normal disease mechanics, at the time of infections the time in each state is generated following the same distributions and a fixed viral load value is chosen for each particle so that the same percentage of particles develops each intensity of symptoms, this value is used in the viral load curve for each particle in the window of time that the particle is meant to be in the infectious state and the rest of the time the viral load is zero. Infection probability is divided by 2 for asymptomatic particles, and multiplied by 2 for severe symptomatic ones.
Infection periods distributions¶
With the virulence mechanics the user can set the distribution to generate all the infection related transition times (inf_incubation
, inf_duration
, inf_severe_duration
and inf_sympt_timeto
) just by replacing it with a RandomDistribution object, the desired distribution can be set using the following parameters: distribution
, a numpy.random distribution method, it's parameters and an upper_limit
and lower_limit
, a the minimum and maximum value acceptable for the distribution.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
|