Skip to content

Commit

Permalink
declare yaml package, add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hillalex committed Sep 26, 2024
1 parent de1586f commit 9dd8e7b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ Imports:
redoc,
rlang,
stringr,
tibble
tibble,
yaml
Remotes:
hillalex/porcelain@i39,
Suggests:
Expand Down
9 changes: 1 addition & 8 deletions R/api.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ target_get_individual <- function(req,
color = NULL,
linetype = NULL,
page = 1) {
.data <- value <- NULL

data <- read_dataset(req, name, scale)
dat <- data$data
xcol <- data$xcol
Expand Down Expand Up @@ -244,6 +242,7 @@ get_paged_ids <- function(ids, current_page, page_length) {
}

get_aes <- function(color, linetype, xcol) {
.data <- value <- NULL
if (is.null(color)) {
if (is.null(linetype)) {
aes <- ggplot2::aes(x = .data[[xcol]], y = value)
Expand Down Expand Up @@ -347,12 +346,6 @@ apply_filter <- function(filter, dat, cols) {
dat[dat[filter_var] == filter_level, ]
}

bad_request_response <- function(msg) {
error <- list(error = "BAD_REQUEST",
detail = msg)
return(list(status = "failure", errors = list(error), data = NULL))
}

get_or_create_session_id <- function(req) {
if (is.null(req$session$id)) {
logger::log_info("Creating new session id")
Expand Down
9 changes: 9 additions & 0 deletions R/dataset-validation.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# The POST /dataset endpoint isn't using Porcelain, so we can't use
# porcelain::porcelain_stop when something goes wrong. Instead we have
# to manually return failure responses with the desired error messages
bad_request_response <- function(msg) {
error <- list(error = "BAD_REQUEST",
detail = msg)
return(list(status = "failure", errors = list(error), data = NULL))
}

invalid_file_type <- function(res) {
res$status <- 400L
msg <- "Invalid file type; please upload file of type text/csv."
Expand Down
3 changes: 2 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ RUN install_packages --repo=https://mrc-ide.r-universe.dev \
remotes \
Rook \
stringr \
tibble
tibble \
yaml

RUN Rscript -e "install.packages('remotes')"
RUN Rscript -e 'remotes::install_github("hillalex/porcelain@i39")'
Expand Down

0 comments on commit 9dd8e7b

Please sign in to comment.