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

Remove add_ct argument #104

Merged
merged 10 commits into from
Apr 29, 2024
2 changes: 0 additions & 2 deletions R/checkers.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
onset_to_death = NULL,
onset_to_recovery = NULL,
add_names = NULL,
add_ct = NULL,
case_type_probs = NULL,
contact_tracing_status_probs = NULL,
hosp_risk = NULL,
Expand All @@ -149,7 +148,6 @@
.check_func_req_args(onset_to_death, func_name = "onset_to_death")
.check_func_req_args(onset_to_recovery, func_name = "onset_to_recovery")
checkmate::assert_logical(add_names, len = 1)
checkmate::assert_logical(add_ct, len = 1)
checkmate::assert_numeric(case_type_probs, len = 3, lower = 0, upper = 1)
checkmate::assert_names(
names(case_type_probs),
Expand Down
15 changes: 6 additions & 9 deletions R/sim_internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
non_hosp_death_risk = NULL,
outbreak_start_date,
add_names = NULL,
add_ct = NULL,
outbreak_size,
population_age,
case_type_probs = NULL,
Expand Down Expand Up @@ -142,14 +141,12 @@
)

# add Ct if confirmed
if (add_ct) {
.data <- .add_ct(
.data = .data,
distribution = config$ct_distribution,
config$ct_distribution_params
)
linelist_cols <- c(linelist_cols, "ct_value")
}
.data <- .add_ct(
.data = .data,
distribution = config$ct_distribution,
config$ct_distribution_params
)
linelist_cols <- c(linelist_cols, "ct_value")
}

