Tutorials › Pharmacometric Workflows and Reproducible Modeling › Cross-Field Consistency Checks in Pharmacometric Workflows

Data Specification and Dataset Preparation · Tutorial 40 of 399

Cross-Field Consistency Checks in Pharmacometric Workflows

Build explicit checks that identify incompatible field combinations without silently changing data or mistaking a warning for proof of an error.

Intermediate 12 min read

What You'll Learn

  • Define cross-field rules as testable relationships among fields and their applicable record types.
  • Check whether dose amount, rate, and duration agree under the declared infusion convention.
  • Validate event types against observation flags without assuming universal codes.
  • Check that censoring status and assay results agree with assay limits and the dataset’s encoding convention.
  • Detect implausible covariate combinations caused by unit mismatches or inconsistent conversions.
  • Distinguish a validation failure from evidence about which value is correct.

Why Check Fields Together?

A record can pass every individual-field check and still be incoherent. A dose amount may be positive, a rate may be positive, and a duration may be positive, while the three values contradict one another. A concentration may be a valid number and a censoring flag may be a valid category, yet the flag may not agree with the reported value and assay limit. These are cross-field consistency problems: the concern is not whether each field is acceptable alone, but whether their combination satisfies the meaning assigned to them.

Such checks are important before pharmacometric data are used to construct dosing histories, observations, and covariates. They do not establish which conflicting value is correct. They identify records that need review under the data specification and source documentation. A check should therefore state its condition, scope, expected result, and action when the condition fails.

Definition: A cross-field consistency check is a rule that evaluates whether two or more fields in a record, or linked fields in related records, satisfy a declared logical or quantitative relationship. A failed check means the record does not meet that rule; it does not by itself prove which field is wrong.

A useful rule is conditional. For example, “when the record is an infusion dose and both amount and duration are recorded, the rate must agree with amount divided by duration within the declared tolerance” is more precise than “check dose fields.” The condition prevents the rule from being applied to bolus doses or records for which duration is not defined. It also makes the expected behavior reviewable and reproducible.

Specify Rules Before Running Them

Before implementing a check, define the dataset convention it relies on. A field name alone is not enough: the meaning of an event category, the treatment of missing values, the unit of a dose, and the encoding of a below-quantification result must be explicit. Earlier material on dataset schemas and required-field validation establishes how fields and allowed values are specified; cross-field rules add relationships among those specified fields.

A rule specification should include the applicable record type, the fields used, the logical or numerical condition, any tolerance, and the outcome for a failure. It should also make clear whether a failure blocks dataset use or generates a review warning. An apparent inconsistency can result from an unrecorded convention or legitimate exception, so do not silently overwrite a source value to make a record pass.

1
Restrict the rule to its intended records.
For example, apply a rate-duration relationship only to infusion doses for which those quantities are defined.
2
Evaluate the relationship.
Use the declared meanings, units, and any pre-specified tolerance; do not infer a convention from the values that happen to appear.
3
Report the finding without editing the record.
Retain the values that failed, identify the rule and record, and route the finding for review or resolution.

Dose Amount, Rate, and Duration

For an infusion recorded with a total amount \(A\), a rate \(R\), and a duration \(T\), all in compatible units, the defining relationship is \(A=RT\), or equivalently \(R=A/T\) when \(T>0\). If amount is in milligrams and duration is in hours, rate must be in milligrams per hour. This relationship is appropriate only if the fields refer to the same dose and the rate is constant over the stated duration. A bolus dose does not have an infusion duration under this convention; a missing rate for a bolus should not fail an infusion-specific rule.

Rule: For an infusion dose with positive duration \(T\), compare the recorded rate \(R\) with the implied rate \(A/T\), using compatible units. A numerical check may be written as \(\left|R-A/T\right|\leq\max(\delta_{\mathrm{abs}},\delta_{\mathrm{rel}}\left|A/T\right|)\), where the absolute and relative tolerances are specified in advance. Exact agreement is appropriate only when the data convention and numeric precision support it.

The tolerance is not a universal pharmacometric constant. It should reflect the source precision, transformation and rounding conventions, and intended use. If a recorded rate is rounded, equality to many decimal places can produce spurious failures. Conversely, a tolerance that is too wide can conceal meaningful contradictions. Check units before evaluating the arithmetic: a thousand-fold difference can be a unit mismatch rather than a dose calculation error.

