Tutorials › Population Pharmacokinetics › Resolve Dose-Sample Ties With Event Ordering

Dataset Construction and Quality Control · Tutorial 25 of 599

Resolve Dose-Sample Ties With Event Ordering

Learn to assign and verify a scientifically justified event order when dose and sample records share a timestamp.

Intermediate 10 min read

What You'll Learn

  • Define an event-ordering rule for dose and sample records with identical timestamps.
  • Distinguish a sample collected before a dose from one collected after it.
  • Represent ordering explicitly instead of relying on row position or software defaults.
  • Identify ambiguous ties that timestamps alone cannot resolve.
  • Audit tied events and evaluate the consequences of inconsistent ordering codes.

Why an Identical Timestamp Is Not a Complete Sequence

A dose and a pharmacokinetic sample can have the same recorded timestamp even when one occurred before the other. This can happen when records retain only minute-level or other rounded clock times, or when a study system assigns a common visit time to events that occurred in sequence. The time value alone then does not say whether the sample reflects drug exposure before the dose or after it.

That distinction matters in a longitudinal analysis. A predose sample belongs to the exposure history before the new dose; a postdose sample belongs to the history after the dose. If the records are ordered incorrectly, the analysis may associate a concentration with the wrong dose history. Sorting rows by timestamp is therefore not enough when timestamps tie.

Definition: An event-ordering rule specifies the order of dose and sample events that have the same recorded timestamp. The rule should represent the known or documented sequence of events, not an arbitrary preference in data processing. A sample is predose with respect to a dose when collection occurred before that dose was administered; it is postdose when collection occurred after administration began or the dose was given, as defined by the study’s event records and dosing method.

There is no universal convention that makes every sample precede every tied dose, or every dose precede every tied sample. The appropriate ordering depends on what happened and what the source records establish. A dataset should preserve that information with an explicit sequence field or event-order code. A consistent sorting rule can then use both timestamp and event order.

Specify the Ordering Before Building the Analysis Records

For a simple tied pair, one transparent convention is to assign an order rank: 1 for an event known to occur first and 2 for the event known to occur second. Within a subject and the relevant record set, sort first by timestamp and then by rank. The rank is meaningful only because it is linked to documented event sequence; the numbers themselves do not establish what happened.

$$ \text{event key} = (\text{timestamp},\ \text{order rank}) $$

For example, if a sample is documented as predose and ties with a dose, assign the sample the earlier rank and the dose the later rank. The ordering is \((t,1)<(t,2)\), even though both events have timestamp \(t\). If the dose is documented as occurring first, the ranks are reversed. Where a dataset uses event codes rather than numeric ranks, the same principle applies: the code definitions must explicitly identify sequence and be applied consistently.

The rule should be based on the best available evidence, such as collection and administration records or a documented study procedure. A label such as “predose” can support a before-dose ordering if it refers to the actual sample collection relative to the actual administration. A visit label or a timestamp tie alone does not establish that sequence. If evidence is insufficient, retain the tie as unresolved for review rather than silently assigning an order.

Worked Example: Preserving a Documented Predose Sample

In a hypothetical record for one participant, a 100 mg dose and a sample with concentration 2.40 mg/L both have the recorded time 08:00. The collection log states that the sample was drawn immediately before administration. Use rank 1 for the first event and rank 2 for the second.

Assign the ranks. The sample is documented as occurring first, so its event key is \((08{:}00,1)\). The dose follows, with event key \((08{:}00,2)\).

Check the order. Comparing the keys gives \((08{:}00,1)<(08{:}00,2)\). The sample therefore precedes the dose in the ordered records, even though the displayed timestamps are identical.

Interpretation. The 2.40 mg/L result is predose with respect to this 100 mg dose. It must not be treated as a sample collected after that dose merely because a software sort happens to place the dose row first. This conclusion is supported by the collection log, not by the assigned rank alone.

Why the Ordering Changes the Dose History

A dose record changes which doses have occurred by the time a sample is collected. The following justification is a bookkeeping argument, not a claim about the size of a concentration change: immediately before a dose event, that dose is not yet part of the administered-dose history; immediately after it, the dose is part of that history. Thus, at a tied timestamp, changing the event order can change the history associated with the sample.

1
Identify the tied events.
Within the same participant’s records, find a dose and sample with the same recorded timestamp.
2
Establish their documented sequence.
Use source information that describes actual collection and administration. Do not infer sequence solely from row position or a default code.
3
Encode and apply the order.
Assign sequence ranks or documented event codes, and sort tied events using those values after timestamp.
4
Check the resulting interpretation.
Confirm that a sample documented as predose appears before the tied dose and that the associated dose history excludes that dose.

Worked Example: Showing How a Code Reverses the Sequence

In a hypothetical dataset, a sample and a 50 mg dose for one participant both have time 14:30. The administration record says the dose was given before the blood draw. The data specification assigns code A to “before” and code B to “after,” but a processing step mistakenly maps A to later and B to earlier.

