Tutorials › Pharmacometric Workflows and Reproducible Modeling › Verifying Dose Event Implementation

Quality Control and Independent Review · Tutorial 331 of 399

Verifying Dose Event Implementation

You will learn to trace dose events through a model, calculate expected input and concentration changes, and diagnose event-record or implementation errors.

Intermediate 12 min read

What You'll Learn

  • Distinguish instantaneous bolus events from time-varying infusion input.
  • Translate dose records into an input function and amount trajectory.
  • Check repeated doses and confirm how dose changes affect future input.
  • Calculate expected concentrations during and after an infusion.
  • Diagnose timing, duration, rate, unit, and event-order implementation errors.
  • Compare analytic event checks with numerical simulation and code inspection.

Why Dose Events Need Their Own Review

A model can have correctly written structural equations and parameter units yet still receive the wrong dose history. An amount may be assigned to the wrong time, an infusion may stop too early, or a repeated-dose record may be interpreted differently from the intended schedule. Each error changes the input to the model and can alter every later prediction. Reviewing dose implementation therefore means tracing the dose records into the model's actual input function, then checking the resulting amount and concentration at selected times.

The calculations below use a one-compartment model with linear elimination. This is a deliberately simple setting for an independent event check: the purpose is to make the relationship between records and input explicit, not to replace review of the model's full structural equations. Assume the amount in the compartment is \(A(t)\), the volume is \(V\), the elimination rate constant is \(k\), and the concentration is \(C(t)=A(t)/V\). Between dose events, elimination follows a first-order process. During an infusion, the input rate is constant over each recorded infusion interval.

Definition: A dose event is a record that specifies when drug enters the model and, as applicable, its amount, route, duration, or rate. A bolus is an instantaneous input: an amount \(D\) at time \(T\) increases \(A(t)\) by \(D\) at that time. An infusion is an input at a rate \(R\) over an interval \([T_{\text{start}},T_{\text{end}})\). The input function \(R_{\text{in}}(t)\) is the rate at which drug enters the compartment; a bolus is represented separately as an instantaneous jump.

For a bolus at time \(T\), the amount just after the event is \(A(T^+)=A(T^-)+D\), where \(T^-\) and \(T^+\) denote the instants immediately before and after the event. For an infusion, \(R_{\text{in}}(t)=R\) while the infusion is active and is zero when it is not, apart from any other simultaneous inputs. During intervals without a bolus jump, the model equation is

$$ \frac{dA(t)}{dt}=R_{\text{in}}(t)-kA(t), \qquad C(t)=\frac{A(t)}{V}. $$

The event review assumes that time units are consistent across dose times, infusion durations, and \(k\); that amounts, rates, and volume use compatible units; and that the stated event schedule is the intended schedule. It also assumes the model's stated compartment and linear elimination apply over the interval being checked. If a model has more complex input, time-varying parameters, or nonlinear elimination, the event logic still needs review, but these simple closed-form calculations do not by themselves verify those additional features.

From Event Records to an Amount Trajectory

Between events, the differential equation can be solved with an integrating factor. Multiplying both sides by \(e^{kt}\) gives \(e^{kt}\frac{dA}{dt}+ke^{kt}A=e^{kt}R_{\text{in}}(t)\), whose left side is \(\frac{d}{dt}\left(e^{kt}A(t)\right)\). Integrating from \(t_0\) to \(t\), provided there is no unrepresented bolus jump inside the interval, yields

$$ A(t)=A(t_0)e^{-k(t-t_0)} +\int_{t_0}^{t}R_{\text{in}}(s)e^{-k(t-s)}\,ds +\sum_{t_0<T_j\leq t}D_j e^{-k(t-T_j)}. $$

This expression has a direct audit interpretation: the initial amount decays from \(t_0\), and each amount entering later contributes after being discounted by elimination between its entry time and \(t\). A bolus of amount \(D_j\) at \(T_j\) contributes \(D_j e^{-k(t-T_j)}\) for \(t\geq T_j\). An infusion at constant rate \(R\) from \(a\) to \(b\) contributes \(R\int_a^b e^{-k(t-s)}ds\) when \(t\geq b\).

$$ A_{\text{inf}}(t) =\frac{R}{k}\left(e^{-k(t-b)}-e^{-k(t-a)}\right), \qquad t\geq b. $$

While the infusion is running, from \(a\) through \(t\leq b\), its accumulated contribution is \(\frac{R}{k}(1-e^{-k(t-a)})\). At the start of an infusion, the amount is continuous; the input rate changes, but the amount does not jump. At its end, the rate returns to zero and the amount then declines through elimination. These distinctions help identify a model that incorrectly treats an infusion as a bolus or gives the infusion an unintended duration.

Worked Example: Checking Repeated Bolus Events

