generated from epiverse-trace/packagetemplate
-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor simulation functions #42
Milestone
Comments
The upcoming v0.2.0 release is primarily changing to the simulation model, with most changes internal and not user facing. Therefore it seems sensible to include these requested changes as part of the v0.2.0 release given the similarity in scope and tackling straight away. |
joshwlambert
added a commit
that referenced
this issue
Feb 9, 2024
…tbl into .sim_internal, closes #42
joshwlambert
added a commit
that referenced
this issue
Feb 9, 2024
joshwlambert
added a commit
that referenced
this issue
Feb 9, 2024
…tbl into .sim_internal, closes #42
joshwlambert
added a commit
that referenced
this issue
Feb 9, 2024
joshwlambert
added a commit
that referenced
this issue
Feb 15, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Upon reading more of the code, I think I understand the rationale behind this separation:
.sim_bp_linelist()
create columns relevant for contacts and linelist while.sim_clinical_linelist()
focuses on columns only relevant for the linelist.I suspect these wrappers were created to reduce duplication across the
sim_*()
functions.However, I don't think the goal is fully achieved as there is still a lot of duplication.
I would like to consider a different refactoring approach:
All
sim_*()
functions call asim_internal()
function:This doesn't result in more nesting since we can then remove the
sim_utils
andsim_contact_tbl()
functions and call directly theadd_col
function.I find it clearer because you don't have to guess where a specific column will be computed ("is it
.sim_bp_linelist()
or.sim_clinical_linelist()
?"). Everything happens clearly in thesim_internal()
function and the exportedsim_*()
functions are just very thin wrappers around it.If performance is not an issue, this
sim_internal()
could also besim_outbreaks()
.sim_linelist()
andsim_contacts()
would then just keep only the relevant df and drop the other.Originally posted by @Bisaloo in #33 (comment)
The text was updated successfully, but these errors were encountered: