Simplified open-source Python implementation of the in vitro-in vivo simulation (IVIVS) code used for the work reported by Vlachou and Karalis. It preserves the central scientific workflow for predicting the probability of success of a bioequivalence study, but it is not a line-by-line release of the complete historical MATLAB application used in the article.
Research software: this package is not validated for regulatory, diagnostic, or clinical decision-making.
ivivs · in-vitro-in-vivo-simulation · bioequivalence-prediction ·
drug-development · development-cost-reduction · r-and-d-guidance ·
pharmacokinetics · monte-carlo-simulation
Can formulation-specific in vitro dissolution data, literature-based pharmacokinetics, gastrointestinal transit, and virtual clinical trials be combined to estimate the probability that a test product will demonstrate bioequivalence to a reference product?
IVIVS-BE combines:
- regional dissolution in the stomach, small intestine, and large intestine;
- true absorption/permeation kinetics, optional absorption lag time, and one- or two-compartment disposition represented by ODEs;
- virtual subjects with between- and within-subject variability;
- noncompartmental AUC, AUCinf, Cmax, and Tmax calculation; and
- paired 2x2 crossover average-bioequivalence assessment using a 90% CI.
For first-order dissolution, each regional profile follows
D(t) = m0 * Dose * (1 - exp(-Kd*t)). Here m0 is represented by
max_fractions; it scales the dissolvable pool and is not applied as a late
hard cap on dissolution from the full dose.
PKParameters.ka denotes the true absorption/permeation rate (Kat) when
dissolution is explicitly represented. For a simple consecutive first-order
model, calculate_true_absorption_rate() can derive Kat from an apparent
absorption rate and a dissolution rate. More complex or regional models
require an independently justified Kat estimate.
The Monte Carlo layer repeats the virtual trial and reports the percentage of trials satisfying the 80.00%-125.00% bioequivalence limits.
The figure is generated from illustrative parameters with
PYTHONPATH=src python3 examples/make_figure.py; it does not reproduce a
specific clinical dataset.
Python 3.9 or newer is required.
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install -e .
python3 examples/quickstart.pyThe example uses a fixed random seed and prints a single-profile PK summary and Monte Carlo acceptance percentages. Its parameters are illustrative and are not a clinical or regulatory dataset.
import numpy as np
from ivivs_be import (
DissolutionParameters, GITransit, PKParameters, SimulationConfig,
calculate_pk_metrics, simulate_profile,
)
config = SimulationConfig(
dose=100.0,
dissolution=DissolutionParameters(rates=(1.2, 0.8, 0.2)),
pk=PKParameters(
ka=1.1,
clearance=5.0,
central_volume=25.0,
peripheral_volume=40.0,
intercompartmental_clearance=3.0,
tlag=0.0,
),
transit=GITransit(stomach=1.0, small_intestine=3.0, large_intestine=8.0),
)
times = np.array([0, 0.5, 1, 2, 3, 4, 6, 8, 12, 18, 24, 36, 48])
profile = simulate_profile(config, times)
metrics = calculate_pk_metrics(times, profile.concentration, terminal_points=4)
print(metrics)See examples/quickstart.py for the Monte Carlo API.
Run the built-in test suite without installing extra test dependencies:
PYTHONPATH=src python3 -m unittest discover -s tests -vThe tests cover parameter behavior, ODE mass balance, zero absorption, a known
mono-exponential terminal slope, the published first-order m0 equation,
absorption lag, a nontrivial manually calculated 2x2 BE reference dataset,
deterministic BE, residual error, and seeded Monte Carlo reproducibility.
This simplified Python implementation makes several deliberate corrections
and does not claim line-by-line numerical identity with the complete
historical MATLAB application. See
MIGRATION.md before comparing results. There is no expiration
date, machine-date check, or execution lock in this package.
Vlachou M, Karalis V. An In Vitro-In Vivo Simulation Approach for the Prediction of Bioequivalence. Materials. 2021;14(3):555. https://doi.org/10.3390/ma14030555
Please cite both the paper above and this software. Machine-readable software
citation metadata are provided in CITATION.cff.
The Python source code is released under the MIT License. The journal article is separately available under the Creative Commons Attribution license.