Suppose a hypothetical subject receives bolus doses of 100 mg at 0, 8, and 16 hours. The one-compartment model has \(V=20\) L and \(k=0.15\ \text{h}^{-1}\). Check the predicted concentration at 20 hours, assuming there are no other inputs and the parameters remain constant.

The event ledger should contain three distinct bolus entries. Each dose contributes its amount multiplied by the fraction remaining after elimination to 20 hours. The time elapsed since the three events is 20, 12, and 4 hours, respectively:

$$ A(20)=100e^{-0.15(20)}+100e^{-0.15(12)}+100e^{-0.15(4)} $$

Substituting and evaluating the three terms gives \(100e^{-3}=4.9787\) mg, \(100e^{-1.8}=16.5299\) mg, and \(100e^{-0.6}=54.8812\) mg. Thus \(A(20)=4.9787+16.5299+54.8812=76.3898\) mg, and

$$ C(20)=\frac{76.3898\ \text{mg}}{20\ \text{L}} =3.81949\ \text{mg/L}\approx 3.819\ \text{mg/L}. $$

This check assumes the three recorded doses are the complete schedule through 20 hours and that each is an instantaneous 100 mg input. If the implementation contains only the most recent dose, it would produce \(100e^{-0.6}/20=2.744\) mg/L, omitting the residual amounts from the first two doses. Comparing the independently assembled contributions with the model's event trace makes that omission visible.

Worked Example: Checking an Infusion and Its End Time

In a hypothetical one-compartment model, \(V=30\) L and \(k=0.20\ \text{h}^{-1}\). A 240 mg infusion begins at hour 2 and runs for 4 hours at a constant rate. There are no other doses. Find the predicted concentration at hour 9, three hours after the infusion ends.

First verify the record arithmetic: \(R=240\ \text{mg}/4\ \text{h}=60\ \text{mg/h}\), and the infusion interval is from hour 2 to hour 6. The clearance implied by this one-compartment parameterization is \(CL=kV=(0.20\ \text{h}^{-1})(30\ \text{L})=6\ \text{L/h}\). For an infusion that has ended before the prediction time, its concentration contribution is

$$ C(9)=\frac{R}{CL} \left(e^{-k(9-6)}-e^{-k(9-2)}\right). $$

Substitution gives

$$ C(9)=\frac{60\ \text{mg/h}}{6\ \text{L/h}} \left(e^{-0.20(3)}-e^{-0.20(7)}\right) =10(0.548812-0.246597) =3.02215\ \text{mg/L}. $$

Therefore the expected concentration is approximately 3.022 mg/L. The calculation checks both the rate and the end time: using hour 2 as the end, for example, would give a different and incorrect decay history. The assumptions here are that the 240 mg is delivered uniformly over four hours, the model uses hours and milligrams consistently, and there is no other input or nonzero starting amount.

Worked Example: Checking Elimination Across a Dose-Free Interval

Suppose an event trace shows an amount of 250.1243 mg at hour 5, followed by no dose input through hour 7. Let \(k=0.20\ \text{h}^{-1}\) and \(V=30\) L. Check the amount and concentration at hour 7. This is a hypothetical example of auditing the interval after the last recorded event.

With no input during the two-hour interval, the amount declines exponentially:

$$ A(7)=250.1243e^{-(0.20)(7-5)} =250.1243e^{-0.4} \approx167.6633\ \text{mg}. $$

Dividing by the stated volume gives

$$ C(7)=\frac{167.6633\ \text{mg}}{30\ \text{L}} \approx5.5888\ \text{mg/L}. $$

The input-free assumption is justified only if the event records and model trace show no bolus, active infusion, or other input between hours 5 and 7. A concentration mismatch could therefore reflect an omitted or extra event as well as an incorrect elimination calculation. In this example, the calculated concentration follows from the stated carry-in amount, rate constant, volume, and absence of input.

Repeated Doses, Dose Changes, and Event Semantics

A repeated-dose schedule is not a single event with an average amount; it is a sequence of inputs at specified times. If doses are equally spaced by an interval \(\tau\), one way to check the schedule is to verify that the event times satisfy \(T_j=T_0+j\tau\) for the intended indices \(j\), and that the number of generated events matches the intended count. If a record format stores a dose plus a repeat interval or additional-dose count, expand that shorthand into its actual event times before comparing it with the model trace. Confirm whether the first dose is included in the stated count and whether the terminal event time is within the intended treatment period.

A dose change ordinarily changes the amount or rate of a later event; it does not rewrite drug already administered. For bolus dosing, a new 150 mg event is an additional 150 mg bolus at its recorded time, not a replacement of an earlier 100 mg dose. For an infusion rate change, represent the schedule as adjacent intervals with the relevant rates. Unless the specification explicitly says otherwise, the amount delivered before the change remains part of the compartment and continues to be eliminated.

Worked Example: Checking an Infusion Rate Change

