Skip to content

Commit 4d5df11

Browse files
committed
wip: backtesting current season
1 parent b992f25 commit 4d5df11

File tree

3 files changed

+290
-240
lines changed

3 files changed

+290
-240
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ aux_data
1515
.netlify
1616
reports/*.html
1717
reports/report.md
18-
cache
18+
cache/
19+
data/
20+
.vscode/

R/aux_data_utils.R

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,3 +728,26 @@ up_to_date_nssp_state_archive <- function(disease = c("covid", "influenza")) {
728728
mutate(time_value = time_value + 3) %>%
729729
as_epi_archive(compactify = TRUE)
730730
}
731+
732+
# Get the last time the signal was updated.
733+
get_covidcast_signal_last_update <- function(source, signal) {
734+
pub_covidcast_meta() %>%
735+
filter(source == !!source, signal == !!signal) %>%
736+
pull(last_update) %>%
737+
as.POSIXct()
738+
}
739+
740+
# Get the last time the Socrata dataset was updated.
741+
get_socrata_updated_at <- function(dataset_url) {
742+
httr::GET(dataset_url) %>%
743+
httr::content() %>%
744+
pluck("rowsUpdatedAt") %>%
745+
as.POSIXct()
746+
}
747+
748+
get_s3_object_last_modified <- function(bucket, key) {
749+
# Format looks like "Fri, 31 Jan 2025 22:01:16 GMT"
750+
attr(aws.s3::head_object(key, bucket = bucket), "last-modified") %>%
751+
str_replace_all(" GMT", "") %>%
752+
as.POSIXct(format = "%a, %d %b %Y %H:%M:%S")
753+
}

0 commit comments

Comments
 (0)