mrc-ide / helios

Simulating far UVC for pathogen control
https://mrc-ide.github.io/helios/
Other
5 stars 0 forks source link

Issue 72: Further far UVC install strategies #93

Closed athowes closed 3 months ago

athowes commented 4 months ago

This PR closes #72.

Features added:

Remaining uncertainties / things to add:

Get started reviewing this code via:

library(helios)
parameters_list <- helios::get_parameters()
variables_list <- create_variables(parameters_list)
parameters <- variables_list$parameters_list
variables_list <- variables_list$variables_list

parameters <- set_uvc(
  parameters_list = parameters,
  setting = "household",
  coverage = 0.7,
  coverage_target = "individuals",
  coverage_type = "random",
  efficacy = 0.6,
  timestep = 100
)

x <- generate_far_uvc_switches(parameters, variables_list)

# Check this is geq to coverage times population
sum(x$setting_sizes$household * x$uvc_household)

# Also test the get_setting_size function
get_setting_size(variables_list, setting = "school")
get_setting_size(variables_list, setting = "workplace")
get_setting_size(variables_list, setting = "household")
tbreweric commented 3 months ago

This PR closes #72.

Features added:

  • Small changes to roxygen2 documentation of set_uvc and generate_far_uvc_switches
  • Added generate_setting_far_uvc_switches helper function which allows generate_far_uvc_switches to be reduced from 183 lines to 10
  • Altered get_setting_sizes (returns list of setting sizes) to get_setting_size (returns settting size[s] for a single setting e.g. households)
  • Added coverage_target == "individuals" options for random and targetted coverage at a specified proportion of individuals

Remaining uncertainties / things to add:

  • Haven't added unit tests for this
  • With the individuals as coverage target, the far UVC covered number is always going to be greater than or equal to the specified. For something like households this isn't a big deal (households are small), but for schools and workplaces this is relevant. Not sure what we can do about it...

Get started reviewing this code via:

library(helios)
parameters_list <- helios::get_parameters()
variables_list <- create_variables(parameters_list)
parameters <- variables_list$parameters_list
variables_list <- variables_list$variables_list

parameters <- set_uvc(
  parameters_list = parameters,
  setting = "household",
  coverage = 0.7,
  coverage_target = "individuals",
  coverage_type = "random",
  efficacy = 0.6,
  timestep = 100
)

x <- generate_far_uvc_switches(parameters, variables_list)

# Check this is geq to coverage times population
sum(x$setting_sizes$household * x$uvc_household)

# Also test the get_setting_size function
get_setting_size(variables_list, setting = "school")
get_setting_size(variables_list, setting = "workplace")
get_setting_size(variables_list, setting = "household")

I had a thought that if we are concerned about overshooting the number of people covered (which I'm not convinced I am) we could:

  1. calculate the number of individuals covered by the full set of indices
  2. calculate the number of individuals by all by the last indices
  3. calculate the difference between each of these and the number of people we ideally want to cover
  4. select the one that minimises the difference

Probably more faff than it's worth, and where random targeting is implemented could be further improved by searching for/including a setting with the ideal size, but a possible solution if we want it.