Skip to content

Commit 0dd35f8

Browse files
committed
Add upto configure
1 parent 2af60b9 commit 0dd35f8

25 files changed

+1130
-0
lines changed

.Rbuildignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
^CODE_OF_CONDUCT\.md$
2+
^README\.Rmd$
3+
^.*\.Rproj$
4+
^\.Rproj\.user$
5+
^data-raw$
6+
dev_history.R
7+
^dev$
8+
$run_dev.*

CODE_OF_CONDUCT.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Contributor Code of Conduct
2+
3+
As contributors and maintainers of this project, we pledge to respect all people who
4+
contribute through reporting issues, posting feature requests, updating documentation,
5+
submitting pull requests or patches, and other activities.
6+
7+
We are committed to making participation in this project a harassment-free experience for
8+
everyone, regardless of level of experience, gender, gender identity and expression,
9+
sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
10+
11+
Examples of unacceptable behavior by participants include the use of sexual language or
12+
imagery, derogatory comments or personal attacks, trolling, public or private harassment,
13+
insults, or other unprofessional conduct.
14+
15+
Project maintainers have the right and responsibility to remove, edit, or reject comments,
16+
commits, code, wiki edits, issues, and other contributions that are not aligned to this
17+
Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed
18+
from the project team.
19+
20+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by
21+
opening an issue or contacting one or more of the project maintainers.
22+
23+
This Code of Conduct is adapted from the Contributor Covenant
24+
(http://contributor-covenant.org), version 1.0.0, available at
25+
http://contributor-covenant.org/version/1/0/0/

DESCRIPTION

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Package: bdchecks.app
2+
Title: Graphical Interface for bdchecks App
3+
Version: 0.0.0.9000
4+
Authors@R: person('Thiloshon', 'Nagarajah', email = '[email protected]', role = c('cre', 'aut'))
5+
Description: Shiny App giving complete workflow to selectively perform datachecks.
6+
License: What license is it under?
7+
Encoding: UTF-8
8+
LazyData: true
9+
Imports:
10+
shiny,
11+
golem,
12+
htmltools
13+
RoxygenNote: 6.1.1
14+
URL: https://github.com/bd-R/bdchecks.app
15+
BugReports: https://github.com/bd-R/bdchecks.app/issues

NAMESPACE

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by roxygen2: do not edit by hand
2+
3+
export(get_dc_groups)
4+
export(get_dc_ids)
5+
export(mod_configure_checks_server)
6+
export(mod_configure_checks_ui)
7+
export(run_app)
8+
import(bdchecks)
9+
import(bddwc.app)
10+
import(mod_add_data_ui)
11+
import(shiny)
12+
import(shinydashboard)
13+
import(shinyjs)
14+
importFrom(glue,glue)
15+
importFrom(golem,with_golem_options)
16+
importFrom(htmltools,HTML)
17+
importFrom(htmltools,tagAppendAttributes)
18+
importFrom(htmltools,tagList)
19+
importFrom(htmltools,tags)
20+
importFrom(shiny,NS)
21+
importFrom(shiny,column)
22+
importFrom(shiny,shinyApp)
23+
importFrom(shiny,tagList)

R/app_server.R

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#' @import shiny bddwc.app
2+
app_server <- function(input, output,session) {
3+
4+
#------------- Data --------------
5+
data_store <-
6+
shiny::reactiveValues(
7+
data_user = data.frame()
8+
)
9+
#------------- Data --------------
10+
11+
12+
#------------- Modules --------------
13+
data_store$data_user <-
14+
callModule(
15+
bddwc.app::mod_add_data_server,
16+
id = "bdFileInput"
17+
)
18+
19+
callModule(
20+
mod_configure_checks_server,
21+
id = "bdChecksConfigure"
22+
)
23+
24+
#------------- Modules --------------
25+
26+
27+
#------------- Events --------------
28+
observeEvent(input$dataToDictionary, {
29+
dat <- data_store$data_user
30+
31+
if (length(dat()) == 0) {
32+
showNotification("Please add data",
33+
duration = 6)
34+
} else {
35+
updateTabItems(session, "sideBar", "configure")
36+
}
37+
})
38+
39+
#------------- Events --------------
40+
}

R/app_ui.R

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#' @import shiny shinydashboard mod_add_data_ui
2+
app_ui <- function() {
3+
tagList(
4+
dashboardPage(
5+
dashboardHeader(title = "bdchecks"),
6+
7+
dashboardSidebar(sidebarMenu(
8+
id = "sideBar",
9+
menuItem(
10+
"Add Data",
11+
tabName = "add",
12+
icon = icon("plus-circle")
13+
),
14+
menuItem(
15+
"Configure Cleaning",
16+
tabName = "configure",
17+
icon = icon("wrench")
18+
)
19+
# menuItem("Darwinize",
20+
# tabName = "darwinize",
21+
# icon = icon("blocks"))
22+
)),
23+
24+
dashboardBody(
25+
# Leave this function for adding external resources
26+
golem_add_external_resources(),
27+
28+
tabItems(
29+
# ------------- Add Data Module -------------------
30+
tabItem("add",
31+
fluidRow(
32+
div(bddwc.app::mod_add_data_ui("bdFileInput")),
33+
34+
column(12,
35+
div(
36+
id = "dataToDictionaryDiv",
37+
tags$br(),
38+
actionButton("dataToDictionary", "Next: Configure Cleaning")
39+
))
40+
)),
41+
42+
tabItem("configure",
43+
fluidRow(
44+
div(mod_configure_checks_ui("bdChecksConfigure"))
45+
))
46+
)
47+
)
48+
),
49+
tags$script(src = "www/isotope.pkgd.min.js"),
50+
tags$script(src="www/script.js"))
51+
}
52+
53+
#' @import shiny shinyjs
54+
golem_add_external_resources <- function(){
55+
56+
addResourcePath(
57+
'www', system.file('app/www', package = 'bdchecks.app')
58+
)
59+
60+
tags$head(
61+
golem::activate_js(),
62+
golem::favicon(),
63+
useShinyjs(),
64+
65+
tags$link(rel = "stylesheet", type = "text/css", href = "www/input.css"),
66+
tags$link(rel = "stylesheet", type = "text/css", href = "www/style.css"),
67+
tags$link(rel = "stylesheet", type = "text/css", href = "www/shuffle.css")
68+
)
69+
}

R/bd_utils.R

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#' @export
2+
#' @import bdchecks
3+
get_dc_groups <- function(group){
4+
dc_group <- lapply(bdchecks:::data.checks@dc_body, function(x) {
5+
if (group == "DarwinCoreClass") {
6+
data.frame(
7+
DC = x@name,
8+
group = gsub(" ", "_", x@description$DarwinCoreClass),
9+
groupName = gsub("_", " ", x@description$DarwinCoreClass)
10+
)
11+
} else {
12+
data.frame(
13+
DC = x@name,
14+
group = gsub(" ", "_", x@flags[[group]]),
15+
groupName = gsub("_", " ", x@flags[[group]])
16+
)
17+
}
18+
})
19+
do.call(rbind, dc_group)
20+
}
21+
22+
23+
#' @export
24+
#' @import bdchecks
25+
get_dc_ids <- function(){
26+
return(names(bdchecks::data.checks@dc_body))
27+
}

R/golem_utils_server.R

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Inverted versions of in, is.null and is.na
2+
`%not_in%` <- Negate(`%in%`)
3+
4+
not_null <- Negate(is.null)
5+
6+
not_na <- Negate(is.na)
7+
8+
# Removes the null from a vector
9+
drop_nulls <- function(x){
10+
x[!sapply(x, is.null)]
11+
}
12+
13+
# If x is null, return y, otherwise return x
14+
"%||%" <- function(x, y){
15+
if (is.null(x)) {
16+
y
17+
} else {
18+
x
19+
}
20+
}
21+
# If x is NA, return y, otherwise return x
22+
"%|NA|%" <- function(x, y){
23+
if (is.na(x)) {
24+
y
25+
} else {
26+
x
27+
}
28+
}
29+
30+
# typing reactiveValues is too long
31+
rv <- shiny::reactiveValues
32+
rvtl <- shiny::reactiveValuesToList

0 commit comments

Comments
 (0)