Closed averbraeck closed 6 months ago
Offspring is not so easy to calculate, since medlabs typically uses an (extension of an) SEIR model. This means that persons in the models are exposed at the time when we know who causes the exposed state, but when the infectious state is reached, that relation is gone. Therefore, the changeDiseasePhase
method in an implementation of DiseaseProgression
interface separates the exposed
stage into a separate exposed
method that identifies the infecting persons (or a list of possible infecting persons from which one has to be chosen) for an exposed person. The exposed
method returns a boolean
indicating whether the exposure will lead in the end to an infection. The registration of an infection is then allocated to the day when the transmission of the disease took place.
DiseaseProgression
implements the exposed
methods as follows:
public abstract boolean expose(Person exposedPerson, DiseasePhase exposurePhase);
public void expose(final Person exposedPerson, final DiseasePhase exposurePhase,
final Person infectiousPerson)
{
if (expose(exposedPerson, exposurePhase))
{
getModel().getDiseaseMonitor().reportInfection(exposedPerson, infectiousPerson);
}
}
public void expose(final Person exposedPerson, final DiseasePhase exposurePhase,
final TIntList infectiousPersonList)
{
if (infectiousPersonList.size() == 1)
{
expose(exposedPerson, exposurePhase, this.model.getPersonMap()
.get(infectiousPersonList.get(0)));
}
else if (infectiousPersonList.size() > 1)
{
expose(exposedPerson, exposurePhase, this.model.getPersonMap()
.get(infectiousPersonList.get(this.model.getRandomStream()
.nextInt(0, infectiousPersonList.size() - 1))));
}
else
{
expose(exposedPerson, exposurePhase);
}
}
The following changes are made:
DiseaseProgression
for an actual disease can decide how to implement the abstract exposed
method.DiseaseMonitor
class can decide what to do with the reported infection.DiseaseTransmission
class calls the exposed
method when exposure takes place, instead of calling changeDiseasePhase(person, DiseasePhase.exposed)
. DiseaseProgression.changeDiseasePhase(...)
containing the SEIR state machine becomes protected rather than public since only expose
is called externally, changeDiseasePhase
calls itself using the simulation scheduler for successive stages of the disease.changePhase
in Person
is no longer needed (it always called DiseaseProgression.changeDiseasePhase(this, phase)
and did nothing else), and will be removed.Changes has been tested, and seem to work as intended.
Offspring is the number of susceptible persons typically infected by an infectious person.