UT-Covid / episimlab

Framework for development of epidemiological models
https://ut-covid.github.io/episimlab/
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Alternative implementation of #18 #19

Closed ethho closed 3 years ago

ethho commented 3 years ago

An alternative implementation of #18 for sake of demonstration. Similar to #18, the goal is to allow the contact partitioning processing to ingest a travel_fp with a date column, and generate a time-varying contact matrix contact_xr at every step of the simulation.

The implementation in #18 provides a new process TravelManager that wraps the Partition class. While this is nonstandard paradigm in the xsimlab ecosystem, it is a perfectly viable implementation. It essentially uses Partition as an attr.s decorated class, rather than an xsimlab process (xsimlab.process decorated class).

The implementation in this PR does not create a TravelManager process, but instead modifies the existing Partition class. Methods such as probabilistic_partition, partitions_to_contacts, and contact_matrix were moved from the initialize to the run_step method so that they are run at every step. In addition, run_step performs the date indexing that is handled by TravelManager.subset_date, generating a travel_df that changes at every step.

kellypierce commented 3 years ago

Looks good to me! I agree it makes more sense to do it this way, rather than wrap the Partition class.