if (sim_type %in% c("contacts", "outbreak")) {
Expand Down
9 changes: 1 addition & 8 deletions R/sim_linelist.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@
#' @param outbreak_start_date A `date` for the start of the outbreak.
#' @param add_names A `logical` boolean for whether to add names to each row
#' of the line list. Default is `TRUE`.
#' @param add_ct A `logical` boolean for whether to add Ct values to each
#' confirmed case and `NA` otherwise for each case in the line list.
#' Default is `TRUE`. Ct refers to the Cycle threshold from a Real-time
#' PCR or quantitative PCR (qPCR).
#' @param outbreak_size A `numeric` vector of length 2 defining the minimum and
#' the maximum number of infected individuals for the simulated outbreak.
#' Default is `c(10, 1e4)`, so the minimum outbreak size is 10 infected
Expand All @@ -92,7 +88,7 @@
#' each case type. The names of the vector must be `"suspected"`, `"probable"`,
#' `"confirmed"`. Values of each case type must sum to one.
#' @param config A list of settings to adjust the randomly sampled delays and
#' Ct values (if `add_ct = TRUE`). See [create_config()] for more information.
#' Ct values. See [create_config()] for more information.
#'
#' @return A line list `<data.frame>`
#' @export
Expand Down Expand Up @@ -167,7 +163,6 @@ sim_linelist <- function(contact_distribution,
non_hosp_death_risk = 0.05,
outbreak_start_date = as.Date("2023-01-01"),
add_names = TRUE,
add_ct = TRUE,
outbreak_size = c(10, 1e4),
population_age = c(1, 90),
case_type_probs = c(
Expand Down Expand Up @@ -203,7 +198,6 @@ sim_linelist <- function(contact_distribution,
onset_to_death = onset_to_death,
onset_to_recovery = onset_to_recovery,
add_names = add_names,
add_ct = add_ct,
case_type_probs = case_type_probs,
hosp_risk = hosp_risk,
hosp_death_risk = hosp_death_risk,
Expand Down Expand Up @@ -261,7 +255,6 @@ sim_linelist <- function(contact_distribution,
non_hosp_death_risk = non_hosp_death_risk,
outbreak_start_date = outbreak_start_date,
add_names = add_names,
add_ct = add_ct,
outbreak_size = outbreak_size,
population_age = population_age,
case_type_probs = case_type_probs,
Expand Down
3 changes: 0 additions & 3 deletions R/sim_outbreak.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ sim_outbreak <- function(contact_distribution,
non_hosp_death_risk = 0.05,
outbreak_start_date = as.Date("2023-01-01"),
add_names = TRUE,
add_ct = TRUE,
outbreak_size = c(10, 1e4),
population_age = c(1, 90),
case_type_probs = c(
Expand Down Expand Up @@ -105,7 +104,6 @@ sim_outbreak <- function(contact_distribution,
onset_to_death = onset_to_death,
onset_to_recovery = onset_to_recovery,
add_names = add_names,
add_ct = add_ct,
case_type_probs = case_type_probs,
contact_tracing_status_probs = contact_tracing_status_probs,
hosp_risk = hosp_risk,
Expand Down Expand Up @@ -164,7 +162,6 @@ sim_outbreak <- function(contact_distribution,
non_hosp_death_risk = non_hosp_death_risk,
outbreak_start_date = outbreak_start_date,
add_names = add_names,
add_ct = add_ct,
outbreak_size = outbreak_size,
population_age = population_age,
case_type_probs = case_type_probs,
Expand Down
8 changes: 6 additions & 2 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ reference:
- create_config

articles:
- title: Package Vignettes
navbar: Package Vignettes
- title: Customising simulated outbreak
navbar: Customising simulated outbreak
contents:
- age-strat-risks
- age-struct-pop
- time-varying-cfr
- title: Wrangling and plotting data
navbar: Wrangling and plotting data
contents:
- wrangling-linelist
- vis-linelist
- title: Developer Documentation
navbar: Developer Documentation
Expand Down
9 changes: 8 additions & 1 deletion inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ aes
apyramid
bookdown
bw
Çetinkaya
cfr
CMD
codecov
Expand All @@ -13,6 +14,7 @@ COVID
Ct
ct
db
Deon
df
dist
dplyr
Expand All @@ -27,6 +29,7 @@ facetted
ggplot
gh
github
Grolemund
implmented
infector
integerish
Expand All @@ -36,6 +39,8 @@ lifecycle
Lifecycle
linelist
lintr
Lusseau
Mancini
md
MERS
olds
Expand All @@ -52,8 +57,9 @@ qPCR
randomNames
RECON
redocumented
rmarkdown
resimulate
rmarkdown
Rundel
SARS
sensu
sim
Expand All @@ -65,6 +71,7 @@ tabset
testthat
threejs
tidyr
tidyverse
Tidyverse
visNetwork
yaml
2 changes: 1 addition & 1 deletion man/dot-add_date.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions man/dot-check_sim_input.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions man/dot-sim_internal.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/dot-sim_network_bp.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/sim_contacts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions man/sim_linelist.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions man/sim_outbreak.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 0 additions & 34 deletions tests/testthat/_snaps/sim_linelist.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,40 +66,6 @@
11 <NA> 2023-01-01 2023-01-04 NA
12 <NA> 2023-01-01 2023-01-03 NA

# sim_linelist works as expected without Ct

Code
sim_linelist(contact_distribution = contact_distribution, infect_period = infect_period,
prob_infect = 0.5, onset_to_hosp = onset_to_hosp, onset_to_death = onset_to_death,
add_ct = FALSE)
Output
id case_name case_type sex age date_onset date_admission
1 1 Dominic Sundara probable m 35 2023-01-01 <NA>
2 2 Preston Montgomery suspected m 43 2023-01-01 <NA>
3 3 Reece Chittum probable m 1 2023-01-01 <NA>
4 5 Michael Cheek confirmed m 78 2023-01-01 <NA>
5 6 Jennifer Smith confirmed f 22 2023-01-01 <NA>
6 8 Erika Quintero confirmed f 28 2023-01-01 <NA>
7 11 Isaiah Patterson suspected m 46 2023-01-01 2023-01-13
8 12 Cicely Anderson suspected f 67 2023-01-01 <NA>
9 13 Michael John probable m 86 2023-01-01 2023-01-01
10 18 Giovana Magana Aguirre suspected f 60 2023-01-02 <NA>
11 20 Mudrik al-Hallal suspected m 49 2023-01-02 <NA>
12 22 Tea Slaughter probable f 7 2023-01-02 2023-01-02
outcome date_outcome date_first_contact date_last_contact
1 recovered <NA> <NA> <NA>
2 recovered <NA> 2022-12-30 2023-01-05
3 recovered <NA> 2022-12-30 2023-01-02
4 recovered <NA> 2022-12-29 2023-01-02
5 recovered <NA> 2023-01-01 2023-01-03
6 recovered <NA> 2023-01-03 2023-01-04
7 recovered <NA> 2023-01-04 2023-01-05
8 recovered <NA> 2023-01-01 2023-01-04
9 died 2023-01-12 2022-12-31 2023-01-03
10 recovered <NA> 2022-12-30 2023-01-03
11 recovered <NA> 2023-01-01 2023-01-04
12 recovered <NA> 2023-01-01 2023-01-03

# sim_linelist works as expected with anonymous

Code
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-checkers.R
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ test_that(".check_sim_input works as expected", {
onset_to_death = onset_to_death,
onset_to_recovery = onset_to_recovery,
add_names = TRUE,
add_ct = FALSE,
case_type_probs = c(
suspected = 0.2,
probable = 0.3,
Expand Down Expand Up @@ -217,7 +216,6 @@ test_that(".check_sim_input works as expected", {
onset_to_death = onset_to_death,
onset_to_recovery = onset_to_recovery,
add_names = TRUE,
add_ct = FALSE,
case_type_probs = c(
suspected = 0.2,
probable = 0.3,
Expand Down Expand Up @@ -261,7 +259,6 @@ test_that(".check_sim_input works as expected with NA risks", {
onset_to_death = onset_to_death,
onset_to_recovery = onset_to_recovery,
add_names = TRUE,
add_ct = FALSE,
case_type_probs = c(
suspected = 0.2,
probable = 0.3,
Expand Down
Loading
Loading