Commit 541192b8 authored by Lorenz Kapsner's avatar Lorenz Kapsner
Browse files

added gitlab-ci, added sitename to filenames, fixed r cmd check results

Showing with 150 additions and 19 deletions
+150 -19
......@@ -4,3 +4,4 @@
^LICENSE\.md$
^docker$
^inst/application/_settings$
^\.gitlab-ci\.yml$
variables:
_R_CHECK_CRAN_INCOMING_: "false"
_R_CHECK_FORCE_SUGGESTS_: "true"
CI_IMAGE_NAME: "rocker/verse"
CI_IMAGE_TAG: "3.6.1"
R_PKG_NAME: "DQAgui"
default:
image: ${CI_IMAGE_NAME}:${CI_IMAGE_TAG}
before_script:
- echo "options('repos' = 'https://ftp.fau.de/cran/')" >> /usr/local/lib/R/etc/Rprofile.site
- R -e "devtools::install_deps(pkg = '.', upgrade = 'always')"
- R -e "devtools::install_dev_deps(pkg = '.', upgrade = 'always')"
- mkdir -p ci
stages:
- build
- test
- deploy
check:
stage: build
script:
- R -e "devtools::check(pkg = '.', args = c('--no-tests'), build_args = c('--no-build-vignettes'), check_dir = '${CI_PROJECT_DIR}/ci')"
artifacts:
paths:
- "${CI_PROJECT_DIR}/ci/*.Rcheck"
when: on_failure # upload check artifacts when job fails!
expire_in: 1 week
create_manual:
stage: build
script:
- R -e "devtools::build_manual(pkg = '.', path = '${CI_PROJECT_DIR}/ci')"
artifacts:
paths:
- "${CI_PROJECT_DIR}/ci/*.pdf"
expire_in: 1 week
build_source:
stage: build
script:
- R -e "devtools::build(pkg = '.', path = '${CI_PROJECT_DIR}/ci', binary = FALSE, vignettes = FALSE)"
artifacts:
paths:
- "${CI_PROJECT_DIR}/ci/*.tar.gz"
expire_in: 1 week
build_binary:
stage: build
script:
- R -e "devtools::build(pkg = '.', path = '${CI_PROJECT_DIR}/ci', binary = TRUE, vignettes = FALSE)"
artifacts:
paths:
- "${CI_PROJECT_DIR}/ci/*.tar.gz"
expire_in: 1 week
# To have the coverage percentage appear as a gitlab badge follow these
# instructions:
# https://docs.gitlab.com/ee/user/project/pipelines/settings.html#test-coverage-parsing
# The coverage parsing string is
# Coverage: \d+\.\d+
coverage:
stage: test
allow_failure: true
when: on_success
script:
- R -e "install.packages('DT')"
- R -e "covr::gitlab(quiet = FALSE)"
artifacts:
paths:
- public
testing:
stage: test
allow_failure: true
when: on_success
script:
- R -e "devtools::test(pkg = '.')"
# To produce a code coverage report as a GitLab page see
# https://about.gitlab.com/2016/11/03/publish-code-coverage-report-with-gitlab-pages/
install:
stage: deploy
script:
- R -e "devtools::install(pkg = '.', upgrade = 'always')"
......@@ -13,7 +13,7 @@ URL: https://gitlab.miracum.org/miracum-dqa/dqagui
BugReports: https://gitlab.miracum.org/miracum-dqa/dqagui/issues
Encoding: UTF-8
Copyright: Universitätsklinikum Erlangen
Date/Publication: 2019-11-05 15:25:31 UTC
Date: 2019-11-11
Imports:
data.table,
magrittr,
......@@ -30,3 +30,6 @@ Imports:
Suggests:
testthat,
processx
Remotes:
git::git@gitlab.miracum.org:miracumdqa/dqastats.git
RoxygenNote: 6.1.1
# DQAgui - A graphical user interface (GUI) to the functions implemented in the R package 'DQAstats'.
# DQAgui - A graphical user interface (GUI) to the functions implemented in the
# R package 'DQAstats'.
# Copyright (C) 2019 Universitätsklinikum Erlangen
#
# This program is free software: you can redistribute it and/or modify
......@@ -18,12 +19,16 @@
#' @title Launch the DQA graphical user interface (GUI)
#'
#' @param port The port, the MIRACUM DQA Tool is running on (default: 3838)
#' @param utilspath The path to the utilities-folder, containing the metadata repository files (`mdr.csv` inside the folder `MDR`),
#' JSON files with SQL statements (inside the folder `SQL`), config files for the database connection (`settings_default.yml`)
#' and the email address used for the data map (`email.yml`), a JSON file containing site names (inside the folder `MISC`) and a
#' markdown templated to create the PDF report (`DQA_report.Rmd` inside the folder `RMD`).
#' @param db_source The name of the source database. Currently, the only allowed argument is `p21csv` used for the import of the
#' corresponding csv files.
#' @param utilspath The path to the utilities-folder, containing the metadata
#' repository files (`mdr.csv` inside the folder `MDR`), JSON files with SQL
#' statements (inside the folder `SQL`), config files for the database
#' connection (`settings_default.yml`) and the email address used for the
#' data map (`email.yml`), a JSON file containing site names (inside the
#' folder `MISC`) and a markdown templated to create the PDF report
#' (`DQA_report.Rmd` inside the folder `RMD`).
#' @param db_source The name of the source database. Currently, the only
#' allowed argument is `p21csv` used for the import of the corresponding
#' csv files.
#'
#' @return DQAgui Shiny application
#'
......@@ -34,10 +39,34 @@
#' @export
#'
launchApp <- function(port=3838, utilspath, db_source){
launchApp <- function(port=3838,
utilspath,
db_source) {
global_env_hack <- function(key,
val,
pos) {
assign(
key,
val,
envir = as.environment(pos)
)
}
global_env_hack(
key = "utilspath",
val = utilspath,
pos = 1L
)
global_env_hack(
key = "db_source",
val = db_source,
pos = 1L
)
options(shiny.port = port)
assign("utilspath", utilspath, envir = .GlobalEnv)
assign("db_source", db_source, envir = .GlobalEnv)
shiny::shinyAppDir(appDir = system.file("application", package = "DQAgui"))
}
......
......@@ -93,6 +93,8 @@ moduleReportServer <- function(input,
gsub("\\-|\\:| ",
"",
substr(rv$start.time, 1, 16)),
"_",
rv$sitename,
".pdf")
},
content = function(file){
......@@ -116,6 +118,8 @@ moduleReportServer <- function(input,
gsub("\\-|\\:| ",
"",
substr(rv$start.time, 1, 16)),
"_",
rv$sitename,
".zip")
},
content = function(fname) {
......
......@@ -21,7 +21,7 @@ my_desc$set(Title = "DQA GUI")
# The description of your package
my_desc$set(Description = "A graphical user interface (GUI) to the functions implemented in the R package 'DQAstats'.")
# The description of your package
my_desc$set("Date/Publication" = paste(as.character(Sys.time()), "UTC"))
my_desc$set("Date" = as.character(Sys.Date()))
# The urls
my_desc$set("URL", "https://gitlab.miracum.org/miracum-dqa/dqagui")
my_desc$set("BugReports",
......@@ -67,8 +67,10 @@ usethis::use_package("testthat", type = "Suggests")
usethis::use_package("processx", type = "Suggests")
# Development package
# https://remotes.r-lib.org/articles/dependencies.html
devtools::install_git(url = "https://gitlab.miracum.org/miracum-dqa/dqastats.git", ref = "master", upgrade = "always")
usethis::use_dev_package("DQAstats", type = "Imports")
# https://cran.r-project.org/web/packages/devtools/vignettes/dependencies.html
desc::desc_set_remotes("git::git@gitlab.miracum.org:miracumdqa/dqastats.git", file = usethis::proj_get())
# buildignore and gitignore
usethis::use_build_ignore("docker")
......
......@@ -9,13 +9,17 @@ launchApp(port = 3838, utilspath, db_source)
\arguments{
\item{port}{The port, the MIRACUM DQA Tool is running on (default: 3838)}
\item{utilspath}{The path to the utilities-folder, containing the metadata repository files (`mdr.csv` inside the folder `MDR`),
JSON files with SQL statements (inside the folder `SQL`), config files for the database connection (`settings_default.yml`)
and the email address used for the data map (`email.yml`), a JSON file containing site names (inside the folder `MISC`) and a
markdown templated to create the PDF report (`DQA_report.Rmd` inside the folder `RMD`).}
\item{utilspath}{The path to the utilities-folder, containing the metadata
repository files (`mdr.csv` inside the folder `MDR`), JSON files with SQL
statements (inside the folder `SQL`), config files for the database
connection (`settings_default.yml`) and the email address used for the
data map (`email.yml`), a JSON file containing site names (inside the
folder `MISC`) and a markdown templated to create the PDF report
(`DQA_report.Rmd` inside the folder `RMD`).}
\item{db_source}{The name of the source database. Currently, the only allowed argument is `p21csv` used for the import of the
corresponding csv files.}
\item{db_source}{The name of the source database. Currently, the only
allowed argument is `p21csv` used for the import of the corresponding
csv files.}
}
\value{
DQAgui Shiny application
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment