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

Fix for # 100 - Remove model library and access #130

Merged
merged 9 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
^scratch.R
^doc$
^Meta$
^CITATION\.cff$
^CITATION\.cff$
^.vscode$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ scratch*
/Meta/

/.luarc.json
.vscode
pratikunterwegs marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ S3method(print,infection)
S3method(print,intervention)
S3method(print,population)
S3method(print,vaccination)
export(add_to_library)
export(as.intervention)
export(as.vaccination)
export(epidemic_default_cpp)
Expand All @@ -16,7 +15,6 @@ export(epidemic_ebola_r)
export(epidemic_size)
export(epidemic_vacamole_cpp)
export(epidemic_vacamole_r)
export(get_model_names)
export(get_parameter)
export(get_transmission_rate)
export(infection)
Expand All @@ -27,7 +25,6 @@ export(is_intervention)
export(is_population)
export(is_rate_intervention)
export(is_vaccination)
export(model_library)
export(new_infections)
export(no_contacts_intervention)
export(no_rate_intervention)
Expand Down
35 changes: 28 additions & 7 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,16 @@
#' as specified in the initial conditions matrix (see [population()]).
#' The second list element is a vector of timesteps.
#' @keywords internal
.epidemic_default_cpp <- function(initial_state, beta, alpha, gamma, contact_matrix, npi_time_begin, npi_time_end, npi_cr, vax_time_begin, vax_time_end, vax_nu, rate_interventions, time_dependence, time_end = 100.0, increment = 1.0) {
.Call(`_epidemics_epidemic_default_cpp_internal`, initial_state, beta, alpha, gamma, contact_matrix, npi_time_begin, npi_time_end, npi_cr, vax_time_begin, vax_time_end, vax_nu, rate_interventions, time_dependence, time_end, increment)
.epidemic_default_cpp <- function(
initial_state, beta, alpha, gamma, contact_matrix, npi_time_begin,
npi_time_end, npi_cr, vax_time_begin, vax_time_end, vax_nu,
rate_interventions, time_dependence, time_end = 100.0, increment = 1.0) {
.Call(
`_epidemics_epidemic_default_cpp_internal`, initial_state,
beta, alpha, gamma, contact_matrix, npi_time_begin, npi_time_end,
npi_cr, vax_time_begin, vax_time_end, vax_nu, rate_interventions,
time_dependence, time_end, increment
)
}

#' @title Run an SEIR model with Erlang passage times
Expand Down Expand Up @@ -73,8 +81,13 @@
#' This output is intended to be passed to [output_to_df()] to be converted
#' into a data.frame for further analysis.
#' @keywords internal
.epidemic_ebola_cpp <- function(initial_state, population_size, beta, shape_E, rate_E, shape_I, rate_I, time_end) {
.Call(`_epidemics_epidemic_ebola_cpp_internal`, initial_state, population_size, beta, shape_E, rate_E, shape_I, rate_I, time_end)
.epidemic_ebola_cpp <- function(
initial_state, population_size, beta, shape_E, rate_E,
shape_I, rate_I, time_end) {
.Call(
`_epidemics_epidemic_ebola_cpp_internal`, initial_state,
population_size, beta, shape_E, rate_E, shape_I, rate_I, time_end
)
}

#' @title Run the RIVM Vacamole model
Expand Down Expand Up @@ -132,8 +145,17 @@
#' as specified in the initial conditions matrix (see [population()]).
#' The second list element is a vector of timesteps.
#' @keywords internal
.epidemic_vacamole_cpp <- function(initial_state, beta, beta_v, alpha, omega, omega_v, eta, eta_v, gamma, contact_matrix, npi_time_begin, npi_time_end, npi_cr, vax_time_begin, vax_time_end, vax_nu, rate_interventions, time_dependence, time_end = 100.0, increment = 1.0) {
.Call(`_epidemics_epidemic_vacamole_cpp_internal`, initial_state, beta, beta_v, alpha, omega, omega_v, eta, eta_v, gamma, contact_matrix, npi_time_begin, npi_time_end, npi_cr, vax_time_begin, vax_time_end, vax_nu, rate_interventions, time_dependence, time_end, increment)
.epidemic_vacamole_cpp <- function(
initial_state, beta, beta_v, alpha, omega, omega_v, eta, eta_v, gamma,
contact_matrix, npi_time_begin, npi_time_end, npi_cr, vax_time_begin,
vax_time_end, vax_nu, rate_interventions, time_dependence,
time_end = 100.0, increment = 1.0) {
.Call(
`_epidemics_epidemic_vacamole_cpp_internal`, initial_state,
beta, beta_v, alpha, omega, omega_v, eta, eta_v, gamma, contact_matrix,
npi_time_begin, npi_time_end, npi_cr, vax_time_begin, vax_time_end,
vax_nu, rate_interventions, time_dependence, time_end, increment
)
}

#' @title Compute the discrete probability of the truncated Erlang distribution
Expand All @@ -143,4 +165,3 @@
prob_discrete_erlang_cpp <- function(shape, rate) {
.Call(`_epidemics_prob_discrete_erlang_cpp`, shape, rate)
}

4 changes: 2 additions & 2 deletions R/check_args_default.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
)

# load number of compartments to check initial conditions matrix
compartments_default <- read_from_library(
model_name = "default", what = "compartments"
compartments_default <- c(
"susceptible", "exposed", "infectious", "recovered", "vaccinated"
)
assert_population(
mod_args[["population"]],
Expand Down
5 changes: 3 additions & 2 deletions R/check_args_ebola.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@
)

# load number of compartments to check initial conditions matrix
compartments_ebola <- read_from_library(
model_name = "ebola", what = "compartments"
compartments_ebola <- c(
"susceptible", "exposed", "infectious", "hospitalised", "funeral", "removed"
)

assert_population(
mod_args[["population"]],
compartments = compartments_ebola
Expand Down
6 changes: 4 additions & 2 deletions R/check_args_vacamole.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@
)

# load number of compartments to check initial conditions matrix
compartments_vacamole <- read_from_library(
model_name = "vacamole", what = "compartments"
compartments_vacamole <- c(
"susceptible", "vaccinated_one_dose", "vaccinated_two_dose",
"exposed", "exposed_vaccinated", "infectious", "infectious_vaccinated",
"hospitalised", "hospitalised_vaccinated", "dead", "recovered"
)
# input checking on population parameters
assert_population(
Expand Down
1 change: 0 additions & 1 deletion R/epidemic_ebola.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ epidemic_ebola_r <- function(population, infection,
# input checking for the ebola R model
assert_population(
population,
demography_groups = 1L,
compartments = c(
"susceptible", "exposed", "infectious",
"hospitalised", "funeral", "removed"
Expand Down
115 changes: 0 additions & 115 deletions R/library_helpers.R

This file was deleted.

55 changes: 0 additions & 55 deletions R/read_from_library.R

This file was deleted.

26 changes: 0 additions & 26 deletions inst/extdata/model_library.json

This file was deleted.

31 changes: 0 additions & 31 deletions man/add_to_library.Rd

This file was deleted.

17 changes: 0 additions & 17 deletions man/get_model_names.Rd

This file was deleted.

Loading
Loading