From 23787dacae2361578b8f0d5e45400fc138d15e84 Mon Sep 17 00:00:00 2001 From: Bill Denney Date: Fri, 24 Apr 2026 01:02:31 +0000 Subject: [PATCH] data-raw: replace stamp-file download with archive-listing lookup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The NCI EVS Publication Date Stamp URLs returned HTTP 403 from GitHub Actions (IP-blocked) while being accessible from other environments. Replace fetch_current_release_date() with a simpler implementation that calls list_archive_dates() and takes the maximum date — the archive already contains a dated file for every published release, so the max archive date always equals the current release date. Also switch fetch_ct_sdtm.R and fetch_ct_adam.R to always use archive_url() for downloading terminology files, since the current release is now derived from the archive listing rather than the undated SDTM_CURRENT / ADAM_CURRENT URLs. This removes all dependency on the Publication Date Stamp files. Co-Authored-By: Claude Sonnet 4.6 --- data-raw/fetch_ct_adam.R | 2 +- data-raw/fetch_ct_sdtm.R | 2 +- data-raw/utils_nci.R | 24 +++++++++++++----------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/data-raw/fetch_ct_adam.R b/data-raw/fetch_ct_adam.R index 4920a3c..32467fd 100644 --- a/data-raw/fetch_ct_adam.R +++ b/data-raw/fetch_ct_adam.R @@ -61,7 +61,7 @@ if (length(all_dates) == 0L) { d <- as.Date(d) message(sprintf(" Processing %s...", format(d))) - url <- if (identical(d, current_date)) ADAM_CURRENT else archive_url("adam", d) + url <- archive_url("adam", d) new_release <- tryCatch( fetch_raw_ct_tbl(url, "adam", d), diff --git a/data-raw/fetch_ct_sdtm.R b/data-raw/fetch_ct_sdtm.R index d39852d..79b0237 100644 --- a/data-raw/fetch_ct_sdtm.R +++ b/data-raw/fetch_ct_sdtm.R @@ -64,7 +64,7 @@ if (length(all_dates) == 0L) { d <- as.Date(d) message(sprintf(" Processing %s...", format(d))) - url <- if (identical(d, current_date)) SDTM_CURRENT else archive_url("sdtm", d) + url <- archive_url("sdtm", d) new_release <- tryCatch( fetch_raw_ct_tbl(url, "sdtm", d), diff --git a/data-raw/utils_nci.R b/data-raw/utils_nci.R index 215015c..8a47b06 100644 --- a/data-raw/utils_nci.R +++ b/data-raw/utils_nci.R @@ -98,19 +98,21 @@ parse_nci_ct_txt <- function(local_path, release_date) { result } -# Extract the release date from the NCI Publication Date Stamp text file +# Return the most recent CT release date by inspecting the archive listing. +# Replaces the former approach of downloading the Publication Date Stamp file, +# which became unreliable from GitHub Actions (HTTP 403 via download.file). +# The archive already contains a dated file for every published release, so +# the maximum archive date equals the current release date. fetch_current_release_date <- function(type = c("sdtm", "adam")) { type <- match.arg(type) - stamp_url <- switch(type, - sdtm = paste0(NCI_BASE, "/SDTM/SDTM%20Publication%20Date%20Stamp.txt"), - adam = paste0(NCI_BASE, "/ADaM/ADaM%20Publication%20Date%20Stamp.txt") - ) - tmp <- tempfile() - on.exit(unlink(tmp)) - download.file(stamp_url, tmp, quiet = TRUE) - stamp <- readLines(tmp, warn = FALSE)[[1L]] - # Format is typically "SDTM Terminology YYYY-MM-DD" or just "YYYY-MM-DD" - as.Date(regmatches(stamp, regexpr("\\d{4}-\\d{2}-\\d{2}", stamp))) + dates <- list_archive_dates(type) + if (length(dates) == 0L) { + stop(sprintf( + "Could not determine current %s CT release date: archive listing returned no dates.", + toupper(type) + )) + } + max(dates) } # List all archived version dates for a CT type by parsing the Apache