Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understand what happens with filtering of edges in epidemic simulator #151

Open
dburov190 opened this issue Jul 1, 2020 · 1 comment
Open

Comments

@dburov190
Copy link
Collaborator

In epidemic simulator's run method here:
https://github.com/dburov190/risk-networks/blob/ecaf3369ef7e45b6d51a8a73330cde52808d0aa5/epiforecast/epidemic_simulator.py#L142-L166

it 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

@glwagner
Copy link
Collaborator

glwagner commented Jul 8, 2020

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:

https://github.com/dburov190/risk-networks/blob/ecaf3369ef7e45b6d51a8a73330cde52808d0aa5/epiforecast/health_service.py#L173-L175

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:

https://github.com/dburov190/risk-networks/blob/ecaf3369ef7e45b6d51a8a73330cde52808d0aa5/epiforecast/contact_simulator.py#L192-L197

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants