diff --git a/.Rbuildignore b/.Rbuildignore index 95e6b03b..d752d52f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -4,3 +4,5 @@ ^.venv ^schematic$ ^\.github$ +^.*\.Rproj$ +^\.Rproj\.user$ diff --git a/.Rprofile b/.Rprofile index 974262f3..f99102e0 100644 --- a/.Rprofile +++ b/.Rprofile @@ -2,8 +2,8 @@ source("renv/activate.R") .First <- function() { options( repos = c( - CRAN = "https://cran.rstudio.com/", - Sage = "http://ran.synapse.org" + binaries = "https://packagemanager.posit.co/cran/__linux__/noble/latest", + CRAN = "https://cran.rstudio.com/" ), sass.cache = FALSE, # turn of styling caching stringsAsFactors = FALSE # no needed if R >= 4.0.0 diff --git a/Dockerfile b/Dockerfile index d025a7bd..e5190530 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/afwillia/shiny-base:release-1.12 +FROM ghcr.io/afwillia/shiny-base:release-1.13 # add version tag as a build argument ARG DCA_VERSION @@ -7,7 +7,7 @@ ENV DCA_VERSION=$DCA_VERSION USER root RUN apt-get update -RUN apt-get install -y libxml2 libglpk-dev libicu-dev libicu70 curl +RUN apt-get install -y libxml2 libglpk-dev libicu-dev curl # overwrite the default config with our modified copy COPY shiny-server.conf /etc/shiny-server/shiny-server.conf @@ -20,6 +20,6 @@ COPY --chown=shiny ./ ./ # set up r packages via renv. Use binary lib matching the shiny-base ubuntu version # to speed up installatioon. -RUN Rscript -e 'renv::restore(repos="https://packagemanager.rstudio.com/all/__linux__/jammy/latest"); renv::install("./")' +RUN Rscript -e 'renv::restore(repos="https://packagemanager.posit.co/cran/__linux__/noble/latest"); renv::install("./")' CMD ["./dca_startup.sh"] diff --git a/R/schematic_rest_api.R b/R/schematic_rest_api.R index 6c108cd2..4678d6dd 100644 --- a/R/schematic_rest_api.R +++ b/R/schematic_rest_api.R @@ -15,15 +15,23 @@ check_success <- function(x){ } } +#' Download a manifest #' @description Download an existing manifest #' @param url URI of API endpoint #' @param access_token Synapse PAT #' @param asset_view ID of view listing all project data assets #' @param manifest_id the parent ID of the manifest #' @param as_json if True return the manifest in JSON format +#' @param new_manifest_name Name of new manifest (Default = NULL) #' @returns a csv of the manifest #' @export -manifest_download <- function(url = "http://localhost:3001/v1/manifest/download", access_token, manifest_id, as_json=TRUE, new_manifest_name=NULL) { + +manifest_download <- function( + url = "http://localhost:3001/v1/manifest/download", + access_token, + manifest_id, + as_json = TRUE, + new_manifest_name = NULL) { req <- httr2::request(url) |> httr2::req_retry( @@ -45,26 +53,35 @@ manifest_download <- function(url = "http://localhost:3001/v1/manifest/download" } #' schematic rest api to generate manifest -#' +#' @param url schematic endpoint url +#' @param schema_url url of jsonld schema #' @param title Name of dataset #' @param data_type Type of dataset -#' @param oauth true or false STRING passed to python -#' @param use_annotations true or false STRING passed to python +#' @param use_annotations true or false #' @param dataset_id Synapse ID of existing manifest +#' @param asset_view Synapse ID of asset view +#' @param output_format Desired format of generated manifest (excel, google_sheet) +#' @param access_token Synapse PAT +#' @param strict_validation If using Google Sheets, can set the strictness of Google Sheets regex match validation. True (default) will block users from entering incorrect values, False will throw a warning to users. +#' @param data_model_labels Which labels to use (class_label, display_label) #' #' @returns a URL to a google sheet #' @export -manifest_generate <- function(url="http://localhost:3001/v1/manifest/generate", +manifest_generate <- function(url = "http://localhost:3001/v1/manifest/generate", schema_url, title, data_type, - use_annotations="false", - dataset_id=NULL, + use_annotations = "false", + dataset_id = NULL, asset_view, - output_format, + output_format = c("google_sheet", "excel"), access_token = NULL, strict_validation = FALSE, - data_model_labels = "class_label") { + data_model_labels = c("class_label", "display_label")) { + + # do not accept dataframe as input, it's not supported at this time + match.arg(output_format) + match.arg(data_model_labels) req <- httr::GET(url, httr::add_headers(Authorization = sprintf("Bearer %s", access_token)), @@ -91,8 +108,11 @@ manifest_generate <- function(url="http://localhost:3001/v1/manifest/generate", #' @param schema_url URL to a schema jsonld #' @param data_type Type of dataset #' @param title Title of csv +#' @param return_excel Return Excel? TRUE/FALSE +#' @param data_model_labels Which labels to use (class_label, display_label) #' @param csv_file Filepath of csv to validate #' @export + manifest_populate <- function(url="http://localhost:3001/v1/manifest/populate", schema_url, data_type, @@ -122,9 +142,15 @@ manifest_populate <- function(url="http://localhost:3001/v1/manifest/populate", #' @param schema_url URL to a schema jsonld #' @param data_type Type of dataset #' @param file_name Filepath of csv to validate -#' +#' @param restrict_rules If True, validation suite will only run with in-house validation rule. If False, the Great Expectations suite will be utilized and all rules will be available. +#' @param project_scope List, a subset of the projects contained within the asset view that are relevant for the current operation. Speeds up some operations that interact with Synapse. Relevant for validating manifests involving cross-manifest validation, but optional. +#' @param access_token Synapse PAT +#' @param asset_view SynID of asset view +#' @param json_str JSON string to validate +#' @param data_model_labels Which labels to use (class_label, display_label) #' @returns An empty list() if sucessfully validated. Or a list of errors. #' @export + manifest_validate <- function(url="http://localhost:3001/v1/model/validate", schema_url, data_type, @@ -294,9 +320,11 @@ model_submit <- function(url="http://localhost:3001/v1/model/submit", #' Given a source model component (see https://w3id.org/biolink/vocab/category for definnition of component), return all components required by it. #' +#' @param url URL to schematic API endpoint #' @param schema_url Data Model URL #' @param source_component an attribute label indicating the source component. (i.e. Patient, Biospecimen, ScRNA-seqLevel1, ScRNA-seqLevel2) #' @param as_graph if False return component requirements as a list; if True return component requirements as a dependency graph (i.e. a DAG) +#' @param data_model_labels Which labels to use (class_label, display_label) #' #' @returns A list of required components associated with the source component. #' @export @@ -335,9 +363,8 @@ model_component_requirements <- function(url="http://localhost:3001/v1/model/com #' Gets all datasets in folder under a given storage project that the current user has access to. #' #' @param url URL to schematic API endpoint -#' @param syn_master_file_view synapse ID of master file view. -#' @param syn_master_file_name Synapse storage manifest file name. -#' @param project_id synapse ID of a storage project. +#' @param asset_view synapse ID of master file view. +#' @param project_id Synapse storage manifest file name. #' @param access_token synapse PAT #' #'@export @@ -360,9 +387,8 @@ storage_project_datasets <- function(url="http://localhost:3001/v1/storage/proje #' Get all storage projects the current user has access to #' #' @param url URL to schematic API endpoint -#' @param syn_master_file_view synapse ID of master file view. -#' @param syn_master_file_name Synapse storage manifest file name. -#' @param access_token synapse PAT +#' @param asset_view synapse ID of master file view. +#' @param access_token Synapse storage manifest file name. #' #' @export storage_projects <- function(url="http://localhost:3001/v1/storage/projects", @@ -382,8 +408,7 @@ storage_projects <- function(url="http://localhost:3001/v1/storage/projects", #' /storage/dataset/files #' #' @param url URL to schematic API endpoint -#' @param syn_master_file_view synapse ID of master file view. -#' @param syn_master_file_name Synapse storage manifest file name. +#' @param asset_view synapse ID of master file view. #' @param dataset_id synapse ID of a storage dataset. #' @param file_names a list of files with particular names (i.e. Sample_A.txt). If you leave it empty, it will return all dataset files under the dataset ID. #' @param full_path Boolean. If True return the full path as part of this filename; otherwise return just base filename @@ -407,11 +432,12 @@ storage_dataset_files <- function(url="http://localhost:3001/v1/storage/dataset/ } -#' /storage/asset/table +#' /storage/asset/table endpoint #' #' @param url URL to schematic API endpoint #' @param access_token synapse PAT #' @param asset_view Synapse ID of asset view +#' @param return_type Output format (json, csv) #' @export get_asset_view_table <- function(url="http://localhost:3001/v1/storage/assets/tables", access_token, asset_view, return_type="json") { @@ -432,9 +458,11 @@ get_asset_view_table <- function(url="http://localhost:3001/v1/storage/assets/ta } +#' graph by edge type endpoint #' @param url URL of schematic API endpoint #' @param schema_url URL of data model #' @param relationship Argument to schematic graph_by_edge_type +#' @param data_model_labels Which labels to use (class_label, display_label) #' @export #' @importFrom httr GET content graph_by_edge_type <- function(url = "https://schematic-dev.api.sagebionetworks.org/v1/schemas/get/graph_by_edge_type", diff --git a/Shiny_App.Rproj b/Shiny_App.Rproj index 8e3c2ebc..21a4da08 100644 --- a/Shiny_App.Rproj +++ b/Shiny_App.Rproj @@ -11,3 +11,7 @@ Encoding: UTF-8 RnwWeave: Sweave LaTeX: pdfLaTeX + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source diff --git a/global.R b/global.R index 62fa4e01..c7368d96 100644 --- a/global.R +++ b/global.R @@ -18,6 +18,7 @@ suppressPackageStartupMessages({ library(shinydashboardPlus) library(promises) library(future) + library(httr2) # dashboard library(purrr) library(data.table) diff --git a/man/format_validation_response.Rd b/man/format_validation_response.Rd new file mode 100644 index 00000000..8d0ceea0 --- /dev/null +++ b/man/format_validation_response.Rd @@ -0,0 +1,16 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{format_validation_response} +\alias{format_validation_response} +\title{Truncate the results of schematic validation} +\usage{ +format_validation_response(x, n = 50) +} +\arguments{ +\item{x}{Schematic validation result} + +\item{n}{Number of records to keep} +} +\description{ +Truncate the results of schematic validation +} diff --git a/man/get_asset_view_table.Rd b/man/get_asset_view_table.Rd index a2bf1037..c6f60016 100644 --- a/man/get_asset_view_table.Rd +++ b/man/get_asset_view_table.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/schematic_rest_api.R \name{get_asset_view_table} \alias{get_asset_view_table} -\title{/storage/asset/table} +\title{/storage/asset/table endpoint} \usage{ get_asset_view_table( url = "http://localhost:3001/v1/storage/assets/tables", @@ -17,7 +17,9 @@ get_asset_view_table( \item{access_token}{synapse PAT} \item{asset_view}{Synapse ID of asset view} + +\item{return_type}{Output format (json, csv)} } \description{ -/storage/asset/table +/storage/asset/table endpoint } diff --git a/man/graph_by_edge_type.Rd b/man/graph_by_edge_type.Rd new file mode 100644 index 00000000..64dfe21a --- /dev/null +++ b/man/graph_by_edge_type.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/schematic_rest_api.R +\name{graph_by_edge_type} +\alias{graph_by_edge_type} +\title{graph by edge type endpoint} +\usage{ +graph_by_edge_type( + url = "https://schematic-dev.api.sagebionetworks.org/v1/schemas/get/graph_by_edge_type", + schema_url, + relationship = "requiresDependency", + data_model_labels = "class_label" +) +} +\arguments{ +\item{url}{URL of schematic API endpoint} + +\item{schema_url}{URL of data model} + +\item{relationship}{Argument to schematic graph_by_edge_type} + +\item{data_model_labels}{Which labels to use (class_label, display_label)} +} +\description{ +graph by edge type endpoint +} diff --git a/man/manifest_download.Rd b/man/manifest_download.Rd new file mode 100644 index 00000000..9a319cff --- /dev/null +++ b/man/manifest_download.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/schematic_rest_api.R +\name{manifest_download} +\alias{manifest_download} +\title{Download a manifest} +\usage{ +manifest_download( + url = "http://localhost:3001/v1/manifest/download", + access_token, + manifest_id, + as_json = TRUE, + new_manifest_name = NULL +) +} +\arguments{ +\item{url}{URI of API endpoint} + +\item{access_token}{Synapse PAT} + +\item{manifest_id}{the parent ID of the manifest} + +\item{as_json}{if True return the manifest in JSON format} + +\item{new_manifest_name}{Name of new manifest (Default = NULL)} + +\item{asset_view}{ID of view listing all project data assets} +} +\value{ +a csv of the manifest +} +\description{ +Download an existing manifest +} diff --git a/man/manifest_generate.Rd b/man/manifest_generate.Rd index ba9d0099..6c6bc075 100644 --- a/man/manifest_generate.Rd +++ b/man/manifest_generate.Rd @@ -12,22 +12,34 @@ manifest_generate( use_annotations = "false", dataset_id = NULL, asset_view, - output_format, + output_format = c("google_sheet", "excel"), access_token = NULL, strict_validation = FALSE, - data_model_labels = "class_label" + data_model_labels = c("class_label", "display_label") ) } \arguments{ +\item{url}{schematic endpoint url} + +\item{schema_url}{url of jsonld schema} + \item{title}{Name of dataset} \item{data_type}{Type of dataset} -\item{use_annotations}{true or false STRING passed to python} +\item{use_annotations}{true or false} \item{dataset_id}{Synapse ID of existing manifest} -\item{oauth}{true or false STRING passed to python} +\item{asset_view}{Synapse ID of asset view} + +\item{output_format}{Desired format of generated manifest (excel, google_sheet)} + +\item{access_token}{Synapse PAT} + +\item{strict_validation}{If using Google Sheets, can set the strictness of Google Sheets regex match validation. True (default) will block users from entering incorrect values, False will throw a warning to users.} + +\item{data_model_labels}{Which labels to use (class_label, display_label)} } \value{ a URL to a google sheet diff --git a/man/manifest_populate.Rd b/man/manifest_populate.Rd index 2259feb1..515714bf 100644 --- a/man/manifest_populate.Rd +++ b/man/manifest_populate.Rd @@ -23,6 +23,10 @@ manifest_populate( \item{title}{Title of csv} +\item{return_excel}{Return Excel? TRUE/FALSE} + +\item{data_model_labels}{Which labels to use (class_label, display_label)} + \item{csv_file}{Filepath of csv to validate} } \description{ diff --git a/man/manifest_validate.Rd b/man/manifest_validate.Rd index bef15d38..a1aa8c2b 100644 --- a/man/manifest_validate.Rd +++ b/man/manifest_validate.Rd @@ -13,6 +13,7 @@ manifest_validate( project_scope = NULL, access_token, asset_view = NULL, + json_str = NULL, data_model_labels = "class_label" ) } @@ -24,6 +25,18 @@ manifest_validate( \item{data_type}{Type of dataset} \item{file_name}{Filepath of csv to validate} + +\item{restrict_rules}{If True, validation suite will only run with in-house validation rule. If False, the Great Expectations suite will be utilized and all rules will be available.} + +\item{project_scope}{List, a subset of the projects contained within the asset view that are relevant for the current operation. Speeds up some operations that interact with Synapse. Relevant for validating manifests involving cross-manifest validation, but optional.} + +\item{access_token}{Synapse PAT} + +\item{asset_view}{SynID of asset view} + +\item{json_str}{JSON string to validate} + +\item{data_model_labels}{Which labels to use (class_label, display_label)} } \value{ An empty list() if sucessfully validated. Or a list of errors. diff --git a/man/model_component_requirements.Rd b/man/model_component_requirements.Rd index 7b80b159..6a7f5e0f 100644 --- a/man/model_component_requirements.Rd +++ b/man/model_component_requirements.Rd @@ -13,11 +13,15 @@ model_component_requirements( ) } \arguments{ +\item{url}{URL to schematic API endpoint} + \item{schema_url}{Data Model URL} \item{source_component}{an attribute label indicating the source component. (i.e. Patient, Biospecimen, ScRNA-seqLevel1, ScRNA-seqLevel2)} \item{as_graph}{if False return component requirements as a list; if True return component requirements as a dependency graph (i.e. a DAG)} + +\item{data_model_labels}{Which labels to use (class_label, display_label)} } \value{ A list of required components associated with the source component. diff --git a/man/storage_dataset_files.Rd b/man/storage_dataset_files.Rd index 6037a77d..cc621af4 100644 --- a/man/storage_dataset_files.Rd +++ b/man/storage_dataset_files.Rd @@ -16,6 +16,8 @@ storage_dataset_files( \arguments{ \item{url}{URL to schematic API endpoint} +\item{asset_view}{synapse ID of master file view.} + \item{dataset_id}{synapse ID of a storage dataset.} \item{file_names}{a list of files with particular names (i.e. Sample_A.txt). If you leave it empty, it will return all dataset files under the dataset ID.} @@ -23,10 +25,6 @@ storage_dataset_files( \item{full_path}{Boolean. If True return the full path as part of this filename; otherwise return just base filename} \item{access_token}{synapse PAT} - -\item{syn_master_file_view}{synapse ID of master file view.} - -\item{syn_master_file_name}{Synapse storage manifest file name.} } \description{ /storage/dataset/files diff --git a/man/storage_project_datasets.Rd b/man/storage_project_datasets.Rd index efc7427a..b1c406e4 100644 --- a/man/storage_project_datasets.Rd +++ b/man/storage_project_datasets.Rd @@ -14,13 +14,11 @@ storage_project_datasets( \arguments{ \item{url}{URL to schematic API endpoint} -\item{project_id}{synapse ID of a storage project.} +\item{asset_view}{synapse ID of master file view.} -\item{access_token}{synapse PAT} - -\item{syn_master_file_view}{synapse ID of master file view.} +\item{project_id}{Synapse storage manifest file name.} -\item{syn_master_file_name}{Synapse storage manifest file name.} +\item{access_token}{synapse PAT} } \description{ Gets all datasets in folder under a given storage project that the current user has access to. diff --git a/man/storage_projects.Rd b/man/storage_projects.Rd index c52dc300..48e6caf4 100644 --- a/man/storage_projects.Rd +++ b/man/storage_projects.Rd @@ -13,11 +13,9 @@ storage_projects( \arguments{ \item{url}{URL to schematic API endpoint} -\item{access_token}{synapse PAT} +\item{asset_view}{synapse ID of master file view.} -\item{syn_master_file_view}{synapse ID of master file view.} - -\item{syn_master_file_name}{Synapse storage manifest file name.} +\item{access_token}{Synapse storage manifest file name.} } \description{ Get all storage projects the current user has access to diff --git a/renv.lock b/renv.lock index 0ea6f44b..e4739b7b 100644 --- a/renv.lock +++ b/renv.lock @@ -1,45 +1,65 @@ { "R": { - "Version": "4.1.3", + "Version": "4.4.1", "Repositories": [ { "Name": "CRAN", "URL": "https://cran.rstudio.com" }, { - "Name": "Sage", - "URL": "http://ran.synapse.org" - }, - { - "Name": "Rstudio-binaries", - "URL": "https://packagemanager.rstudio.com/all/__linux__/focal/latest" + "Name": "binaries", + "URL": "https://packagemanager.posit.co/cran/__linux__/noble/latest" } ] }, "Packages": { + "AsioHeaders": { + "Package": "AsioHeaders", + "Version": "1.22.1-2", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "85bf3bd8fa58da21a22d84fd4f4ef0a8" + }, "DT": { "Package": "DT", - "Version": "0.27", + "Version": "0.33", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "crosstalk", "htmltools", "htmlwidgets", + "httpuv", "jquerylib", "jsonlite", "magrittr", "promises" ], - "Hash": "3444e6ed78763f9f13aaa39f2481eb34" + "Hash": "64ff3427f559ce3f2597a4fe13255cb6" + }, + "MASS": { + "Package": "MASS", + "Version": "7.3-61", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "grDevices", + "graphics", + "methods", + "stats", + "utils" + ], + "Hash": "0cafd6f0500e5deba33be22c46bf6055" }, "Matrix": { "Package": "Matrix", - "Version": "1.5-3", + "Version": "1.7-1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", + "grDevices", "graphics", "grid", "lattice", @@ -47,7 +67,7 @@ "stats", "utils" ], - "Hash": "4006dffe49958d2dd591c17e61e60591" + "Hash": "5122bb14d8736372411f955e1b16bc8a" }, "R6": { "Package": "R6", @@ -59,16 +79,26 @@ ], "Hash": "470851b6d5d0ac559e9d01bb352b4021" }, + "RColorBrewer": { + "Package": "RColorBrewer", + "Version": "1.1-3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "45f0398006e83a5b10b72a90663d8d8c" + }, "Rcpp": { "Package": "Rcpp", - "Version": "1.0.10", + "Version": "1.0.13", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "methods", "utils" ], - "Hash": "e749cae40fa9ef469b6050959517453c" + "Hash": "f27411eb6d9c3dada5edd444b8416675" }, "RcppTOML": { "Package": "RcppTOML", @@ -83,13 +113,13 @@ }, "askpass": { "Package": "askpass", - "Version": "1.1", + "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "sys" ], - "Hash": "e8a22846fff485f0be3770c2da758713" + "Hash": "c39f4155b3ceb1a9a2799d700fbd4b6a" }, "base64enc": { "Package": "base64enc", @@ -103,17 +133,17 @@ }, "bit": { "Package": "bit", - "Version": "4.0.5", + "Version": "4.5.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "d242abec29412ce988848d0294b208fd" + "Hash": "5dc7b2677d65d0e874fc4aaf0e879987" }, "bit64": { "Package": "bit64", - "Version": "4.0.5", + "Version": "4.5.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -123,49 +153,54 @@ "stats", "utils" ], - "Hash": "9fe98599ca456d6552421db0d6772d8f" + "Hash": "e84984bf5f12a18628d9a02322128dfd" }, "brio": { "Package": "brio", - "Version": "1.1.3", + "Version": "1.1.5", "Source": "Repository", "Repository": "CRAN", - "Hash": "976cf154dfb043c012d87cddd8bca363" + "Requirements": [ + "R" + ], + "Hash": "c1ee497a6d999947c2c224ae46799b1a" }, "bslib": { "Package": "bslib", - "Version": "0.4.2", + "Version": "0.8.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "base64enc", "cachem", + "fastmap", "grDevices", "htmltools", "jquerylib", "jsonlite", + "lifecycle", "memoise", "mime", "rlang", "sass" ], - "Hash": "a7fbf03946ad741129dc81098722fca1" + "Hash": "b299c6741ca9746fb227debcb0f9fb6c" }, "cachem": { "Package": "cachem", - "Version": "1.0.7", + "Version": "1.1.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "fastmap", "rlang" ], - "Hash": "cda74447c42f529de601fe4d4050daef" + "Hash": "cd9a672193789068eb5a2aad65a0dedf" }, "callr": { "Package": "callr", - "Version": "3.7.3", + "Version": "3.7.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -174,18 +209,18 @@ "processx", "utils" ], - "Hash": "9b2191ede20fa29828139b9900922e51" + "Hash": "d7e13f49c19103ece9e58ad2d83a7354" }, "cli": { "Package": "cli", - "Version": "3.6.0", + "Version": "3.6.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "3177a5a16c243adc199ba33117bd9657" + "Hash": "b21916dd77a27642b447374a5d30ecf3" }, "clipr": { "Package": "clipr", @@ -197,43 +232,50 @@ ], "Hash": "3f038e5ac7f41d4ac41ce658c85e3042" }, - "commonmark": { - "Package": "commonmark", - "Version": "1.8.1", + "codetools": { + "Package": "codetools", + "Version": "0.2-20", "Source": "Repository", "Repository": "CRAN", - "Hash": "b6e3e947d1d7ebf3d2bdcea1bde63fe7" + "Requirements": [ + "R" + ], + "Hash": "61e097f35917d342622f21cdc79c256e" }, - "covr": { - "Package": "covr", - "Version": "3.6.1", + "colorspace": { + "Package": "colorspace", + "Version": "2.1-1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", - "crayon", - "digest", - "httr", - "jsonlite", + "grDevices", + "graphics", "methods", - "rex", - "stats", - "utils", - "withr", - "yaml" + "stats" ], - "Hash": "a861cee34fbb4b107a73dd414ef56724" + "Hash": "d954cb1c57e8d8b756165d7ba18aa55a" + }, + "commonmark": { + "Package": "commonmark", + "Version": "1.9.2", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "14eb0596f987c71535d07c3aff814742" }, "cpp11": { "Package": "cpp11", - "Version": "0.4.3", + "Version": "0.5.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "ed588261931ee3be2c700d22e94a29ab" + "Requirements": [ + "R" + ], + "Hash": "91570bba75d0c9d3f1040c835cee8fba" }, "crayon": { "Package": "crayon", - "Version": "1.5.2", + "Version": "1.5.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -241,11 +283,11 @@ "methods", "utils" ], - "Hash": "e8a1e41acf02548751f45c718d55aa6a" + "Hash": "859d96e65ef198fd43e82b9628d593ef" }, "crosstalk": { "Package": "crosstalk", - "Version": "1.2.0", + "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -254,32 +296,32 @@ "jsonlite", "lazyeval" ], - "Hash": "6aa54f69598c32177e920eb3402e8293" + "Hash": "ab12c7b080a57475248a30f4db6298c0" }, "curl": { "Package": "curl", - "Version": "5.0.0", + "Version": "5.2.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "e4f97056611e8e6b8b852d13b7400cf1" + "Hash": "d91263322a58af798f6cf3b13fd56dde" }, "data.table": { "Package": "data.table", - "Version": "1.14.8", + "Version": "1.16.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "b4c06e554f33344e044ccd7fdca750a9" + "Hash": "2e00b378fc3be69c865120d9f313039a" }, "data.tree": { "Package": "data.tree", - "Version": "1.0.0", + "Version": "1.1.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -288,21 +330,20 @@ "methods", "stringi" ], - "Hash": "c0ddced80c3f074cb39a7a781698f68a" + "Hash": "d7602f0f55e0335b83f2353337848d6f" }, "desc": { "Package": "desc", - "Version": "1.4.2", + "Version": "1.4.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "R6", "cli", - "rprojroot", "utils" ], - "Hash": "6b9602c7ebbe87101a9c8edb6e8b6d21" + "Hash": "99b79fcbd6c4d1ce087f5c5c758b384f" }, "diffobj": { "Package": "diffobj", @@ -321,18 +362,18 @@ }, "digest": { "Package": "digest", - "Version": "0.6.31", + "Version": "0.6.37", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "8b708f296afd9ae69f450f9640be8990" + "Hash": "33698c4b3127fc9f506654607fb73676" }, "dplyr": { "Package": "dplyr", - "Version": "1.1.0", + "Version": "1.1.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -351,33 +392,21 @@ "utils", "vctrs" ], - "Hash": "d3c34618017e7ae252d46d79a1b9ec32" - }, - "ellipsis": { - "Package": "ellipsis", - "Version": "0.3.2", - "Source": "Repository", - "Repository": "CRAN", - "Requirements": [ - "R", - "rlang" - ], - "Hash": "bb0eec2fe32e88d9e2836c2f73ea2077" + "Hash": "fedd9d00c2944ff00a0e2696ccf048ec" }, "evaluate": { "Package": "evaluate", - "Version": "0.20", + "Version": "1.0.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ - "R", - "methods" + "R" ], - "Hash": "4b68aa51edd89a0e044a66e75ae3cc6c" + "Hash": "3fd29944b231036ad67c3edb32e02201" }, "fansi": { "Package": "fansi", - "Version": "1.0.4", + "Version": "1.0.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -385,18 +414,25 @@ "grDevices", "utils" ], - "Hash": "1d9e7ad3c8312a192dea7d3db0274fde" + "Hash": "962174cf2aeb5b9eea581522286a911f" + }, + "farver": { + "Package": "farver", + "Version": "2.1.2", + "Source": "Repository", + "Repository": "CRAN", + "Hash": "680887028577f3fa2a81e410ed0d6e42" }, "fastmap": { "Package": "fastmap", - "Version": "1.1.1", + "Version": "1.2.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "f7736a18de97dea803bde0a2daaafb27" + "Hash": "aa5e1cd11c2d15497494c5292d7ffcc8" }, "fontawesome": { "Package": "fontawesome", - "Version": "0.5.0", + "Version": "0.5.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -404,36 +440,47 @@ "htmltools", "rlang" ], - "Hash": "e80750aec5717dedc019ad7ee40e4a7c" + "Hash": "c2efdd5f0bcd1ea861c2d4e2a883a67d" }, "fresh": { "Package": "fresh", - "Version": "0.2.0", + "Version": "0.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ + "bslib", "htmltools", "rstudioapi", "sass", "shiny" ], - "Hash": "fa54367040deb4537da49b7ac0ee5770" + "Hash": "7bdb5c90d4fe3cb14dcefbe837ce01da" }, "fs": { "Package": "fs", - "Version": "1.6.1", + "Version": "1.6.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "f4dcd23b67e33d851d2079f703e8b985" + "Hash": "15aeb8c27f5ea5161f9f6a641fafd93a" }, "future": { "Package": "future", - "Version": "1.32.0", - "Source": "Repository" + "Version": "1.34.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "digest", + "globals", + "listenv", + "parallel", + "parallelly", + "utils" + ], + "Hash": "475771e3edb711591476be387c9a8c2e" }, "generics": { "Package": "generics", @@ -446,16 +493,68 @@ ], "Hash": "15e9634c0fcd294799e9b2e929ed1b86" }, + "ggplot2": { + "Package": "ggplot2", + "Version": "3.5.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "MASS", + "R", + "cli", + "glue", + "grDevices", + "grid", + "gtable", + "isoband", + "lifecycle", + "mgcv", + "rlang", + "scales", + "stats", + "tibble", + "vctrs", + "withr" + ], + "Hash": "44c6a2f8202d5b7e878ea274b1092426" + }, + "globals": { + "Package": "globals", + "Version": "0.16.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "codetools" + ], + "Hash": "2580567908cafd4f187c1e5a91e98b7f" + }, "glue": { "Package": "glue", - "Version": "1.6.2", + "Version": "1.8.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "methods" ], - "Hash": "4f2596dfb05dac67b9dc558e5c6fba2e" + "Hash": "5899f1eaa825580172bb56c08266f37c" + }, + "gtable": { + "Package": "gtable", + "Version": "0.3.6", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cli", + "glue", + "grid", + "lifecycle", + "rlang", + "stats" + ], + "Hash": "de949855009e2d4d0e52a844e30617ae" }, "here": { "Package": "here", @@ -469,50 +568,48 @@ }, "highr": { "Package": "highr", - "Version": "0.10", + "Version": "0.11", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "xfun" ], - "Hash": "06230136b2d2b9ba5805e1963fa6e890" + "Hash": "d65ba49117ca223614f71b60d85b8ab7" }, "hms": { "Package": "hms", - "Version": "1.1.2", + "Version": "1.1.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ - "ellipsis", "lifecycle", "methods", "pkgconfig", "rlang", "vctrs" ], - "Hash": "41100392191e1244b887878b533eea91" + "Hash": "b59377caa7ed00fa41808342002138f9" }, "htmltools": { "Package": "htmltools", - "Version": "0.5.4", + "Version": "0.5.8.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "base64enc", "digest", - "ellipsis", "fastmap", "grDevices", "rlang", "utils" ], - "Hash": "9d27e99cc90bd701c0a7a63e5923f9b7" + "Hash": "81d371a9cc60640e74e4ab6ac46dcedc" }, "htmlwidgets": { "Package": "htmlwidgets", - "Version": "1.6.1", + "Version": "1.6.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -523,11 +620,11 @@ "rmarkdown", "yaml" ], - "Hash": "b677ee5954471eaa974c0d099a343a1a" + "Hash": "04291cc45198225444a397606810ac37" }, "httpuv": { "Package": "httpuv", - "Version": "1.6.9", + "Version": "1.6.15", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -538,11 +635,11 @@ "promises", "utils" ], - "Hash": "1046aa31a57eae8b357267a56a0b6d8b" + "Hash": "d55aa087c47a63ead0f6fc10f8fa1ee0" }, "httr": { "Package": "httr", - "Version": "1.4.5", + "Version": "1.4.7", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -553,30 +650,62 @@ "mime", "openssl" ], - "Hash": "f6844033201269bec3ca0097bc6c97b3" + "Hash": "ac107251d9d9fd72f0ca8049988f1d7f" }, "httr2": { "Package": "httr2", - "Version": "1.0.0", - "Source": "Repository" + "Version": "1.0.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "curl", + "glue", + "lifecycle", + "magrittr", + "openssl", + "rappdirs", + "rlang", + "vctrs", + "withr" + ], + "Hash": "d84e4c33206aaace37714901ac2b00c3" }, "igraph": { "Package": "igraph", - "Version": "1.4.1", + "Version": "2.1.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "Matrix", + "R", + "cli", + "cpp11", "grDevices", "graphics", + "lifecycle", "magrittr", "methods", "pkgconfig", "rlang", "stats", + "utils", + "vctrs" + ], + "Hash": "c03878b48737a0e2da3b772d7b2e22da" + }, + "isoband": { + "Package": "isoband", + "Version": "0.2.7", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "grid", "utils" ], - "Hash": "a7ef0d811cb66d8be9da0d7b5ab80ded" + "Hash": "0080607b4a1a7b28979aecef976d8bc2" }, "jquerylib": { "Package": "jquerylib", @@ -590,17 +719,17 @@ }, "jsonlite": { "Package": "jsonlite", - "Version": "1.8.4", + "Version": "1.8.9", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "methods" ], - "Hash": "a4269a09a9b865579b2635c77e572374" + "Hash": "4e993b65c2c3ffbffce7bb3e2c6f832b" }, "knitr": { "Package": "knitr", - "Version": "1.42", + "Version": "1.48", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -612,22 +741,33 @@ "xfun", "yaml" ], - "Hash": "8329a9bcc82943c8069104d4be3ee22d" + "Hash": "acf380f300c721da9fde7df115a5f86f" + }, + "labeling": { + "Package": "labeling", + "Version": "0.4.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "graphics", + "stats" + ], + "Hash": "b64ec208ac5bc1852b285f665d6368b3" }, "later": { "Package": "later", - "Version": "1.3.0", + "Version": "1.3.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "Rcpp", "rlang" ], - "Hash": "7e7b457d7766bc47f2a5f21cc2984f8e" + "Hash": "a3e051d405326b8b0012377434c62b37" }, "lattice": { "Package": "lattice", - "Version": "0.20-45", + "Version": "0.22-6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -638,7 +778,7 @@ "stats", "utils" ], - "Hash": "b64cdbb2b340437c4ee047a1f4c4377b" + "Hash": "cc5ac1ba4c238c7ca9fa6a87ca11a7e2" }, "lazyeval": { "Package": "lazyeval", @@ -652,7 +792,7 @@ }, "lifecycle": { "Package": "lifecycle", - "Version": "1.0.3", + "Version": "1.0.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -661,7 +801,17 @@ "glue", "rlang" ], - "Hash": "001cecbeac1cff9301bdc3775ee46a86" + "Hash": "b8552d117e1b808b09a832f589b79035" + }, + "listenv": { + "Package": "listenv", + "Version": "0.9.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "e2fca3e12e4db979dccc6e519b10a7ee" }, "magrittr": { "Package": "magrittr", @@ -684,6 +834,23 @@ ], "Hash": "e2817ccf4a065c5d9d7f2cfbe7c1d78c" }, + "mgcv": { + "Package": "mgcv", + "Version": "1.9-1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "Matrix", + "R", + "graphics", + "methods", + "nlme", + "splines", + "stats", + "utils" + ], + "Hash": "110ee9d83b496279960e162ac97764ce" + }, "mime": { "Package": "mime", "Version": "0.12", @@ -694,6 +861,17 @@ ], "Hash": "18e9c28c1d3ca1560ce30658b22ce104" }, + "munsell": { + "Package": "munsell", + "Version": "0.5.1", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "colorspace", + "methods" + ], + "Hash": "4fd8900853b746af55b81fda99da7695" + }, "networkD3": { "Package": "networkD3", "Version": "0.4", @@ -707,14 +885,45 @@ ], "Hash": "38310ec4ddb1398359abdd603c151067" }, + "nlme": { + "Package": "nlme", + "Version": "3.1-166", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "graphics", + "lattice", + "stats", + "utils" + ], + "Hash": "ccbb8846be320b627e6aa2b4616a2ded" + }, "openssl": { "Package": "openssl", - "Version": "2.1.1", - "Source": "Repository" + "Version": "2.2.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "askpass" + ], + "Hash": "d413e0fef796c9401a4419485f709ca1" + }, + "parallelly": { + "Package": "parallelly", + "Version": "1.38.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "parallel", + "tools", + "utils" + ], + "Hash": "6e8b139c1904f5e9e14c69db64453bbe" }, "pillar": { "Package": "pillar", - "Version": "1.8.1", + "Version": "1.9.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -727,7 +936,22 @@ "utils", "vctrs" ], - "Hash": "f2316df30902c81729ae9de95ad5a608" + "Hash": "15da5a8412f317beeee6175fbc76f4bb" + }, + "pkgbuild": { + "Package": "pkgbuild", + "Version": "1.4.5", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "callr", + "cli", + "desc", + "processx" + ], + "Hash": "30eaaab94db72652e72e3475c1b55278" }, "pkgconfig": { "Package": "pkgconfig", @@ -741,23 +965,25 @@ }, "pkgload": { "Package": "pkgload", - "Version": "1.3.2", + "Version": "1.4.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "cli", - "crayon", "desc", "fs", "glue", + "lifecycle", "methods", + "pkgbuild", + "processx", "rlang", "rprojroot", "utils", "withr" ], - "Hash": "6b0c222c5071efe0f3baf3dae9aa40e2" + "Hash": "2ec30ffbeec83da57655b850cf2d3e0e" }, "png": { "Package": "png", @@ -778,14 +1004,17 @@ }, "prettyunits": { "Package": "prettyunits", - "Version": "1.1.1", + "Version": "1.2.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "95ef9167b75dde9d2ccc3c7528393e7e" + "Requirements": [ + "R" + ], + "Hash": "6b01fc98b1e86c4f705ce9dcfd2f57c7" }, "processx": { "Package": "processx", - "Version": "3.8.0", + "Version": "3.8.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -794,50 +1023,52 @@ "ps", "utils" ], - "Hash": "a33ee2d9bf07564efb888ad98410da84" + "Hash": "0c90a7d71988856bad2a2a45dd871bb9" }, "progress": { "Package": "progress", - "Version": "1.2.2", + "Version": "1.2.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ + "R", "R6", "crayon", "hms", "prettyunits" ], - "Hash": "14dc9f7a3c91ebb14ec5bb9208a07061" + "Hash": "f4625e061cb2865f111b47ff163a5ca6" }, "promises": { "Package": "promises", - "Version": "1.2.0.1", + "Version": "1.3.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R6", "Rcpp", + "fastmap", "later", "magrittr", "rlang", "stats" ], - "Hash": "4ab2c43adb4d4699cf3690acd378d75d" + "Hash": "434cd5388a3979e74be5c219bcd6e77d" }, "ps": { "Package": "ps", - "Version": "1.7.2", + "Version": "1.8.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "utils" ], - "Hash": "68dd03d98a5efd1eb3012436de45ba83" + "Hash": "b4404b1de13758dea1c0484ad0d48563" }, "purrr": { "Package": "purrr", - "Version": "1.0.1", + "Version": "1.0.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -848,7 +1079,7 @@ "rlang", "vctrs" ], - "Hash": "d71c815267c640f17ddbf7f16144b4bb" + "Hash": "1cba04a4e9414bdefc9dcaa99649a8dc" }, "r2d3": { "Package": "r2d3", @@ -876,7 +1107,7 @@ }, "readr": { "Package": "readr", - "Version": "2.1.4", + "Version": "2.1.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -895,7 +1126,7 @@ "utils", "vroom" ], - "Hash": "b5047343b3825f37ad9d3b5d89aa1078" + "Hash": "9de96463d2117f6ac49980577939dfb3" }, "rematch2": { "Package": "rematch2", @@ -909,14 +1140,14 @@ }, "renv": { "Package": "renv", - "Version": "0.17.3", + "Version": "1.0.11", "OS_type": null, - "Repository": "CRAN", + "Repository": "binaries", "Source": "Repository" }, "reticulate": { "Package": "reticulate", - "Version": "1.28", + "Version": "1.39.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -930,69 +1161,66 @@ "methods", "png", "rappdirs", + "rlang", "utils", "withr" ], - "Hash": "86c441bf33e1d608db773cb94b848458" + "Hash": "e1a5d04397edc1580c5e0ed1dbdccf76" }, - "rex": { - "Package": "rex", - "Version": "1.2.1", + "rlang": { + "Package": "rlang", + "Version": "1.1.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ - "lazyeval" + "R", + "utils" ], - "Hash": "ae34cd56890607370665bee5bd17812f" - }, - "rlang": { - "Package": "rlang", - "Version": "1.1.3", - "Source": "Repository" + "Hash": "3eec01f8b1dee337674b2e34ab1f9bc1" }, "rmarkdown": { "Package": "rmarkdown", - "Version": "2.20", + "Version": "2.28", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "bslib", "evaluate", + "fontawesome", "htmltools", "jquerylib", "jsonlite", "knitr", "methods", - "stringr", "tinytex", "tools", "utils", "xfun", "yaml" ], - "Hash": "716fde5382293cc94a71f68c85b78d19" + "Hash": "062470668513dcda416927085ee9bdc7" }, "rprojroot": { "Package": "rprojroot", - "Version": "2.0.3", + "Version": "2.0.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "1de7ab598047a87bba48434ba35d497d" + "Hash": "4c8415e0ec1e29f3f4f6fc108bef0144" }, "rstudioapi": { "Package": "rstudioapi", - "Version": "0.14", + "Version": "0.17.1", "Source": "Repository", "Repository": "CRAN", - "Hash": "690bd2acc42a9166ce34845884459320" + "Hash": "5f90cd73946d706cfe26024294236113" }, "sass": { "Package": "sass", - "Version": "0.4.5", + "Version": "0.4.9", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1002,11 +1230,31 @@ "rappdirs", "rlang" ], - "Hash": "2bb4371a4c80115518261866eab6ab11" + "Hash": "d53dbfddf695303ea4ad66f86e99b95d" + }, + "scales": { + "Package": "scales", + "Version": "1.3.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "RColorBrewer", + "cli", + "farver", + "glue", + "labeling", + "lifecycle", + "munsell", + "rlang", + "viridisLite" + ], + "Hash": "c19df082ba346b0ffa6f833e92de34d1" }, "shiny": { "Package": "shiny", - "Version": "1.7.4", + "Version": "1.9.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1016,7 +1264,6 @@ "cachem", "commonmark", "crayon", - "ellipsis", "fastmap", "fontawesome", "glue", @@ -1036,7 +1283,7 @@ "withr", "xtable" ], - "Hash": "c2eae3d8c670fa9dfa35a12066f4a1d5" + "Hash": "6a293995a66e12c48d13aa1f957d09c7" }, "shinydashboard": { "Package": "shinydashboard", @@ -1070,7 +1317,8 @@ "shiny", "shinydashboard", "waiter" - ] + ], + "Hash": "5ac2268c276ed8481cc1780a6b6cbb8d" }, "shinyjs": { "Package": "shinyjs", @@ -1085,15 +1333,39 @@ ], "Hash": "802e4786b353a4bb27116957558548d5" }, + "shinyloadtest": { + "Package": "shinyloadtest", + "Version": "1.2.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "R6", + "cli", + "curl", + "dplyr", + "ggplot2", + "httpuv", + "jsonlite", + "magrittr", + "rlang", + "scales", + "stringr", + "svglite", + "vroom", + "websocket", + "xml2" + ], + "Hash": "0e63156a8b6abe5dad29a344e3ad797f" + }, "shinypop": { "Package": "shinypop", "Version": "0.1.1", "Source": "GitHub", "RemoteType": "github", "RemoteHost": "api.github.com", - "RemoteUsername": "dreamRs", "RemoteRepo": "shinypop", - "RemoteRef": "master", + "RemoteUsername": "dreamrs", "RemoteSha": "7745a0b1ecf31f783fa59603f3c5cede0c948118", "Requirements": [ "R", @@ -1101,7 +1373,7 @@ "jsonlite", "shiny" ], - "Hash": "ee29555190ce6a726046a5909cc91d9b" + "Hash": "d69a5eada8b146d064f367d650b9f2cd" }, "shinythemes": { "Package": "shinythemes", @@ -1126,7 +1398,7 @@ }, "stringi": { "Package": "stringi", - "Version": "1.7.12", + "Version": "1.8.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1135,11 +1407,11 @@ "tools", "utils" ], - "Hash": "ca8bd84263c77310739d2cf64d84d7c9" + "Hash": "39e1144fd75428983dc3f63aa53dfa91" }, "stringr": { "Package": "stringr", - "Version": "1.5.0", + "Version": "1.5.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1152,18 +1424,42 @@ "stringi", "vctrs" ], - "Hash": "671a4d384ae9d32fc47a14e98bfa3dc8" + "Hash": "960e2ae9e09656611e0b8214ad543207" + }, + "svglite": { + "Package": "svglite", + "Version": "2.1.3", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11", + "systemfonts" + ], + "Hash": "124a41fdfa23e8691cb744c762f10516" }, "sys": { "Package": "sys", - "Version": "3.4.1", + "Version": "3.4.3", "Source": "Repository", "Repository": "CRAN", - "Hash": "34c16f1ef796057bfa06d3f4ff818a5d" + "Hash": "de342ebfebdbf40477d0758d05426646" + }, + "systemfonts": { + "Package": "systemfonts", + "Version": "1.1.0", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R", + "cpp11", + "lifecycle" + ], + "Hash": "213b6b8ed5afbf934843e6c3b090d418" }, "testthat": { "Package": "testthat", - "Version": "3.1.6", + "Version": "3.2.1.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1174,7 +1470,6 @@ "cli", "desc", "digest", - "ellipsis", "evaluate", "jsonlite", "lifecycle", @@ -1189,11 +1484,11 @@ "waldo", "withr" ], - "Hash": "7910146255835c66e9eb272fb215248d" + "Hash": "3f6e7e5e2220856ff865e4834766bf2b" }, "tibble": { "Package": "tibble", - "Version": "3.1.8", + "Version": "3.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1208,11 +1503,11 @@ "utils", "vctrs" ], - "Hash": "56b6934ef0f8c68225949a8672fe1a8f" + "Hash": "a84e2cc86d07289b3b6f5069df7a004c" }, "tidyr": { "Package": "tidyr", - "Version": "1.3.0", + "Version": "1.3.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1231,11 +1526,11 @@ "utils", "vctrs" ], - "Hash": "e47debdc7ce599b070c8e78e8ac0cfcf" + "Hash": "915fb7ce036c22a6a33b5a8adb712eb1" }, "tidyselect": { "Package": "tidyselect", - "Version": "1.2.0", + "Version": "1.2.1", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1247,42 +1542,42 @@ "vctrs", "withr" ], - "Hash": "79540e5fcd9e0435af547d885f184fd5" + "Hash": "829f27b9c4919c16b593794a6344d6c0" }, "tinytex": { "Package": "tinytex", - "Version": "0.44", + "Version": "0.53", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "xfun" ], - "Hash": "c0f007e2eeed7722ce13d42b84a22e07" + "Hash": "9db859e8aabbb474293dde3097839420" }, "tzdb": { "Package": "tzdb", - "Version": "0.3.0", + "Version": "0.4.0", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "cpp11" ], - "Hash": "b2e1cbce7c903eaf23ec05c58e59fb5e" + "Hash": "f561504ec2897f4d46f0c7657e488ae1" }, "utf8": { "Package": "utf8", - "Version": "1.2.3", + "Version": "1.2.4", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R" ], - "Hash": "1fe17157424bb09c48a8b3b550c753bc" + "Hash": "62b65c52671e6665f803ff02954446e9" }, "vctrs": { "Package": "vctrs", - "Version": "0.5.2", + "Version": "0.6.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1292,11 +1587,21 @@ "lifecycle", "rlang" ], - "Hash": "e4ffa94ceed5f124d429a5a5f0f5b378" + "Hash": "c03fa420630029418f7e6da3667aac4a" + }, + "viridisLite": { + "Package": "viridisLite", + "Version": "0.4.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "R" + ], + "Hash": "c826c7c4241b6fc89ff55aaea3fa7491" }, "vroom": { "Package": "vroom", - "Version": "1.6.1", + "Version": "1.6.5", "Source": "Repository", "Repository": "CRAN", "Requirements": [ @@ -1318,7 +1623,7 @@ "vctrs", "withr" ], - "Hash": "7015a74373b83ffaef64023f4a0f5033" + "Hash": "390f9315bc0025be03012054103d227c" }, "waiter": { "Package": "waiter", @@ -1334,55 +1639,71 @@ }, "waldo": { "Package": "waldo", - "Version": "0.4.0", + "Version": "0.5.3", "Source": "Repository", "Repository": "CRAN", "Requirements": [ + "R", "cli", "diffobj", - "fansi", "glue", "methods", "rematch2", "rlang", "tibble" ], - "Hash": "035fba89d0c86e2113120f93301b98ad" + "Hash": "16aa934a49658677d8041df9017329b9" + }, + "websocket": { + "Package": "websocket", + "Version": "1.4.2", + "Source": "Repository", + "Repository": "CRAN", + "Requirements": [ + "AsioHeaders", + "R6", + "cpp11", + "later" + ], + "Hash": "e77c5569354172d0d04d54a9dec89e33" }, "withr": { "Package": "withr", - "Version": "2.5.0", + "Version": "3.0.2", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", "grDevices", - "graphics", - "stats" + "graphics" ], - "Hash": "c0e49a9760983e81e55cdd9be92e7182" + "Hash": "cc2d62c76458d425210d1eb1478b30b4" }, "xfun": { "Package": "xfun", - "Version": "0.37", + "Version": "0.48", "Source": "Repository", "Repository": "CRAN", "Requirements": [ + "R", + "grDevices", "stats", "tools" ], - "Hash": "a6860e1400a8fd1ddb6d9b4230cc34ab" + "Hash": "89e455b87c84e227eb7f60a1b4e5fe1f" }, "xml2": { "Package": "xml2", - "Version": "1.3.3", + "Version": "1.3.6", "Source": "Repository", "Repository": "CRAN", "Requirements": [ "R", - "methods" + "cli", + "methods", + "rlang" ], - "Hash": "40682ed6a969ea5abfd351eb67833adc" + "Hash": "1d0336142f4cd25d8d23cd3ba7a8fb61" }, "xtable": { "Package": "xtable", @@ -1398,10 +1719,10 @@ }, "yaml": { "Package": "yaml", - "Version": "2.3.7", + "Version": "2.3.10", "Source": "Repository", "Repository": "CRAN", - "Hash": "0d0056cc5383fbc240ccd0cb584bf436" + "Hash": "51dab85c6c98e50a18d7551e9d49f76c" } } } diff --git a/renv/activate.R b/renv/activate.R index d77c4c83..0eb51088 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -2,10 +2,28 @@ local({ # the requested version of renv - version <- "0.17.3" + version <- "1.0.11" + attr(version, "sha") <- NULL # the project directory - project <- getwd() + project <- Sys.getenv("RENV_PROJECT") + if (!nzchar(project)) + project <- getwd() + + # use start-up diagnostics if enabled + diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE") + if (diagnostics) { + start <- Sys.time() + profile <- tempfile("renv-startup-", fileext = ".Rprof") + utils::Rprof(profile) + on.exit({ + utils::Rprof(NULL) + elapsed <- signif(difftime(Sys.time(), start, units = "auto"), digits = 2L) + writeLines(sprintf("- renv took %s to run the autoloader.", format(elapsed))) + writeLines(sprintf("- Profile: %s", profile)) + print(utils::summaryRprof(profile)) + }, add = TRUE) + } # figure out whether the autoloader is enabled enabled <- local({ @@ -15,6 +33,14 @@ local({ if (!is.null(override)) return(override) + # if we're being run in a context where R_LIBS is already set, + # don't load -- presumably we're being run as a sub-process and + # the parent process has already set up library paths for us + rcmd <- Sys.getenv("R_CMD", unset = NA) + rlibs <- Sys.getenv("R_LIBS", unset = NA) + if (!is.na(rlibs) && !is.na(rcmd)) + return(FALSE) + # next, check environment variables # TODO: prefer using the configuration one in the future envvars <- c( @@ -34,9 +60,22 @@ local({ }) - if (!enabled) + # bail if we're not enabled + if (!enabled) { + + # if we're not enabled, we might still need to manually load + # the user profile here + profile <- Sys.getenv("R_PROFILE_USER", unset = "~/.Rprofile") + if (file.exists(profile)) { + cfg <- Sys.getenv("RENV_CONFIG_USER_PROFILE", unset = "TRUE") + if (tolower(cfg) %in% c("true", "t", "1")) + sys.source(profile, envir = globalenv()) + } + return(FALSE) + } + # avoid recursion if (identical(getOption("renv.autoloader.running"), TRUE)) { warning("ignoring recursive attempt to run renv autoloader") @@ -59,22 +98,154 @@ local({ unloadNamespace("renv") # load bootstrap tools + ansify <- function(text) { + if (renv_ansify_enabled()) + renv_ansify_enhanced(text) + else + renv_ansify_default(text) + } + + renv_ansify_enabled <- function() { + + override <- Sys.getenv("RENV_ANSIFY_ENABLED", unset = NA) + if (!is.na(override)) + return(as.logical(override)) + + pane <- Sys.getenv("RSTUDIO_CHILD_PROCESS_PANE", unset = NA) + if (identical(pane, "build")) + return(FALSE) + + testthat <- Sys.getenv("TESTTHAT", unset = "false") + if (tolower(testthat) %in% "true") + return(FALSE) + + iderun <- Sys.getenv("R_CLI_HAS_HYPERLINK_IDE_RUN", unset = "false") + if (tolower(iderun) %in% "false") + return(FALSE) + + TRUE + + } + + renv_ansify_default <- function(text) { + text + } + + renv_ansify_enhanced <- function(text) { + + # R help links + pattern <- "`\\?(renv::(?:[^`])+)`" + replacement <- "`\033]8;;ide:help:\\1\a?\\1\033]8;;\a`" + text <- gsub(pattern, replacement, text, perl = TRUE) + + # runnable code + pattern <- "`(renv::(?:[^`])+)`" + replacement <- "`\033]8;;ide:run:\\1\a\\1\033]8;;\a`" + text <- gsub(pattern, replacement, text, perl = TRUE) + + # return ansified text + text + + } + + renv_ansify_init <- function() { + + envir <- renv_envir_self() + if (renv_ansify_enabled()) + assign("ansify", renv_ansify_enhanced, envir = envir) + else + assign("ansify", renv_ansify_default, envir = envir) + + } + `%||%` <- function(x, y) { - if (is.environment(x) || length(x)) x else y + if (is.null(x)) y else x + } + + catf <- function(fmt, ..., appendLF = TRUE) { + + quiet <- getOption("renv.bootstrap.quiet", default = FALSE) + if (quiet) + return(invisible()) + + msg <- sprintf(fmt, ...) + cat(msg, file = stdout(), sep = if (appendLF) "\n" else "") + + invisible(msg) + + } + + header <- function(label, + ..., + prefix = "#", + suffix = "-", + n = min(getOption("width"), 78)) + { + label <- sprintf(label, ...) + n <- max(n - nchar(label) - nchar(prefix) - 2L, 8L) + if (n <= 0) + return(paste(prefix, label)) + + tail <- paste(rep.int(suffix, n), collapse = "") + paste0(prefix, " ", label, " ", tail) + + } + + heredoc <- function(text, leave = 0) { + + # remove leading, trailing whitespace + trimmed <- gsub("^\\s*\\n|\\n\\s*$", "", text) + + # split into lines + lines <- strsplit(trimmed, "\n", fixed = TRUE)[[1L]] + + # compute common indent + indent <- regexpr("[^[:space:]]", lines) + common <- min(setdiff(indent, -1L)) - leave + text <- paste(substring(lines, common), collapse = "\n") + + # substitute in ANSI links for executable renv code + ansify(text) + + } + + startswith <- function(string, prefix) { + substring(string, 1, nchar(prefix)) == prefix } bootstrap <- function(version, library) { + friendly <- renv_bootstrap_version_friendly(version) + section <- header(sprintf("Bootstrapping renv %s", friendly)) + catf(section) + # attempt to download renv - tarball <- tryCatch(renv_bootstrap_download(version), error = identity) - if (inherits(tarball, "error")) - stop("failed to download renv ", version) + catf("- Downloading renv ... ", appendLF = FALSE) + withCallingHandlers( + tarball <- renv_bootstrap_download(version), + error = function(err) { + catf("FAILED") + stop("failed to download:\n", conditionMessage(err)) + } + ) + catf("OK") + on.exit(unlink(tarball), add = TRUE) # now attempt to install - status <- tryCatch(renv_bootstrap_install(version, tarball, library), error = identity) - if (inherits(status, "error")) - stop("failed to install renv ", version) + catf("- Installing renv ... ", appendLF = FALSE) + withCallingHandlers( + status <- renv_bootstrap_install(version, tarball, library), + error = function(err) { + catf("FAILED") + stop("failed to install:\n", conditionMessage(err)) + } + ) + catf("OK") + + # add empty line to break up bootstrapping from normal output + catf("") + return(invisible()) } renv_bootstrap_tests_running <- function() { @@ -83,31 +254,32 @@ local({ renv_bootstrap_repos <- function() { + # get CRAN repository + cran <- getOption("renv.repos.cran", "https://cloud.r-project.org") + # check for repos override repos <- Sys.getenv("RENV_CONFIG_REPOS_OVERRIDE", unset = NA) - if (!is.na(repos)) + if (!is.na(repos)) { + + # check for RSPM; if set, use a fallback repository for renv + rspm <- Sys.getenv("RSPM", unset = NA) + if (identical(rspm, repos)) + repos <- c(RSPM = rspm, CRAN = cran) + return(repos) + } + # check for lockfile repositories repos <- tryCatch(renv_bootstrap_repos_lockfile(), error = identity) if (!inherits(repos, "error") && length(repos)) return(repos) - # if we're testing, re-use the test repositories - if (renv_bootstrap_tests_running()) { - repos <- getOption("renv.tests.repos") - if (!is.null(repos)) - return(repos) - } - # retrieve current repos repos <- getOption("repos") # ensure @CRAN@ entries are resolved - repos[repos == "@CRAN@"] <- getOption( - "renv.repos.cran", - "https://cloud.r-project.org" - ) + repos[repos == "@CRAN@"] <- cran # add in renv.bootstrap.repos if set default <- c(FALLBACK = "https://cloud.r-project.org") @@ -146,33 +318,34 @@ local({ renv_bootstrap_download <- function(version) { - # if the renv version number has 4 components, assume it must - # be retrieved via github - nv <- numeric_version(version) - components <- unclass(nv)[[1]] - - # if this appears to be a development version of 'renv', we'll - # try to restore from github - dev <- length(components) == 4L - - # begin collecting different methods for finding renv - methods <- c( - renv_bootstrap_download_tarball, - if (dev) - renv_bootstrap_download_github - else c( - renv_bootstrap_download_cran_latest, - renv_bootstrap_download_cran_archive + sha <- attr(version, "sha", exact = TRUE) + + methods <- if (!is.null(sha)) { + + # attempting to bootstrap a development version of renv + c( + function() renv_bootstrap_download_tarball(sha), + function() renv_bootstrap_download_github(sha) ) - ) + + } else { + + # attempting to bootstrap a release version of renv + c( + function() renv_bootstrap_download_tarball(version), + function() renv_bootstrap_download_cran_latest(version), + function() renv_bootstrap_download_cran_archive(version) + ) + + } for (method in methods) { - path <- tryCatch(method(version), error = identity) + path <- tryCatch(method(), error = identity) if (is.character(path) && file.exists(path)) return(path) } - stop("failed to download renv ", version) + stop("All download methods failed") } @@ -195,8 +368,11 @@ local({ quiet = TRUE ) - if ("headers" %in% names(formals(utils::download.file))) - args$headers <- renv_bootstrap_download_custom_headers(url) + if ("headers" %in% names(formals(utils::download.file))) { + headers <- renv_bootstrap_download_custom_headers(url) + if (length(headers) && is.character(headers)) + args$headers <- headers + } do.call(utils::download.file, args) @@ -236,8 +412,6 @@ local({ type <- spec$type repos <- spec$repos - message("* Downloading renv ", version, " ... ", appendLF = FALSE) - baseurl <- utils::contrib.url(repos = repos, type = type) ext <- if (identical(type, "source")) ".tar.gz" @@ -254,13 +428,10 @@ local({ condition = identity ) - if (inherits(status, "condition")) { - message("FAILED") + if (inherits(status, "condition")) return(FALSE) - } # report success and return - message("OK (downloaded ", type, ")") destfile } @@ -280,10 +451,21 @@ local({ for (type in types) { for (repos in renv_bootstrap_repos()) { + # build arguments for utils::available.packages() call + args <- list(type = type, repos = repos) + + # add custom headers if available -- note that + # utils::available.packages() will pass this to download.file() + if ("headers" %in% names(formals(utils::download.file))) { + headers <- renv_bootstrap_download_custom_headers(repos) + if (length(headers) && is.character(headers)) + args$headers <- headers + } + # retrieve package database db <- tryCatch( as.data.frame( - utils::available.packages(type = type, repos = repos), + do.call(utils::available.packages, args), stringsAsFactors = FALSE ), error = identity @@ -317,8 +499,6 @@ local({ urls <- file.path(repos, "src/contrib/Archive/renv", name) destfile <- file.path(tempdir(), name) - message("* Downloading renv ", version, " ... ", appendLF = FALSE) - for (url in urls) { status <- tryCatch( @@ -326,14 +506,11 @@ local({ condition = identity ) - if (identical(status, 0L)) { - message("OK") + if (identical(status, 0L)) return(destfile) - } } - message("FAILED") return(FALSE) } @@ -356,7 +533,7 @@ local({ if (!file.exists(tarball)) { # let the user know we weren't able to honour their request - fmt <- "* RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." + fmt <- "- RENV_BOOTSTRAP_TARBALL is set (%s) but does not exist." msg <- sprintf(fmt, tarball) warning(msg) @@ -365,14 +542,19 @@ local({ } - fmt <- "* Bootstrapping with tarball at path '%s'." - msg <- sprintf(fmt, tarball) - message(msg) - + catf("- Using local tarball '%s'.", tarball) tarball } + renv_bootstrap_github_token <- function() { + for (envvar in c("GITHUB_TOKEN", "GITHUB_PAT", "GH_TOKEN")) { + envval <- Sys.getenv(envvar, unset = NA) + if (!is.na(envval)) + return(envval) + } + } + renv_bootstrap_download_github <- function(version) { enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") @@ -380,23 +562,21 @@ local({ return(FALSE) # prepare download options - pat <- Sys.getenv("GITHUB_PAT") - if (nzchar(Sys.which("curl")) && nzchar(pat)) { + token <- renv_bootstrap_github_token() + if (nzchar(Sys.which("curl")) && nzchar(token)) { fmt <- "--location --fail --header \"Authorization: token %s\"" - extra <- sprintf(fmt, pat) + extra <- sprintf(fmt, token) saved <- options("download.file.method", "download.file.extra") options(download.file.method = "curl", download.file.extra = extra) on.exit(do.call(base::options, saved), add = TRUE) - } else if (nzchar(Sys.which("wget")) && nzchar(pat)) { + } else if (nzchar(Sys.which("wget")) && nzchar(token)) { fmt <- "--header=\"Authorization: token %s\"" - extra <- sprintf(fmt, pat) + extra <- sprintf(fmt, token) saved <- options("download.file.method", "download.file.extra") options(download.file.method = "wget", download.file.extra = extra) on.exit(do.call(base::options, saved), add = TRUE) } - message("* Downloading renv ", version, " from GitHub ... ", appendLF = FALSE) - url <- file.path("https://api.github.com/repos/rstudio/renv/tarball", version) name <- sprintf("renv_%s.tar.gz", version) destfile <- file.path(tempdir(), name) @@ -406,26 +586,105 @@ local({ condition = identity ) - if (!identical(status, 0L)) { - message("FAILED") + if (!identical(status, 0L)) return(FALSE) - } - message("OK") + renv_bootstrap_download_augment(destfile) + return(destfile) } + # Add Sha to DESCRIPTION. This is stop gap until #890, after which we + # can use renv::install() to fully capture metadata. + renv_bootstrap_download_augment <- function(destfile) { + sha <- renv_bootstrap_git_extract_sha1_tar(destfile) + if (is.null(sha)) { + return() + } + + # Untar + tempdir <- tempfile("renv-github-") + on.exit(unlink(tempdir, recursive = TRUE), add = TRUE) + untar(destfile, exdir = tempdir) + pkgdir <- dir(tempdir, full.names = TRUE)[[1]] + + # Modify description + desc_path <- file.path(pkgdir, "DESCRIPTION") + desc_lines <- readLines(desc_path) + remotes_fields <- c( + "RemoteType: github", + "RemoteHost: api.github.com", + "RemoteRepo: renv", + "RemoteUsername: rstudio", + "RemotePkgRef: rstudio/renv", + paste("RemoteRef: ", sha), + paste("RemoteSha: ", sha) + ) + writeLines(c(desc_lines[desc_lines != ""], remotes_fields), con = desc_path) + + # Re-tar + local({ + old <- setwd(tempdir) + on.exit(setwd(old), add = TRUE) + + tar(destfile, compression = "gzip") + }) + invisible() + } + + # Extract the commit hash from a git archive. Git archives include the SHA1 + # hash as the comment field of the tarball pax extended header + # (see https://www.kernel.org/pub/software/scm/git/docs/git-archive.html) + # For GitHub archives this should be the first header after the default one + # (512 byte) header. + renv_bootstrap_git_extract_sha1_tar <- function(bundle) { + + # open the bundle for reading + # We use gzcon for everything because (from ?gzcon) + # > Reading from a connection which does not supply a 'gzip' magic + # > header is equivalent to reading from the original connection + conn <- gzcon(file(bundle, open = "rb", raw = TRUE)) + on.exit(close(conn)) + + # The default pax header is 512 bytes long and the first pax extended header + # with the comment should be 51 bytes long + # `52 comment=` (11 chars) + 40 byte SHA1 hash + len <- 0x200 + 0x33 + res <- rawToChar(readBin(conn, "raw", n = len)[0x201:len]) + + if (grepl("^52 comment=", res)) { + sub("52 comment=", "", res) + } else { + NULL + } + } + renv_bootstrap_install <- function(version, tarball, library) { # attempt to install it into project library - message("* Installing renv ", version, " ... ", appendLF = FALSE) dir.create(library, showWarnings = FALSE, recursive = TRUE) + output <- renv_bootstrap_install_impl(library, tarball) + + # check for successful install + status <- attr(output, "status") + if (is.null(status) || identical(status, 0L)) + return(status) + + # an error occurred; report it + header <- "installation of renv failed" + lines <- paste(rep.int("=", nchar(header)), collapse = "") + text <- paste(c(header, lines, output), collapse = "\n") + stop(text) + + } + + renv_bootstrap_install_impl <- function(library, tarball) { # invoke using system2 so we can capture and report output bin <- R.home("bin") exe <- if (Sys.info()[["sysname"]] == "Windows") "R.exe" else "R" - r <- file.path(bin, exe) + R <- file.path(bin, exe) args <- c( "--vanilla", "CMD", "INSTALL", "--no-multiarch", @@ -433,19 +692,7 @@ local({ shQuote(path.expand(tarball)) ) - output <- system2(r, args, stdout = TRUE, stderr = TRUE) - message("Done!") - - # check for successful install - status <- attr(output, "status") - if (is.numeric(status) && !identical(status, 0L)) { - header <- "Error installing renv:" - lines <- paste(rep.int("=", nchar(header)), collapse = "") - text <- c(header, lines, output) - writeLines(text, con = stderr()) - } - - status + system2(R, args, stdout = TRUE, stderr = TRUE) } @@ -486,6 +733,9 @@ local({ # if the user has requested an automatic prefix, generate it auto <- Sys.getenv("RENV_PATHS_PREFIX_AUTO", unset = NA) + if (is.na(auto) && getRversion() >= "4.4.0") + auto <- "TRUE" + if (auto %in% c("TRUE", "True", "true", "1")) return(renv_bootstrap_platform_prefix_auto()) @@ -655,34 +905,61 @@ local({ } - renv_bootstrap_validate_version <- function(version) { + renv_bootstrap_validate_version <- function(version, description = NULL) { - loadedversion <- utils::packageDescription("renv", fields = "Version") - if (version == loadedversion) + # resolve description file + # + # avoid passing lib.loc to `packageDescription()` below, since R will + # use the loaded version of the package by default anyhow. note that + # this function should only be called after 'renv' is loaded + # https://github.com/rstudio/renv/issues/1625 + description <- description %||% packageDescription("renv") + + # check whether requested version 'version' matches loaded version of renv + sha <- attr(version, "sha", exact = TRUE) + valid <- if (!is.null(sha)) + renv_bootstrap_validate_version_dev(sha, description) + else + renv_bootstrap_validate_version_release(version, description) + + if (valid) return(TRUE) - # assume four-component versions are from GitHub; - # three-component versions are from CRAN - components <- strsplit(loadedversion, "[.-]")[[1]] - remote <- if (length(components) == 4L) - paste("rstudio/renv", loadedversion, sep = "@") + # the loaded version of renv doesn't match the requested version; + # give the user instructions on how to proceed + dev <- identical(description[["RemoteType"]], "github") + remote <- if (dev) + paste("rstudio/renv", description[["RemoteSha"]], sep = "@") else - paste("renv", loadedversion, sep = "@") + paste("renv", description[["Version"]], sep = "@") - fmt <- paste( - "renv %1$s was loaded from project library, but this project is configured to use renv %2$s.", - "Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile.", - "Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library.", - sep = "\n" + # display both loaded version + sha if available + friendly <- renv_bootstrap_version_friendly( + version = description[["Version"]], + sha = if (dev) description[["RemoteSha"]] ) - msg <- sprintf(fmt, loadedversion, version, remote) - warning(msg, call. = FALSE) + fmt <- heredoc(" + renv %1$s was loaded from project library, but this project is configured to use renv %2$s. + - Use `renv::record(\"%3$s\")` to record renv %1$s in the lockfile. + - Use `renv::restore(packages = \"renv\")` to install renv %2$s into the project library. + ") + catf(fmt, friendly, renv_bootstrap_version_friendly(version), remote) FALSE } + renv_bootstrap_validate_version_dev <- function(version, description) { + expected <- description[["RemoteSha"]] + is.character(expected) && startswith(expected, version) + } + + renv_bootstrap_validate_version_release <- function(version, description) { + expected <- description[["Version"]] + is.character(expected) && identical(expected, version) + } + renv_bootstrap_hash_text <- function(text) { hashfile <- tempfile("renv-hash-") @@ -706,7 +983,7 @@ local({ hooks <- getHook("renv::autoload") for (hook in hooks) if (is.function(hook)) - tryCatch(hook(), error = warning) + tryCatch(hook(), error = warnify) # load the project renv::load(project) @@ -847,6 +1124,40 @@ local({ } + renv_bootstrap_version_friendly <- function(version, shafmt = NULL, sha = NULL) { + sha <- sha %||% attr(version, "sha", exact = TRUE) + parts <- c(version, sprintf(shafmt %||% " [sha: %s]", substring(sha, 1L, 7L))) + paste(parts, collapse = "") + } + + renv_bootstrap_exec <- function(project, libpath, version) { + if (!renv_bootstrap_load(project, libpath, version)) + renv_bootstrap_run(version, libpath) + } + + renv_bootstrap_run <- function(version, libpath) { + + # perform bootstrap + bootstrap(version, libpath) + + # exit early if we're just testing bootstrap + if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) + return(TRUE) + + # try again to load + if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { + return(renv::load(project = getwd())) + } + + # failed to download or load renv; warn the user + msg <- c( + "Failed to find an renv installation: the project will not be loaded.", + "Use `renv::activate()` to re-initialize the project." + ) + + warning(paste(msg, collapse = "\n"), call. = FALSE) + + } renv_json_read <- function(file = NULL, text = NULL) { @@ -855,7 +1166,7 @@ local({ # if jsonlite is loaded, use that instead if ("jsonlite" %in% loadedNamespaces()) { - json <- catch(renv_json_read_jsonlite(file, text)) + json <- tryCatch(renv_json_read_jsonlite(file, text), error = identity) if (!inherits(json, "error")) return(json) @@ -864,7 +1175,7 @@ local({ } # otherwise, fall back to the default JSON reader - json <- catch(renv_json_read_default(file, text)) + json <- tryCatch(renv_json_read_default(file, text), error = identity) if (!inherits(json, "error")) return(json) @@ -877,14 +1188,14 @@ local({ } renv_json_read_jsonlite <- function(file = NULL, text = NULL) { - text <- paste(text %||% read(file), collapse = "\n") + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") jsonlite::fromJSON(txt = text, simplifyVector = FALSE) } renv_json_read_default <- function(file = NULL, text = NULL) { # find strings in the JSON - text <- paste(text %||% read(file), collapse = "\n") + text <- paste(text %||% readLines(file, warn = FALSE), collapse = "\n") pattern <- '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' locs <- gregexpr(pattern, text, perl = TRUE)[[1]] @@ -932,14 +1243,14 @@ local({ map <- as.list(map) # remap strings in object - remapped <- renv_json_remap(json, map) + remapped <- renv_json_read_remap(json, map) # evaluate eval(remapped, envir = baseenv()) } - renv_json_remap <- function(json, map) { + renv_json_read_remap <- function(json, map) { # fix names if (!is.null(names(json))) { @@ -966,7 +1277,7 @@ local({ # recurse if (is.recursive(json)) { for (i in seq_along(json)) { - json[i] <- list(renv_json_remap(json[[i]], map)) + json[i] <- list(renv_json_read_remap(json[[i]], map)) } } @@ -986,35 +1297,9 @@ local({ # construct full libpath libpath <- file.path(root, prefix) - # attempt to load - if (renv_bootstrap_load(project, libpath, version)) - return(TRUE) - - # load failed; inform user we're about to bootstrap - prefix <- paste("# Bootstrapping renv", version) - postfix <- paste(rep.int("-", 77L - nchar(prefix)), collapse = "") - header <- paste(prefix, postfix) - message(header) - - # perform bootstrap - bootstrap(version, libpath) - - # exit early if we're just testing bootstrap - if (!is.na(Sys.getenv("RENV_BOOTSTRAP_INSTALL_ONLY", unset = NA))) - return(TRUE) - - # try again to load - if (requireNamespace("renv", lib.loc = libpath, quietly = TRUE)) { - message("* Successfully installed and loaded renv ", version, ".") - return(renv::load()) - } - - # failed to download or load renv; warn the user - msg <- c( - "Failed to find an renv installation: the project will not be loaded.", - "Use `renv::activate()` to re-initialize the project." - ) + # run bootstrap code + renv_bootstrap_exec(project, libpath, version) - warning(paste(msg, collapse = "\n"), call. = FALSE) + invisible() }) diff --git a/server.R b/server.R index f624d983..962ecce0 100644 --- a/server.R +++ b/server.R @@ -959,6 +959,10 @@ shinyServer(function(input, output, session) { # reads file csv again submit_data <- csvInfileServer("inputFile", colsAsCharacters = TRUE, keepBlank = TRUE, trimEmptyRows = TRUE)$data() + # If enabled, create a column in the manifest to store the data model URL + if (isTRUE(dcc_config_react()$dcc$data_model_version_as_column)) { + submit_data$DataModelURL <- data_model() + } # If a file-based component selected (define file-based components) note for future # the type to filter (eg file-based) on could probably also be a config choice display_names <- config_schema()$manifest_schemas$display_name[config_schema()$manifest_schemas$type == "file"] @@ -1132,6 +1136,38 @@ shinyServer(function(input, output, session) { # if no error if (startsWith(manifest_id(), "syn") == TRUE) { + # If enabled, annotate the file and folder with the data model + if (isTRUE(dcc_config_react()$dcc$data_model_version_as_annotation)) { + lapply(c(manifest_id()), function(id) { # add selected$folder() if annotating folder. + # Get existing annotations + annotations <- request(sprintf("https://repo-prod.prod.sagebase.org/repo/v1/entity/%s/annotations2", id)) |> + req_auth_bearer_token(access_token) |> + req_perform() |> + resp_body_json() + annotations_upload <- annotations$annotations + if (!"DataModelURL" %in% names(annotations_upload)) { + annotations_upload$DataModelURL <- list( + type="STRING", value=list(data_model()) + ) + } + add_annotation <- request( + sprintf( + "https://repo-prod.prod.sagebase.org/repo/v1/entity/%s/annotations2", + id + )) |> + req_method("PUT") |> + req_auth_bearer_token(access_token) |> + req_body_json( + list( + id = id, + etag = annotations$etag, + annotations = annotations_upload + ) + ) |> + req_error(is_error = function(x) FALSE) |> + req_perform() + }) + } dcWaiter("hide") nx_report_success("Success!", HTML(paste0("Manifest submitted to: ", manifest_path))) diff --git a/tests/testthat/test_schematic_rest_api.R b/tests/testthat/test_schematic_rest_api.R index 804c203a..dd04acbf 100644 --- a/tests/testthat/test_schematic_rest_api.R +++ b/tests/testthat/test_schematic_rest_api.R @@ -7,7 +7,7 @@ context("test schematic rest api wrappers") schematic_url <- "https://schematic-dev.api.sagebionetworks.org" ping <- try(httr::GET(schematic_url), silent = TRUE) skip_it <- function(skip=ping) { - if (inherits(ping, "try-error")) skip(sprintf("schematic server URL unavailable (%s). Is it running locally?", schematic_url)) #nolint + if (inherits(ping, "try-error")) skip(sprintf("schematic server URL unavailable (%s).", schematic_url)) #nolint } schema_url <- "https://raw.githubusercontent.com/Sage-Bionetworks/data-models/main/example.model.jsonld" @@ -16,42 +16,129 @@ pass_csv <- system.file("testdata", "HTAN-Biospecimen-Tier-1-2-pass.csv", fail_csv <- system.file("testdata", "HTAN-Biospecimen-Tier-1-2-fail.csv", package = "datacurator") -test_that("manifest_generate returns a URL if sucessful", { +test_that("manifest_generate returns expected output", { skip_it() - url <- manifest_generate(url=file.path(schematic_url, "v1/manifest/generate"), - schema_url = schema_url, access_token = Sys.getenv("SYNAPSE_PAT"), - title="Test biospecimen", data_type="Biospecimen", + url <- file.path(schematic_url, "v1/manifest/generate") + + # output_format = google_sheet - expect url + url <- manifest_generate( + url = url, + schema_url = schema_url, + access_token = Sys.getenv("SYNAPSE_PAT"), + title = "Test biospecimen", + data_type = "Biospecimen", use_annotations = FALSE, - dataset_id="syn33715357", asset_view="syn33715412", + dataset_id = "syn33715357", + asset_view = "syn33715412", output_format = "google_sheet") + expect_true(grepl("^https://docs.google", url)) + + # output_format = excel - expect not to error + # TODO: Would need to update what the api function returns to check specifically for excel sheet + expect_no_error( + manifest_generate( + url=url, + schema_url = schema_url, + access_token = Sys.getenv("SYNAPSE_PAT"), + title = "Test biospecimen", + data_type = "Biospecimen", + use_annotations = FALSE, + dataset_id = "syn33715357", + asset_view = "syn33715412", + output_format = "excel") + ) }) -# test_that("manifest_generate returns an xlsx", { -# skip_it() -# -# xlsx <- manifest_generate(url=file.path(schematic_url, "v1/manifest/generate"), -# title="Test biospecimen", data_type="Biospecimen", -# asset_view="syn33715412", output_format="excel") -# -# }) +test_that("manifest_generate errors as expected", { + skip_it() + + url <- file.path(schematic_url, "v1/manifest/generate") + + # expect dataframe to error out + # not supported at this time + expect_error( + manifest_generate( + url = url, + schema_url = schema_url, + access_token = Sys.getenv("SYNAPSE_PAT"), + title = "Test biospecimen", + data_type = "Biospecimen", + use_annotations = FALSE, + dataset_id = "syn33715357", + asset_view = "syn33715412", + output_format = "dataframe") + ) + + # bad pat + expect_error( + manifest_generate( + url = url, + schema_url = schema_url, + access_token = "bad pat", + title = "Test biospecimen", + data_type = "Biospecimen", + use_annotations = FALSE, + dataset_id = "syn33715357", + asset_view = "syn33715412", + output_format = "google_sheet") + ) + + expect_error( + manifest_generate( + url = paste0(url, "typo"), + schema_url = schema_url, + access_token = Sys.getenv("SYNAPSE_PAT"), + title = "Test biospecimen", + data_type = "Biospecimen", + use_annotations = FALSE, + dataset_id = "syn33715357", + asset_view = "syn33715412", + output_format = "google_sheet") + ) + + expect_error( + manifest_generate( + url = url, + schema_url = paste0(schema_url, "typo"), + access_token = Sys.getenv("SYNAPSE_PAT"), + title = "Test biospecimen", + data_type = "Biospecimen", + use_annotations = FALSE, + dataset_id = "syn33715357", + asset_view = "syn33715412", + output_format = "google_sheet") + ) + +}) -# test_that("manifest_populate returns a google sheet link with records filled", { -# skip_it() -# req <- manifest_populate(data_type="Biospecimen", title="Example", -# csv_file = pass_csv) -# }) +# TODO: Is there a way to check that the google sheet is populated? +test_that("manifest_populate returns a google sheet link", { + skip_it() + req <- manifest_populate( + url = file.path(schematic_url, "v1/manifest/populate"), + schema_url = schema_url, + data_type = "Biospecimen", + title = "Example", + csv_file = pass_csv) + + # expect a google doc url + expect_true(grepl("^https://docs.google", httr::content(req))) + +}) test_that("manifest_validate passes and fails correctly", { skip_it() + # expect empth list pass <- manifest_validate(url=file.path(schematic_url, "v1/model/validate"), data_type="Biospecimen", file_name=fail_csv, access_token = Sys.getenv("SYNAPSE_PAT"), schema_url = schema_url) expect_identical(pass, list(errors = list(), warnings = list())) + # expect list with content fail <- manifest_validate(url=file.path(schematic_url, "v1/model/validate"), data_type="Biospecimen", file_name=pass_csv, access_token = Sys.getenv("SYNAPSE_PAT"), @@ -73,74 +160,304 @@ test_that("model_submit successfully uploads to synapse", { expect_true(grepl("^syn", submit)) }) -test_that("storage_project_datasets returns available datasets", { +test_that("storage_project_datasets returns a list of datasets", { + skip_it() + + url <- file.path(schematic_url, "v1/storage/project/datasets") + + # expect list with projects + datasets <- storage_project_datasets( + url = url, + asset_view="syn23643253", + project_id="syn26251192", + access_token=Sys.getenv("SYNAPSE_PAT")) + + expect_true(is.list(datasets)) + expect_true(length(datasets) > 0) + + # typo in project id expect empty list + datasets <- storage_project_datasets( + url = url, + asset_view="syn23643253", + project_id="typo", + access_token=Sys.getenv("SYNAPSE_PAT")) + + expect_true(is.list(datasets)) + expect_true(length(datasets) == 0) +}) + +test_that("storage_project_datasets errors correctly", { skip_it() - storage_project_datasets(url=file.path(schematic_url, "v1/storage/project/datasets"), - asset_view="syn23643253", - project_id="syn26251192", - access_token=Sys.getenv("SYNAPSE_PAT")) + + # bad url + expect_error( + storage_project_datasets( + url = file.path(schematic_url, "bad url"), + asset_view = "syn23643253", + project_id = "syn26251192", + access_token = Sys.getenv("SYNAPSE_PAT") + ) + ) + + # typo in asset_view + expect_error( + storage_project_datasets( + url = url, + asset_view = "typo", + project_id = "syn26251192", + access_token = Sys.getenv("SYNAPSE_PAT") + ) + ) + + # typo in synapse pat + expect_error( + storage_project_datasets( + url = url, + asset_view = "typo", + project_id = "syn26251192", + access_token = "bad pat" + ) + ) }) -test_that("storage_projects returns available projects", { +test_that("storage_projects returns a list of projects", { skip_it() - storage_projects(url=file.path(schematic_url, "v1/storage/projects"), - asset_view="syn23643253", - access_token=Sys.getenv("SYNAPSE_PAT")) + + # successful call + projects <- storage_projects( + url = file.path(schematic_url, "v1/storage/projects"), + asset_view = "syn23643253", + access_token = Sys.getenv("SYNAPSE_PAT")) + + expect_true(is.list(projects)) + expect_true(length(projects) > 0) + }) -test_that("storage_dataset_files returns files", { +test_that("storage_projects errors as expected", { skip_it() - storage_dataset_files(url=file.path(schematic_url, "v1/storage/dataset/files"), - asset_view = "syn23643253", - dataset_id = "syn23643250", - access_token=Sys.getenv("SYNAPSE_PAT")) + + url <- file.path(schematic_url, "v1/storage/projects") + + # typo in url + expect_error( + projects <- storage_projects( + url = file.path(url, "typo"), + asset_view = "syn23643253", + access_token = Sys.getenv("SYNAPSE_PAT")) + ) + + # typo in asset_view + expect_error( + projects <- storage_projects( + url = url, + asset_view = "typo", + access_token = Sys.getenv("SYNAPSE_PAT")) + ) + + # invalid access_token + expect_error( + projects <- storage_projects( + url = url, + asset_view = "syn23643253", + access_token = "bad pat") + ) +}) + +test_that("storage_dataset_files returns a list of files", { + skip_it() + + # success + files <- storage_dataset_files( + url = file.path(schematic_url, "v1/storage/dataset/files"), + asset_view = "syn23643253", + dataset_id = "syn23643250", + access_token = Sys.getenv("SYNAPSE_PAT")) + + expect_true(is.list(files)) + expect_true(length(files) > 0) +}) + +test_that("storage_dataset_files errors as expected", { + skip_it() + + url <- file.path(schematic_url, "v1/storage/dataset/files") + + # bad file path + expect_error( + storage_dataset_files( + url = paste0(url, "typo"), + asset_view = "syn23643253", + dataset_id = "syn23643250", + access_token = Sys.getenv("SYNAPSE_PAT")) + ) + + # bad asset_view + expect_error( + storage_dataset_files( + url = url, + asset_view = "syn23643253333", + dataset_id = "syn23643250", + access_token = Sys.getenv("SYNAPSE_PAT")) + ) + + # bad dataset_id + expect_error( + storage_dataset_files( + url = url, + asset_view = "syn23643253", + dataset_id = "syn2364325000", + access_token = Sys.getenv("SYNAPSE_PAT")) + ) + + # bad PAT + expect_error( + storage_dataset_files( + url = url, + asset_view = "syn23643253", + dataset_id = "syn23643250", + access_token = paste0(Sys.getenv("SYNAPSE_PAT"), "1234")) + ) }) test_that("model_component_requirements returns list of required components", { skip_it() - good <- model_component_requirements(url=file.path(schematic_url, "v1/model/component-requirements"), - schema_url="https://raw.githubusercontent.com/ncihtan/data-models/main/HTAN.model.jsonld", - source_component="Patient", - as_graph = FALSE) - expect_equal(length(good), 8L) - expect_error(model_component_requirements(url=file.path(schematic_url, "v1/model/component-requirements"), - schema_url="https://aaaabad.url.jsonld", - source_component="Patient", - as_graph = FALSE)) + # Successful call + reqs <- model_component_requirements( + url = file.path(schematic_url, "v1/model/component-requirements"), + schema_url = "https://raw.githubusercontent.com/ncihtan/data-models/main/HTAN.model.jsonld", + source_component = "Patient", + as_graph = FALSE) + + expect_equal(length(reqs), 8L) + + # Filepath for url is errant + # returns an empty list() + reqs <- model_component_requirements( + url = file.path(schematic_url, "v1/model/component-requirements-badurl"), + schema_url = "https://raw.githubusercontent.com/ncihtan/data-models/main/HTAN.model.jsonld", + source_component = "Patient", + as_graph = FALSE) + + expect_equal(length(reqs), 0L) + reqs <- model_component_requirements( + url = file.path(schematic_url, "v1/model/component-requirements"), + schema_url = "https://raw.githubusercontent.com/ncihtan/data-models/main/HTAN.model.jsonld", + source_component = "Patient", + as_graph = TRUE) + + #FIXME: Does this output make sense? + expect_equal(length(reqs), 7L) }) -# test_that("manifest_download returns a csv.", { -# skip_it() -# csv <- manifest_download(url=file.path(schematic_url, "v1/manifest/download"), -# manifest_id="syn51078535", -# access_token=Sys.getenv("SYNAPSE_PAT")) -# exp <- setNames(c("BulkRNA-seqAssay", "CSV/TSV", "Sample_A", "GRCm38", NA, 2022L, "syn28278954"), -# c("Component", "File Format", "Filename", "Genome Build", "Genome FASTA", "Sample ID", "entityId")) -# expect_equal(unlist(csv), exp) -# }) +test_that("model_component_requirements errors as expected", { + + # bad schema url + expect_error( + model_component_requirements( + url=file.path(schematic_url, "v1/model/component-requirements"), + schema_url="https://aaaabad.url.jsonld", + source_component="Patient", + as_graph = FALSE) + ) + + # FIXME + # if source component is errant, function seems to run endlessly? + + # reqs <- model_component_requirements( + # url = file.path(schematic_url, "v1/model/component-requirements"), + # schema_url = "https://raw.githubusercontent.com/ncihtan/data-models/main/HTAN.model.jsonld", + # source_component = "xxx", + # as_graph = FALSE) +}) -test_that("get_asset_view_table returns asset view table", { +test_that("manifest_download returns a manifest as a dataframe", { skip_it() - av <- get_asset_view_table(url=file.path(schematic_url, "v1/storage/assets/tables"), - access_token = Sys.getenv("SYNAPSE_PAT"), - asset_view="syn23643253") - storage_tbl <- subset(av, av$name == "synapse_storage_manifest.csv") - expect_true(inherits(av, "data.frame"), "name" %in% names(av)) + + manifest <- manifest_download( + url = file.path(schematic_url, "v1/manifest/download"), + manifest_id = "syn51078535", + access_token = Sys.getenv("SYNAPSE_PAT") + ) + + exp <- setNames(c("BulkRNA-seqAssay", "CSV/TSV", "Sample_A", "GRCm38", NA, 2022L, "syn28278954"), + c("Component", "File Format", "Filename", "Genome Build", "Genome FASTA", "Sample ID", "entityId")) + + expect_equal(unlist(manifest), exp) + expect_true(is.data.frame(manifest)) + expect_true(nrow(manifest) == 1) }) -test_that("asset_tables returns a data.frame", { +test_that("manifest_download errors as expected", { skip_it() - tst <- get_asset_view_table(url=file.path(schematic_url, "v1/storage/assets/tables"), - asset_view = "syn28559058", - access_token = Sys.getenv("SYNAPSE_PAT"), - return_type="json") - expect_identical(nrow(tst), 4L) - expect_error(get_asset_view_table(url=file.path(schematic_url, "v1/storage/assets/tables"), - asset_view = "syn28559058", - access_token = Sys.getenv("SYNAPSE_PAT"), - return_type = "csv") - ) + # errant URL DOESNT ERROR + # outputs a list including status and detail message + error <- manifest_download( + url = file.path(schematic_url, "v1/manifest/download/TYPO"), + manifest_id = "syn51078535", + access_token = Sys.getenv("SYNAPSE_PAT") + ) + + expect_true(is.list(error)) + expect_true(error$status == 404) + + # bad manifest id + expect_error( + manifest_download( + url = file.path(schematic_url, "v1/manifest/download"), + manifest_id = "syn51078535xx", + access_token = Sys.getenv("SYNAPSE_PAT") + ) + ) + + # bad PAT + expect_error( + manifest_download( + url = file.path(schematic_url, "v1/manifest/download"), + manifest_id = "syn51078535", + access_token = "bad PAT" + ) + ) +}) + +test_that("get_asset_view_table returns output as expected", { + skip_it() + + # returns manifest from csv + # FIXME: THIS FAILS (no csv is actually returned) + # TODO: fix or remove csv return as an option + # get_asset_view_table( + # url = file.path(schematic_url, "v1/storage/assets/tables"), + # access_token = Sys.getenv("SYNAPSE_PAT"), + # asset_view ="syn23643253", + # return_type = "csv" + # ) + + # returns manifest from json + asset_view_table <- get_asset_view_table( + url = file.path(schematic_url, "v1/storage/assets/tables"), + access_token = Sys.getenv("SYNAPSE_PAT"), + asset_view ="syn23643253", + return_type = "json" + ) + + expect_true( + nrow(asset_view_table) > 0 & is.data.frame(asset_view_table) + ) +}) + +test_that("graph_by_edge_type returns a list", { + skip_it() + + out <- graph_by_edge_type( + schema_url = schema_url, + relationship = "requiresDependency", + data_model_labels = "class_label" + ) + + expect_true(is.list(out)) + expect_true(length(out) > 0) })