-
Notifications
You must be signed in to change notification settings - Fork 0
Add initial package functions #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
This pull request:
Reach out on slack ( (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`? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- disease is touchstone specific
- see for example https://github.com/vimc/montagu-reports/tree/main/shared/rapid-model-run-metadata/202511rsv
R/burden_diagnositics.R
Outdated
| "File dictionary found at {.file {template}}, no action needed." | ||
| ) | ||
| } else { | ||
| # TODO: resolve magic strings |
There was a problem hiding this comment.
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.
R/burden_diagnositics.R
Outdated
| ) | ||
| } | ||
|
|
||
| sce$file <- NA_character_ # TODO: investigate this further |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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? |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
|
I am wondering if we could also append tests to this package. Like |
| 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] | ||
| ) | ||
| } |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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?
|
This pull request:
Reach out on slack ( (Note that results may be inaccurate if you branched from an outdated version of the target branch.) |
This draft PR adds some initial functions taken from https://github.com/vimc/montagu-reports/pull/1312.