💊
Pharmacometrics
PK/PD modeling with uncertainty quantification for drug development and clinical trial design
Pharmacometrics with Sounio
Sounio provides a powerful platform for pharmacometric modeling, enabling drug dosage optimization and clinical trial design with rigorous uncertainty handling.
Why Sounio for Pharmacometrics?
Traditional pharmacometric tools often treat model parameters as fixed values. In reality:
- Drug absorption rates vary between patients
- Measurement equipment has finite precision
- Population studies have sampling uncertainty
Sounio’s epistemic types naturally capture this uncertainty.
Example: PK/PD Modeling
use std::units::{mg, L, h, mg_per_L}
use std::epistemic::{Knowledge, measure}
struct PKParameters {
clearance: Knowledge<L/h>,
volume: Knowledge<L>,
ka: Knowledge<1/h>, // Absorption rate
}
fn predict_concentration(
dose: Knowledge<mg>,
params: &PKParameters,
time: h
) -> Knowledge<mg_per_L> {
let cl = params.clearance
let v = params.volume
let ka = params.ka
// One-compartment model with first-order absorption
let ke = cl / v
let concentration = (dose * ka) / (v * (ka - ke)) *
(exp(-ke * time) - exp(-ka * time))
concentration // Uncertainty propagates automatically
}
Confidence-Gated Dosing
fn recommend_dose(
patient: &Patient,
target: Knowledge<mg_per_L>
) -> DoseRecommendation with IO {
let predicted = simulate_dosing(patient, proposed_dose)
if predicted.confidence > 0.90 {
if within_therapeutic_window(predicted, target) {
DoseRecommendation::Approve(proposed_dose)
} else {
DoseRecommendation::Adjust(calculate_adjustment(predicted, target))
}
} else {
// Uncertainty too high - request more data
perform IO::warn("Insufficient confidence for dosing recommendation")
DoseRecommendation::RequestData(needed_measurements(patient))
}
}
Population Modeling
fn population_pk_analysis(
patients: Vec<PatientData>
) -> PopulationParameters with IO, Prob {
// Hierarchical Bayesian model
let population_cl = perform Prob::sample(LogNormal(log(10.0), 0.3))
let population_v = perform Prob::sample(LogNormal(log(50.0), 0.2))
for patient in patients {
// Individual parameters with random effects
let individual_cl = perform Prob::sample(
LogNormal(log(population_cl), omega_cl)
)
// Condition on observed concentrations
for obs in patient.observations {
let predicted = predict_concentration(
patient.dose, individual_cl, patient.v, obs.time
)
perform Prob::observe(
Normal(predicted.value, obs.uncertainty),
obs.concentration
)
}
}
PopulationParameters {
clearance: population_cl,
volume: population_v,
}
}
Features for Pharma
- GUM-compliant uncertainty: Follows ISO/GUM standards
- Unit safety: Prevents mg/kg vs mg/L errors
- Provenance tracking: Full audit trail for FDA compliance
- Effect isolation: Separates pure computation from I/O
Regulatory Compliance
Sounio’s provenance tracking supports:
- FDA 21 CFR Part 11
- GxP validation requirements
- ICH E9 statistical principles
- Full audit trails
Get Started
sounio new pharma-project --template pharmacometrics
cd pharma-project
sounio run examples/pk_model.sio