Skip to content

Commit f33264a

Browse files
committed
contributing.md added
1 parent 407c12e commit f33264a

14 files changed

Lines changed: 137 additions & 68 deletions

CONTRIBUTING.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Contributing to {carver}
2+
3+
This outlines how to propose a change to {carver}.
4+
5+
## Making Changes
6+
7+
If you want to make a change, it's a good idea to first file an issue and make sure someone from the team agrees that it’s needed.
8+
Per pfizer-opensource policies, only those listed as collaborators can raise issues.
9+
If you’ve found a bug, please email the maintainer (`smriti.anand@pfizer.com`) illustrating the bug with a minimal
10+
[reprex](https://www.tidyverse.org/help/#reprex) (this will also help you write a unit test, if needed).
11+
Alternatively if you have access to the COSA community Slack channel for {carver}, you can raise it there.
12+
See guide on [how to create a great issue](https://code-review.tidyverse.org/issues/) for more advice.
13+
14+
### Pull request process
15+
16+
* Fork the package and clone onto your computer.
17+
18+
* If needed, install all development dependencies with `devtools::install_dev_deps()`, and then make sure the package passes R CMD check by running `devtools::check()`.
19+
If R CMD check doesn't pass cleanly, it's a good idea to ask for help before continuing.
20+
* Create a Git branch for your pull request (PR).
21+
22+
* Make your changes, commit to git, and then create a PR.
23+
The title of your PR should briefly describe the change.
24+
The body of your PR should contain `Closes #issue-number`.
25+
26+
* For user-facing changes, add a bullet to the top of `NEWS.md` (i.e. just below the first header). Follow the style described in <https://style.tidyverse.org/news.html>.
27+
28+
### Code Style
29+
30+
* New code should follow the tidyverse [style guide](https://style.tidyverse.org).
31+
You can use the [styler](https://CRAN.R-project.org/package=styler) package to apply these styles, but please don't restyle code that has nothing to do with your PR.
32+
33+
* To apply the appropriate style with styler please use `styler:::style_active_pkg()` or `styler::style_file()`
34+
35+
* We use [roxygen2](https://cran.r-project.org/package=roxygen2), with [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html), for documentation.
36+
37+
* We use [testthat](https://cran.r-project.org/package=testthat) for unit tests.
38+
Contributions with test cases included are easier to accept.
39+
40+
* All helper/non-exported functions are documented with roxygen2 as indicated above.
41+
Include `#' @keywords internal` to mark the function as internal.
42+
Any helper functions that appear in examples will need to use the `carver:::`
43+
prefix.
44+
45+
### Error Handling
46+
47+
TBD
48+
49+
### Package Dependencies
50+
51+
Additional package dependencies should be considered after exhausting other possibilities. If you do need to add one,
52+
email the maintainer or collaborators/start a discussion to make a decision on the necessity of it.
53+
Once agreed upon, the dependency can be added to the package via the relevant files.
54+
55+
## Scope
56+
57+
The {carver} package will be an open-source tool and package to enable generation of
58+
common analysis reports (tables and interactive plots) for clinical
59+
review and direct inclusion in submission for regulatory agencies
60+
61+
## Deprecation Cycle
62+
63+
TBD
64+
65+
## Code of Conduct
66+
67+
Please note that the carver project is released with a
68+
[Contributor Code of Conduct](CODE_OF_CONDUCT.md). By contributing to this
69+
project you agree to abide by its terms.

R/app_server.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ app_server <- function(input, output, session) {
6767
removeUI("#readData")
6868
runjs("Shiny.setInputValue('data_upload', true);")
6969
}
70-
}) %>%
70+
}) |>
7171
bindEvent(adam_read())
7272

7373
rep_inputs <- mod_report_selection_server(

R/event_interval.R

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ interval_plot <- function(datain,
5555
xaxislab = "Start and End Study Day",
5656
yaxislab = "") {
5757
# Filter subject and get info
58-
ad_plot <- datain %>%
59-
filter(USUBJID == subjectid) %>%
58+
ad_plot <- datain |>
59+
filter(USUBJID == subjectid) |>
6060
mutate(Status = case_when(
6161
(is.na(get(startvar)) & get(endvar) >= 0) ~ "End Day",
6262
(is.na(get(endvar)) & get(startvar) >= 0) ~ "Start Day",
6363
(!is.na(get(startvar)) & !is.na(get(endvar))) ~ "Complete",
6464
TRUE ~ "Remove"
65-
)) %>%
65+
)) |>
6666
filter(Status != "Remove")
6767
# Check if no data left and return accordingly
6868
if (nrow(ad_plot) == 0) {
@@ -81,8 +81,8 @@ interval_plot <- function(datain,
8181
series_color <- g_seriescol(ad_plot, series_color, seriesvar)
8282
}
8383
# Hover Information:
84-
ad_plot <- ad_plot %>%
85-
select(all_of(c("USUBJID", startvar, endvar, yvar, seriesvar, "Status"))) %>%
84+
ad_plot <- ad_plot |>
85+
select(all_of(c("USUBJID", startvar, endvar, yvar, seriesvar, "Status"))) |>
8686
mutate(
8787
HOVER_TEXT = paste0(
8888
!!sym(yvar), "\n",
@@ -94,15 +94,15 @@ interval_plot <- function(datain,
9494
!!yvar := as.factor(!!sym(yvar))
9595
)
9696
# Use data with both dates present for segment plot
97-
segmentdata <- ad_plot %>%
97+
segmentdata <- ad_plot |>
9898
filter(Status == "Complete")
9999

100100
# Use data with either Start or end dates only for scatter plot
101-
scatterdata <- ad_plot %>%
102-
filter(Status != "Complete" | !!sym(startvar) == !!sym(endvar)) %>%
103-
tidyr::pivot_longer(all_of(c(startvar, endvar)), names_to = "key", values_to = "Value") %>%
104-
filter(!is.na(Value)) %>%
105-
select(-key) %>%
101+
scatterdata <- ad_plot |>
102+
filter(Status != "Complete" | !!sym(startvar) == !!sym(endvar)) |>
103+
tidyr::pivot_longer(all_of(c(startvar, endvar)), names_to = "key", values_to = "Value") |>
104+
filter(!is.na(Value)) |>
105+
select(-key) |>
106106
distinct(.keep_all = TRUE)
107107

108108
# Create ggplot object - segment plot for Complete intervals and scatter for incomplete

R/mod_data_check.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ mod_data_check_server <- function(id, sourcedata, domain) {
9999
{
100100
req(input$data_varlist)
101101

102-
data_lkup <- sourcedata()[[domain()]] %>%
102+
data_lkup <- sourcedata()[[domain()]] |>
103103
select(unlist(strsplit(paste(input$data_varlist, collapse = ","), ",")))
104104

105105
datatable(

R/mod_data_read.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ mod_data_read_server <-
4545
ui_data_source = source(),
4646
ui_adam_data = adam_data
4747
)
48-
}) %>%
48+
}) |>
4949
bindEvent(read_btn())
5050
})
5151
}

