-
Notifications
You must be signed in to change notification settings - Fork 1
/
deployment.Rmd
151 lines (118 loc) · 5.6 KB
/
deployment.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
---
title: 'Deployment and Customization'
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Deployment and Customization}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include=FALSE}
# knitr::opts_chunk$set(echo = TRUE, message=FALSE, eval=FALSE)
# require(ggplot2)
# require(rhandsontable)
# require(flextable)
# require(ruminate)
# # Determining if ubiquity is installed
# if(system.file(package="ubiquity") == ""){
# ubiquity_found = FALSE
# } else {
# require(ubiquity)
# ubiquity_found = TRUE
# }
# if(system.file(package="gridExtra") == ""){
# gridExtra_found = FALSE
# } else {
# require(gridExtra)
# gridExtra_found = TRUE
# }
#
# # The presim variable will contain presimulated data when eval is set to true
# presim_loaded = FALSE
```
```{r echo=FALSE, results=FALSE}
# presim= list()
# if(file.exists("NCA_presim.RData")){
# file.remove("NCA_presim.RData")
# }
```
```{r echo=FALSE, results=FALSE, eval=TRUE}
# if(file.exists("NCA_presim.RData")){
# load("NCA_presim.RData")
# presim_loaded = TRUE
# }
#
# NCA_yaml = yaml::read_yaml(system.file(package="ruminate", "templates","NCA.yaml"))
```
# Introduction
Running ruminate is simple and straight forward using the ruminate function:
```r
library(ruminate)
ruminate()
```
This is the default and presents all of the modules in the standard format. However you may wish deploy ruminate on an internal server or customize it.
# Deployment
To deploy ruminate you can create a copy of the app based on a template in the package:
```r
file.copy(from = system.file(package="ruminate","templates", "ruminate.R"),
to = "App.R")
```
Certain features of the app behave differently depending on whether it is running locally or deployed on a server. To *tell* the App it is deployed you need to create an empty file named `DEPLOYED` in the same directory as the deployed app file.
```r
file.create("DEPLOYED")
```
Those two files (`App.R` and `DEPLOYED`) placed in the same direcory on a shiny
server with ruminate installed should be enough to deploy the basic app.
# Customization
You can open the `App.R` file and run the app locally from there as well. You can also edit this file to customize the app. This includes the default text that is presented, any graphics you might want, and also the color scheme. Beyond that the individual modules are also customizable.
## App Layout
The app is built around modules and the overall look and introductory text is controlled by this file. The default app uses the `{shinydashboard}` package. You can look through the documentation for that package to alter tabs, the default skin color, module icons, etc. The default package contains all of the modules, but you can simply remove the tabs for any modules you do not want.
## Individual Modules
At the top of the `App.R` file the locations of module configuration files are defined:
```{r, eval=FALSE}
formods.yaml = system.file(package="formods", "templates", "formods.yaml")
ASM.yaml = system.file(package="formods", "templates", "ASM.yaml")
UD.yaml = system.file(package="formods", "templates", "UD.yaml")
DW.yaml = system.file(package="formods", "templates", "DW.yaml")
FG.yaml = system.file(package="formods", "templates", "FG.yaml")
NCA.yaml = system.file(package="ruminate", "templates", "NCA.yaml")
MB.yaml = system.file(package="ruminate", "templates", "MB.yaml")
CTS.yaml = system.file(package="ruminate", "templates", "CTS.yaml")
```
Each of these controls different aspects of the module including the text displayed, icons used, certain behaviors of the app, default values, etc. These options and are described in the comments of the configuration files. To use these you need to first make a copy of the specific configuration file. For example, to customize the NCA module you would make a copy of the `NCA.yaml` file:
```{r, eval=FALSE}
file.copy(from = system.file(package="ruminate", "templates", "NCA.yaml"),
to = "myNCA.yaml")
```
Then you can make any changes you want in the `myNCA.yaml` file. Then you need specify in the `App.R` file that you want to use the new configuration file.
```{r, eval=FALSE}
NCA.yaml = "myNCA.yaml"
```
You can do the same thing for the other modules as well.
## Reporting Templates
To use your own organizational templates you need to create `onbrand` Word and
PowerPoint templates using the methods described here:
- [Creating onbrand templates](https://onbrand.ubiquity.tools/articles/Custom_Office_Templates.html)
- [formods reporting templates](https://formods.ubiquity.tools/articles/included_modules.html#avialable-modules)
Place the Word (`report.docx`), PowerPoint (`report.pptx`), and YAML (`report.yaml`) files
in a `templates` directory. Then you need to create a copy of the `formods` YAML file
in the deployment folder.
```{r, eval=FALSE}
file.copy(from = system.file(package="formods", "templates", "formods.yaml"),
to = "myformods.yaml")
```
Next you need to edit the `myformods.yaml` file to ensure those new files are used by editing the `include` section to update the sources for each file. See below:
```{r, eval=FALSE}
FM:
include:
files:
- file:
source: 'file.path(".", "templates", "report.docx")'
dest: 'file.path("config","report.docx")'
- file:
source: 'file.path(".", "templates", "report.pptx")'
dest: 'file.path("config","report.pptx")'
- file:
source: 'file.path(".", "templates", "report.yaml")'
dest: 'file.path("config","report.yaml")'
```
Then change the `App.R` file to point to the new `myformods.yaml` file.