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

Prospective refactor #77

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open

Conversation

joshwlambert
Copy link
Collaborator

This pull request makes a series of changes to the {ringbp} to hopefully improve the package.

This PR is not for merging. It is purely to demonstrate the types of changes that could be made in {ringbp}.

If this PR contains changes that we want to include in {ringbp} then I can make specific feature branches and tag the relevant issues. In this PR I have not related the changes to any existing issues in the {ringbp} GitHub repository as this was a more general exploration of how the package can be improved.

This is not a full refactor, but a start of to give a flavour of the improvements, without sinking too much time if we decide this is not the best direction of development for the package. Some changes include:

  • input checking
  • removing dist_spec() function
  • removing duplication in documentation
  • improving function examples
  • snake case code style
  • new function arguments to generalise parameterisation of model

…ument default in scenario_sim, outbreak_model and outbreak_step
… set argument default in scenario_sim, outbreak_model and outbreak_step
@joshwlambert joshwlambert requested a review from sbfnk October 4, 2024 15:19
Copy link
Contributor

@sbfnk sbfnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @joshwlambert I this these are sensible suggestions - left some minor comments on style/linting.

Comment on lines +42 to +43
#' @param outbreak_df_week data.table weekly cases produced by the outbreak
#' model
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#' @param outbreak_df_week data.table weekly cases produced by the outbreak
#' model
#' @param outbreak_df_week data.table weekly cases produced by the outbreak
#' model

Should have 2 indents throughout here for readability as in e.g. https://github.com/r-lib/roxygen2/blob/9652d15221109917d46768e836eaf55e33c21633/R/roxygenize.R#L14

#' disp_com = 0.16,
#' disp_subclin = 0.16,
#' k = 0,
#' onset_to_isolation = function(x) rweibull(n = x, shape = 1.651524, scale = 4.287786),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#' onset_to_isolation = function(x) rweibull(n = x, shape = 1.651524, scale = 4.287786),
#' onset_to_isolation = \(x) rweibull(n = x, shape = 1.651524, scale = 4.287786),

we already have this notation elsewhere

Comment on lines +66 to +80
outbreak_model <- function(num_initial_cases,
prop_ascertain,
cap_max_days,
cap_cases,
r0isolated,
r0community,
r0subclin = r0community,
disp_iso,
disp_com,
disp_subclin = disp_com,
k,
onset_to_isolation,
incubation_period,
prop_asym,
quarantine) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
outbreak_model <- function(num_initial_cases,
prop_ascertain,
cap_max_days,
cap_cases,
r0isolated,
r0community,
r0subclin = r0community,
disp_iso,
disp_com,
disp_subclin = disp_com,
k,
onset_to_isolation,
incubation_period,
prop_asym,
quarantine) {
outbreak_model <- function(
num_initial_cases,
prop_ascertain,
cap_max_days,
cap_cases,
r0isolated,
r0community,
r0subclin = r0community,
disp_iso,
disp_com,
disp_subclin = disp_com,
k,
onset_to_isolation,
incubation_period,
prop_asym,
quarantine
) {

to be consistent with the style in other parts of the package

@joshwlambert
Copy link
Collaborator Author

Thanks for the suggestions @sbfnk. Are you happy for me to work through the {ringbp} issues and make some of the changes included in this PR along the way?

@sbfnk
Copy link
Contributor

sbfnk commented Oct 7, 2024

Yes, that would be great!

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

Successfully merging this pull request may close these issues.

2 participants