Skip to content

Commit ab33519

Browse files
committed
Revert "post-release-cleanup (#247)"
This reverts commit 78a5aab.
1 parent ad09cf3 commit ab33519

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1004
-1487
lines changed

.lintr

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
linters: linters_with_defaults(
22
line_length_linter = line_length_linter(120),
33
cyclocomp_linter = NULL,
4-
object_usage_linter = NULL
4+
object_usage_linter = NULL,
5+
indentation_linter = NULL
56
)

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ Date: 2024-02-19
55
Authors@R: c(
66
person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre"),
77
comment = c(ORCID = "0000-0001-9533-457X")),
8-
person("Kartikeya", "Kirar", , "kartikeya.kirar@businesspartner.roche.com", role = "aut",
9-
comment = c(ORCID = "0009-0005-1258-4757")),
8+
person("Kartikeya", "Kirar", , "kartikeya.kirar@businesspartner.roche.com", role = "aut"),
109
person("Marcin", "Kosinski", , "marcin.kosinski.mk1@roche.com", role = "aut"),
1110
person("Maciej", "Nasinski", role = "aut"),
1211
person("Konrad", "Pagacz", role = "aut"),

R/AddCardModule.R

Lines changed: 37 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,10 @@
1-
#' Add card button module
2-
#'
1+
#' Add Card Button User Interface
32
#' @description `r lifecycle::badge("experimental")`
4-
#'
5-
#' Provides a button to add views/cards to a report.
3+
#' button for adding views/cards to the Report.
64
#'
75
#' For more details see the vignette: `vignette("simpleReporter", "teal.reporter")`.
8-
#'
9-
#' @details
10-
#' The `card_fun` function is designed to create a new `ReportCard` instance and optionally customize it:
11-
#' - The `card` parameter allows for specifying a custom or default `ReportCard` instance.
12-
#' - Use the `comment` parameter to add a comment to the card via `card$append_text()` - if `card_fun` does not
13-
#' have the `comment` parameter, then `comment` from `Add Card UI` module will be added at the end of the content of the
14-
#' card.
15-
#' - The `label` parameter enables customization of the card's name and its content through `card$append_text()`-
16-
#' if `card_fun` does not have the `label` parameter, then card name will be set to the name passed in
17-
#' `Add Card UI` module, but no text will be added to the content of the `card`.
18-
#'
19-
#' This module supports using a subclass of [`ReportCard`] for added flexibility.
20-
#' A subclass instance should be passed as the default value of
21-
#' the `card` argument in the `card_fun` function.
22-
#' See below:
23-
#' ```{r}
24-
#' CustomReportCard <- R6::R6Class(
25-
#' classname = "CustomReportCard",
26-
#' inherit = teal.reporter::ReportCard
27-
#' )
28-
#'
29-
#' custom_function <- function(card = CustomReportCard$new()) {
30-
#' card
31-
#' }
32-
#' ```
33-
#' @name add_card_button
34-
#'
35-
#' @param id (`character(1)`) this `shiny` module's id.
36-
#' @param reporter (`Reporter`) instance.
37-
#' @param card_fun (`function`) which returns a [`ReportCard`] instance. See `Details`.
38-
#'
39-
#' @return `NULL`.
40-
NULL
41-
42-
#' @rdname add_card_button
6+
#' @param id `character(1)` this `shiny` module's id.
7+
#' @return `shiny::tagList`
438
#' @export
449
add_card_button_ui <- function(id) {
4510
ns <- shiny::NS(id)
@@ -81,7 +46,39 @@ add_card_button_ui <- function(id) {
8146
)
8247
}
8348

