-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.qmd
324 lines (269 loc) · 11.2 KB
/
index.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
---
title: 'Engineering a Reliable R Package for Regulatory Use Using “rpact” as an Example'
subtitle: 'useR! 2024, Salzburg, Austria'
date: 07/10/2024
date-format: long
author: Friedrich Pahlke and Gernot Wassmer
affiliation: RPACT
institute: RPACT
format:
revealjs:
theme: [default, custom.scss]
logo: ../figures/logo_full.png
fontsize: 34px
toc: false
slide-number: true
progress: true
code-line-numbers: true
mouse-wheel: false
link-external-newwindow: true
footer: '[useR! 2024 | Salzburg]{.footer-text} [<svg xmlns="http://www.w3.org/2000/svg" height="1.0em" viewBox="0 0 384 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --> <path d="M48 0C21.5 0 0 21.5 0 48V464c0 26.5 21.5 48 48 48h96V432c0-26.5 21.5-48 48-48s48 21.5 48 48v80h96c26.5 0 48-21.5 48-48V48c0-26.5-21.5-48-48-48H48zM64 240c0-8.8 7.2-16 16-16h32c8.8 0 16 7.2 16 16v32c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V240zm112-16h32c8.8 0 16 7.2 16 16v32c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V240c0-8.8 7.2-16 16-16zm80 16c0-8.8 7.2-16 16-16h32c8.8 0 16 7.2 16 16v32c0 8.8-7.2 16-16 16H272c-8.8 0-16-7.2-16-16V240zM80 96h32c8.8 0 16 7.2 16 16v32c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16zm80 16c0-8.8 7.2-16 16-16h32c8.8 0 16 7.2 16 16v32c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V112zM272 96h32c8.8 0 16 7.2 16 16v32c0 8.8-7.2 16-16 16H272c-8.8 0-16-7.2-16-16V112c0-8.8 7.2-16 16-16z"/> </svg>](https://www.rpact.com/ "RPACT Website"){preview-link="false" .external target="_blank"} [<svg xmlns="http://www.w3.org/2000/svg" height="1.0em" viewBox="0 0 448 512"> <!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --> <path d="M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"/> </svg>](https://www.linkedin.com/company/rpact/ "RPACT @ LinkedIn"){preview-link="false" .external target="_blank"} [<svg xmlns="http://www.w3.org/2000/svg" height="1.0em" viewBox="0 0 512 512"><!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --><path d="M256 64C150 64 64 150 64 256s86 192 192 192c17.7 0 32 14.3 32 32s-14.3 32-32 32C114.6 512 0 397.4 0 256S114.6 0 256 0S512 114.6 512 256v32c0 53-43 96-96 96c-29.3 0-55.6-13.2-73.2-33.9C320 371.1 289.5 384 256 384c-70.7 0-128-57.3-128-128s57.3-128 128-128c27.9 0 53.7 8.9 74.7 24.1c5.7-5 13.1-8.1 21.3-8.1c17.7 0 32 14.3 32 32v80 32c0 17.7 14.3 32 32 32s32-14.3 32-32V256c0-106-86-192-192-192zm64 192a64 64 0 1 0 -128 0 64 64 0 1 0 128 0z"/> </svg>](https://www.rpact.com/contact "Contact"){preview-link="false" .external target="_blank"}'
title-slide-attributes:
data-background-image: "../figures/logo_full.png"
data-background-size: "200px 200px"
data-background-position: "20px 20px"
data-background-opacity: "1"
include-in-header:
- text: |
<link href="./favicon.ico" rel="icon" />
---
## Automation
**Automation of recurring validation processes/activities**
```{r}
#| echo: TRUE
#| eval: FALSE
#| code-line-numbers: "3,4,5,6,7,8,10,11,12"
library(rpact.validator)
createNewsTexFile()
createBaseRPackagesTable()
createOutputSpecification()
createPlotTypeSpecification()
createSourceDirectoryStructure()
createBusinessObjectStructure()
createUnitTests()
createTestPlan()
createUnitTestResultDocumentation()
createPerformanceQualification()
runSopCheck()
```
$\rightarrow$ Documentation work
##
**Automation of recurring validation processes/activities**
```{r}
#| echo: TRUE
#| eval: FALSE
#| code-line-numbers: "13"
library(rpact.validator)
createNewsTexFile()
createBaseRPackagesTable()
createOutputSpecification()
createPlotTypeSpecification()
createSourceDirectoryStructure()
createBusinessObjectStructure()
createUnitTests()
createTestPlan()
createUnitTestResultDocumentation()
createPerformanceQualification()
runSopCheck()
```
$\rightarrow$ Quality control of the process steps up to the final validation documentation
$\rightarrow$ The SOPs help not to forget or overlook any step
##
**Automation of recurring validation processes/activities**
```{r}
#| echo: TRUE
#| eval: FALSE
#| code-line-numbers: "9"
library(rpact.validator)
createNewsTexFile()
createBaseRPackagesTable()
createOutputSpecification()
createPlotTypeSpecification()
createSourceDirectoryStructure()
createBusinessObjectStructure()
createUnitTests()
createTestPlan()
createUnitTestResultDocumentation()
createPerformanceQualification()
runSopCheck()
```
$\rightarrow$ Efficient unit test case generation
## Example: Test Template
`test_template_f_design_group_sequential.R`:
::: {.r-stack}
::: {.fragment .fade-in-then-out}
```{r}
#| echo: TRUE
#| eval: FALSE
#' @exit Do not create the unit tests again
#' @context Testing the Group Sequential and Inverse Normal Design Functionality
#' @test_that 'getDesignInverseNormal' with default parameters:
#' parameters and results are as expected
#' @refFS[Tab.]{fs:tab:output:getDesignInverseNormal}
#' @refFS[Formula]{fs:criticalValuesOBrienFleming}
x0 <- getDesignInverseNormal()
getUnitTestObject(x0, "x0")
```
Template
:::
::: {.fragment .fade-in-then-out}
```{r}
#| echo: TRUE
#| eval: FALSE
#| code-line-numbers: "1"
#' @exit Do not create the unit tests again
#' @context Testing the Group Sequential and Inverse Normal Design Functionality
#' @test_that 'getDesignInverseNormal' with default parameters:
#' parameters and results are as expected
#' @refFS[Tab.]{fs:tab:output:getDesignInverseNormal}
#' @refFS[Formula]{fs:criticalValuesOBrienFleming}
x0 <- getDesignInverseNormal()
getUnitTestObject(x0, "x0")
```
Regeneration is disabled
<!-- Regeneration may only occur after bugs have been fixed or test cases have been added -->
:::
::: {.fragment .fade-in-then-out}
```{r}
#| echo: TRUE
#| eval: FALSE
#| code-line-numbers: "2"
#' @exit Do not create the unit tests again
#' @context Testing the Group Sequential and Inverse Normal Design Functionality
#' @test_that 'getDesignInverseNormal' with default parameters:
#' parameters and results are as expected
#' @refFS[Tab.]{fs:tab:output:getDesignInverseNormal}
#' @refFS[Formula]{fs:criticalValuesOBrienFleming}
x0 <- getDesignInverseNormal()
getUnitTestObject(x0, "x0")
```
Section title in the document (context for testthat version <3)
:::
::: {.fragment .fade-in-then-out}
```{r}
#| echo: TRUE
#| eval: FALSE
#| code-line-numbers: "4,5"
#' @exit Do not create the unit tests again
#' @context Testing the Group Sequential and Inverse Normal Design Functionality
#' @test_that 'getDesignInverseNormal' with default parameters:
#' parameters and results are as expected
#' @refFS[Tab.]{fs:tab:output:getDesignInverseNormal}
#' @refFS[Formula]{fs:criticalValuesOBrienFleming}
x0 <- getDesignInverseNormal()
getUnitTestObject(x0, "x0")
```
Unit test title/description
:::
::: {.fragment .fade-in-then-out}
```{r}
#| echo: TRUE
#| eval: FALSE
#| code-line-numbers: "7"
#' @exit Do not create the unit tests again
#' @context Testing the Group Sequential and Inverse Normal Design Functionality
#' @test_that 'getDesignInverseNormal' with default parameters:
#' parameters and results are as expected
#' @refFS[Tab.]{fs:tab:output:getDesignInverseNormal}
#' @refFS[Formula]{fs:criticalValuesOBrienFleming}
x0 <- getDesignInverseNormal()
getUnitTestObject(x0, "x0")
```
Reference to a table in the Functional Specification
:::
::: {.fragment .fade-in-then-out}
```{r}
#| echo: TRUE
#| eval: FALSE
#| code-line-numbers: "8"
#' @exit Do not create the unit tests again
#' @context Testing the Group Sequential and Inverse Normal Design Functionality
#' @test_that 'getDesignInverseNormal' with default parameters:
#' parameters and results are as expected
#' @refFS[Tab.]{fs:tab:output:getDesignInverseNormal}
#' @refFS[Formula]{fs:criticalValuesOBrienFleming}
x0 <- getDesignInverseNormal()
getUnitTestObject(x0, "x0")
```
Reference to a formula in the Functional Specification
:::
::: {.fragment .fade-in-then-out}
```{r}
#| echo: TRUE
#| eval: FALSE
#| code-line-numbers: "9"
#' @exit Do not create the unit tests again
#' @context Testing the Group Sequential and Inverse Normal Design Functionality
#' @test_that 'getDesignInverseNormal' with default parameters:
#' parameters and results are as expected
#' @refFS[Tab.]{fs:tab:output:getDesignInverseNormal}
#' @refFS[Formula]{fs:criticalValuesOBrienFleming}
x0 <- getDesignInverseNormal()
getUnitTestObject(x0, "x0")
```
The function call to be tested
:::
::: {.fragment .fade-in-then-out}
```{r}
#| echo: TRUE
#| eval: FALSE
#| code-line-numbers: "10"
#' @exit Do not create the unit tests again
#' @context Testing the Group Sequential and Inverse Normal Design Functionality
#' @test_that 'getDesignInverseNormal' with default parameters:
#' parameters and results are as expected
#' @refFS[Tab.]{fs:tab:output:getDesignInverseNormal}
#' @refFS[Formula]{fs:criticalValuesOBrienFleming}
x0 <- getDesignInverseNormal()
getUnitTestObject(x0, "x0")
```
Create a unit test for each field of the object `x0`.
:::
:::
## Example: Test Template
```{r}
#| echo: TRUE
#| eval: FALSE
library(rpact)
library(rpact.validator)
x0 <- getDesignInverseNormal()
getUnitTestObject(x0, "x0")
```
results in:
```{css, echo=FALSE}
.limited-height .sourceCode {
/*max-height: 380px;*/
height: 380px;
}
```
```{r}
#| class-source: limited-height
#| echo: TRUE
#| eval: FALSE
## Comparison of the results of TrialDesignInverseNormal
## object 'x0' with expected results
expect_equal(x0$alphaSpent, c(0.00025917372, 0.0071600594, 0.02499999),
tolerance = 1e-07)
expect_equal(x0$criticalValues, c(3.4710914, 2.4544323, 2.0040356),
tolerance = 1e-07)
expect_equal(x0$stageLevels, c(0.00025917372, 0.0070553616, 0.022533125),
tolerance = 1e-07)
invisible(capture.output(expect_error(print(x0), NA)))
expect_output(print(x0)$show())
invisible(capture.output(expect_error(summary(x0), NA)))
expect_output(summary(x0)$show())
x0CodeBased <- eval(parse(text =
getObjectRCode(x0, stringWrapParagraphWidth = NULL)))
expect_equal(x0CodeBased$alphaSpent, x0$alphaSpent, tolerance = 1e-07)
expect_equal(x0CodeBased$criticalValues, x0$criticalValues, tolerance = 1e-07)
expect_equal(x0CodeBased$stageLevels, x0$stageLevels, tolerance = 1e-07)
expect_type(names(x0), "character")
df <- as.data.frame(x0)
expect_s3_class(df, "data.frame")
expect_true(nrow(df) > 0 && ncol(df) > 0)
mtx <- as.matrix(x0)
expect_true(is.matrix(mtx))
expect_true(nrow(mtx) > 0 && ncol(mtx) > 0)
```
## Contact
Friedrich Pahlke [`r fontawesome::fa("github")`](https://github.com/fpahlke/) [`r fontawesome::fa("linkedin")`](https://www.linkedin.com/in/pahlke/)