Documentation

41.3 Case 1: a dirty file, line by line

A 12-record file and the defects qc-data found

What you will learn

  • Read the verdict, the check counts and the findings table of a qc-data run.
  • See which defects the program flags as errors, which as warnings, and which it only comments on.
  • Trace each finding to the line and cell that caused it.
  • Recognise what a quality-control run did not find, and why.

Prerequisites: Chapter 11, data quality control.

The question: is this file ready to be analysed?

The evidence: the Chapter 11 bundle documents/ch11, input defective_pk.csv (12 records, 16 columns, four individuals), settings defective.qcd, outputs in results/defective/.

The file

The file was written to contain defects, one or more per individual, so it makes a compact teaching specimen. Its settings declare a lower limit of quantification of 0.1, a BLQ flag column, three covariates (WT, AGE, SEX) of which SEX is categorical with the expected levels 0 and 1, and fail_on = "never", so the program reports without stopping. (Page 41.5 turns that setting round.)

The verdict

The summary opens with three lines worth quoting in full:

Content   12 records, 16 columns; 4 individuals; 3 dose records; 9 observations (9 used)
Verdict   NOT READY — fix the failures before analysis
Checks    99 checks: 63 PASS, 10 COMMENT, 13 WARN, 4 FAIL, 9 N/A

Ninety-nine questions were asked; 63 were answered "pass" and nine were not applicable (a check that needs more data than the file has is reported as N/A, not as a pass). The verdict is driven by the four FAIL checks. The findings table has 29 rows: 4 errors, 22 warnings, 3 comments. The ratio matters: one check can produce several findings (the covariate check COV03 fired twice, once for weight and once for age).

The four errors

Each error is a defect that makes the data not mean what it says to NONMEM-style software.

Check Line Individual Finding Why it matters
REC03 2 1 EVID = 1 but MDV = 0 A dose record must have MDV = 1; with 0 the dose line would be read as an observation with a missing value
TIM01 5 1 TIME 1 is below the previous 2 Time runs backwards within the individual
TIM02 13 1 ID 1 appears again after other IDs NONMEM reads the final record as a separate individual
REC14 6 2 ADDL = 2 but II = 0 Two additional doses were requested with no interval between them

The third row is the most instructive. Individual 1 occupies lines 2–5 and then one more record at line 13. Nothing is wrong with the record itself (1,4,0.4,…); what is wrong is its position. A program that reads the file in order will treat that last line as a fifth individual with one observation and no dose. This is why qc-data has a check for block structure of the ID column, and why sorting a file by anything other than ID and time is a quiet way to damage it.

The warnings, by individual

Twenty-two warnings spread across the four individuals; reading them per individual shows which profiles will be a problem.

Individual Findings What they say
1 9 MDV/TIME/ID errors above; WT takes two values (70, 71); only 1 usable observation after the ID split; no dose record in the split-off record
2 9 WT 500 (plausible range 0.3–350) and AGE 132 (0–120); SEX = 3 is not one of 0, 1; DV −2 is negative and below the LLOQ but not flagged as BLQ; two observations at time 1 with different DV (−2 and 2)
3 5 A DV of 0 written at the time of the dose, after it (treated as post-dose by NONMEM, but its value looks like a pre-dose sample); DV 0 and 0.05 below the LLOQ without a BLQ flag; none of its two observations quantifiable after the first dose
4 5 One observation, no dose record, one record only, and SEX = 1 occurs in a single individual
(data set) 1 3 of 9 observations (33 %) are BLQ, above the 20 % limit set in the settings

Note two pairings. First, TIM05 appears twice with different levels: a comment for individual 1 (DV 8 at the time of the dose, written after it) and a warning for individual 3 (DV 0 at the time of the dose, written after it, "its DV looks like a pre-dose sample"). The program escalates when the value suggests the record was meant to come before the dose. Second, OBS04 reports that the three BLQ observations carry three different DV values (0, 0.05, −2): a BLQ rule needs one imputation convention, and this file has none.

What was not found

Look at line 5: 1,1,99,…. A concentration of 99 at time 1, between 3.5 (time 2) and 0.4 (time 4) for the same individual, is almost certainly a typing error. No check flagged it. The checklist says why:

  • OBS06 (concentrations far from those of other individuals at similar times) is N/A: "only 4 usable observations (at least 8 are needed)".
  • OBS07 (isolated spikes within a profile) passes: "no spikes within the profiles".

The first is a sample-size rule: with four usable observations there is no honest way to call one an outlier. The second shows that a spike check is also bounded by what it can see. Two lessons follow. A clean quality-control report is a statement about the checks that ran, and the N/A rows are part of that statement. And for a data set this small, the 99 is caught by the human who reads the plot of concentration against time, which the run also wrote (plots/concentration_time.png, one of 11 figures).

The decision

Question Evidence Decision Reversible?
Is the file ready? qc_summary.txt: NOT READY; 4 FAIL, 13 WARN No. Do not analyse. Return to the data source for four corrections and a decision on each warning yes

What would have changed it: zero FAIL checks. With warnings only, the decision becomes "ready with these accepted exceptions", each written down. Four errors admit no such reading.

What this case does not show

It shows a deliberately small, deliberately broken file. A real study file will have thousands of records, so outlier checks will run rather than being N/A, and the findings table will be much longer. The reading skill is the same: verdict, counts, errors first, then warnings by individual.

Review checklist

  • Did you read the N/A rows as well as the failures?
  • For each error, can you say what NONMEM would do with the record?
  • For each warning, have you decided fix, exclude or accept?
  • Did you look at the concentration–time plot?

See the previous page, the next page and the complete case-study reference.