R/mod_download_report.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ mod_download_report_server <- function(id, repType, repName, repNum, save_fmt, t
8181
}
8282
}
8383
print("save report object created")
84-
}) %>%
84+
}) |>
8585
bindEvent(list(repType(), toutput(), goutput(), save_fmt()))
8686

8787
observe({

R/mod_generic_filters.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ mod_generic_filters_server <-
424424
"Analysis Subset",
425425
text
426426
)
427-
}) %>%
427+
}) |>
428428
bindEvent(repName())
429429

430430
# observer to control showing/hiding inputs based on report selection
@@ -563,7 +563,7 @@ mod_generic_filters_server <-
563563

564564
rv$ae_pre_comp <- rv$ae_pre_comp + 1
565565
}
566-
}) %>%
566+
}) |>
567567
bindEvent(
568568
list(
569569
repName(), input$ae_filter, input$period, input$period_spec
@@ -714,7 +714,7 @@ mod_generic_filters_server <-
714714
})
715715
print("AE treatment pair processing end")
716716
}
717-
}) %>%
717+
}) |>
718718
bindEvent(list(rv$ae_pre_comp, rv$ment_out))
719719

720720
# Tornado Plot
@@ -741,7 +741,7 @@ mod_generic_filters_server <-
741741
selected = c("Primary System Organ Class (AESOC)" = "AESOC")
742742
)
743743
}
744-
}) %>%
744+
}) |>
745745
bindEvent(list(
746746
repName()
747747
))
@@ -919,7 +919,7 @@ mod_generic_filters_server <-
919919

920920
print("AE Tornado plot pre-processing end")
921921
}
922-
}) %>%
922+
}) |>
923923
bindEvent(list(
924924
repName(), trt_var(), trt_sort(), popfilter(),
925925
input$ae_filter, input$ae_catvar, input$period, input$period_spec,
@@ -938,10 +938,10 @@ mod_generic_filters_server <-
938938
req(input$overall_subset)
939939
print("Edish process start")
940940

941-
merged_df <- sourcedata()$adsl %>%
941+
merged_df <- sourcedata()$adsl |>
942942
adsl_merge(
943943
dataset_add = filter(sourcedata()$adlb, !!!rlang::parse_exprs(input$a_subset))
944-
) %>%
944+
) |>
945945
mentry(
946946
subset = input$overall_subset,
947947
byvar = NA_character_,
@@ -955,14 +955,14 @@ mod_generic_filters_server <-
955955
sgtotalyn = "N",
956956
add_grpmiss = ifelse(repType() == "Table", input$grpvarmiss, "N")
957957
)
958-
rv$ae_pre <- merged_df %>%
958+
rv$ae_pre <- merged_df |>
959959
process_edish_data(
960960
alt_paramcd = "ALT",
961961
ast_paramcd = "AST",
962962
bili_paramcd = "BILI"
963963
)
964964
print("Edish process ends")
965-
}) %>%
965+
}) |>
966966
bindEvent(list(
967967
trt_var(), trt_sort(), popfilter(), input$apply_gen_filt
968968
))