Worked Example: Checking an Infusion Record

Hypothetical data. A dataset specification says that infusion amount is in milligrams, rate is in milligrams per hour, and duration is in hours. For this example, the pre-specified absolute tolerance is \(0.01\) mg/h and the relative tolerance is zero. One infusion record has amount \(600\) mg, duration \(2.00\) h, and recorded rate \(300\) mg/h.

The implied rate is

$$ \frac{A}{T}=\frac{600\ \mathrm{mg}}{2.00\ \mathrm{h}}=300\ \mathrm{mg/h}. $$

The difference is \(\left|300-300\right|=0\) mg/h, which is no greater than \(0.01\) mg/h. The record passes this relationship check. This conclusion assumes the three fields describe one constant-rate infusion; the check does not verify that the dose was administered as recorded.

Event Type and Observation Status

An event type describes what a row represents under the dataset’s convention; an observation flag indicates whether the row contributes a measured response. Their valid combinations are schema-dependent. A dose row might be designated as a dosing event and not as a concentration observation, while a concentration-sample row might be designated as an observation. Other row types, such as covariate updates or administrative records, may have their own flag behavior.

Do not assume that a particular numeric code universally means “dose” or “observation.” Instead, use the documented category mapping and write the permitted combinations as a table or logical rule. Also distinguish a row with no observed concentration from a concentration value that is missing for a different reason. The relevant rule concerns the meaning of the row and its flags, not merely whether a numeric field happens to be populated.

Worked Example: Validating Event and Observation Flags

Hypothetical data. In a specified dataset, event category “DOSE” means an administered dose and requires observation flag 0; category “SAMPLE” means a concentration observation and requires observation flag 1. A third category, “COVARIATE,” requires flag 0. A record has category “SAMPLE,” observation flag 0, and a concentration of \(2.4\) mg/L.

The declared rule for SAMPLE rows requires observation flag 1. The record instead has flag 0, so it fails the event-flag consistency check even though \(2.4\) mg/L is a plausible numeric result. The finding should report the record identifier, event category, flag, and applicable rule. It should not automatically change the flag to 1: the category, flag, or concentration may have been transcribed or generated incorrectly, and the correct value must be established through review.

Censoring Status and Assay Limits

An assay limit gives meaning to certain reported results. For example, a result below the lower limit of quantification (LLOQ) may be flagged as below quantification. The dataset must specify how such results are stored: a numeric value may be missing, set to the LLOQ, or represented by another convention, with a separate censoring indicator. These encodings are not interchangeable, and a cross-field check must follow the declared one.

A useful rule examines the combination of censoring status, reported result, and the applicable limit for that assay and sample. It can flag a record marked as quantified when its value is below the applicable LLOQ, or a record marked below the LLOQ whose stored value contradicts the declared encoding. Such findings are conditional on the limit being matched to the correct analyte, assay, and unit. The check does not turn a censored result into an exact concentration.

Worked Example: Checking a Below-LLOQ Convention

Hypothetical data. A dataset specification states that a result below the LLOQ is stored numerically as the LLOQ and marked “BLQ”; quantified results are marked “QUANT.” For one assay, the LLOQ is \(0.50\) mg/L. A sample record contains value \(0.50\) mg/L and status “BLQ.”

The combination is consistent with the stated storage convention: the numeric value equals the applicable LLOQ and the status is BLQ. The recorded \(0.50\) mg/L is a storage representation required by this convention, not evidence that the sample’s true concentration equals \(0.50\) mg/L. If a value below the LLOQ were marked “QUANT,” the rule would flag it for review. A value equal to the LLOQ marked “QUANT” would be inconsistent only if the specification explicitly requires values at the LLOQ to be marked “BLQ.” A different dataset convention could require a different check.

Covariate Values and Units

A covariate value has meaning only together with its unit and, where relevant, its measurement basis. A value of 70 could represent kilograms, pounds, or another quantity; comparing values without checking units can create false discrepancies or misleading covariates. Cross-field checks can verify that a unit label is allowed for the variable, that a conversion uses the declared factor, and that two representations intended to describe the same measurement agree within an appropriate tolerance.

