Skip to content

Commit 7dcb59e

Browse files
Merge pull request #253 from Biogen-Inc/rh-survival
`v0.2.2` - making survival plots more robust!
2 parents f41ed77 + cc4a66a commit 7dcb59e

38 files changed

Lines changed: 13476 additions & 2243 deletions

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ vignettes/x0*
3030
^CRAN-SUBMISSION$
3131
^scripts$
3232
\.sass$
33+
manifest.json
34+
^\.posit$

.github/workflows/pkgdown.yaml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,17 @@ jobs:
2929
use-public-rspm: true
3030

3131
- uses: r-lib/actions/setup-renv@v2
32-
with:
33-
extra-packages: any::pkgdown, local::.
34-
needs: website
3532

36-
- name: Install specific pkgdown version
37-
run: install.packages("remotes") ; remotes::install_version("pkgdown", version = "2.0.3", repos = "cran.rstudio.com", dependencies = FALSE)
33+
- name: Install dev dependencies
34+
run: install.packages(c("pkgdown", "devtools", "covr"))
3835
shell: Rscript {0}
3936

4037
- name: Install tidyCDISC
4138
shell: bash
4239
run: R CMD INSTALL --preclean .
4340

4441
- name: Build site
45-
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
42+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = TRUE)
4643
shell: Rscript {0}
4744

4845
- name: Deploy to GitHub pages 🚀

.github/workflows/test-coverage.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ jobs:
2424
use-public-rspm: true
2525

2626
- uses: r-lib/actions/setup-renv@v2
27-
with:
28-
extra-packages: covr
27+
28+
- name: Install dev dependencies
29+
run: install.packages(c("devtools", "covr"))
30+
shell: Rscript {0}
2931

3032
- name: Install tidyCDISC
3133
shell: bash

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ docs/
88
revdep/
99
/doc/
1010
/Meta/
11+
/.posit

DESCRIPTION

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: tidyCDISC
22
Title: Quick Table Generation & Exploratory Analyses on ADaM-Ish Datasets
3-
Version: 0.2.1
3+
Version: 0.2.2
44
Authors@R: c(
55
person("Aaron", "Clark", , "clark.aaronchris@gmail.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0002-0123-0970")),
@@ -10,6 +10,8 @@ Authors@R: c(
1010
person("Maya", "Gans", , "maya.gans@biogen.com", role = "aut"),
1111
person("Robert", "Krajcik", , "robert.krajcik@biogen.com", role = "ctb"),
1212
person("Marly", "Gotti", , "marly.cormar@biogen.com", role = "ctb"),
13+
person("Ryan", "Harrison", , "harrison.ryan.w@gmail.com", role = "aut",
14+
comment = c(ORCID = "0000-0003-4575-006X")),
1315
person("Biogen", "Inc", role = "cph")
1416
)
1517
Description: Provides users a quick exploratory dive into common
@@ -36,40 +38,56 @@ License: AGPL (>= 3)
3638
URL: https://github.com/Biogen-Inc/tidyCDISC/, https://Biogen-Inc.github.io/tidyCDISC/
3739
BugReports: https://github.com/Biogen-Inc/tidyCDISC/issues
3840
Depends:
39-
R (>= 2.10)
41+
R (>= 4.1)
4042
Imports:
43+
arrow,
44+
broom.helpers,
4145
cicerone,
46+
cli,
4247
config,
4348
dplyr,
4449
DT,
50+
fs,
4551
GGally,
4652
ggcorrplot,
4753
ggplot2,
54+
ggsurvfit,
4855
glue,
4956
golem,
5057
gt,
58+
gtsummary,
5159
haven,
5260
IDEAFilter,
61+
pkgload,
5362
plotly,
5463
purrr,
64+
readxl,
5565
rlang,
5666
rmarkdown,
5767
shiny,
5868
shinyjs,
5969
shinyWidgets,
6070
sjlabelled,
71+
stringdist,
6172
stringr,
6273
survival,
74+
tibble,
6375
tidyr,
76+
tidyselect,
6477
timevis,
65-
tippy (== 0.1.0)
78+
tippy (== 0.1.0),
79+
vroom
6680
Suggests:
81+
devtools,
6782
knitr,
83+
shinyalert,
6884
spelling,
6985
testthat
7086
VignetteBuilder:
7187
knitr
88+
Config/Needs/website: pkgdown
89+
Config/Needs/coverage: covr
7290
Encoding: UTF-8
7391
Language: en-US
7492
LazyData: true
75-
RoxygenNote: 7.2.3
93+
RoxygenNote: 7.3.3

