DoseOptima is an advanced Bayesian Maximum A Posteriori (MAP) pharmacokinetic feedback and precision Therapeutic Drug Monitoring (TDM) dosing engine in Python. It integrates clinical patient covariates (renal CrCl, weight, age) with population pharmacokinetic priors and sparse drug serum observations to personalize narrow-therapeutic-index antimicrobial regimens (such as Vancomycin and Aminoglycosides) targeting precise
For intravenous infusion at rate
Where micro-rate constants are
Creatinine clearance is estimated using the Cockcroft-Gault equation:
Log-normal population typical parameters:
Individual parameters follow
Given measured serum concentrations
Where:
-
$\hat{C}(t_j, \boldsymbol{\theta})$ : Superposed model predicted concentration. -
$\sigma_j = \max(0.5, \sigma_{\text{prop}} \cdot \hat{C}_j)$ : Combined proportional-additive residual unexplained error. -
$\boldsymbol{\eta}^T \Omega^{-1} \boldsymbol{\eta} = \left(\frac{\eta_{\text{CL}}}{\omega_{\text{CL}}}\right)^2 + \left(\frac{\eta_V}{\omega_V}\right)^2$ : Penalization from population prior.
The individual parameter vector $\hat{\boldsymbol{\eta}}{\text{MAP}}$ is found by minimizing $\Phi{\text{MAP}}$ using bounded L-BFGS-B optimization.
Targeting steady-state daily exposure
Regimens are evaluated across dosing intervals
flowchart TD
subgraph Patient ["Patient Clinical Profile"]
DEMO["Age, Weight, Sex, Serum Creatinine"] --> CRCL["Cockcroft-Gault CrCl"]
CRCL --> POP["Population Prior (CL_pop, V_pop, Omega)"]
end
subgraph Sampling ["Therapeutic Monitoring"]
HIST["Dosing History: Doses, Infusion Times"]
LABS["Measured Serum Concentrations (Peak / Trough)"]
end
subgraph BayesianEngine ["Bayesian MAP Engine"]
POP & HIST & LABS --> OBJ["MAP Objective Function: Residuals + Prior Penalty"]
OBJ --> MIN["L-BFGS-B Numerical Optimization"]
MIN --> IND["Individualized Parameters: CL_ind, V_ind, t_1/2"]
end
subgraph Dosing ["Adaptive Decision Support"]
IND --> REG["Regimen Optimizer (AUC24 = 400 - 600)"]
REG --> REPORT["Optimal Dose (mg), Interval tau (h), Predicted Peak/Trough"]
end
src/dose_optima/
├── __init__.py # Package re-exports and API definitions
├── models.py # 1- and 2-compartment IV infusion PK models & superposition
├── population.py # Cockcroft-Gault CrCl, Thomson-Goti Vancomycin priors, Omega matrix
├── bayesian.py # Bayesian MAP objective function and L-BFGS-B optimizer
├── regimen.py # Adaptive dosing regimen optimizer targeting AUC24 and trough
└── tdm.py # Consolidated VancomycinTDM clinical report generator
tests/
├── test_pk_models.py # Analytical peak, clearance, and superposition tests
├── test_bayesian_map.py # Parameter recovery from synthetic noisy clinical samples
└── test_regimen.py # Dosing optimization and end-to-end TDM execution
# Clone repository
git clone https://github.com/ZengLLQ/dose-optima.git
cd dose-optima
# Install in development mode
pip install -e .[dev]
# Run unit tests
pytest -vThis project is licensed under the MIT License.