Skip to content
Draft
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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@
^scratch\.R$
^scratch$
^data-raw$
^jarl\.toml$
8 changes: 6 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: vimcheck
Title: Diagnostics for Vaccine Impact Modelling Consortium Burden and
Impact Estimates
Version: 0.0.3
Version: 0.0.4
Authors@R: c(
person("Pratik", "Gupte", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-5294-7819")),
Expand All @@ -24,13 +24,17 @@ Depends:
Imports:
checkmate,
cli,
diffdf,
dplyr,
forcats,
ggplot2,
ggridges,
glue,
here,
readr,
rlang,
scales,
stats,
stringr,
tidyr
Suggests:
Expand All @@ -48,4 +52,4 @@ Encoding: UTF-8
Language: en-GB
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
RoxygenNote: 7.3.3
40 changes: 40 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,20 +1,56 @@
# Generated by roxygen2: do not edit by hand

export(COLNAMES_INTEREST_PRESSURE_TEST)
export(COLNAMES_KEY_PRESSURE_TEST)
export(COLOUR_VIMC)
export(DEF_TOUCHSTONE_NEW)
export(DEF_TOUCHSTONE_OLD)
export(DEF_TOUCHSTONE_OLD_OLD)
export(EXCLUDED_DISEASES)
export(IMPACT_OUTCOMES)
export(MAX_TS_MONTH)
export(MAX_TS_YEAR)
export(MIN_TS_MONTH)
export(MIN_TS_YEAR)
export(N_TS_MIN_CHARS)
export(N_TS_YEAR_CHARS)
export(basic_burden_sanity)
export(burden_outcome_names)
export(check_demography_alignment)
export(colnames_df_missing_cols)
export(colnames_plot_demog_compare)
export(compare_natl_subreg)
export(file_dict_colnames)
export(filter_duplicates)
export(filter_excluded_diseases_ts)
export(filter_invalid_trajectories)
export(filter_recent_ts)
export(flag_large_diffs)
export(gen_combined_df)
export(gen_national_iqr)
export(generate_diffs)
export(plot_age_patterns)
export(plot_compare_demography)
export(plot_coverage_set)
export(plot_cumul)
export(plot_diff)
export(plot_fvp)
export(plot_global_burden)
export(plot_global_burden_decades)
export(plot_modelling_group_variation)
export(plot_sig_diff)
export(plot_vaccine_gavi)
export(prep_plot_age)
export(prep_plot_burden_decades)
export(prep_plot_coverage_set)
export(prep_plot_cumul)
export(prep_plot_demography)
export(prep_plot_fvp)
export(prep_plot_global_burden)
export(prep_plot_mod_grp_varn)
export(prep_plot_vax_gavi)
export(save_outputs)
export(scenario_data_colnames)
export(theme_vimc)
export(theme_vimc_noxaxis)
export(validate_complete_incoming_files)
Expand All @@ -26,12 +62,16 @@ importFrom(ggplot2,facet_grid)
importFrom(ggplot2,facet_wrap)
importFrom(ggplot2,geom_col)
importFrom(ggplot2,geom_hline)
importFrom(ggplot2,geom_point)
importFrom(ggplot2,geom_segment)
importFrom(ggplot2,ggplot)
importFrom(ggplot2,label_wrap_gen)
importFrom(ggplot2,labeller)
importFrom(ggplot2,labs)
importFrom(ggplot2,scale_fill_distiller)
importFrom(ggplot2,scale_x_continuous)
importFrom(ggplot2,scale_y_continuous)
importFrom(ggplot2,theme)
importFrom(ggplot2,vars)
importFrom(rlang,":=")
importFrom(rlang,.data)
8 changes: 8 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# vimcheck 0.0.4

- Added impact diagnostics functions in `R/fn_impact_diagnostics.R`.

- Added plotting preparation functions and plotting functions in `R/fn_plotting_prep_impact_diagnostics.R` and `R/fn_plotting_impact_diagnostics.R`.

- Added dependencies _diffdf_ and _here_.

# vimcheck 0.0.3

- Separated data-prep for plotting from plotting functions.
Expand Down
169 changes: 169 additions & 0 deletions R/constants.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
#' Package constants
#'
#' @description
#' Constant values used in _vimcheck_. See the **Examples** section for the
#' constant values.
#'
#' @name constants
#' @rdname constants
#'
#' @keywords constants
#'
#' @examples
#' file_dict_colnames
#'
#' @export
file_dict_colnames <- c(
"scenario_type",
Expand All @@ -15,6 +22,11 @@ file_dict_colnames <- c(
)

#' @name constants
#'
#' @examples
#' scenario_data_colnames
#'
#' @export
scenario_data_colnames <- c(
"scenario_type",
"scenario_type_description",
Expand All @@ -23,6 +35,11 @@ scenario_data_colnames <- c(
)

#' @name constants
#'
#' @examples
#' burden_outcome_names
#'
#' @export
burden_outcome_names <- c(
"cases",
"deaths",
Expand All @@ -37,6 +54,11 @@ burden_outcome_names <- c(
)

#' @name constants
#'
#' @examples
#' colnames_plot_demog_compare
#'
#' @export
colnames_plot_demog_compare <- c(
"variable",
"scenario",
Expand All @@ -46,3 +68,150 @@ colnames_plot_demog_compare <- c(
"value",
"value_millions"
)

#' @name constants
#'
#' @examples
#' colnames_df_missing_cols
#'
#' @export
colnames_df_missing_cols <- c(
"country_name",
"vaccine",
"activity_type",
"year",
"modelling_group"
)

#' @name constants
#'
#' @examples
#' COLNAMES_KEY_PRESSURE_TEST
#'
#' @export
COLNAMES_KEY_PRESSURE_TEST <- c(
"country",
"country_name",
"vaccine",
"activity_type",
"year",
"disease",
"modelling_group"
)

#' @name constants
#'
#' @examples
#' COLNAMES_INTEREST_PRESSURE_TEST
#'
#' @export
COLNAMES_INTEREST_PRESSURE_TEST <- union(
COLNAMES_KEY_PRESSURE_TEST,
c(
"fvps",
"target_population",
"coverage",
"deaths_averted",
"dalys_averted",
"deaths_averted_rate",
"dalys_averted_rate"
)
)

#' @name constants
#'
#' @examples
#' IMPACT_OUTCOMES
#'
#' @export
IMPACT_OUTCOMES <- c("deaths_averted", "dalys_averted")

IMPACT_GROUP_VARS <- c("activity_type", "vaccine")

#' @name constants
#'
#' @examples
#' EXCLUDED_DISEASES
#'
#' @export
EXCLUDED_DISEASES <- c("Hib", "PCV", "Rota", "JE")

#' @name constants
#'
#' @examples
#' N_TS_MIN_CHARS
#'
#' @export
N_TS_MIN_CHARS <- 6L

#' @name constants
#'
#' @examples
#' N_TS_YEAR_CHARS
#'
#' @export
N_TS_YEAR_CHARS <- 4L

#' @name constants
#'
#' @examples
#' MIN_TS_YEAR
#'
#' @export
MIN_TS_YEAR <- 2000

#' @name constants
#'
#' @examples
#' MAX_TS_YEAR
#'
#' @export
MAX_TS_YEAR <- 2100

#' @name constants
#'
#' @examples
#' MIN_TS_MONTH
#'
#' @export
MIN_TS_MONTH <- 1

#' @name constants
#'
#' @examples
#' MAX_TS_MONTH
#'
#' @export
MAX_TS_MONTH <- 12

#' @name constants
#'
#' @examples
#' DEF_TOUCHSTONE_OLD
#'
#' @export
DEF_TOUCHSTONE_OLD <- "201910"

#' @name constants
#'
#' @examples
#' DEF_TOUCHSTONE_NEW
#'
#' @export
DEF_TOUCHSTONE_NEW <- "202310"

#' @name constants
#'
#' @examples
#' DEF_TOUCHSTONE_OLD_OLD
#'
#' @export
DEF_TOUCHSTONE_OLD_OLD <- "202110"

#' @name constants
#'
#' @examples
#' COLOUR_VIMC
#'
#' @export
COLOUR_VIMC <- "#008080"
10 changes: 5 additions & 5 deletions R/burden_diagnostics.R → R/fn_burden_diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' Prints a message to screen informing the user whether any action has been
#' taken.
#'
#' @keywords diagnostics
#' @keywords burden_diagnostics
#'
#' @export
validate_file_dict_template <- function(
Expand Down Expand Up @@ -121,7 +121,7 @@ validate_file_dict_template <- function(
#' @return A `<tibble>` of the scenario file dictionary in `path_burden` if all
#' checks pass. Otherwise, exits with informative errors on failed checks.
#'
#' @keywords diagnostics
#' @keywords burden_diagnostics
#'
#' @export
validate_complete_incoming_files <- function(
Expand Down Expand Up @@ -212,7 +212,7 @@ validate_complete_incoming_files <- function(
#' @return A named list of checks carried out on `burden_set` to compare it
#' against `template`, with information on missing and extra data.
#'
#' @keywords diagnostics
#' @keywords burden_diagnostics
#'
#' @export
validate_template_alignment <- function(burden_set, template) {
Expand Down Expand Up @@ -276,7 +276,7 @@ validate_template_alignment <- function(burden_set, template) {
#' @return A `<tibble>` giving the alignment, i.e., percentage difference of
#' modelled population size from the WPP-derived population estimates.
#'
#' @keywords diagnostics
#' @keywords burden_diagnostics
#'
#' @export
check_demography_alignment <- function(
Expand Down Expand Up @@ -344,7 +344,7 @@ check_demography_alignment <- function(
#' @return A character vector of messages generated by checks on burden
#' estimates, with the length of the vector depending on how many checks fail.
#'
#' @keywords diagnostics
#' @keywords burden_diagnostics
#'
#' @export
basic_burden_sanity <- function(burden) {
Expand Down
Loading
Loading