NAMESPACE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
S3method(error_handler,default)
4+
S3method(error_handler,purrr_error_indexed)
5+
S3method(error_handler,rlang_error)
36
export(app_methods)
47
export(col_for_list_expr)
58
export(common_rownames)
@@ -36,6 +39,11 @@ importFrom(ggplot2,ggplot)
3639
importFrom(ggplot2,labs)
3740
importFrom(ggplot2,scale_color_manual)
3841
importFrom(ggplot2,scale_x_continuous)
42+
importFrom(ggsurvfit,add_censor_mark)
43+
importFrom(ggsurvfit,add_confidence_interval)
44+
importFrom(ggsurvfit,add_risktable)
45+
importFrom(ggsurvfit,ggsurvfit)
46+
importFrom(ggsurvfit,survfit2)
3947
importFrom(glue,glue)
4048
importFrom(golem,activate_js)
4149
importFrom(golem,add_resource_path)
@@ -111,6 +119,7 @@ importFrom(shinyjs,useShinyjs)
111119
importFrom(sjlabelled,get_label)
112120
importFrom(sjlabelled,set_label)
113121
importFrom(stats,as.formula)
122+
importFrom(stats,reformulate)
114123
importFrom(stringr,str_detect)
115124
importFrom(stringr,str_locate_all)
116125
importFrom(stringr,str_remove)

NEWS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# tidyCDISC 0.2.2
2+
3+
### General
4+
* Add ADaM validation functions
5+
* Allow more input file types: csv, parquet, txt, xls, xlsx
6+
* Add Ryan Harrison as author
7+
8+
### Population Explorer - KM plots
9+
* Refactor from plotly to ggsurvfit
10+
* Add estimated median table
11+
* Add estimate survival probabilities table
12+
* Add time-axis ticks configuration
13+
* Enable multiple groups
14+
* Add Cox PH Hazard Ratios table
115

216
# tidyCDISC 0.2.1 (CRAN Release)
317

R/global.R