R/mod_goutput.R

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ mod_goutput_server <- function(id, sourcedata, repName, filters, process_btn) {
150150
)
151151
print("AE risk_stat process end")
152152
rv$output_trigger <- rv$output_trigger + 1
153-
}) %>%
153+
}) |>
154154
bindEvent(process_btn())
155155

156156
observe({
@@ -199,7 +199,7 @@ mod_goutput_server <- function(id, sourcedata, repName, filters, process_btn) {
199199
"Dashed Vertical line represents risk value reference line \n",
200200
"The number of participants reporting at least 1 occurrence of the event specified."
201201
)
202-
}) %>%
202+
}) |>
203203
bindEvent(rv$output_trigger)
204204

205205
observe({
@@ -255,7 +255,7 @@ mod_goutput_server <- function(id, sourcedata, repName, filters, process_btn) {
255255
"are not necessarily the sum of those at the lower",
256256
"levels since a participant may report two or more."
257257
)
258-
}) %>%
258+
}) |>
259259
bindEvent(rv$output_trigger)
260260

261261
observe({
@@ -289,7 +289,7 @@ mod_goutput_server <- function(id, sourcedata, repName, filters, process_btn) {
289289
rv$footnote <- ""
290290
})
291291
print("AE Tornado Plot process end")
292-
}) %>%
292+
}) |>
293293
bindEvent(process_btn())
294294

295295
observe({
@@ -333,7 +333,7 @@ mod_goutput_server <- function(id, sourcedata, repName, filters, process_btn) {
333333
})
334334
rv$title <- "eDISH Plot of Laboratory Data"
335335
rv$footnote <- ""
336-
}) %>%
336+
}) |>
337337
bindEvent(process_btn())
338338

339339
observe({
@@ -506,7 +506,7 @@ mod_goutput_server <- function(id, sourcedata, repName, filters, process_btn) {
506506
)
507507
})
508508
print("AE event analysis process end")
509-
}) %>%
509+
}) |>
510510
bindEvent(process_btn())
511511

512512
plot_data <- reactive({
@@ -521,11 +521,11 @@ mod_goutput_server <- function(id, sourcedata, repName, filters, process_btn) {
521521
} else {
522522
test <- rv$outdata$query_df
523523
trt_level_diff <- length(levels(test$TRTVAR)) - length(unique(test$TRTVAR))
524-
test <- test %>%
524+
test <- test |>
525525
mutate(point_n = as.numeric(as.factor(TRTVAR)) - trt_level_diff)
526-
order_df <- data.frame(DPTVAL = levels(reorder(test$DPTVAL, -test$DECODh))) %>%
526+
order_df <- data.frame(DPTVAL = levels(reorder(test$DPTVAL, -test$DECODh))) |>
527527
mutate(curve_n = row_number() + 1)
528-
test <- full_join(test, order_df, by = "DPTVAL") %>%
528+
test <- full_join(test, order_df, by = "DPTVAL") |>
529529
filter(point_n == event$x, curve_n == event$curveNumber)
530530
}
531531
}
@@ -545,20 +545,20 @@ mod_goutput_server <- function(id, sourcedata, repName, filters, process_btn) {
545545
relocate(c("USUBJID", "TRTVAR"))
546546

547547
## displaying the listing table
548-
plot_table <- plot_table %>%
548+
plot_table <- plot_table |>
549549
rename(
550550
!!filters()$ae_hlt := "BYVAR1",
551551
!!filters()$trt_var := "TRTVAR"
552-
) %>%
552+
) |>
553553
distinct()
554-
}) %>%
554+
}) |>
555555
bindEvent(plotly::event_data("plotly_click", source = "plot_output"))
556556

557557
# set selected point to null every time plot updates
558558
observe({
559559
req(length(plotly::event_data("plotly_click", source = "plot_output")) > 0)
560560
runjs("Shiny.setInputValue('plotly_click-plot_output', null);")
561-
}) %>%
561+
}) |>
562562
bindEvent(list(repName(), rv$goutput$x$data, rv$goutput$plot$data))
563563

564564
observe({

R/mod_plot_profile.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ mod_plot_profile_server <- function(id, sourcedata, sel_rows, datain, plot_data)
8585
footer = tagList(actionButton(ns("closeCM"), "Close", class = "sidebar-btn"))
8686
))
8787
}
88-
}) %>%
88+
}) |>
8989
bindEvent(sel_rows())
9090

9191
observe({
@@ -99,7 +99,7 @@ mod_plot_profile_server <- function(id, sourcedata, sel_rows, datain, plot_data)
9999
ui_adam_data = input$cm_data
100100
)$adam
101101
rv$sourcedata <- append(sourcedata(), cm_data)
102-
}) %>%
102+
}) |>
103103
bindEvent(input$closeCM)
104104

105105
observe({

0 commit comments

Comments
 (0)