This vignette takes the user through the basic functionality of the
review
package. The user will gain experience with:
demoRepo()
creates a temporary SVN repo containing files
with version history. This repo already contains a QC log and partially
completed QC for demonstration purposes. The function returns the path
to the repo.
## [1] "/tmp/RtmpuBeC7q/svn-proj/abc-123"
If a repo does not contain a QC log, the first step would be to run
logCreate()
, which will generate an empty one. As mentioned
above, the demo repo already contains a QC log. The contents are shown
below.
## # A tibble: 7 × 6
## file origin revf revo reviewer time
## <chr> <chr> <dbl> <dbl> <chr> <chr>
## 1 script/data-assembly.R script/data-assembly.R 0 0 anyone 2024-11-14…
## 2 script/pk/load-spec.R script/pk/load-spec.R 0 0 anyone 2024-11-14…
## 3 script/combine-da.R script/combine-da.R 0 0 anyone 2024-11-14…
## 4 script/examp-txt.txt script/examp-txt.txt 0 0 anyone 2024-11-14…
## 5 script/data-assembly.R script/data-assembly.R 1 1 michaelm 2024-11-14…
## 6 script/pk/load-spec.R script/pk/load-spec.R 1 1 michaelm 2024-11-14…
## 7 script/combine-da.R script/combine-da.R 1 1 michaelm 2024-11-14…
A few helpful definitions:
file
: Relative file path from the location of the QC
log.origin
: Relative file path of the origin file.revf
: the revision number of the file that was
reviewed.revo
: the revision number of the origin file at time
indicated.reviewer
: the reviewer of the file, given as the
equivalent in R to Sys.info()[["user"]]
.time
: the time of the assignment or acceptance.When a file is ready for QC, it should be assigned in the QC log.
This can be done using the logAssign()
function, which will
add a record to the QC log.
Looking at the demo QC log, the first row is an example of a record
that logAssign()
will generate.
## # A tibble: 1 × 6
## file origin revf revo reviewer time
## <chr> <chr> <dbl> <dbl> <chr> <chr>
## 1 script/data-assembly.R script/data-assembly.R 0 0 anyone 2024-11-14…
Notice that revf
is 0 for all entries. Additionally, the
reviewer is set to “anyone”. This assignment is done to signify the file
is ready for QC, but revf = 0
indicates no QC has been
completed yet.
If we want to assign another file, such as
script/examp-yaml.yaml
, we can do the following:
logAssign("script/examp-yaml.yaml")
After the reviewer completes their QC of a file,
logAccept()
should be used to create a record of this. The
revision number at the time of QC is captured along with the username of
the reviewer.
We can look at the QC history of script/data-assembly.R
to demonstrate the differences between logAssign()
and
logAccept()
.
## # A tibble: 2 × 6
## file origin revf revo reviewer time
## <chr> <chr> <dbl> <dbl> <chr> <chr>
## 1 script/data-assembly.R script/data-assembly.R 0 0 anyone 2024-11-14…
## 2 script/data-assembly.R script/data-assembly.R 1 1 michaelm 2024-11-14…
Notice that the row created by logAccept()
updated the
revf
value to 1, which is the revision number where the QC
was completed. The reviewer was updated from “anyone” to the actual user
who did the QC.
It is important to note that after any operation where the QC log is updated, the updates should be checked into SVN. Multiple users are often completing QC of different files in parallel, which makes checking in updates to the QC log itself important to ensure all records are captured.
logPending()
is a helpful function for identifying files
in need of QC. It will return all files that meet the following
criteria:
logAssign()
but no completed QCRunning logPending()
on the demo repo will result with
the following output:
## file origin revf headf revo heado reviewer
## 5 script/data-assembly.R script/data-assembly.R 1 5 1 5 michaelm
## 4 script/examp-txt.txt script/examp-txt.txt 0 1 0 1 anyone
## 6 script/pk/load-spec.R script/pk/load-spec.R 1 4 1 4 michaelm
## time
## 5 2024-11-14 20:31:43.3276793956757 GMT
## 4 2024-11-14 20:31:43.0441052913666 GMT
## 6 2024-11-14 20:31:43.4084506034851 GMT
Looking at script/data-assembly.R
, revf = 1
indicates a QC was completed on the file at revision 1. However,
headf = 5
indicates edits were made to the file at revision
5, indicating another round of QC is needed.
Looking at script/examp-txt.txt
, revf = 0
indicates a QC has never been completed on the file.
headf = 1
indicates edits were made to the file at revision
1.
When logPending()
indicates a file is in need of QC but
has previously had a QC completed at an earlier revision, it is helpful
to know what changed. This can save QC efforts where only a minor change
was made.
diffQced()
helps with this as it generates a visual diff
in the Viewer pane in R studio. All deleted, added and modified lines of
code are shown in the diff.
When diffQced()
is supplied a file name, it uses the QC
log to identify the revision number when the last QC was completed. The
difference is then generated using the version of the file at that
revision number versus the current file.
diffQced("script/data-assembly.R")
@@ 1,5 @@@@ 1,10 @@library(tidyverse)library(tidyverse)~>source(here::here("script", "data-assembly", "da-functions.R"))src_abc <- mrgda::read_src_dir(here::here("data", "source", "STUDY-ABC"))src_abc <- mrgda::read_src_dir(here::here("data", "source", "STUDY-ABC"))derived <- list(sl = list(),tv = list())derived <- list(sl = list(),tv = list())dm_0 <- src_abc$dm %>% filter(ACTARM != "Screen Failure")dm_0 <- src_abc$dm %>% filter(ACTARM != "Screen Failure")derived$sl$dm <- dm_0derived$sl$dm <- dm_0~>pk_0 <- src_abc$pc %>% filter(PCTEST == "TEST OF INTEREST")~>derived$tv$pc <- pk_0~>ex_1 <- src_abc$ex %>% filter(EXTRT == "DRUG OF INTEREST")~>derived$tv$dosing <- ex_1
If you are interested in generating a visual diff with two different
files, diffFiles()
can be used.
If you are interested in generating a visual diff of a file at
specific revision numbers, diffPreviousRevisions()
can be
used.
renderQCSummary()
generates a PDF summary of the QC
status of all files checked into the SVN repo.
Some summaries include tables indicating files that are in need of QC
(similar to the output of logPending()
) and files up to
date with QC. Each of these are stratified by the author of the
files.
Another helpful summary provided are tables showing all the files checked into SVN, stratified by their QC status. Each contributor to the repo has their own table. The QC status of a given file could be one of the following:
Not in QC log
: file is checked into SVN, but has not
been added to the QC log.In QC log, needs QC
: file is in need of QC.QC up to date
: file has no QC needs currently.To see an example of a QC summary document, run the following locally: