diff --git a/.Rbuildignore b/.Rbuildignore index f7decba..23f5539 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -2,3 +2,8 @@ ^\.Rproj\.user$ ^LICENSE\.md$ ^\.github$ +^LICENSE\.md$ +^docker$ +^\.github$ +^\.idea$ +^\uploads$ \ No newline at end of file diff --git a/DESCRIPTION b/DESCRIPTION index 1f8d8c7..2672a5e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,19 +1,24 @@ Package: serovizr -Title: R API for seroviz app +Title: R API for SeroViz app Version: 0.0.0 Authors@R: person("Alex", "Hill", , "alex.hill@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0009-0003-8104-1890")) -Description: +Description: "R API for SeroViz app." License: GPL (>= 3) Encoding: UTF-8 Roxygen: list(markdown = TRUE) RoxygenNote: 7.3.1 Imports: docopt, - porcelain, + jsonlite, logger, - Rook + mgcv, + plumber, + porcelain, + Rook, + stringr, + tibble Remotes: reside-ic/porcelain, Suggests: diff --git a/R/api.R b/R/api.R index 6fc5683..5fa1694 100644 --- a/R/api.R +++ b/R/api.R @@ -8,7 +8,7 @@ target_get_version <- function() { target_post_dataset <- function(req, res) { parsed <- Rook::Multipart$parse(req) - file_body <- read.csv(parsed$file$tempfile) + file_body <- utils::read.csv(parsed$file$tempfile) filename <- parsed$file$filename filename <- stringr::str_remove_all(filename, paste0(".", tools::file_ext(filename))) path <- file.path("uploads", filename) @@ -27,7 +27,7 @@ target_post_dataset <- function(req, res) { return(list(status = "failure", errors = list(error), data = NULL)) } - write.csv(file_body, path, row.names = FALSE) + utils::write.csv(file_body, path, row.names = FALSE) return(filename) } @@ -85,7 +85,7 @@ read_dataset <- function(name) { porcelain::porcelain_stop(paste("Did not find dataset with name ", name), code = "BAD_REQUEST", status_code = 404L) } - dat <- read.csv(path) + dat <- utils::read.csv(path) dat$value <- as.numeric(dat$value) dat } @@ -102,7 +102,7 @@ model_out <- function(dat) { } range <- range(dat$day, na.rm = TRUE) xseq <- range[1]:range[2] - list(x = xseq, y = predict(m, tibble::data_frame(day = xseq))) + list(x = xseq, y = stats::predict(m, tibble::data_frame(day = xseq))) } data_out <- function(dat) { diff --git a/README.md b/README.md index ed798ba..832616f 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ [![Project Status: Concept – Minimal or no implementation has been done yet, or the repository is only intended to be a limited example, demo, or proof-of-concept.](https://www.repostatus.org/badges/latest/concept.svg)](https://www.repostatus.org/#concept) -[![R build status](https://github.com/seroanalytics/serovizr/workflows/R-CMD-check/badge.svg)](https://github.com/seroanalytics/serovizr/actions) -[![Codecov test coverage](https://codecov.io/gh/seroanalytics/serovizr/branch/master/graph/badge.svg)](https://codecov.io/gh/seroanalytics/serovizr?branch=master) +[![R-CMD-check.yaml](https://github.com/seroanalytics/serovizr/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/seroanalytics/serovizr/actions/workflows/R-CMD-check.yaml)[![Codecov test coverage](https://codecov.io/gh/seroanalytics/serovizr/branch/master/graph/badge.svg)](https://codecov.io/gh/seroanalytics/serovizr?branch=master) R API for the SeroViz app. Based on the [porcelain](https://github.com/reside-ic/porcelain) framework. diff --git a/tests/testthat/test-upload-dataset.R b/tests/testthat/test-upload-dataset.R deleted file mode 100644 index 117188b..0000000 --- a/tests/testthat/test-upload-dataset.R +++ /dev/null @@ -1,10 +0,0 @@ -test_that("returns error", { - res <- jsonlite::fromJSON(target_post_dataset()) - expect_equal(res, as.character(packageVersion("serovizr"))) - - router <- build_routes() - res_api <- router$request("POST", "/dataset/") - expect_equal(res_api$status, 200) - body <- jsonlite::fromJSON(res_api$body) - expect_equal(res, body$data) -}) diff --git a/tests/testtthat.R b/tests/testtthat.R index 17a59bb..ef33452 100644 --- a/tests/testtthat.R +++ b/tests/testtthat.R @@ -1,4 +1,4 @@ library(testthat) library(serovizr) -test_check("mintr") +test_check("serovizr")