Skip to content

Commit 3b01c94

Browse files
kingsleyiyawenatemcintoshgithub-actions[bot]
authored
saves point exclusions file only if data values are present (#326)
* does not save csv outlier files if contents are empty * only save outliers if values are located in the file * added space in if statement * replaced the cat with the cli call Co-authored-by: Nate McIntosh <NMcIntosh@cdc.gov> * Update utils/Rt_review_exclusions.R Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: Nate McIntosh <NMcIntosh@cdc.gov> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 9867de4 commit 3b01c94

2 files changed

Lines changed: 22 additions & 11 deletions

File tree

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# CFAEpiNow2Pipeline v0.2.0
22

33
## Features
4+
* Does not save outlier csv files if contents are empty
45
* Switching base rocker image from geospatial (4.7 GB) to r-ver (3 GB)
56
* Refactoring unit tests to make use of setup.R global testing env
67
* Adding dependencies to install cmdstanr backend and using GH action

utils/Rt_review_exclusions.R

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,18 +137,28 @@ create_pt_excl_from_rt_xslx <- function(dates) {
137137
container_name <- "nssp-etl"
138138
cont <- CFAEpiNow2Pipeline::fetch_blob_container(container_name)
139139

140-
cli::cli_alert_info(
141-
"saving {lubridate::ymd(report_date)}.csv in
142-
{container_name}/outliers-v2"
143-
)
144-
AzureStor::storage_write_csv(
145-
cont = cont,
146-
object = point_exclusions,
147-
file = file.path(
148-
"outliers-v2",
149-
paste0(lubridate::ymd(report_date), ".csv")
140+
empty_df <- function(df2) {
141+
all(df2 == "")
142+
}
143+
144+
if (empty_df(point_exclusions)) {
145+
cli::cli_alert_info(
146+
"This CSV contains empty values. No output file created."
150147
)
151-
)
148+
} else {
149+
cli::cli_alert_info(
150+
"saving {lubridate::ymd(report_date)}.csv in
151+
{container_name}/outliers-v2"
152+
)
153+
AzureStor::storage_write_csv(
154+
cont = cont,
155+
object = point_exclusions,
156+
file = file.path(
157+
"outliers-v2",
158+
paste0(lubridate::ymd(report_date), ".csv")
159+
)
160+
)
161+
}
152162

153163
#### State exclusions #####
154164
state_exclusions <- combined_df |>

0 commit comments

Comments
 (0)