| Title: | TAF Checks |
|---|---|
| Description: | Tools to check TAF analyses. |
| Authors: | Arni Magnusson [aut, cre], Colin Millar [aut] |
| Maintainer: | Arni Magnusson <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.0 |
| Built: | 2026-12-02 09:42:57 UTC |
| Source: | https://github.com/ices-tools-prod/qcTAF |
Tools to check TAF analyses.
Quality control:
qc |
run all quality checks |
qc.boot.exists |
boot directory exists |
qc.data.bib.exists |
DATA.bib exists |
qc.data.bib.valid |
DATA.bib is valid |
qc.data.bib.processed |
DATA.bib processed |
qc.data.declared |
data files are declared |
qc.software.bib.exists |
SOFTWARE.bib exists |
qc.software.bib.valid |
SOFTWARE.bib is valid |
qc.software.bib.processed
|
SOFTWARE.bib processed |
qc.software.declared |
software files are declared |
qc.initial.data |
initial data files |
qc.only.relative.paths |
scripts use only relative paths |
qc.any.scripts.exist |
any scripts exist |
qc.all.scripts.exist |
all scripts exist |
Validation with required and optional checks:
qc.validate |
run checks in a validation profile |
qc.checks |
list checks in a validation profile |
qc.passed |
no required check failed |
qc.summary |
summary list, e.g. for JSON |
qc.markdown |
summary Markdown table |
Arni Magnusson and Colin Millar.
Useful links:
Print results from qc.validate.
## S3 method for class 'qcTAF' print(x, ...)## S3 method for class 'qcTAF' print(x, ...)
x |
result from |
... |
ignored. |
x, invisibly.
qc.validate runs the checks.
qcTAF-package gives an overview of the package.
Run all quality checks for a given analysis.
qc(analysis = ".")qc(analysis = ".")
analysis |
directory containing a TAF analysis. |
Logical vector indicating the result from each test.
The checks are run in the following order:
dir.exists checks if directory exists.
qc.boot.exists checks if boot directory exists.
qc.data.bib.exists checks if DATA.bib exists.
qc.data.bib.valid checks if DATA.bib is valid.
qc.data.bib.processed checks if DATA.bib entries have
been processed.
qc.data.declared checks if data files are declared.
qc.software.bib.exists checks if SOFTWARE.bib exists.
qc.software.bib.valid checks if SOFTWARE.bib is valid.
qc.software.bib.processed checks if SOFTWARE.bib entries
have been processed.
qc.data.declared checks if software files are declared.
qc.initial.data checks if initial data files have the same
contents as boot data files.
qc.any.scripts.exist checks if any scripts exist.
qc.all.scripts.exist checks if all scripts exist.
qc.only.relative.paths checks if scripts use only relative
paths.
qc.validate runs checks in a validation profile, where some
checks are optional.
qcTAF-package gives an overview of the package.
## Not run: qc("rjm-347d") ## End(Not run)## Not run: qc("rjm-347d") ## End(Not run)
Check if all TAF scripts (data.R, model.R, output.R, and
report.R) exist.
qc.all.scripts.exist(analysis = ".")qc.all.scripts.exist(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.all.scripts.exist("rjm-347d") ## End(Not run)## Not run: qc.all.scripts.exist("rjm-347d") ## End(Not run)
Check if any TAF scripts (data.R, model.R, output.R, and
report.R) exist.
qc.any.scripts.exist(analysis = ".")qc.any.scripts.exist(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.any.scripts.exist("rjm-347d") ## End(Not run)## Not run: qc.any.scripts.exist("rjm-347d") ## End(Not run)
Check if a boot directory exists.
qc.boot.exists(analysis = ".")qc.boot.exists(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.boot.exists("rjm-347d") ## End(Not run)## Not run: qc.boot.exists("rjm-347d") ## End(Not run)
List the quality checks that make up a validation profile, with the level of each check (required or optional).
qc.checks(profile = "pre-run")qc.checks(profile = "pre-run")
profile |
validation profile: |
A required check that fails is a failure. An optional check that fails is a warning and does not make the validation fail.
A check with a requires entry is only run if the named check passed,
otherwise it is skipped. This is used for SOFTWARE.bib: the file is
optional, but if it exists it must be valid and its software must be
declared.
The "pre-run" profile checks an analysis before taf.boot has
been run. It leaves out qc.data.bib.processed and
qc.software.bib.processed, which can only pass after
taf.boot.
The "post-run" profile checks an analysis after it has been run, and
requires the DATA.bib and SOFTWARE.bib entries to have been
processed.
In both profiles, qc.software.bib.exists and
qc.all.scripts.exist are optional.
Data frame with columns check (function name), level
("required" or "optional"), and requires (check that
must pass for this check to run, or NA).
qc.validate runs the checks in a profile.
qcTAF-package gives an overview of the package.
qc.checks() qc.checks("post-run")qc.checks() qc.checks("post-run")
Check if a DATA.bib file exists.
qc.data.bib.exists(analysis = ".")qc.data.bib.exists(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.data.bib.exists("rjm-347d") ## End(Not run)## Not run: qc.data.bib.exists("rjm-347d") ## End(Not run)
Check if a DATA.bib entries appear to have been processed, i.e., found
as files and directories inside the boot folder.
qc.data.bib.processed(analysis = ".")qc.data.bib.processed(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc.data.bib.processed checks if all bib entries have made it into the
boot data folder:
DATA.bib | boot/data
---------+----------
A |
B ==>
C |
qc.data.declared checks if all boot data files were declared as bib
entries:
DATA.bib | boot/data
---------+----------
| A
<== B
| C
When used together, those two functions ensure that DATA.bib and
boot/data contain precisely the same entries.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.data.bib.processed("rjm-347d") ## End(Not run)## Not run: qc.data.bib.processed("rjm-347d") ## End(Not run)
Check if a DATA.bib file is valid.
qc.data.bib.valid(analysis = ".")qc.data.bib.valid(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.data.bib.valid("rjm-347d") ## End(Not run)## Not run: qc.data.bib.valid("rjm-347d") ## End(Not run)
Check if all files in the boot data folder are declared in the
DATA.bib file.
qc.data.declared(analysis = ".")qc.data.declared(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc.data.bib.processed checks if all bib entries have made it into the
boot data folder:
DATA.bib | boot/data
---------+----------
A |
B ==>
C |
qc.data.declared checks if all boot data files were declared as bib
entries:
DATA.bib | boot/data
---------+----------
| A
<== B
| C
When used together, those two functions ensure that DATA.bib and
boot/data contain precisely the same entries.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.data.declared("rjm-347d") ## End(Not run)## Not run: qc.data.declared("rjm-347d") ## End(Not run)
Check if initial data files have the same contents as boot data files.
qc.initial.data(analysis = ".")qc.initial.data(analysis = ".")
analysis |
directory containing a TAF analysis. |
Files are compared recursively, so files inside folder entries are
compared by their path within the folder. Files that exist in only one of
boot/initial/data and boot/data are not compared.
TRUE if test succeeds, otherwise FALSE.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.initial.data("rjm-347d") ## End(Not run)## Not run: qc.initial.data("rjm-347d") ## End(Not run)
Format validation results as a Markdown table, for example to write to a GitHub Actions step summary.
qc.markdown(x)qc.markdown(x)
x |
result from |
Character vector of Markdown lines.
qc.validate runs the checks.
qc.summary summarizes the results as a list.
qcTAF-package gives an overview of the package.
## Not run: x <- qc.validate("rjm-347d") writeLines(qc.markdown(x), Sys.getenv("GITHUB_STEP_SUMMARY")) ## End(Not run)## Not run: x <- qc.validate("rjm-347d") writeLines(qc.markdown(x), Sys.getenv("GITHUB_STEP_SUMMARY")) ## End(Not run)
Check if scripts (*.R, *.Rmd, Rnw, *.qmd) use
only relative paths.
qc.only.relative.paths(analysis = ".")qc.only.relative.paths(analysis = ".")
analysis |
directory containing a TAF analysis. |
Scripts are checked in the main analysis folder and its subfolders, such
as boot, except folders containing data, software, or results:
boot/initial, boot/data, boot/software,
boot/library, data, model, method,
output, report, and renv.
URLs such as https:// and ftp:// are ignored, but
file:// URLs are checked, since they can point to absolute paths.
Lines starting with # or % are ignored, as are
README files.
TRUE if test succeeds, otherwise FALSE.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.only.relative.paths("rjm-347d") ## End(Not run)## Not run: qc.only.relative.paths("rjm-347d") ## End(Not run)
Check if a validation passed, meaning that no required check failed.
qc.passed(x)qc.passed(x)
x |
result from |
TRUE if no required check failed, otherwise FALSE.
qc.validate runs the checks.
qcTAF-package gives an overview of the package.
## Not run: x <- qc.validate("rjm-347d") qc.passed(x) ## End(Not run)## Not run: x <- qc.validate("rjm-347d") qc.passed(x) ## End(Not run)
Check if a SOFTWARE.bib file exists.
qc.software.bib.exists(analysis = ".")qc.software.bib.exists(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.software.bib.exists("rjm-347d") ## End(Not run)## Not run: qc.software.bib.exists("rjm-347d") ## End(Not run)
Check if a SOFTWARE.bib entries appear to have been processed, i.e.,
found as files and directories inside the boot folder.
qc.software.bib.processed(analysis = ".")qc.software.bib.processed(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc.software.bib.processed checks if all bib entries have made it into
the boot software folder:
SOFTWARE.bib | boot/software
-------------+--------------
A |
B ==>
C |
qc.software.declared checks if all boot software files were declared
as bib entries:
SOFTWARE.bib | boot/software
-------------+--------------
| A
<== B
| C
When used together, those two functions ensure that SOFTWARE.bib and
boot/software contain precisely the same entries.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.software.bib.processed("rjm-347d") ## End(Not run)## Not run: qc.software.bib.processed("rjm-347d") ## End(Not run)
Check if a SOFTWARE.bib file is valid.
qc.software.bib.valid(analysis = ".")qc.software.bib.valid(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.software.bib.valid("rjm-347d") ## End(Not run)## Not run: qc.software.bib.valid("rjm-347d") ## End(Not run)
Check if all files in the boot software folder are declared in the
SOFTWARE.bib file.
qc.software.declared(analysis = ".")qc.software.declared(analysis = ".")
analysis |
directory containing a TAF analysis. |
TRUE if test succeeds, otherwise FALSE.
qc.software.bib.processed checks if all bib entries have made it into
the boot software folder:
SOFTWARE.bib | boot/software
-------------+--------------
A |
B ==>
C |
qc.software.declared checks if all boot software files were declared
as bib entries:
SOFTWARE.bib | boot/software
-------------+--------------
| A
<== B
| C
When used together, those two functions ensure that SOFTWARE.bib and
boot/software contain precisely the same entries.
qc runs all qc.* tests.
qcTAF-package gives an overview of the package.
## Not run: qc.software.declared("rjm-347d") ## End(Not run)## Not run: qc.software.declared("rjm-347d") ## End(Not run)
Summarize validation results as a list, suitable for writing to JSON.
qc.summary(x)qc.summary(x)
x |
result from |
List with elements passed_checks, warning_checks,
failed_checks, skipped_checks (character vectors of check
names), and passed (logical, see qc.passed).
qc.validate runs the checks.
qc.markdown summarizes the results as a Markdown table.
qcTAF-package gives an overview of the package.
## Not run: x <- qc.validate("rjm-347d") jsonlite::write_json(qc.summary(x), "qc.json", auto_unbox=TRUE) ## End(Not run)## Not run: x <- qc.validate("rjm-347d") jsonlite::write_json(qc.summary(x), "qc.json", auto_unbox=TRUE) ## End(Not run)
Run the quality checks in a validation profile, treating failed optional checks as warnings rather than failures.
qc.validate(analysis = ".", profile = "pre-run", optional = NULL)qc.validate(analysis = ".", profile = "pre-run", optional = NULL)
analysis |
directory containing a TAF analysis. |
profile |
validation profile: |
optional |
names of additional checks to treat as optional. |
Each check gets one of four statuses:
"pass" |
check passed |
"warn" |
optional check failed |
"fail" |
required check failed |
"skip" |
not run, because a check it requires did not pass |
See qc.checks for the checks in each profile.
Object of class qcTAF, a data frame with columns check,
level, status, and passed (NA if skipped).
qc.checks lists the checks in a profile.
qc.passed, qc.summary, and
qc.markdown summarize the results.
qc runs all checks and returns a logical vector.
qcTAF-package gives an overview of the package.
## Not run: x <- qc.validate("rjm-347d") x qc.passed(x) ## End(Not run)## Not run: x <- qc.validate("rjm-347d") x qc.passed(x) ## End(Not run)