Title: | Internal Montagu Helpers |
---|---|
Description: | Helpers for Montagu. |
Authors: | Rich FitzJohn |
Maintainer: | Rich FitzJohn <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.26 |
Built: | 2024-12-21 02:54:09 UTC |
Source: | https://github.com/vimc/jenner |
Set the active touchstone
admin_set_active_touchstone(con, touchstone_id, dry_run = TRUE)
admin_set_active_touchstone(con, touchstone_id, dry_run = TRUE)
con |
Database connection (will require write access to the database) |
touchstone_id |
Touchstone id to set as "open" |
dry_run |
Don't commit the transaction - just test if it would work |
Calculate dalys
calculate_dalys(con, touchstone_name, year_min = 2000, year_max = 2030, vimc_dalys_only = TRUE, modelling_group = NULL, stochastic_data = NULL, dalys_parameters = NULL, life_table = NULL) create_dalys_parameters(con, touchstone_name = "201710gavi", vimc_dalys_only) create_dalys_life_table(con, touchstone_name = "201710gavi", year_min = 2000, year_max = 2030)
calculate_dalys(con, touchstone_name, year_min = 2000, year_max = 2030, vimc_dalys_only = TRUE, modelling_group = NULL, stochastic_data = NULL, dalys_parameters = NULL, life_table = NULL) create_dalys_parameters(con, touchstone_name = "201710gavi", vimc_dalys_only) create_dalys_life_table(con, touchstone_name = "201710gavi", year_min = 2000, year_max = 2030)
con |
You can be |
touchstone_name |
touchstone for which dalys are calcualted |
year_min |
minimal year |
year_max |
maximum year |
vimc_dalys_only |
set to be TRUE if we are only interested in Ferrari, Li and LiST (201710gavi) |
modelling_group |
This parameter makes the calcualtion more flexible, specify a vector of modelling_group(s) that you are interested in. |
stochastic_data |
If this is not NULL, then instead of querying the database for the burden estimate set, use the specified stochastic_data, which must be a data frame containing the columns "burden_estimate_set", "country", "year", "age", "burden_outcome" and "burden". The burden_estimate_set should refer to the central burden estimate set for that group, which daly parameters related to. "country" is the 3-character representation. "year" and "age" are trivial; "burden_outcome" is the integer code for the burden, for each line, and "burden" is the data value. |
dalys_parameters |
Leave as NULL, for single calls to calculate_dalys, but for many calls, for example stochastic runs, call create_dalys_parameters first, and pass the result as an argument here to speed things up. |
life_table |
Leave as NULL, for single calls to calculate_dalys, but for many calls, for example stochastic runs, call create_dalys_life_table first, and pass the result as an argument here to speed things up significantly. |
Create and import a new touchstone.
create_touchstone(con, dat, demography_from = NULL, path_meta = "meta", transaction = TRUE, dry_run = TRUE)
create_touchstone(con, dat, demography_from = NULL, path_meta = "meta", transaction = TRUE, dry_run = TRUE)
con |
Database connection. You will need to be the
|
dat |
A |
demography_from |
Touchstone id to import demographic statistics from. This must currently be given, but in future we'll allow this to be imported from a csv |
path_meta |
Path that we look for various metadata files. Eventually we'll document what they look like. |
transaction |
Do in one transaction (logical scalar) |
dry_run |
Don't commit (just rollback the transaction after completion) |
Connect to database
database_connection(location = "science", user = "readonly", local_port = NULL, local_password_group = "science")
database_connection(location = "science", user = "readonly", local_port = NULL, local_password_group = "science")
location |
One of "science", "production", "uat" or "localhost". Be very careful if using production |
user |
Username to connect as |
local_port |
Port (when running locally) |
local_password_group |
Password group (when running locally) |
Provide age-specific coverage-un_pop-fvps
fix_coverage_fvps(con, touchstone_name = "201710gavi", year_min = 2000, year_max = 2100, pine = FALSE, write_table = TRUE, report_suspecious_coverage = FALSE, touchstone_pop = NULL, gavi_support_levels = c("with", "bestminus"))
fix_coverage_fvps(con, touchstone_name = "201710gavi", year_min = 2000, year_max = 2100, pine = FALSE, write_table = TRUE, report_suspecious_coverage = FALSE, touchstone_pop = NULL, gavi_support_levels = c("with", "bestminus"))
con |
Database connection. You will need to be |
touchstone_name |
Specify touchstone name only, not with specific version. |
year_min |
min year of vaccination |
year_max |
max year of vaccination |
pine |
this is for testthat. we only grab data for pine countries if true |
write_table |
If true, create a temporary table; otherwise return a dataframe |
report_suspecious_coverage |
switch on/off the reporting of suspecious coverage |
touchstone_pop |
population touchstone, this is for the modups where fvps are calculated using a coverage touchstone and a population touchstone |
gavi_support_levels |
specify gavi_support_levels that apply to the touchstone_name you are looking at |
Calcualte impact with method2 that allocate impact by fvps*impact_rate
impact_calculation(con, meta, year_min = 2000, year_max = 2030, routine_tot_rate_shape = "trace_cohort", method = "method2", age_max = 100)
impact_calculation(con, meta, year_min = 2000, year_max = 2030, routine_tot_rate_shape = "trace_cohort", method = "method2", age_max = 100)
con |
Database connection. You will need to be |
meta |
This is the metadata that goes into the calcualtion |
year_min |
minimal year of vaccination |
year_max |
maximal year year of vaccination |
routine_tot_rate_shape |
This parameter determines how we chop off the year-age matrix to calculate impact rates campaign is stratiforward, use all fvps and all burden estimates to calculate impact rate. So no need to specify. Becuase all impacts (years 2000-2100) are derived from campaigns between 2000 and 2030. Routine is more complicated. We either trance birth cohort between 2000-2030 or trance all birth cohorts between 2000-2100. |
method |
impact calculation method - chose from method1 and method2 impact outcome can be provided as age specific if simplified=FALSE |
age_max |
maximum age considered, eg. age_max = 4 for under 5s |
Do a modified update
modified_update_calculate(con, touchstone_name_mod, touchstone_use)
modified_update_calculate(con, touchstone_name_mod, touchstone_use)
con |
Database connection |
touchstone_name_mod |
Name of the new modified touchstone that we are creating |
touchstone_use |
Name of the touchstone that we are basing this off of |
Modified update summary output
modified_update_summary_output(con, res, path_meta)
modified_update_summary_output(con, res, path_meta)
con |
Database connection |
res |
A modified update object (returned from
|
path_meta |
Path to the metadata directory. In this
directory the following files must exist:
|
Calculate updated impact
mu_scale(name, d)
mu_scale(name, d)
name |
Impact type: deaths_averted or cases_averted |
d |
Data: use impact_rate_tot (method 2) |
Look for introduction year and add to summary output
mu_year_introduction(con, dat, dat_summary)
mu_year_introduction(con, dat, dat_summary)
con |
Database connection |
dat |
Data: the list output from the modup |
dat_summary |
Data: the summary output from the modup |
Prepare impact calculation recipes
prepare_recipe(con, recipe = "impact.csv")
prepare_recipe(con, recipe = "impact.csv")
con |
Database connection. You will need to be |
recipe |
at the moment, it is a csv file. Once imported, recipe will be more flexible |
Project coverage
project_coverage(dat, year_project_from, year_from = 1980, year_to = 2100)
project_coverage(dat, year_project_from, year_from = 1980, year_to = 2100)
dat |
Data with columns... |
year_project_from |
This is the year that the projections start |
year_from , year_to
|
Range of the actual coverage data that that you want. |