Skip to content

Commit

Permalink
use new text file to obtain date of analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
rpodcast committed Apr 11, 2024
1 parent c0c0d85 commit d5a5708
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
15 changes: 15 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ podcastdb_log_object <- function(root_url, date = format(Sys.time(), "%Y-%m-%d")
return(res)
}

podcastdb_timestamp_object <- function(url, dev_mode = FALSE) {
if (dev_mode) {
tmp_file <- "dev_files/job_timestamp.txt"
} else {
tmp_file <- tempfile(pattern = "job_timestamp")

download.file(
url = url,
destfile = tmp_file
)
}
res <- readLines(tmp_file)
return(res)
}

date_report <- function(log_object, tz = "UTC") {
dt <- log_object |>
filter(arg1 == "Downloading podcast database") |>
Expand Down
12 changes: 7 additions & 5 deletions index.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ params:
pointblank_object_path: "https://podcast20-projects.us-east-1.linodeobjects.com/exports/podcastdb_pointblank_object/podcastdb_pointblank_object"
podcast_dup_df_path: "https://podcast20-projects.us-east-1.linodeobjects.com/exports/podcast_dup_df.rds"
podcast_analysis_df_path: "https://podcast20-projects.us-east-1.linodeobjects.com/exports/analysis_metrics_df.rds"
podcast_timestamp_path: "https://podcast20-projects.us-east-1.linodeobjects.com/exports/job_timestamp.txt"
podcast_log_path: "https://podcast20-projects.us-east-1.linodeobjects.com/logs/"
---

Expand Down Expand Up @@ -53,12 +54,13 @@ source("R/fct_tables.R")
pointblank_object <- podcastdb_pointblank_object(url = params$pointblank_object_path, dev_mode = params$dev_mode)
podcast_dup_df <- podcastdb_dupdf_object(url = params$podcast_dup_df_path, dev_mode = params$dev_mode)
analysis_metrics_df <- podcastdb_analysisdf_object(url = params$podcast_analysis_df_path, dev_mode = params$dev_mode)
podcast_db_date <- podcastdb_timestamp_object(url = params$podcast_timestamp_path, dev_mode = params$dev_mode)
if (!params$dev_mode) {
podcast_db_date <- podcastdb_log_object(root_url = params$podcast_log_path, date = as.character(lubridate::today())) |> date_report()
} else {
podcast_db_date <- "20XX-XX-XX"
}
# if (!params$dev_mode) {
# podcast_db_date <- podcastdb_log_object(root_url = params$podcast_log_path, date = as.character(lubridate::today())) |> date_report()
# } else {
# podcast_db_date <- "20XX-XX-XX"
# }
```

Expand Down

0 comments on commit d5a5708

Please sign in to comment.