From f30212ff142d320d9a24915015131b7d0b4f2eff Mon Sep 17 00:00:00 2001 From: afwillia Date: Wed, 2 Oct 2024 11:05:01 -0700 Subject: [PATCH 1/2] Update model/validate call to accept dataset_scope --- R/schematic_rest_api.R | 9 ++++++--- functions/schematic_rest_api.R | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/R/schematic_rest_api.R b/R/schematic_rest_api.R index fad8baed..6c108cd2 100644 --- a/R/schematic_rest_api.R +++ b/R/schematic_rest_api.R @@ -134,7 +134,8 @@ manifest_validate <- function(url="http://localhost:3001/v1/model/validate", access_token, asset_view = NULL, json_str = NULL, - data_model_labels = "class_label") { + data_model_labels = "class_label", + dataset_scope = NULL) { flattenbody <- function(x) { # A form/query can only have one value per name, so take @@ -175,7 +176,8 @@ manifest_validate <- function(url="http://localhost:3001/v1/model/validate", restrict_rules=restrict_rules, project_scope = project_scope, data_model_labels = data_model_labels, - asset_view = asset_view + asset_view = asset_view, + dataset_scope = dataset_scope ) |> httr2::req_body_multipart(file_name=curl::form_file(file_name)) |> httr2::req_perform() @@ -191,7 +193,8 @@ manifest_validate <- function(url="http://localhost:3001/v1/model/validate", project_scope = project_scope, asset_view = asset_view, data_model_labels = data_model_labels, - json_str = json_str + json_str = json_str, + dataset_scope = dataset_scope ) |> #httr2::req_retry( # max_tries = 3, diff --git a/functions/schematic_rest_api.R b/functions/schematic_rest_api.R index fad8baed..6c108cd2 100644 --- a/functions/schematic_rest_api.R +++ b/functions/schematic_rest_api.R @@ -134,7 +134,8 @@ manifest_validate <- function(url="http://localhost:3001/v1/model/validate", access_token, asset_view = NULL, json_str = NULL, - data_model_labels = "class_label") { + data_model_labels = "class_label", + dataset_scope = NULL) { flattenbody <- function(x) { # A form/query can only have one value per name, so take @@ -175,7 +176,8 @@ manifest_validate <- function(url="http://localhost:3001/v1/model/validate", restrict_rules=restrict_rules, project_scope = project_scope, data_model_labels = data_model_labels, - asset_view = asset_view + asset_view = asset_view, + dataset_scope = dataset_scope ) |> httr2::req_body_multipart(file_name=curl::form_file(file_name)) |> httr2::req_perform() @@ -191,7 +193,8 @@ manifest_validate <- function(url="http://localhost:3001/v1/model/validate", project_scope = project_scope, asset_view = asset_view, data_model_labels = data_model_labels, - json_str = json_str + json_str = json_str, + dataset_scope = dataset_scope ) |> #httr2::req_retry( # max_tries = 3, From c3578899f390f471cec32b3d2c6f3769fefa3ef8 Mon Sep 17 00:00:00 2001 From: afwillia Date: Wed, 2 Oct 2024 11:05:59 -0700 Subject: [PATCH 2/2] Pass selected folder to dataset_scope parameter of model/validate --- server.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server.R b/server.R index eb89e4b8..55743aed 100644 --- a/server.R +++ b/server.R @@ -806,6 +806,7 @@ shinyServer(function(input, output, session) { .dd_template <- input$dropdown_template .restrict_rules <- dcc_config_react()$schematic$model_validate$restrict_rules .project_scope <- NULL + .dataset_scope <- selected$folder() .access_token <- access_token .data_model_labels <- dcc_config_react()$schematic$global$data_model_labels # asset view must be NULL to avoid cross-manifest validation. @@ -834,7 +835,8 @@ shinyServer(function(input, output, session) { project_scope = .project_scope, access_token = .access_token, data_model_labels = .data_model_labels, - asset_view = .asset_view + asset_view = .asset_view, + dataset_scope = .dataset_scope ), { list(list(