84-
#' @rdname add_card_button
49+
#' Add Card Button Server
50+
#' @description `r lifecycle::badge("experimental")`
51+
#' server for adding views/cards to the Report.
52+
#'
53+
#' For more details see the vignette: `vignette("simpleReporter", "teal.reporter")`.
54+
#'
55+
#' @details
56+
#' This module allows using a child of [`ReportCard`] instead of [`ReportCard`].
57+
#' To properly support this, an instance of the child class must be passed
58+
#' as the default value of the `card` argument in the `card_fun` function.
59+
#' See below:
60+
#' ```{r}
61+
#' CustomReportCard <- R6::R6Class( # nolint: object_name_linter.
62+
#' classname = "CustomReportCard",
63+
#' inherit = teal.reporter::ReportCard
64+
#' )
65+
#'
66+
#' custom_function <- function(card = CustomReportCard$new()) {
67+
#' card
68+
#' }
69+
#' ```
70+
#'
71+
#' @param id `character(1)` this `shiny` module's id.
72+
#' @param reporter [`Reporter`] instance.
73+
#' @param card_fun `function` which returns a [`ReportCard`] instance. It can have optional `card`, `comment` and
74+
#' `label` parameters. If `card` parameter is added, then the `ReportCard` instance is created for the user.
75+
#' Use `comment` parameter to pass it's value whenever you prefer with `card$append_text()` - if `card_fun` does not
76+
#' have `comment` parameter, then `comment` from `Add Card UI` module will be added at the end of the content of the
77+
#' card. If `label` parameter is provided, you can use it to customize appearance of the `card name` and use if to
78+
#' specify `card` content with `card$append_text()` - if `card_fun` does not have `label` parameter, then `card name`
79+
#' will be set to the name passed in `Add Card UI` module, but no text will be added to the content of the `card`.
80+
#'
81+
#' @return `shiny::moduleServer`
8582
#' @export
8683
add_card_button_srv <- function(id, reporter, card_fun) {
8784
checkmate::assert_function(card_fun)

R/Archiver.R

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
#' @title `Archiver`: Base class for data archiving
2-
#' @docType class
3-
#' @description
4-
#' A base `R6` class for implementing data archiving functionality.
5-
#'
1+
#' @title `Archiver`
62
#' @keywords internal
73
Archiver <- R6::R6Class( # nolint: object_name_linter.
84
classname = "Archiver",
95
public = list(
10-
#' @description Initialize an `Archiver` object.
6+
#' @description Returns an `Archiver` object.
117
#'
12-
#' @return Object of class `Archiver`, invisibly.
8+
#' @return an `Archiver` object
139
#' @examples
1410
#' Archiver <- getFromNamespace("Archiver", "teal.reporter")
1511
#' Archiver$new()
@@ -20,14 +16,12 @@ Archiver <- R6::R6Class( # nolint: object_name_linter.
2016
finalize = function() {
2117
# destructor
2218
},
23-
#' @description Reads data from the `Archiver`.
24-
#' Pure virtual method that should be implemented by inherited classes.
19+
#' @description Pure virtual method for reading an `Archiver`.
2520
read = function() {
2621
# returns Reporter instance
2722
stop("Pure virtual method.")
2823
},
29-
#' @description Writes data to the `Archiver`.
30-
#' Pure virtual method that should be implemented by inherited classes.
24+
#' @description Pure virtual method for writing an `Archiver`.
3125
write = function() {
3226
stop("Pure virtual method.")
3327
}
@@ -36,20 +30,15 @@ Archiver <- R6::R6Class( # nolint: object_name_linter.
3630
lock_class = TRUE
3731
)
3832

39-
#' @title `FileArchiver`: A File-based `Archiver`
40-
#' @docType class
41-
#' @description
42-
#' Inherits from `Archiver` to provide file-based archiving functionality.
43-
#' Manages an output directory for storing archived data.
44-
#'
33+
#' @title `RDSArchiver`
4534
#' @keywords internal
4635
FileArchiver <- R6::R6Class( # nolint: object_name_linter.
4736
classname = "FileArchiver",
4837
inherit = Archiver,
4938
public = list(
50-
#' @description Initialize a `FileArchiver` object with a unique output directory.
39+
#' @description Returns a `FileArchiver` object.
5140
#'
52-
#' @return Object of class `FileArchiver`, invisibly.
41+
#' @return a `FileArchiver` object
5342
#' @examples
5443
#' FileArchiver <- getFromNamespace("FileArchiver", "teal.reporter")
5544
#' FileArchiver$new()
@@ -61,11 +50,10 @@ FileArchiver <- R6::R6Class( # nolint: object_name_linter.
6150
invisible(self)
6251
},
6352
#' @description Finalizes a `FileArchiver` object.
64-
#' Cleans up by removing the output directory and its contents.
6553
finalize = function() {
6654
unlink(private$output_dir, recursive = TRUE)
6755
},
68-
#' @description Get `output_dir` field.
56+
#' @description get `output_dir` field
6957
#'
7058
#' @return `character` a `output_dir` field path.
7159
#' @examples
@@ -80,34 +68,25 @@ FileArchiver <- R6::R6Class( # nolint: object_name_linter.
8068
)
8169
)
8270

83-
#' @title `JSONArchiver`: A `JSON`-based `Archiver`
84-
#' @docType class
85-
#' @description
86-
#' Inherits from `FileArchiver` to implement `JSON`-based archiving functionality.
87-
#' Convert `Reporter` instances to and from `JSON` format.
88-
#'
71+
#' @title `JSONArchiver`
8972
#' @keywords internal
9073
JSONArchiver <- R6::R6Class( # nolint: object_name_linter.
9174
classname = "JSONArchiver",
9275
inherit = FileArchiver,
9376
public = list(
94-
#' @description Write a `Reporter` instance in `JSON` file.
95-
#' Serializes a given `Reporter` instance and saves it in the `Archiver`'s output directory,
96-
#' to this `JSONArchiver` object.
77+
#' @description write a `Reporter` instance in to this `JSONArchiver` object.
9778
#'
98-
#' @param reporter (`Reporter`) instance.
79+
#' @param reporter `Reporter` instance.
9980
#'
100-
#' @return `self`.
81+
#' @return invisibly self
10182
#' @examples
102-
#' library(ggplot2)
103-
#'
10483
#' ReportCard <- getFromNamespace("ReportCard", "teal.reporter")
10584
#' card1 <- ReportCard$new()
10685
#'
10786
#' card1$append_text("Header 2 text", "header2")
10887
#' card1$append_text("A paragraph of default text", "header2")
10988
#' card1$append_plot(
110-
#' ggplot(iris, aes(x = Petal.Length)) + geom_histogram()
89+
#' ggplot2::ggplot(iris, ggplot2::aes(x = Petal.Length)) + ggplot2::geom_histogram()
11190
#' )
11291
#'
11392
#' Reporter <- getFromNamespace("Reporter", "teal.reporter")
@@ -124,22 +103,19 @@ JSONArchiver <- R6::R6Class( # nolint: object_name_linter.
124103
reporter$to_jsondir(private$output_dir)
125104
self
126105
},
127-
#' @description Read a `Reporter` instance from a `JSON` file.
128-
#' Converts a `Reporter` instance from the `JSON` file in the `JSONArchiver`'s output directory.
106+
#' @description read a `Reporter` instance from a directory with `JSONArchiver`.
129107
#'
130-
#' @param path (`character(1)`) a path to the directory with all proper files.
108+
#' @param path `character(1)` a path to the directory with all proper files.
131109
#'
132110
#' @return `Reporter` instance.
133111
#' @examples
134-
#' library(ggplot2)
135-
#'
136112
#' ReportCard <- getFromNamespace("ReportCard", "teal.reporter")
137113
#' card1 <- ReportCard$new()
138114
#'
139115
#' card1$append_text("Header 2 text", "header2")
140116
#' card1$append_text("A paragraph of default text", "header2")
141117
#' card1$append_plot(
142-
#' ggplot(iris, aes(x = Petal.Length)) + geom_histogram()
118+
#' ggplot2::ggplot(iris, ggplot2::aes(x = Petal.Length)) + ggplot2::geom_histogram()
143119
#' )
144120
#'
145121
#' Reporter <- getFromNamespace("Reporter", "teal.reporter")

R/ContentBlock.R

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
1-
#' @title `ContentBlock`: A building block for report content
2-
#' @docType class
3-
#' @description This class represents a basic content unit in a report,
4-
#' such as text, images, or other multimedia elements.
5-
#' It serves as a foundation for constructing complex report structures.
6-
#'
1+
#' @title `ContentBlock`
72
#' @keywords internal
83
ContentBlock <- R6::R6Class( # nolint: object_name_linter.
94
classname = "ContentBlock",
105
public = list(
11-
#' @description Initialize a `ContentBlock` object.
6+
#' @description Returns a `ContentBlock` object.
127
#'
138
#' @details Returns a `ContentBlock` object with no content and the default style.
149
#'
15-
#' @return Object of class `ContentBlock`, invisibly.
10+
#' @return `ContentBlock`
1611
#' @examples
1712
#' ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
1813
#' ContentBlock$new()
@@ -23,9 +18,9 @@ ContentBlock <- R6::R6Class( # nolint: object_name_linter.
2318
},
2419
#' @description Sets content of this `ContentBlock`.
2520
#'
26-
#' @param content (`character(0)` or `character(1)`) string or file path assigned to this `ContentBlock`
21+
#' @param content (`character(0)` or `character(1)`) a string literal or a file path assigned to this `ContentBlock`
2722
#'
28-
#' @return `self`, invisibly.
23+
#' @return invisibly self
2924
#' @examples
3025
#' ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
3126
#' block <- ContentBlock$new()
@@ -36,9 +31,9 @@ ContentBlock <- R6::R6Class( # nolint: object_name_linter.
3631
private$content <- content
3732
invisible(self)
3833
},
39-
#' @description Retrieves the content assigned to this block.
34+
#' @description Returns the absolute path to content of this `ContentBlock`
4035
#'
41-
#' @return `character` string or file path assigned to this `ContentBlock`.
36+
#' @return `character` content of this `ContentBlock`
4237
#' @examples
4338
#' ContentBlock <- getFromNamespace("ContentBlock", "teal.reporter")
4439
#' block <- ContentBlock$new()
@@ -49,10 +44,10 @@ ContentBlock <- R6::R6Class( # nolint: object_name_linter.
4944
},
5045
#' @description Create the `ContentBlock` from a list.
5146
#'
52-
#' @param x (`named list`) with two fields `text` and `style`.
47+
#' @param x `named list` with two fields `c("text", "style")`.
5348
#' Use the `get_available_styles` method to get all possible styles.
5449
#'
55-
#' @return `self`, invisibly.
50+
#' @return invisibly self
5651
from_list = function(x) {
5752
invisible(self)
5853
},
@@ -67,7 +62,7 @@ ContentBlock <- R6::R6Class( # nolint: object_name_linter.
6762
content = character(0),
6863
# @description The copy constructor.
6964
#
70-
# @param name (`character(1)`) the name of the field
65+
# @param name `character(1)` the name of the field
7166
# @param value the value assigned to the field
7267
#
7368
# @return the value of the copied field

0 commit comments

Comments
 (0)