For a conversion check, keep the raw value and unit available, compute the converted value using the declared factor, and compare it with the corresponding standardized value. The tolerance should account for recorded precision and any documented rounding. A passing comparison supports internal consistency, not the truth of either measurement. A failed comparison is a review signal, not permission to replace one field with another.

Worked Example: Comparing Weight Values in Different Units

Hypothetical data. A record contains a weight of \(154.3\) lb and a standardized weight of \(70.0\) kg. The declared conversion factor is \(1\) lb \(=0.453592\) kg, and the pre-specified comparison tolerance is \(0.1\) kg.

Convert the source value:

$$ 154.3\times0.453592=69.9892456\ \mathrm{kg}, $$

which rounds to \(69.99\) kg to four significant figures. The absolute difference from the recorded metric value is \(\left|70.0-69.9892456\right|=0.0107544\) kg, about \(0.0108\) kg. Since \(0.0107544<0.1\), the values pass the stated tolerance check. This finding says the two representations agree within the specified tolerance; it does not prove which source measurement is authoritative.

Diagnostics, Alternatives, and Limitations

A good validation report makes it possible to understand why a row failed. Include the rule identifier, record key, relevant field values and units, the expected relationship, and the result of the comparison. Review patterns as well as individual findings: many rate failures may indicate a unit conversion or schema misunderstanding, while failures concentrated in one assay may point to an incorrect limit mapping. Such patterns guide investigation but do not establish a cause.

Cross-field checks complement, rather than replace, other data-quality approaches. Range and distribution checks assess individual values and patterns across records; they may miss a pair of individually plausible but contradictory values. A cross-field rule tests a declared relationship, but it cannot establish source accuracy. Manual review can use contextual judgment but is harder to apply consistently at scale. These approaches answer different questions and are strongest when their roles are explicit.

Several failure modes deserve particular attention:

  • Applying a rule to the wrong row type. An infusion relationship does not apply to a bolus unless the specification defines one.
  • Comparing incompatible units. Arithmetic can be internally correct and still be meaningless if amount, rate, duration, or covariate units do not match.
  • Using an undocumented encoding assumption. Censoring values and event codes vary by dataset; a rule must follow the current specification.
  • Using excessive precision or tolerance. Unrounded floating-point comparisons can create false alarms, while a loose tolerance can mask material conflicts.
  • Automatically “fixing” failures. A logical conflict identifies a need for review; it does not identify the correct field to change.

Cross-field checks are limited by the quality of their definitions and inputs. They cannot detect every plausible but incorrect record, resolve conflicting sources, or infer the intended value from internal consistency alone. Their purpose is narrower and valuable: make important relationships explicit, apply them consistently, and expose records that do not satisfy them.

Key takeaway: Define each relationship using the dataset’s documented meanings, units, row types, and encoding conventions. Report failures with enough context to review them, and preserve the distinction between detecting an inconsistency and deciding how it should be resolved.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. An infusion has amount \(480\) mg, duration \(1.5\) h, and recorded rate \(320\) mg/h. Does it satisfy the amount-rate-duration relationship?
  2. A dataset defines “SAMPLE” rows as observations requiring flag 1. A SAMPLE row has flag 0 and a nonmissing concentration. What does the consistency check establish, and what does it not establish?
  3. Under a convention that stores BLQ values at the LLOQ, a record has LLOQ \(0.20\) mg/L, value \(0.20\) mg/L, and status BLQ. Is that combination consistent, and how should the numeric value be interpreted?
  4. Using \(1\) lb \(=0.453592\) kg, convert \(132.3\) lb to kilograms and compare with a recorded value of \(60.0\) kg. Is the difference below a tolerance of \(0.1\) kg?

Solutions. 1. The implied rate is \(480/1.5=320\) mg/h, so the fields agree exactly. 2. The row violates the declared SAMPLE-flag rule. The check does not show whether the event category, flag, or concentration is wrong, nor does it justify changing any value without review. 3. Yes. The value equals the LLOQ and the status follows the stated storage convention; it is a representation of a below-quantification result, not an exact measured concentration. 4. \(132.3\times0.453592=60.0102216\) kg. The absolute difference is \(\left|60.0-60.0102216\right|=0.0102216\) kg, about \(0.0102\) kg, which is less than \(0.1\) kg. The two values pass that specified comparison check.

Clinical Biostats