Correct ordering. Because the dose occurred first, its rank is 1 and the sample’s rank is 2. The correct keys are \((14{:}30,1)\) for the dose and \((14{:}30,2)\) for the sample; therefore \((14{:}30,1)<(14{:}30,2)\).

Ordering after the mapping error. If the code mapping assigns the sample rank 1 and dose rank 2, the processed keys become \((14{:}30,1)\) for the sample and \((14{:}30,2)\) for the dose. The software now places the sample first, contrary to the administration record.

Consequence. The result is classified as predose relative to the 50 mg dose when it was actually collected after that dose. The error is not corrected by sorting consistently: a consistent sort using an incorrect mapping still produces a consistently wrong sequence. The code definitions and their implementation must agree.

When the Timestamp Cannot Resolve the Tie

If there is no reliable information about which event occurred first, a deterministic processing rule cannot recover the unknown chronology. For instance, assigning every tied sample a lower rank than every tied dose creates an orderly file, but it does not demonstrate that all such samples were predose. The scientifically defensible status is unresolved until additional evidence is available.

Worked Example: Separating a Known Predose Tie From an Ambiguous Tie

Two hypothetical participants each have a sample and a 75 mg dose recorded at 09:15. For participant A, the source record explicitly says “sample collected before administration.” For participant B, no collection sequence is available.

Participant A. The documented sequence justifies assigning sample rank 1 and dose rank 2: \((09{:}15,1)<(09{:}15,2)\). The sample is predose relative to this dose.

Participant B. Both possible orders remain compatible with the timestamp. Sample first would give \((09{:}15,1)\) for the sample and \((09{:}15,2)\) for the dose; dose first would give the reverse. The data provide no basis for choosing between them. Mark the sequence unresolved and seek source clarification; do not label the sample predose or postdose based only on the tie.

Conclusion. Identical timestamps identify a potential ordering problem, not its solution. One tie can be resolved from documented sequence while another remains ambiguous, even when the recorded times and dose amounts match.

Quality Checks, Alternatives, and Limitations

Useful checks focus on both the code definition and the event pairs to which it is applied. Review the data specification and processing logic together: a code name, numeric rank, and sorting direction must all express the same ordering. Then inspect tied dose-sample pairs, checking the source sequence where available and confirming that the final ordered records preserve it.

  • Flag every dose-sample pair for the same participant with an identical recorded timestamp, rather than reviewing only examples selected by an existing code.
  • Check that documented predose samples sort before the corresponding dose and documented postdose samples sort after it.
  • Look for contradictory codes for equivalent documented sequences, including codes that change meaning across sources or processing steps.
  • Check unresolved ties separately from resolved ties; do not let a default rank make an unknown sequence appear verified.
  • After changing a code mapping, rerun the tie checks and compare the resulting event order with the source records.

A common pitfall is to assume that equal timestamps mean the sample and dose were simultaneous, so their row order is immaterial. The correction is that recorded equality may reflect limited timestamp resolution, while the biological and administrative sequence can still be meaningful. A second pitfall is to assume that sorting by timestamp is sufficient. When timestamps tie, sort order requires additional, scientifically justified sequence information.

The main alternative is to retain a shared timestamp and add a separate event-order field. This keeps the recorded time intact while representing the sequence explicitly. Replacing one event’s timestamp with a slightly earlier or later time can force a sort, but it invents time information and may falsely imply a measured interval. Use such a change only if a documented data convention specifically supports it, and preserve the original timestamp and rationale. If sequence is unknown, flagging the tie for review is preferable to either arbitrary ordering or an invented time.

Event ordering has limits. A correct rank does not recover a missing collection time, establish the actual interval between events, or prove that an event label is accurate. It also does not, by itself, determine how a particular analysis handles a dose and a sample at the same time. The ordering must be interpreted within the documented study records and the analysis method.

Key takeaway: For tied dose and sample timestamps, use an explicit order supported by event documentation. Verify that the code definition, its implementation, and the resulting predose or postdose interpretation all agree. If the sequence is unknown, keep it unresolved rather than allowing a default sort to decide it.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. A sample and dose share a timestamp. The collection record says the sample was drawn first. Which event should receive the earlier rank, and what is the sample’s status relative to that dose?
  2. Why is it not sufficient to sort all records by timestamp when a sample and dose have identical timestamps?
  3. A documented dose occurred before a tied sample, but a code mapping makes the sample sort first. What is wrong, and what should be checked?
  4. The timestamp is tied, but no source establishes whether the dose or sample came first. What should the dataset represent?

Solutions. (1) The sample receives the earlier rank and is predose relative to the dose, because the source documents that it was drawn first. (2) Equal timestamp values do not encode sequence; a second, documented ordering value is needed to preserve the event chronology. (3) The processed order contradicts the documented chronology and misclassifies the sample as predose. Check the code definitions, the mapping direction, and the sort implementation, then correct and re-audit the records. (4) Represent the sequence as unresolved and seek source clarification. Do not assign predose or postdose status based only on the tied timestamp.

Clinical Biostats