Skip to content

Commit 64eb5bb

Browse files
Clean up some docs for PR
1 parent da3696a commit 64eb5bb

10 files changed

Lines changed: 53 additions & 43 deletions

DESCRIPTION

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,31 @@ Description: Run diagnostics on burden estimates submitted by modellers in
1919
License: MIT + file LICENSE
2020
URL: https://github.com/vimc/vimcheck, https://vimc.github.io/vimcheck/
2121
BugReports: https://github.com/vimc/vimcheck/issues
22+
Depends:
23+
R (>= 3.5)
24+
Imports:
25+
checkmate,
26+
cli,
27+
dplyr,
28+
forcats,
29+
ggplot2,
30+
glue,
31+
readr,
32+
reshape2,
33+
rlang,
34+
tidyr
2235
Suggests:
2336
knitr,
2437
rmarkdown,
2538
spelling,
26-
testthat (>= 3.0.0)
39+
testthat (>= 3.0.0),
40+
tibble,
41+
withr
2742
VignetteBuilder:
2843
knitr
2944
Config/testthat/edition: 3
3045
Encoding: UTF-8
3146
Language: en-GB
47+
LazyData: true
3248
Roxygen: list(markdown = TRUE)
3349
RoxygenNote: 7.3.2
34-
Imports:
35-
cli,
36-
dplyr,
37-
fs,
38-
ggplot2,
39-
glue,
40-
readr,
41-
rlang,
42-
tidyr
43-
Depends:
44-
R (>= 3.5)
45-
LazyData: true

R/burden_diagnositics.R

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,22 @@
1111
#'
1212
#' @param path_burden A directory with burden estimate data.
1313
#'
14-
#' @return Nothing; called primarily for its side-effets.
14+
#' @return Nothing; called primarily for its side-effects.
1515
#' If the file `path_burden/file_dictionary.csv` does not exist, a file
1616
#' dictionary CSV file is written to the same location.
1717
#' Prints a message to screen informing the user whether any action has been
1818
#' taken.
1919
#'
2020
#' @keywords diagnostics
2121
#'
22-
#' @examples
23-
#'
2422
#' @export
2523
validate_file_dict_template <- function(
2624
disease,
2725
path_burden = "incoming_burden_estimates"
2826
) {
29-
# TODO: check conditions on arg disease - what is the original source `pars`?
27+
# NOTE: maybe need to check allowed options for disease?
3028

29+
checkmate::assert_string(disease)
3130
checkmate::assert_directory_exists(path_burden)
3231
template <- file.path(path_burden, "file_dictionary.csv")
3332

@@ -64,8 +63,6 @@ validate_file_dict_template <- function(
6463
)
6564
}
6665
} else {
67-
# TODO: explain why this branch of the decision tree triggers in fn docs
68-
6966
# NOTE: see expected dir structure in `tests/testthat/testdata/`
7067
scenario_dir <- file.path(path_burden, "model_inputs")
7168
checkmate::assert_directory_exists(scenario_dir)
@@ -125,8 +122,6 @@ validate_file_dict_template <- function(
125122
#' @return A `<tibble>` of the scenario file dictionary in `path_burden` if all
126123
#' checks pass. Otherwise, exits with informative errors on failed checks.
127124
#'
128-
#' @examples
129-
#'
130125
#' @keywords diagnostics
131126
#'
132127
#' @export
@@ -145,7 +140,7 @@ validate_complete_incoming_files <- function(
145140
show_col_types = FALSE
146141
)
147142

148-
col_filenames <- "file" # TODO: remove/explain magic colnm
143+
col_filenames <- "file"
149144
scenario_filenames <- df_dict[[col_filenames]]
150145
df_dict <- dplyr::select(df_dict, -{{ col_filenames }})
151146

@@ -212,11 +207,9 @@ validate_complete_incoming_files <- function(
212207
#' @param template A `<data.frame>` of the burden template as provided to
213208
#' modelling groups by VIMC.
214209
#'
215-
#' @return A named list of checks carried out on `burden_set` to comapre it
210+
#' @return A named list of checks carried out on `burden_set` to compare it
216211
#' against `template`, with information on missing and extra data.
217212
#'
218-
#' @examples
219-
#'
220213
#' @keywords diagnostics
221214
#'
222215
#' @export
@@ -235,7 +228,6 @@ validate_template_alignment <- function(burden_set, template) {
235228
length(extra_cols_in_burden) ==
236229
0L
237230

238-
# TODO: make magic strings constants
239231
key_cols <- c("disease", "country", "year", "age")
240232
template_grid <- dplyr::distinct(
241233
template,
@@ -250,8 +242,6 @@ validate_template_alignment <- function(burden_set, template) {
250242
})
251243
)
252244

253-
# TODO: if these are data.frames, this might not be the best way to check
254-
# for differences
255245
missing_grid_in_burden <- dplyr::setdiff(template_grid, burden_grid)
256246
extra_grid_in_burden <- dplyr::setdiff(burden_grid, template_grid)
257247
burden_grid_matches_template <- all(
@@ -274,15 +264,19 @@ validate_template_alignment <- function(burden_set, template) {
274264

275265
#' Check incoming burden cohort size against interpolated population
276266
#'
277-
#' @description
267+
#' @description Check the modelled disease burden data has similar population
268+
#' sizes as the provided population data.
278269
#'
279-
#' @param burden_set
270+
#' @inheritParams validate_template_alignment
280271
#'
281-
#' @param wpp
272+
#' @param wpp Population estimates for the country in `burden_set`, provided by
273+
#' VIMC.
282274
#'
283-
#' @param gender
275+
#' @param gender The assigned sex for which demography is to be checked. Options
276+
#' are `"Both"` (default), `"Male"`, or `"Female"`.
284277
#'
285-
#' @return
278+
#' @return A `<tibble>` giving the alignment, i.e., percentage difference of
279+
#' modelled population size from the WPP-derived population estimates.
286280
#'
287281
#' @keywords diagnostics
288282
#'
@@ -507,6 +501,7 @@ impact_check <- function(burden, scenario_order) {
507501
scenario_order <- dplyr::select(scenario_order, {{ scenario_cols }})
508502

509503
d <- dplyr::summarise(
504+
burden,
510505
millions = sum(.data$value) / 1e6,
511506
.by = c("scenario", "burden_outcome"),
512507
.groups = "drop" # probably unnecessary as grouping is temporary

R/example_data.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#' @format ## `eg_burden_template`
2727
#' A data frame with 10,201 rows and 10 columns:
2828
#' \describe{
29-
#' \item{disease}
29+
#' \item{disease}{Disease name}
3030
#' \item{year}{Year}
3131
#' \item{age}{Age}
3232
#' \item{country}{Country name in short format; this is a placeholder name.}

R/plotting.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# TODO: add documentations for these functions
12
#' Plotting theme for vimcheck
23
#'
34
#' @description
@@ -32,7 +33,7 @@ theme_vimc <- function(x_text_angle = 45, y_text_angle = 0, ...) {
3233
)
3334
}
3435

35-
#' Plot burden and impact diagostics
36+
#' Plot burden and impact diagnostics
3637
#'
3738
#' @name plotting
3839
#' @rdname plotting

inst/WORDLIST

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
BMC
22
Codecov
3+
DALYs
34
Echeverria
45
GHA
56
Hallett
@@ -13,5 +14,7 @@ Susy
1314
Toor
1415
VIMC
1516
WIP
17+
WPP
1618
autogenerated
1719
pkgdown
20+
tibble

man/check_demography_alignment.Rd

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/eg_burden_template.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/plotting.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/validate_file_dict_template.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/validate_template_alignment.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)