Skip to content

Commit 7be562c

Browse files
committed
copilot suggestions
1 parent 2c3f578 commit 7be562c

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

DESCRIPTION

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ Imports:
1919
readr,
2020
stringr
2121
Remotes:
22-
forecasttools=github::cdcgov/forecasttools
22+
forecasttools=github::cdcgov/forecasttools,
23+
hubUtils=github::hubverse-org/hubUtils
2324
Suggests:
2425
tibble,
2526
testthat (>= 3.0.0)

R/update_hub_target_data.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,16 @@ update_hub_target_data <- function(
109109
dplyr::arrange(date, location)
110110

111111
output_file <- fs::path(output_dirpath, "time-series", ext = "parquet")
112-
forecasttools::read_tabular_file(output_file) |>
113-
dplyr::bind_rows(hubverse_format_nhsn_data, hubverse_format_nssp_data) |>
112+
if (fs::file_exists(output_file)) {
113+
existing_data <- forecasttools::read_tabular_file(output_file)
114+
} else {
115+
existing_data <- hubverse_format_nhsn_data[0, ]
116+
}
117+
dplyr::bind_rows(
118+
existing_data,
119+
hubverse_format_nhsn_data,
120+
hubverse_format_nssp_data
121+
) |>
114122
dplyr::distinct() |>
115123
forecasttools::write_tabular_file(output_file)
116124
}

tests/testthat/test_update_hub_target_data.R

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@ update_hub_target_data_test <- function(
1010
output_file <- fs::path(base_hub_path, "target-data/time-series.parquet")
1111
fs::dir_create(fs::path(base_hub_path, "target-data"))
1212

13-
mock_target_ts <- tibble::tibble(
14-
date = lubridate::as_date(character()),
15-
observation = numeric(),
16-
location = character(),
17-
as_of = lubridate::as_date(character()),
18-
target = character()
19-
)
20-
forecasttools::write_tabular_file(mock_target_ts, output_file)
21-
2213
mock_nhsn <- tibble::tibble(
2314
weekendingdate = lubridate::as_date(c(
2415
"2024-11-09",

0 commit comments

Comments
 (0)