diff --git a/DESCRIPTION b/DESCRIPTION index adc925f..bee6e82 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,6 +24,7 @@ Imports: assertthat, cli, data.table, + DBI, dplyr, emojifont, fs, @@ -41,6 +42,7 @@ Imports: purrr, R6, readr, + RAthena, RJSONIO, rlang, rmarkdown, diff --git a/NAMESPACE b/NAMESPACE index 688287c..95c343f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -60,6 +60,7 @@ export(multiqc_parse_xyline_plot) export(multiqc_parse_xyline_plot_contig_cvg) export(multiqc_tidy_json) export(portal_meta_read) +export(portal_meta_read_athena) export(rdf2tab) export(read) export(s3_files_list_filter_relevant) diff --git a/R/portal_meta.R b/R/portal_meta.R index 6d5af6d..a0aee4c 100644 --- a/R/portal_meta.R +++ b/R/portal_meta.R @@ -528,3 +528,33 @@ portal_meta_read <- function(pmeta = NULL, rows = 100, params = "", account = "p end = lubridate::with_tz(.data$end, tz = au_tz) ) } + +#' Read ICA Workflows Metadata via Athena +#' +#' Reads the ICA Workflows Metadata for the given workflow run IDs. +#' +#' @param wfrids Character vector of wfr IDs to query. +#' +#' @return Tibble with a row per wfr ID. +#' +#' @examples +#' \dontrun{ +#' wfrids <- c("wfr.1e764ca00e7a43a69e2424f250a34868") +#' portal_meta_read_athena(wfrids) +#' } +#' @export +portal_meta_read_athena <- function(wfrids = NULL) { + assertthat::assert_that(!is.null(wfrids), all(grepl("^wfr\\.", wfrids))) + RAthena::RAthena_options(clear_s3_resource = FALSE) + con <- DBI::dbConnect( + RAthena::athena(), + work_group = "data_portal", + rstudio_conn_tab = FALSE + ) + wfrids_quote <- paste(shQuote(wfrids), collapse = ", ") + q1 <- glue( + 'SELECT * FROM "data_portal"."data_portal"."data_portal_workflow" where wfr_id in ({wfrids_quote});' + ) + RAthena::dbGetQuery(con, q1) |> + tibble::as_tibble() +} diff --git a/man/portal_meta_read_athena.Rd b/man/portal_meta_read_athena.Rd new file mode 100644 index 0000000..5650f99 --- /dev/null +++ b/man/portal_meta_read_athena.Rd @@ -0,0 +1,23 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/portal_meta.R +\name{portal_meta_read_athena} +\alias{portal_meta_read_athena} +\title{Read ICA Workflows Metadata via Athena} +\usage{ +portal_meta_read_athena(wfrids = NULL) +} +\arguments{ +\item{wfrids}{Character vector of wfr IDs to query.} +} +\value{ +Tibble with a row per wfr ID. +} +\description{ +Reads the ICA Workflows Metadata for the given workflow run IDs. +} +\examples{ +\dontrun{ +wfrids <- c('wfr.1e764ca00e7a43a69e2424f250a34868') +portal_meta_read_athena(wfrids) +} +}