Chapter 12. qc-nm: quality control and correction of a control stream
A control stream is executable scientific source code. It connects a dataset to compartments, parameters, likelihood, estimation and retained diagnostics. nlmx qc-nm checks that connection with 81 named checks in ten families and, by default, writes a separately corrected copy without changing the original.
Figure 12.1. The source is checked, selected corrections are applied to a copy, and the complete catalogue is run again on the copy.
Novice promise
This chapter assumes the reader can recognize NONMEM records such as $INPUT and $THETA but may not know why their order, options or indices matter. Every page explains the plain-language question, a failing example, how to investigate, what automation may change, and what still requires a modeller.
Scope and evidence
Behavior was checked against the installed help and the 81-check catalogue. Worked evidence uses the locally available nlmx 4.3.0 release. pytools/ch12_examples.py runs a deliberately flawed teaching model and freezes its outputs under documents/ch12/results.
The example starts NOT READY with four failures and one warning. Seven default corrections create flawed_qc.ctl, after which the automated verdict is READY. The diff is still reviewed line by line; READY is not permission to run unreviewed generated code.
Thirty Markdown pages
This overview plus 29 pages cover:
- 12.0: every applicable command form and CLI option;
- 12.1–12.4: first use, order, configuration and inputs;
- 12.5–12.17: all ten check families and all 81 IDs;
- 12.18–12.23: every correction and its review risk;
- 12.24–12.26: outputs, before/after review and pipelines;
- 12.27–12.28: worked example, limits and validation.
Check-family map
Figure 12.2. FIL, REC, INP, DAT, SUB, COD, PAR, EST, TAB and DOC provide stable navigation across the checklist and findings.
Safety rule
Never point a corrected output at the original file. nlmx refuses that target, but the broader principle matters: preserve the reviewed source, generated copy, change CSV, unified diff and before/after checklist together. Promote changes into a new model revision only after independent scientific review and execution-level validation.