diff --git a/DESCRIPTION b/DESCRIPTION index a88819a..b5e025b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: site Type: Package Title: Site specific malariasimulation modelling -Version: 0.2.2 +Version: 0.3.0 Authors@R: c( person("Pete", "Winskill", email = "p.winskill@imperial.ac.uk", role = c("aut", "cre")) ) diff --git a/R/interventions.R b/R/interventions.R index b55bf4d..ccb4589 100644 --- a/R/interventions.R +++ b/R/interventions.R @@ -33,9 +33,9 @@ add_interventions <- function(p, interventions, species){ interventions = interventions) } # RTSS - if(sum(interventions$rtss_cov, na.rm = TRUE) > 0 & + if((sum(interventions$rtss_coverage, na.rm = TRUE) > 0 | sum(interventions$r21_coverage, na.rm = TRUE) > 0) & species == "pf"){ - p <- add_rtss(p = p, + p <- add_pev_epi(p = p, interventions = interventions) } # PMC @@ -233,25 +233,50 @@ add_smc <- function(p, interventions){ return(p) } -#' Add RTS,S +#' Add pre-erythrocytic vaccine #' #' @inheritParams add_interventions #' #' @return modified parameter list -add_rtss <- function(p, interventions){ +add_pev_epi <- function(p, interventions){ + + month <- 365 / 12 timesteps <- 1 + (interventions$year - p$baseline_year) * 365 - p <- malariasimulation::set_rtss_epi( + # pull correct coverage values for input parameters depending on vaccine type + interventions <- interventions |> + dplyr::mutate( + coverage = ifelse(vaccine == 'R21', r21_coverage, rtss_coverage), + booster_coverage = ifelse(vaccine == 'R21', r21_booster_coverage, rtss_coverage) + ) + + + if (unique(interventions$vaccine)== 'R21'){ + + initial_profile<- profile$r21_profile + booster_profile<- profile$r21_booster_profile + + }else { + + initial_profile<- malariasimulation::rtss_profile + booster_profile<- malariasimulation::rtss_booster_profile + } + + # specify flat booster coverage scenarios (90% for routine and 100% for blue sky) + + p <- malariasimulation::set_pev_epi( parameters = p, + profile = initial_profile, timesteps = timesteps, - coverages = interventions$rtss_cov, + coverages = interventions$coverage, age = round(6 * month), min_wait = 0, - boosters = round(18 * month), - booster_coverage = 0.8, - seasonal_boosters = FALSE + booster_spacing = round(12 * month), + booster_coverage = matrix(interventions$booster_coverage), + booster_profile = list(booster_profile) ) + return(p) } diff --git a/R/profile.R b/R/profile.R new file mode 100644 index 0000000..66d8caf --- /dev/null +++ b/R/profile.R @@ -0,0 +1,10 @@ +#' Median set of parameters for R21 +#' +#' A list containing the median set of parameters for the R21 vaccine per Imperial group draft manuscript. +#' +#' @format A list with 2 variables: +#' \describe{ +#' \item{r21_profile}{profile for the initial 3 doses of R21} +#' \item{r21_booster_profile}{profile for booster dose of R21} +#' } +"profile" diff --git a/README.Rmd b/README.Rmd index 75e15a6..f5ece18 100644 --- a/README.Rmd +++ b/README.Rmd @@ -13,7 +13,7 @@ knitr::opts_chunk$set( ) ``` -# site +# site_vimc [![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip) diff --git a/data/example_site.rda b/data/example_site.rda index 6f7d172..165a5d5 100644 Binary files a/data/example_site.rda and b/data/example_site.rda differ diff --git a/data/profile.rda b/data/profile.rda new file mode 100644 index 0000000..9cc6ef5 Binary files /dev/null and b/data/profile.rda differ diff --git a/man/add_rtss.Rd b/man/add_pev_epi.Rd similarity index 64% rename from man/add_rtss.Rd rename to man/add_pev_epi.Rd index 105c558..39a0046 100644 --- a/man/add_rtss.Rd +++ b/man/add_pev_epi.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/interventions.R -\name{add_rtss} -\alias{add_rtss} -\title{Add RTS,S} +\name{add_pev_epi} +\alias{add_pev_epi} +\title{Add pre-erythrocytic vaccine} \usage{ -add_rtss(p, interventions) +add_pev_epi(p, interventions) } \arguments{ \item{p}{parameter list} @@ -15,5 +15,5 @@ add_rtss(p, interventions) modified parameter list } \description{ -Add RTS,S +Add pre-erythrocytic vaccine } diff --git a/man/profile.Rd b/man/profile.Rd new file mode 100644 index 0000000..b9ed7f7 --- /dev/null +++ b/man/profile.Rd @@ -0,0 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/profile.R +\docType{data} +\name{profile} +\alias{profile} +\title{Median set of parameters for R21} +\format{ +A list with 2 variables: +\describe{ + \item{r21_profile}{profile for the initial 3 doses of R21} + \item{r21_booster_profile}{profile for booster dose of R21} +} +} +\usage{ +profile +} +\description{ +A list containing the median set of parameters for the R21 vaccine per Imperial group draft manuscript. +} +\keyword{datasets} diff --git a/site.Rproj b/site.Rproj deleted file mode 100644 index 497f8bf..0000000 --- a/site.Rproj +++ /dev/null @@ -1,20 +0,0 @@ -Version: 1.0 - -RestoreWorkspace: Default -SaveWorkspace: Default -AlwaysSaveHistory: Default - -EnableCodeIndexing: Yes -UseSpacesForTab: Yes -NumSpacesForTab: 2 -Encoding: UTF-8 - -RnwWeave: Sweave -LaTeX: pdfLaTeX - -AutoAppendNewline: Yes -StripTrailingWhitespace: Yes - -BuildType: Package -PackageUseDevtools: Yes -PackageInstallArgs: --no-multiarch --with-keep.source diff --git a/tests/testthat/test-rtss.R b/tests/testthat/test-rtss.R index 2c0c556..dd84f4a 100644 --- a/tests/testthat/test-rtss.R +++ b/tests/testthat/test-rtss.R @@ -4,16 +4,16 @@ test_that("adding rtss works", { interventions$rtss_cov[1:10] <- 0.5 p0 <- malariasimulation::get_parameters() p0$baseline_year <- 2000 - p1 <- add_rtss( + p1 <- add_pev_epi( p = p0, interventions = interventions) month <- 365 / 12 - expect_equal(p1$rtss_epi_age, round(6 * month)) - expect_equal(p1$rtss_epi_booster_coverage, 0.8) - expect_equal(p1$rtss_epi_boosters, round(18 * month)) - expect_equal(p1$rtss_epi_timesteps, 1 + (365 * (interventions$year - p0$baseline_year))) - expect_equal(p1$rtss_epi_coverages, interventions$rtss_cov) - expect_equal(p1$rtss_epi_min_wait, 0) - expect_equal(p1$rtss_epi_seasonal_boosters, FALSE) + expect_equal(p1$pev_epi_age, round(6 * month)) + expect_equal(p1$pev_epi_booster_coverage, 0.8) + expect_equal(p1$pev_epi_booster_timestep, round(18 * month)) + expect_equal(p1$pev_epi_timesteps, 1 + (365 * (interventions$year - p0$baseline_year))) + expect_equal(p1$pev_epi_coverages, interventions$rtss_cov) + expect_equal(p1$pev_epi_min_wait, 0) + expect_equal(p1$pev_epi_seasonal_boosters, FALSE) }) diff --git a/tests/testthat/test-site_parameters.R b/tests/testthat/test-site_parameters.R index 4fe2b24..6afa684 100644 --- a/tests/testthat/test-site_parameters.R +++ b/tests/testthat/test-site_parameters.R @@ -32,7 +32,7 @@ test_that("setting vivax works", { seasonality = example_site$seasonality, species = "pv" ) - expect_false(p$rtss) + expect_false(p$pev) expect_false(p$smc) expect_false(p$pmc) })