A hypothetical infusion runs at 20 mg/h from hour 0 to hour 4, then at 30 mg/h from hour 4 to hour 6. Let \(V=25\) L and \(k=0.10\ \text{h}^{-1}\), with no other input. Calculate \(C(8)\). This piecewise representation assumes the first rate stops exactly when the second begins, so there is no gap or overlap.

The first interval contributes at hour 8

$$ C_1(8)=\frac{20}{kV} \left(e^{-0.10(8-4)}-e^{-0.10(8-0)}\right) =8(e^{-0.4}-e^{-0.8}) =1.76793\ \text{mg/L}. $$

The second interval contributes

$$ C_2(8)=\frac{30}{kV} \left(e^{-0.10(8-6)}-e^{-0.10(8-4)}\right) =12(e^{-0.2}-e^{-0.4}) =1.78093\ \text{mg/L}. $$

By linear superposition, \(C(8)=C_1(8)+C_2(8)=1.76793+1.78093=3.54886\) mg/L, or approximately 3.549 mg/L. The check depends on the two stated intervals being contiguous and on the rate units being mg/h. If the event trace instead shows both rates active from hour 4 to hour 6, it represents an unintended overlap and gives too much input.

Practical Review: Diagnostics and Alternatives

An independent event check should compare three things: the source dose records, the event records supplied to the model, and the model's resulting input function or event trace. For each event, verify subject assignment, event time, amount, route or compartment, and—when applicable—rate and duration. Then check selected times immediately before and after boluses, at infusion starts and ends, and during dose-free intervals. The expected behavior is specific: a bolus causes an amount jump of exactly \(D\); an infusion start changes the input rate without an amount jump; an infusion stop ends that input; and an interval with no input produces exponential decline under this model.

Useful warning signs include a negative or implausible duration, a rate that does not equal amount divided by duration, events out of chronological order, a repeated-dose count that produces the wrong number of times, or a discontinuity at an infusion boundary that the specified input does not imply. Check units before interpreting a numerical discrepancy: a rate entered in mg/min but treated as mg/h differs by a factor of 60. Also inspect conventions for events at the same time. A bolus and a new infusion may coincide; the intended model must apply both inputs, while the event implementation must not silently discard one because of ordering or record-handling rules.

For small examples or selected audit times, a hand calculation using the event ledger is transparent and easy to reproduce. A separate script that expands the records and computes the input function can efficiently check many subjects and repeated events, but its event-expansion logic should itself be reviewed rather than treated as independent evidence by default. Inspecting model code can show how records are interpreted, while simulation can reveal the resulting trajectory; neither alone proves the input matches the written schedule. A strong check compares these approaches at selected event boundaries and times between events.

Common pitfall: A reviewer sees a changed dose record and assumes it replaces the previous dose or changes the amount already in the compartment. That reasoning is wrong unless the model specification explicitly defines retroactive replacement. A dose change normally affects the later input event or infusion rate; earlier drug remains in the system and follows the model's disposition. Reconstruct the timeline event by event, and verify that each prior contribution persists and decays as specified.

These checks have limits. Agreement at a few times does not prove every record is correct, and a one-compartment analytic calculation cannot validate a more complex absorption, transit, or nonlinear input structure. Analytic checks are especially useful as targeted tests: select events and intervals that could expose timing, unit, repetition, or rate-translation errors, then compare those expectations with the implementation. Broader coverage may require automated checks across all subjects, but unusual cases—such as simultaneous events, a final partial interval, or a dose change during an infusion—still merit explicit review.

Check Your Understanding

Answer each question by tracing the event history and checking units. Solutions follow the questions.

  1. A 50 mg bolus is given at hour 0 and another at hour 5. If \(k=0.10\ \text{h}^{-1}\), what amount remains at hour 5 just after the second bolus, assuming no other input and no initial amount?
  2. An infusion record specifies 180 mg over 3 hours. What rate should the input function use, and what should happen to the compartment amount at infusion start?
  3. A 100 mg/h infusion runs from hour 2 to hour 4. Describe how its input function should be represented after hour 4, and explain whether the amount in the compartment jumps at that time.
  4. Why is it generally incorrect to treat a changed future bolus dose as replacing an earlier bolus?

Solutions. (1) The first bolus contributes \(50e^{-0.10(5)}=50e^{-0.5}=30.3265\) mg just before hour 5. The second bolus adds 50 mg immediately, so the amount just after it is \(30.3265+50=80.3265\) mg. (2) The rate is \(180\ \text{mg}/3\ \text{h}=60\ \text{mg/h}\). An infusion start changes the input rate from zero to 60 mg/h; it does not create an instantaneous jump in amount. (3) The input rate is 100 mg/h from hour 2 until hour 4 and zero after hour 4, absent another input. The amount is continuous at the end time; after the input stops, it declines according to elimination. (4) A future bolus adds its own stated amount at its event time. Earlier drug remains in the compartment and continues to follow the model, unless the written model specification explicitly defines a different operation.

Clinical Biostats