Open dburov190 opened 4 years ago
If I recall correctly, previously the method discharge_and_admit_patients
managed the contact network. The logic was that the action of "discharging" and "admitting" a patient was itself the rewriting of the contact network. It was therefore necessary to recompute the edges_to_add
and edges_to_remove
for the purposes of the ContactSimulator
.
(Using that abstraction it would have still been possible to output contacts_to_add
and contacts_to_remove
to be used by contact_simulator
. However this was not done, perhaps for the sake of the simplicity of the HealthService
.)
As it reads now, it should be possible to omit recomputing edges_to_add
and edges_to_remove
, since it basically reproduces what's done, for example, here:
I think contacts_to_add
and contacts_to_remove
can be passed instead to contact_simulator
. It looks like contact_simulator
will accept edges or lists, and that redundant entries are ok:
It doesn't look to me like the code is currently inconsistent. However, it is unnecessary to recompute edges_to_remove
when it is identical to contacts_to_remove
. This can be checked by comparing edges_to_remove
to contacts_to_remove
(but note that one is a list and one is a set).
As an aside, it may make sense to change the name of discharge_and_admit_patients
, since this method does not discharge or admit patients by modifying the contact network.
In epidemic simulator's
run
method here: https://github.com/dburov190/risk-networks/blob/ecaf3369ef7e45b6d51a8a73330cde52808d0aa5/epiforecast/epidemic_simulator.py#L142-L166it seems a bit inconsistent that there's some sort of filtering done for the edges that are then passed to contact simulator, but not for the edges that are added/removed from the contact network. Seems weird