Lines changed: 83 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
utils::globalVariables(c(
22
"AEDECOD",
3-
"AESER",
3+
"AESER",
44
"AESEV",
55
"AESTDT",
66
"..prop..",
@@ -29,17 +29,17 @@ utils::globalVariables(c(
2929
"value",
3030
"ymax",
3131
"ymin",
32-
"stats",
33-
"as.dist",
34-
"cor",
32+
"stats",
33+
"as.dist",
34+
"cor",
3535
"hclust",
3636
"PopuExplor",
37-
"AVAL",
38-
"AVISIT",
39-
"AVISITN",
40-
"CMDECOD",
41-
"CMSTDT",
42-
"DECODE",
37+
"AVAL",
38+
"AVISIT",
39+
"AVISITN",
40+
"CMDECOD",
41+
"CMSTDT",
42+
"DECODE",
4343
"DOMAIN",
4444
"END",
4545
"EVENTTYP",
@@ -48,7 +48,7 @@ utils::globalVariables(c(
4848
"LBDY",
4949
"LBSTNRHI",
5050
"LBSTNRLO",
51-
"MHCAT",
51+
"MHCAT",
5252
"MHDECOD",
5353
"MHENDTC",
5454
"MHSTDTC",
@@ -57,8 +57,8 @@ utils::globalVariables(c(
5757
"PARAMCD",
5858
"START",
5959
"USUBJID",
60-
"VISIT",
61-
"Visit",
60+
"VISIT",
61+
"Visit",
6262
"all_of",
6363
"className",
6464
"col_exist",
@@ -74,7 +74,7 @@ utils::globalVariables(c(
7474
"hcl",
7575
"min_lbdt",
7676
"missing_disp",
77-
"not_exist",
77+
"not_exist",
7878
"not_exist_disp",
7979
"ord",
8080
"setNames",
@@ -113,20 +113,73 @@ utils::globalVariables(c(
113113
"adtte",
114114
"warn",
115115
"dy_min",
116-
"AEACN", "AEACNOTH", "AREL", "CNSR", "FASFL", "ITTFL", "LOWER", "Lower",
117-
"MEAN", "Mean (SD)",
118-
"Median", "Min | Max", "N", "PANEL", "Q1 | Q3", "SAFFL", "SEM", "STD",
119-
"TRTEMFL", "UPPER", "Upper",
120-
"Variable", "ae_data", "avals_by", "bds_data", "colour", "colour2",
121-
"corr", "corr_lab",
122-
"corr_lab_hover", "descr", "grp", "id_block", "id_desc", "id_rn",
123-
"id_stat", "inner_sort",
124-
"lab", "n_subgroups", "n_tot", "orig_id_rn", "orig_var_rn", "param_x",
125-
"param_y", "pt", "pval",
126-
"pval_hover", "sort_n", "v", "var", "var_rn", "where", "y",
127-
"type", "title"
128-
,":=",
129-
"DATE", "EVENT_TIME", "DATE_ST", "DECODE_ST", "DATE_EN", "DECODE_EN"
116+
"AEACN",
117+
"AEACNOTH",
118+
"AREL",
119+
"CNSR",
120+
"FASFL",
121+
"ITTFL",
122+
"LOWER",
123+
"Lower",
124+
"MEAN",
125+
"Mean (SD)",
126+
"Median",
127+
"Min | Max",
128+
"N",
129+
"PANEL",
130+
"Q1 | Q3",
131+
"SAFFL",
132+
"SEM",
133+
"STD",
134+
"TRTEMFL",
135+
"UPPER",
136+
"Upper",
137+
"Variable",
138+
"ae_data",
139+
"avals_by",
140+
"bds_data",
141+
"colour",
142+
"colour2",
143+
"corr",
144+
"corr_lab",
145+
"corr_lab_hover",
146+
"descr",
147+
"grp",
148+
"id_block",
149+
"id_desc",
150+
"id_rn",
151+
"id_stat",
152+
"inner_sort",
153+
"lab",
154+
"n_subgroups",
155+
"n_tot",
156+
"orig_id_rn",
157+
"orig_var_rn",
158+
"param_x",
159+
"param_y",
160+
"pt",
161+
"pval",
162+
"pval_hover",
163+
"sort_n",
164+
"v",
165+
"var",
166+
"var_rn",
167+
"where",
168+
"y",
169+
"type",
170+
"title",
171+
":=",
172+
"DATE",
173+
"EVENT_TIME",
174+
"DATE_ST",
175+
"DECODE_ST",
176+
"DATE_EN",
177+
"DECODE_EN",
178+
"time",
179+
"est_ci",
180+
"Strata",
181+
"0.95LCL",
182+
"0.95UCL",
183+
"label",
184+
"id"
130185
))
131-
132-

R/mod_dataUpload.R

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ mod_dataUpload_ui <- function(id){
4141
div(style="display: inline-block; ",h3("Data upload")),
4242
div(style="display: inline-block; float:right;",mod_dataComplyRules_ui("dataComplyRules_ui_1")),
4343
HTML("<br>ADSL file is mandatory & BDS/ OCCDS files are optional"),
44-
fileInput(ns("file"), "Upload sas7bdat files",accept = c(".sas7bdat"), multiple = TRUE),
44+
# fileInput(ns("file"), "Upload sas7bdat files",accept = c(".sas7bdat"), multiple = TRUE),
45+
fileInput(ns("file"), "Upload datasets", accept = c(".txt", ".csv", ".xls", ".xlsx", ".sas7bdat"), multiple = TRUE),
4546
uiOutput(ns("radio_test"))
4647
)
4748
),
@@ -91,18 +92,25 @@ mod_dataUpload_server <- function(input, output, session){
9192
data_list <- list()
9293

9394
## data list
94-
for (i in 1:nrow(input$file)){
95-
if(length(grep(".sas7bdat", input$file$name[i], ignore.case = TRUE)) > 0){
96-
data_list[[i]] <- haven::zap_formats(haven::read_sas(input$file$datapath[i])) %>%
97-
dplyr::mutate(dplyr::across(.cols = where(is.character),
98-
.fns = na_if, y = ""))
99-
}else{
100-
data_list[[i]] <- NULL
101-
}
102-
}
95+
# for (i in 1:nrow(input$file)){
96+
# if(length(grep(".sas7bdat", input$file$name[i], ignore.case = TRUE)) > 0){
97+
# data_list[[i]] <- haven::zap_formats(haven::read_sas(input$file$datapath[i])) %>%
98+
# dplyr::mutate(dplyr::across(.cols = where(is.character),
99+
# .fns = na_if, y = ""))
100+
# }else{
101+
# data_list[[i]] <- NULL
102+
# }
103+
# }
104+
105+
data_list <- input$file$datapath |>
106+
purrr::map(\(x) {
107+
read_data(x)
108+
}) |>
109+
purrr::set_names(toupper(tools::file_path_sans_ext(input$file$name)))
110+
103111

104112
# names
105-
names(data_list) <- toupper(stringr::str_remove(input$file$name, ".sas7bdat"))
113+
# names(data_list) <- toupper(stringr::str_remove(input$file$name, ".sas7bdat"))
106114

107115

108116

@@ -111,11 +119,19 @@ mod_dataUpload_server <- function(input, output, session){
111119
id = NULL, #"dataComply_ui_1",
112120
datalist = reactive(data_list))
113121

122+
# if(length(names(dl_comply)) > 0){
123+
# # append to existing reactiveValues list
124+
# dd$data <- c(dd$data, dl_comply) # dl_comply #
125+
126+
# }
114127
if(length(names(dl_comply)) > 0){
115-
# append to existing reactiveValues list
116-
dd$data <- c(dd$data, dl_comply) # dl_comply #
128+
# Normalize ADaM dataset names based on domain validation
129+
dl_normalized <- normalize_adam_datasets(dl_comply)
117130

131+
# append to existing reactiveValues list
132+
dd$data <- c(dd$data, dl_normalized)
118133
}
134+
119135

120136
# set dd$current to FALSE for previous & TRUE for current uploads
121137
dd$current <- c(rep(FALSE, length(dd$current)), rep(TRUE, length(data_list)))

0 commit comments

Comments
 (0)