Skip to content

WIP adding pressure testing#14

Draft
pratikunterwegs wants to merge 10 commits intomainfrom
develop
Draft

WIP adding pressure testing#14
pratikunterwegs wants to merge 10 commits intomainfrom
develop

Conversation

@pratikunterwegs
Copy link
Copy Markdown
Contributor

WIP as PR develops.

Comment thread R/fn_pressure_testing.R Outdated
filter_recent_ts <- function(df, threshold = 202310) {
touchstone_year <- unique(df$touchstone)

# TODO: check that touchstone year is 6 digit - can there be more digits?
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It should always be 6 numbers (year followed by month) in the dataset but sometimes report parameters have character additions for disease too e.g. 202602yf. I think fine to leave as 6 numbers for this filtering purpose

Comment thread R/constants.R Outdated
Comment on lines +50 to +60
#' @name constants
EXCLUDED_DISEASES <- c("Hib", "PCV", "Rota", "JE")

#' @name constants
TOUCHSTONE_OLD <- "201910"

#' @name constants
TOUCHSTONE_NEW <- "202310"

#' @name constants
TOUCHSTONE_OLD_OLD <- "202110"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I agree it's much cleaner have these separate to the functions, the only thing is, they need to be flexible as each time a report is run, users may want to change these, specifically the TOUCHSTONE_OLD etc. in order to compare different reports/ years

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll rename these to DEF_* for default X - that way they shouldn't interfere with users' analyses but it also allows us to have some sensible defaults.

Comment thread R/fn_pressure_testing.R Outdated
Comment on lines +205 to +206
# TODO: replace `old` and `new` with defined objs --- see scratch.R
# unsure why this syntax was used
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I can't see scratch.R? Agree the syntax could be more streamlined, I thought I had a reason at the time but I'm not sure now.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah thanks - that comment is aimed at me - the scratch.R file is where I try out the functions.

Comment thread R/fn_pressure_testing.R
#' @export
gen_combined_df <- function(prev_dat, df2, interest_cols, key_cols) {
# TODO: input checks
# TODO: df2 needs a better name
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

df2 is essentially a cleaned version of of the touchstone_new latest report on packit where vaccine names are cleaned, subregions appended etc. happy to take suggestions on a better way to do it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks - could you suggest an informative name for the argument that somebody new to the package and the workflow would understand? data_current? data_cleaned? If you could pop a couple of lines in this thread about any expectations around it, I can add those to the function docs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

df_clean is fine, thanks. df_clean is the imported dependency report (currently named touchstone_new) with the following cleaning steps applied:

  • Malaria vaccine names amended
  • Subregions appended
  • Fixes for missing country names
  • Removal of now-redundant columns
    It may even be sufficient to just apply these steps to df itself, I think I just kept them separate when developing the report so I didn't have to keep pulling a clean dependency when testing things out.

Comment thread R/fn_pressure_testing.R Outdated
results
}

# TODO: reconsider function name, add explicit arguments
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is this in relation to save_outputs?

Copy link
Copy Markdown
Contributor Author

@pratikunterwegs pratikunterwegs Apr 20, 2026

Choose a reason for hiding this comment

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

Yes - I think a more informative function name would be great - any suggestions? I'll also be adding some explicit arguments, as currently the function relies on having the objects it saves in its environment.

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.

2 participants