Generate a self-contained PDF report that documents whether the NonCompart noncompartmental analysis engine (as used through ncar) reproduces pre-specified reference results on the user's own machine, within a pre-specified relative tolerance. It is intended as Operational Qualification (OQ) evidence, in the spirit of the WinNonlin computational-engine verification. The report uses only base R, NonCompart, and the package's own pdf helpers, so it requires no LaTeX, pandoc, or other external tools.
pdfOQ(fileName = "ncar-OQ-Report.pdf", cases = NULL, tol = 0.001,
refDir = system.file("OQ", package = "ncar"), performedBy = "",
paper = "auto", sigField = FALSE)Invisibly returns a list with elements fileName, qualified
(logical), tol, nCases, nFailCases, and results
(a per-case list with status, comparison counts, maximum relative difference,
and any failed comparisons). A PDF file is written to fileName.
file name to save the PDF report
a list of OQ case definitions. If NULL, the built-in set of
seventeen scenarios is used: eight WinNonlin-referenced ones (Theophylline and
Indometacin, extravascular / IV bolus / IV infusion, each with
linear-up-linear-down and linear-up-log-down AUC), five Tier A cases on
synthetic fixtures with a closed-form reference, and four that carry no external
reference and instead require the rendered report to agree with the analysis
table for the same profile. Each case is a list with elements id,
desc, either dataset (the name of a datasets object) or
data (an inline data frame), key, colTime, colConc,
args (a list of further tblNCA arguments),
ref (the reference csv file name in refDir), and optionally
roundTrip or reportCheck.
acceptance tolerance: a parameter passes when the symmetric relative
difference abs(R - W) / ((abs(R) + abs(W))/2) between the computed value
R and the reference value W is at most tol. An absolute
fallback is used when both values are essentially zero.
directory holding the reference csv files. Defaults to the
OQ folder installed with ncar.
name of the person performing the qualification, printed in the report header. Defaults to the login name.
paper size: "letter", "a4", or "auto" (the
default), which selects "letter" in a United States locale and
"a4" elsewhere. The report uses 1 inch margins on every side and
places the signature (approval) page first.
if TRUE, add Adobe Acrobat Reader signature fields to the
finished report (via addSigField) so it can be signed with one
click in Acrobat Reader.
Kyun-Seop Bae <[email protected]>
For each case the function runs tblNCA on the (frozen) input data,
maps the CDISC PPTESTCD result columns to WinNonlin parameter names using the
internal RptCfg table, matches comparable parameters to the reference table
(robust to % vs . naming), and compares every parameter for every
subject. A case passes only when all of its comparisons pass.
Most bundled reference values are WinNonlin 6.4 NCA outputs. These establish concordance with the de-facto reference implementation (Tier B); they are not, by themselves, an independent verification.
Since 0.7.1 the set also contains independent (Tier A) anchors: three cases run a
synthetic fixture whose terminal phase is exactly mono-exponential, so lambda z, the
half-life and Clast_pred are known in closed form and the AUCs reduce to a
hand-summable trapezoid. The fixture carries a lag-phase zero, an embedded
below-the-limit-of-quantification sample inside the lambda z window and trailing BLQ.
A further three cases run the reporting layer itself and require every printed
parameter to equal the tblNCA value at the printed
precision, so a report can no longer disagree with the analysis table it summarises.
Since 0.7.2 three cases qualify the steady-state path (SS = TRUE with
tau, NonCompart 0.8.4): two Tier A cases on a single dosing interval whose
concentrations are small integers, so that AUCTAU is the hand-summable trapezoid 66,
CAVG is 66/12 and CL/F is the dose over 66, once with tau in hours and once with the
same tau in days; and one report-versus-table case that requires the printed
AUCTAU, CAVG, CLFO and VZFO to equal the table values.
pdfIQ, pdfNCA, tblNCA
#pdfOQ()
#res <- pdfOQ(fileName = "MyEngine-OQ.pdf", performedBy = "Jane Doe")
#res$qualified
#res$results[[1]]$maxRD
Run the code above in your browser using DataLab