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

Feat/vaccines #209

Merged
merged 5 commits into from
Mar 13, 2023
Merged

Feat/vaccines #209

merged 5 commits into from
Mar 13, 2023

Conversation

giovannic
Copy link
Member

@giovannic giovannic commented Jan 3, 2023

Updates the vaccine modelling to allow arbitrary vaccine modelling parameters through the VaccineProfile class.

As an example of how VaccineProfiles are created, see the exported rtss_profile and rtss_booster_profile objects in vaccine_parameters.R

A future PR could be made to export new vaccine profiles.

Changes:

  • rename vaccine strategy functions from set_mass_rtss, set_rtss_epi -> set_mass_vaccination, set_vaccine_epi
  • add vaccine profile parameters to vaccine strategy functions
  • remove vaccine antibody variables rho/ds/dl...
  • change vaccination processes to sample antibody values at simulation time (each timestep) from the corresponding vaccine profile
  • fix regression tests and vaccine vignette

Review requests/notes:

  • Code review: (@pwinskill ?) most of this is renaming rtss -> vaccine, sorry if that makes most of the changes tedious. The most critical changes are in human_infection.R, where the sampling code is a bit different from before.
  • End-user review: (@htopazian ?) does the vaccine vignette make sense? Is there anything else we would want to document in this PR?

Copy link
Member

@pwinskill pwinskill left a comment

Choose a reason for hiding this comment

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

Hi @giovannic
This looks good to me, just one small comment and the following genral one:

Renaming RTSS to vaccine throughout has the possibility to cause seme confusion/ambiguity as we also have other types of vaccine in the model, tbv. We could leave this for now (as it isn't urgent) and make sure that the documentation states clearly that vaccine options refer to pre-erythrocytic vaccines only. I guess our other options would be to change all the new vaccines to pev, or to somehow include the tbv implmentation under the vaccine implementation (both of which seem a bit onerous to do!)

if (length(vaccinated) > 0) {
vaccinated_index <- source_vector[vaccine_times > -1]
antibodies <- calculate_rtss_antibodies(
vaccinated_index <- source_vector[vaccinated]
Copy link
Member

Choose a reason for hiding this comment

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

I can't see where vaccinated_index gets used

@pwinskill
Copy link
Member

@htopazian it might be helpful if you could re-run at least one of the previous RTSS scenarios with the new code as a check that we're getting the same result?

Copy link
Contributor

@htopazian htopazian left a comment

Choose a reason for hiding this comment

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

Nice Giovanni! A few comments in the file changes

man/set_mass_vaccination.Rd Outdated Show resolved Hide resolved
R/vaccines.R Outdated Show resolved Hide resolved
R/vaccine_parameters.R Outdated Show resolved Hide resolved
R/vaccine_parameters.R Outdated Show resolved Hide resolved
R/vaccine_parameters.R Outdated Show resolved Hide resolved
R/vaccine_parameters.R Outdated Show resolved Hide resolved
R/parameters.R Outdated Show resolved Hide resolved
R/vaccine_parameters.R Outdated Show resolved Hide resolved
R/variables.R Outdated Show resolved Hide resolved
@htopazian
Copy link
Contributor

@htopazian it might be helpful if you could re-run at least one of the previous RTSS scenarios with the new code as a check that we're getting the same result?

@pwinskill great idea - looking pretty similar for the mass vax strategy with 100,000!

image

@giovannic giovannic force-pushed the feat/vaccines branch 4 times, most recently from 29d3203 to fdf4d8b Compare February 28, 2023 11:17
 * correlation test passing
 * VaccineProfile class executing

Fix infection integration tests

Fix EPI regressions

Fix regression tests

Fix Vaccines vignette:

 * update vignette to use new vaccine API
 * update process and event creation for new vaccine code

Fix R CMD check issues:

* Fix correlation example
* Update documentation for RTSS vaccine profiles

update vaccine vignette

Rename vaccine to pev

Update vignettes for new function names

Bump version and update NEWS

Remove unused line
@giovannic giovannic requested review from pwinskill and htopazian March 7, 2023 11:55
Copy link
Contributor

@htopazian htopazian left a comment

Choose a reason for hiding this comment

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

Thanks Giovanni, it is looking good and problems with epi boosters are fixed!

Copy link
Member

@pwinskill pwinskill left a comment

Choose a reason for hiding this comment

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

Looks good - thank ❤❤
A couple of sticking points highlighted in the comments

#' @param profile primary vaccine profile of type PEVProfile
#' @param coverages a vector of coverages for the primary doses
#' @param timesteps a vector of timesteps associated with coverages
#' @param age for the target population, (in timesteps)
Copy link
Member

Choose a reason for hiding this comment

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

Not clear to me what this means - is it a single value (upper bound)?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry...presumably age of first dose? Would be helpful to clarify in the help

#' @export
set_pev_epi <- function(
parameters,
profile,
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps for a seperate PR, but is there a reason why the primary profile is a single fixed profile, while the booster can vary? Would we not want flexibility for both?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, is the idea that we could have seperate profiles for the primary doses? We would need a new model for that, since we only model protection after the final dose.

Copy link
Member

Choose a reason for hiding this comment

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

Not seperate for the 3 doses in the primary series, but seperate vaccines given for the primary series at different timepoints, eg.
Year 1: primary series = 3 doses of vaccine A
Year 2: primary series = 3 doses of vaccine B

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I see! Yes, we could implement this feature if we want to model transition between vaccine types. Made an issue here: #228

not_recently_vaccinated <- variables$rtss_vaccinated$get_index_of(
a = max(timestep - parameters$rtss_epi_min_wait, 0),
not_recently_vaccinated <- variables$vaccinated_timestep$get_index_of(
a = max(timestep - parameters$pev_epi_min_wait, 0),
Copy link
Member

Choose a reason for hiding this comment

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

The following was failing for me, I think in relation to this section:

p <- get_parameters(overrides = list(
  human_population = 1000,
  individual_mosquitoes = FALSE
))

p <- p |>
  set_pev_epi(
    profile = rtss_profile,
    coverages = c(0.99, 0.99, 0.99),
    timesteps = 365 * (2:4) + 1,
    age = 5 * 365,
    min_wait = 180,
    booster_profile = list(rtss_profile, rtss_profile, rtss_profile),
    booster_timestep = c(190, 190, 190),
    booster_coverage = c(0.8, 0.8, 0.8)
  )

s <- run_simulation(timesteps = 365 *  7, parameters = p)

Setting min_wait = 0 resolved the issue. Is the a reasonable check we can make on what the user inputs here?

#' @description Parameters for a primary dose of RTS,S for use with the
#' set_mass_pev and set_pev_epi functions
#' @export
rtss_profile <- create_pev_profile(
Copy link
Member

Choose a reason for hiding this comment

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

Really like how these profiles are set up btw 👍

Copy link
Member

@pwinskill pwinskill left a comment

Choose a reason for hiding this comment

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

Thanks @giovannic!

@giovannic giovannic merged commit 03cd3d5 into dev Mar 13, 2023
@giovannic giovannic deleted the feat/vaccines branch March 17, 2023 11:13
@htopazian htopazian mentioned this pull request Mar 30, 2023
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.

3 participants