forked from PYannick/HighFrequencyChecks
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmod_automatise_report.R
107 lines (88 loc) · 3.41 KB
/
mod_automatise_report.R
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
#' Module UI
#' @title mod_automatise_report_ui and mod_automatise_report_server
#' @description A shiny module.
#' @description A shiny module.
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
#' @import shiny
#' @import shinydashboard
#' @keywords internal
mod_automatise_report_ui <- function(id) {
ns <- NS(id)
tabItem(
tabName = "automatise_report",
fluidRow(
column(
width = 12,
h2('Report Automation'),
p("Congratulation you have now configured your data collection quality
monitoring together with your cleaning and basic anonymiation."),
p("For this process to be effective, it needs to be performed with ",
strong("High Frequency"),
" so that the output of this process (aka a report and the 2 additional versions of your data uploaded directly on ridl)
is generated regularly."),
p("This level of automation can actually be implemented using the ",
tags$a(href="https://docs.posit.co/connect/user/scheduling/", "POSIT Connect Report Scheduling"),
". For this you will need to get a published account on the server or
to share the report file for instance with support colleagues in DIMA that publish it for you"),
p("Once published visit",
tags$a(href="https://rstudio.unhcr.org", "POSIT Connect UNHCR server"),
" to set up the RIDL token environment variables, the scheduling and the list of recipient for the HighFrequncyChecks report")
) ),
fluidRow(
shinydashboard::box(
title = "Set up report ",
# status = "primary",
status = "info",
solidHeader = FALSE,
collapsible = TRUE,
#background = "light-blue",
width = 12,
checkboxInput(inputId = ns("positaccount"),
label = " I have a publisher account on Posit Connect",
width = '400px'),
div(
id = ns("hasposit"),
passwordInput(inputId = ns("token"),
label = "Paste below your personal Posit Connect token"),
verbatimTextOutput(outputId = ns("validationposit")),
hr(),
actionButton( inputId = ns("connectpublish"),
label = "Push your report into connect",
width = "400px" ),
verbatimTextOutput(outputId = ns("validationconnect"))
),
div(
id = ns("noposit"),
downloadButton(outputId = ns("downloadnotebook"),
"Download the file for the automatised report
that you can then share with DIMA for publication"),
)
)
)
)
}
#' Module Server
#' @noRd
#' @import shiny
#' @import tidyverse
#' @keywords internal
mod_automatise_report_server <- function(input, output, session, AppReactiveValue) {
ns <- session$ns
observeEvent(input$positaccount, {
if(isTRUE(input$positaccount)) {
golem::invoke_js("show", paste0("#", ns("hasposit")))
golem::invoke_js("hide", paste0("#", ns("noposit")))
} else {
golem::invoke_js("hide", paste0("#", ns("hasposit")))
golem::invoke_js("show", paste0("#", ns("noposit")))
}
})
}
## copy to body.R
# mod_automatise_report_ui("automatise_report_ui_1")
## copy to sidebar.R
# shinydashboard::menuItem("displayName",tabName = "automatise_report",icon = icon("user"))
## and copy to app_server.R
# callModule(mod_automatise_report_server, "automatise_report_ui_1", AppReactiveValue)