launch_app.R 2.09 KB
Newer Older
Lorenz Kapsner's avatar
Lorenz Kapsner committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

kapsner's avatar
kapsner committed
17
18
#' @title Launch the DQA graphical user interface (GUI)
#'
19
20
21
22
23
24
25
#' @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.
kapsner's avatar
kapsner committed
26
27
28
29
30
31
32
33
34
35
#'
#' @return DQAgui Shiny application
#'
#' @import shiny shinydashboard
#' @importFrom magrittr "%>%"
#' @importFrom data.table .N ":="
#'
#' @export
#'

36
launchApp <- function(port=3838, utilspath, db_source){
kapsner's avatar
kapsner committed
37
  options(shiny.port = port)
38
39
  assign("utilspath", utilspath, envir = .GlobalEnv)
  assign("db_source", db_source, envir = .GlobalEnv)
kapsner's avatar
kapsner committed
40
41
  shiny::shinyAppDir(appDir = system.file("application", package = "DQAgui"))
}
42
43
44

# debugging
# launchApp(utilspath = DQAstats::cleanPathName_(system.file("application/_utilities", package = "miRacumDQA")), db_source = "p21csv")