From e90eb6e35feedacf1ae36e64603d13c740a6bb93 Mon Sep 17 00:00:00 2001 From: pdiakumis Date: Mon, 18 Sep 2023 18:10:48 +1000 Subject: [PATCH] meta: add account argument --- R/portal_meta.R | 4 ++-- inst/rmd/umccr_portal/portal_summary.Rmd | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/portal_meta.R b/R/portal_meta.R index 3bb0dbe..634dbcd 100644 --- a/R/portal_meta.R +++ b/R/portal_meta.R @@ -470,7 +470,7 @@ meta_main_cols <- function() { #' \dontrun{ #' portal_meta_read(params = "&type_name=rnasum", rows = 4) #' } -portal_meta_read <- function(pmeta = NULL, rows = 100, params = "") { +portal_meta_read <- function(pmeta = NULL, rows = 100, params = "", account = "prod") { au_tz <- "Australia/Melbourne" utc_tz <- "UTC" if (!is.null(pmeta)) { @@ -505,7 +505,7 @@ portal_meta_read <- function(pmeta = NULL, rows = 100, params = "") { } } # else pmeta is NULL, so read via portal API - base_url <- "https://api.portal.prod.umccr.org/iam" + base_url <- glue("https://api.portal.{account}.umccr.org/iam") url1 <- utils::URLencode(glue("{base_url}/workflows?rowsPerPage={rows}{params}")) awscurl_cmd <- glue( "awscurl '{url1}' ", diff --git a/inst/rmd/umccr_portal/portal_summary.Rmd b/inst/rmd/umccr_portal/portal_summary.Rmd index 42cbb96..750ff44 100644 --- a/inst/rmd/umccr_portal/portal_summary.Rmd +++ b/inst/rmd/umccr_portal/portal_summary.Rmd @@ -100,8 +100,8 @@ get_colours <- function(nc) { clrs[seq_len(nc)] } -get_sbj_url <- function(x, colour = NULL) { - sbj_url <- glue("https://portal.umccr.org/subjects/{x}/overview") +get_sbj_url <- function(x, colour = NULL, account = "") { + sbj_url <- glue("https://portal.{account}umccr.org/subjects/{x}/overview") if (!is.null(colour)) { return(glue("{x}")) } @@ -113,8 +113,8 @@ get_sbj_url <- function(x, colour = NULL) { ```{r vars} # options(width = 150) fmt1 <- "%Y-%m-%dT%H:%M:%S" -date_start <- as.POSIXct("2023-09-02T00:00:01", format = fmt1) -date_end <- as.POSIXct("2023-09-03T23:59:59", format = fmt1) +date_start <- as.POSIXct("2023-09-15T00:00:01", format = fmt1) +date_end <- as.POSIXct("2023-09-18T23:59:59", format = fmt1) wf_order <- c( "bcl_convert", "tso_ctdna_tumor_only", @@ -130,7 +130,7 @@ lims_rds <- here(glue("nogit/data_portal/lims/{as.Date(date_end)}.rds")) # saveRDS(lims_raw, file = lims_rds) lims_raw <- readr::read_rds(lims_rds) pmeta_rds <- here(glue("nogit/data_portal/workflows/{as.Date(date_end)}.rds")) -# pmeta_raw <- dracarys::portal_meta_read(rows = 65) +# pmeta_raw <- dracarys::portal_meta_read(rows = 80, account = "stg") # saveRDS(pmeta_raw, file = pmeta_rds) pmeta_raw <- readr::read_rds(pmeta_rds) pmeta <- pmeta_raw |> @@ -161,7 +161,7 @@ unique_sbj <- sort(unique(pmeta_sumy$sbjid)) clrs1 <- get_colours(length(unique_sbj)) |> purrr::set_names(unique_sbj) |> tibble::enframe(name = "sbjid", value = "color") |> - dplyr::mutate(sbj_url = get_sbj_url(.data$sbjid, colour = .data$color)) + dplyr::mutate(sbj_url = get_sbj_url(.data$sbjid, colour = .data$color, account = "stg.")) pmeta_sumy_count <- pmeta_sumy |> dplyr::count(type_name, .drop = FALSE) |> tibble::deframe()