MaatiRx

Model and methods

Educational model, not for clinical dosing. This page states the model MaatiRx solves. Its validation checks that the model is solved correctly; it does not show that the model predicts real patients.

One compartment, first-order

The drug spreads through one volume V and is eliminated in proportion to its concentration, with rate constant ke. For a single dose D (times the salt factor S, the fraction of the dose that is active drug):

ke=ln2t½CL=ke·VV=V70·WT70

The volume scales with body weight; the half-life is the drug's (or, for a patient, the one their clearance gives).

CIV bolus(t)=S·DV·e−ket
Coral(t)=F·S·D·kaV(ka−ke)·(e−ket−e−kat)

F is the bioavailability and ka the first-order absorption rate constant (when ka = ke the exact limit, ka·t·e−kat, is used).

Cinfusion(t)=R0keV·(1−e−ket)for t ≤ Tinf, then first-order decay; R0=S·DTinf

Every regimen is the sum of its doses (superposition): each dose contributes its own single-dose curve from the moment it is given, by its own route, amount and duration.

C(t)=∑iC1(t−ti;Di,routei)Rac=11−e−keτ

At steady state a regular regimen's levels are the infinite sum of earlier doses, summed exactly as geometric series; Rac is the accumulation ratio for an interval τ.

How routes and schedules are modelled

Two compartments

The dose enters a central volume V that exchanges with a peripheral one at k12 and k21; elimination, k10 = ke, is from the centre, so clearance is still k10·V. After an IV bolus:

C(t)=A·e−αt+B·e−βt

where α and β are the roots of

s2−(k10+k12+k21)s+k10k21=0
A=SD(α−k21)(α−β)V,B=SD(k21−β)(α−β)V

Oral doses and infusions follow from the same two exponentials. The terminal half-life is ln 2 / β.

Saturable (Michaelis–Menten) elimination

dAdt=kaAgut+R(t)−Vmax·CKm+C,C=AV

Superposition no longer holds, so the amount is integrated by the classical Runge–Kutta method on 0.05 h steps that meet every dose and infusion end. The predicted steady state is Css = Km·R / (Vmax − R) for an average input rate R below Vmax.

Effect

E=E0+Emax·CnEC50n+Cn

The sigmoid Emax model, driven by the plasma level or, with an effect-site delay, by the effect-site level:

dCedt=ke0(C−Ce),ke0=ln2t½,eq

solved in closed form for every route. Indirect responses (Dayneka, Garg and Jusko 1993) change how fast a response R is made (kin) or lost (kout):

Type 1:dRdt=kin(1−Imaxf(C))−koutRType 2:dRdt=kin−kout(1−Imaxf(C))RType 3:dRdt=kin(1+Smaxf(C))−koutRType 4:dRdt=kin−kout(1+Smaxf(C))Rf(C)=CnEC50n+Cn,kout=ln2t½,out

R is shown as a percentage of its baseline kin/kout and integrated by the Runge–Kutta method on steps that meet every dose. With an effect-site delay, C in f(C) is the effect-site level Ce, so the response lags the level twice over: the drug reaching its site, then the response's own turnover.

Patients

Simple: an organ-function setting scales clearance. Clinical: creatinine clearance by Cockcroft and Gault (1976), with actual, ideal (Devine) or adjusted body weight, and the drug's renal fraction fe scaled by it against a reference of 120 mL/min:

CrCl=(140−age)×WT72×SCr(× 0.85 for women)
IBW=50 (45.5) +2.3(htin−60),AdjBW=IBW+0.4(WT−IBW)
CL=CLref·[(1−fe)+fe·CrCl120]

Child: renal function from very premature neonates to adults (Rhodin et al., Pediatr Nephrol 2009;24:67–76): glomerular filtration standardized to 70 kg with a ¾-power size model and a sigmoid maturation with postmenstrual age (gestational age at birth plus postnatal age), half the adult value at 47.7 weeks with a Hill coefficient of 3.40.

GFR=121.2·(WT70)0.75·MF,MF=PMA3.447.73.4+PMA3.4
CL=CL70 kg adult·(WT70)0.75·[(1−fe)+fe·MF]

The non-renal part is scaled by size alone: how it matures depends on the enzymes that clear the drug, which this model doesn't include. The volume scales with weight. Phenytoin levels can be read with the Sheiner–Tozer albumin adjustment, Cadj = C / (0.2·albumin + 0.1).

