Skip to content

Conversation

@pratikunterwegs
Copy link
Contributor

This draft PR adds some initial functions taken from https://github.com/vimc/montagu-reports/pull/1312.

@github-actions
Copy link

This pull request:

  • Adds 28 new dependencies (direct and indirect)
  • Adds 3 new system dependencies
  • Removes 0 existing dependencies (direct and indirect)
  • Removes 0 existing system dependencies

Reach out on slack (#code-review or #help channels) to double check if there are base R alternatives to the new dependencies.

(Note that results may be inaccurate if you branched from an outdated version of the target branch.)

disease,
path_burden = "incoming_burden_estimates"
) {
# TODO: check conditions on arg disease - what is the original source `pars`?

Choose a reason for hiding this comment

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

"File dictionary found at {.file {template}}, no action needed."
)
} else {
# TODO: resolve magic strings

Choose a reason for hiding this comment

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

I pull dependency from the report which delivers model inputs, i.e. coverage scenarios, demography and burden templates; and put them into a directory called model-inputs/. These are basically the expectancies.

)
}

sce$file <- NA_character_ # TODO: investigate this further

Choose a reason for hiding this comment

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

We never know what file names modellers would be using. So we have to manually align each scenario to its corresponding file. In the future, we plan to distribute this task to modellers, i.e. we will provide the file_dictionary.csv to them, and let them do the work.

#'
#' @export
check_template_alignment <- function(burden_set, template) {
# TODO: figure out what the args are expected to be: dfs? lists, vecs?

Choose a reason for hiding this comment

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

By default we work with data frames.

length(extra_cols_in_burden) ==
0L

# TODO: make magic strings constants

Choose a reason for hiding this comment

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

Agree. These columns can be constants.

})
)

# TODO: if these are data.frames, this might not be the best way to check

Choose a reason for hiding this comment

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

we can match whatever a better option is

check_demography_alignment <- function(burden_set, wpp, gender = "both") {
# TODO: input checks

# TODO: check if these can be made constants

Choose a reason for hiding this comment

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

I think they can be made constants.

provided = cohort_size # check if this can be made a string const
)

# TODO: explain what expected is

Choose a reason for hiding this comment

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

expectd is cohort size we provided for modellers for consistentcy. We expect our demohgraphy data is used for their models.

)

# TODO: explain what expected is
# TODO: replace with a right-join?

Choose a reason for hiding this comment

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

you mean expected righ-join provided? I think the thing is we want modellers to match expected. Let us know if there is a better option.

expected <- dplyr::rename(
expected,
expected = value
) # TODO: prefer not to use NSE

Choose a reason for hiding this comment

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

Sorry, what is NSE?

)

# TODO: THIS NEEDS TO BE CLEANED UP
# TODO: clarify structure of `coverage` and mapping of gender to age

Choose a reason for hiding this comment

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

We are in early stages moving away from the database. coverage is created in another report which sets up touchstone for coverage scenarios. In that report, we have tests to control structure of coverage and gender. Maybe we can move those tests to vimcheck as well.

values_from = "million"
)

# TODO: CLEAN THIS UP

Choose a reason for hiding this comment

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

This bit is a bit confusing, I know. We could make this clearer.
Intuitively, this is sorting scenarios by vaccine doses, and expecting that a scenario with less vaccine doses has higher disease burden.

@xiangli313
Copy link

xiangli313 commented Jan 7, 2026

I am wondering if we could also append tests to this package. Like
https://github.com/vimc/vimpact/tree/master/inst
https://github.com/vimc/vimpact/tree/master/tests

Comment on lines +395 to +413
for (i in seq_along(todo_list$age_from)) {
pop_all[[i]] <- wpp %>%
x <- dplyr::filter(
wpp,
.data$age >= todo_list$age_from[i],
.data$age <= todo_list$age_to[i],
.data$gender == todo_list$gender[i]
)
x <- dplyr::group_by(x, .data$country, .data$year)
x <- dplyr::summarise(
x,
target_wpp = sum(.data$value),
.groups = "drop"
)
x <- dplyr::mutate(
x,
job = todo_list$job[i]
)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@xiangli313 - could you give me a brief idea of the overall aim of this section?

)

# TODO: CLEAN THIS UP
for (i in 2:nrow(scenario_order)) {
Copy link
Contributor Author

@pratikunterwegs pratikunterwegs Jan 7, 2026

Choose a reason for hiding this comment

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

@xiangli313 - could you explain the aim of this section containing the two for-loops as well?

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

This pull request:

  • Adds 28 new dependencies (direct and indirect)
  • Adds 3 new system dependencies
  • Removes 0 existing dependencies (direct and indirect)
  • Removes 0 existing system dependencies

Reach out on slack (#code-review or #help channels) to double check if there are base R alternatives to the new dependencies.

(Note that results may be inaccurate if you branched from an outdated version of the target branch.)

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