midas-network / SMHvalidation

Other
5 stars 0 forks source link

Filename PDF output of visualization #11

Closed LucieContamin closed 5 months ago

LucieContamin commented 2 years ago

Sometimes the filename returns NA instead of model and/or team name. It seems to be because of the stringr::str_split(file_, pattern="_")[[1]] in the generate_validation_plots() function. Some teams use "_" or "-". I propose to change to:

projection_date <- lubridate::as_date(stringr::str_extract(file_, "[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}"))
team_model_name <- gsub("[[:digit:]]{4}-[[:digit:]]{2}-[[:digit:]]{2}(_|-)|(.csv|.zip|.gz|.pq)", "", file_)