Liver and dialysis

E=fu·CLintQ+fu·CLint,CLH=Q·E,F=fabs·(1−E)

The well-stirred liver model: hepatic blood flow Q, the unbound fraction in blood and the intrinsic clearance give the extraction ratio, hepatic clearance and the first pass.

k (in a session)=ke+CLdV

Hemodialysis adds the dialyzer's clearance while each session runs. Between events (a dose, an infusion's end, a session's start or end) the rates are constant, so the amounts are carried exactly from one event to the next; with two compartments, through the system's two eigenvalues, and the level rebounds after each session as drug returns from the tissues. With saturable elimination a session adds −CLd·C to dA/dt = input − Vmax·C/(Km + C): Runge–Kutta steps meet every session edge and shorten where rates are fast, the amount removed is CLd times the exact area under each step's cubic, and since the body's clearance falls as the level rises while the dialyzer's does not, each fall per session is stated from a level.

Variability and measured levels

CLi=CL·eηCL,Vi=V·eηV,η∼N(0,ω2),ω2=ln(1+CV2)

Population mode draws virtual patients this way (the scenario's values are the medians), reproducibly from a seed. The CVs are teaching assumptions.

minimize ∑j(yj−ŷjσj)2+(ηCLωCL)2+(ηVωV)2

Individualizing from levels: the maximum a posteriori estimate (the approach of Sheiner et al. 1979) weighs each measured level against the patient model's prediction, each by its error σj = √((0.1·yj)² + a²), with a proportional 10% and an additive part a of a tenth of the MEC.

Antimicrobial indices

fT>MIC is the share of time the unbound level, fu·C, stays above the MIC, with fu taken as constant; Cmax/MIC and AUC24/MIC use the total level. A regular regimen is read at steady state over one interval, with AUC24 = AUCτ × 24/τ.

What the tests cover

An automated suite (node --test tests/) runs on every push. It covers closed-form results (the equations above and their limits), the clinical, child and saturable models, two compartments, the effect site and indirect responses, the liver model, dialysis (with exact mass balance), population mode, the Bayesian estimate, regimen edge cases (loading and missed doses, custom schedules), the share-link format across every version, every quantitative claim each lesson makes, every practice answer against a simulation of its own scenario, every case and its grading, the page's accessibility commitments, its script budget and the offline cache. It is also compared with an independent solver on 146 scenarios, and on its Bayesian estimates, antimicrobial indices, indirect responses and dialysis sessions: see Validation, which reruns that comparison in your browser.

Disclaimer

Educational simulation. MaatiRx models idealized one- or two-compartment pharmacokinetics (first-order, or saturable in one compartment) and a sigmoid Emax concentration–effect relationship for learning and demonstration. Drug library values name their source (an FDA label or a paper) or are marked unverified; they are not prescribing information. Its validation checks that it solves its own model correctly, not that the model predicts real patients: it is not clinical software and must not be used to make dosing decisions for real patients.

Privacy, effects and visit counting

Privacy. MaatiRx runs in your browser, and after one visit it also opens offline. Your progress and saved scenarios stay in this browser. Shared links encode scenario settings in the URL; a case or assignment an instructor writes travels in its link the same way. Assignment progress and completion codes are made in this browser with the class key, which never leaves it. Do not enter patient-identifying information, or a student's name as an identifier.

Effects. The fonts come from this site. With Effects on, the 3D stage loads Three.js, a pinned and hash-checked copy, from cdnjs.cloudflare.com; that request is the only one to another site, and it carries nothing you enter. Turn Effects off in the top bar and it is never made.

Visit counting: off. When the site owner turns it on, MaatiRx counts page visits with GoatCounter, which works without cookies and doesn't store IP addresses. It sends only the page's path; GoatCounter keeps aggregate numbers of visits, referring sites, browsers, screen sizes and countries. It never receives the part of a link after #, where a scenario's settings live, or anything you enter.

Citing MaatiRx

Zenodo archives every release. doi:10.5281/zenodo.23082408 always resolves to the newest version; each release also has its own DOI, listed there. Releases up to 2.19 are archived under the earlier name, DoseCurve. The source, MIT-licensed, is on GitHub.