Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #21 #25 remove mention of _all in yamls and edits mapping spec vignette #27

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ Remotes:
gsm=Gilead-BioStats/gsm@gsm-core-test
Suggests:
clindata,
DT,
knitr,
reactable,
rmarkdown,
testthat,
tibble
Expand Down
11 changes: 0 additions & 11 deletions R/ApplySpec.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@
#' @export

ApplySpec <- function(dfSource, columnSpecs, domain) {
# Add all columns to the spec if '_all' is present.
if ("_all" %in% names(columnSpecs)) {
missingColumnSpecs <- setdiff(names(dfSource), names(columnSpecs))

for (column in missingColumnSpecs) {
columnSpecs[[column]] <- list()
}

columnSpecs[["_all"]] <- NULL
}

# write a query to select the columns from the source
columnMapping <- columnSpecs %>%
imap(
Expand Down
46 changes: 37 additions & 9 deletions vignettes/mapping_spec.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Each of the above 13 domains generally map directly 1-to-1 from a raw source, ex

```{r raw, echo = FALSE, message = FALSE, error = FALSE}
library(dplyr)
library(DT)
library(gsm)
library(gsm.mapping)
library(reactable)
# Source Data
lSource <- list(
Source_SUBJ = clindata::rawplus_dm,
Expand Down Expand Up @@ -103,13 +103,41 @@ raw_result <- lapply(names(mappings_wf), function(domain_name) {
# Combine all domains into one table
raw_final_table <- do.call(rbind, raw_result)
row.names(raw_final_table) <- NULL
raw_final_table %>%
DT::datatable(
extensions = 'FixedColumns',
options = list(
scrollX = FALSE,
fixedColumns = TRUE
),
rownames = FALSE
# raw_final_table %>%
# DT::datatable(
# extensions = 'FixedColumns',
# options = list(
# scrollX = FALSE,
# fixedColumns = TRUE
# ),
# rownames = FALSE
# )

reactable(
raw_final_table,
groupBy = "Domain",
defaultPageSize = 5,
bordered = FALSE, # Removes unnecessary borders
highlight = TRUE, # Highlights row on hover
theme = reactableTheme(
borderColor = "#dee2e6",
backgroundColor = "white",
style = list(
fontFamily = "Arial, sans-serif",
fontSize = "14px"
),
headerStyle = list(
fontWeight = "bold",
fontSize = "16px",
backgroundColor = "#f8f9fa",
borderBottom = "2px solid #dee2e6"
)
),
columns = list(
Domain = colDef(name = "Domain", style = list(fontWeight = "bold", fontSize = "15px")),
Source_Variable = colDef(name = "Source Variable"),
Mapped_Variable = colDef(name = "Mapped Variable"),
Type = colDef(name = "Type")
)
)
```