Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ Cargo.lock
*.pkm
/paper_files
paper.html
/joss/paper_files
20 changes: 20 additions & 0 deletions joss/paper.bib
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,24 @@ @Article{npag
publisher = {MDPI AG},
}

@Book{npod,
author = {Hovd, Markus and Kryshchenko, Alona and Neely, Michael N. and Otalvaro, Julian and Schumitzky, Alan and Yamada, Walter M.},
editor = {Cristina Garcia-Cardona and Harlin Lee},
publisher = {Springer Nature Switzerland},
title = {A Non-parametric Optimal Design Algorithm for Population Pharmacokinetics},
year = {2025},
address = {Cham},
isbn = {9783031878046},
number = {37},
series = {Association for Women in Mathematics Series},
booktitle = {Advances in Data Science: Women in Data Science and Mathematics (WiSDM) 2023},
doi = {10.1007/978-3-031-87804-6_12},
issn = {2364-5741},
pages = {259--274},
pagetotal = {1357},
ppn_gvk = {1937384802},
subtitle = {Women in data science and mathematics (WiSDM) 2023},
url = {https://doi.org/10.1007/978-3-031-87804-6_12},
}

@Comment{jabref-meta: databaseType:bibtex;}
26 changes: 23 additions & 3 deletions joss/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ Pharmacokinetic and pharmacodynamic modeling and simulation are computationally

As a fully open-source solution, `pharmsol` empowers users to inspect, modify, and extend the simulation capabilities without licensing constraints. Users can define custom models by specifying their own differential equations as closures, or use the provided analytical solutions for standard compartmental models. Additionally, `pharmsol` can be integrated in more user-friendly languages such as R using `extendr` [@extendr], making it accessible to pharmacometricians who may prefer higher-level interfaces.

# Software design

To the authors' knowledge, `pharmsol` is the first software written in Rust for pharmacokinetic modeling and simulation. The design principle of `pharmsol` is to provide researchers and pharmacometricians a flexible and efficient library for solving pharmacokinetic problems.

These problems are defined by two key aspects: the pharmacokinetic data, and the structural model. While the data structure is explained in detail below, the structural model is more complex. In `pharmsol`, models are defined using a set of closures, providing methods to define the set of equations that describe the mass transfer of drug, as well as initial conditions and output equations, i.e. detailing the initial and observed states of the system. Bioavailability terms and lag-time of absorption is also supported. Covariates may be applied on both parameters and state values. Importantly, `pharmsol` provides both linear interpolation and carry-forward for covariates, both common in population pharmacokinetic models.

The three different solver types, i.e. analytical, ODE, and SDE based, are all built around a common `Equation` trait. This gives `Pharmsol` a modular design, allowing users to easily extend the library with new solvers or to rely on it while being agnostic on the underlying solver type. This flexibility is particularly useful when integrating `pharmsol` with other software, as it allows users to select the most appropriate solver for their specific use case (e.g., speed vs. model complexity).

# Research impact statement

As a tool for pharmacokinetic modelling and simulation, `pharmsol` has already demonstrated research impact. Most notably, it is used as a simulation engine for the Rust crate `PMcore` and `Pmetrics` [@pmetrics] - the _de facto_ R package for non-parametric population pharmacokinetic modelling and simulation.

Additionally, `pharmsol` has been used to generate results in scientific publications, such as the creation of a new algorithm for non-parametric parameter estimation [@npod].

Internally, `pharmsol` is also used for simulating alternative dose regimens to individualize drug therapy in patients.

# Data format

`pharmsol` is designed around a hierarchical data structure that models the typical organization of pharmacometric data. The primary data struct, `Data`, is a collection of `Subject`s, which may have one or more `Occasion`s, i.e. separate pharmacokinetic investigations. Each occasion consists of one or more `Event`s, e.g. an instantaneous dose (bolus), infusions of drug, or observed concentrations at given times.
Expand All @@ -47,15 +63,15 @@ As a fully open-source solution, `pharmsol` empowers users to inspect, modify, a
Data → Subject → Occasion → Event (Bolus, Infusion, Observation)
```

Currently, `pharmsol` provides methods to parse the Pmetrics [@pmetrics] data format. In the future, we aim to also support additional formats, such as those used by NONMEM, Monolix [@monolix], and more.
Currently, `pharmsol` provides methods to parse the Pmetrics [@pmetrics] data format. In the future, we aim to also support additional formats, such as those used by NONMEM, Monolix [@monolix], and more. Data may also be built using a provided builder-pattern, providing a flexible method for defining subjects on the go for pharmacometricians comfortable with Rust. This is especially useful when integrating `pharmsol` with third-party software, as it allows for reading and generating data that is not in a supported format.

# Supported equation formats

The equation module provides the mathematical foundation for simulating PK/PD output with three model equation solver types: analytical solutions, ordinary differential equations, and experimental support for stochastic differential equations.
As stated before the `Equation` trait provides the architectural backbone for simulating PK/PD profiles. Pharmsol currently also provides three solvers implementing this trait: analytical solutions, ordinary differential equations, and experimental support for stochastic differential equations.

## Analytical Solutions

For standard compartmental models, `pharmsol` provides closed-form solutions for one- and two-compartment models, with and without oral absorption. These have been verified against their differential equation counterparts. Benchmarks demonstrate 20-33× speedups compared to equivalent ODE formulations without loss of precision (see repository benchmarks for details). Additional analytical solutions will be added in future versions.
For standard compartmental models, `pharmsol` provides closed-form solutions for one-, two- and three-compartment models, with and without oral absorption. These have been verified against their differential equation counterparts. Benchmarks demonstrate 20-33× speedups compared to equivalent ODE formulations without loss of precision (see repository benchmarks for details). Additional analytical solutions will be added in future versions.

## Ordinary Differential Equations

Expand All @@ -69,6 +85,10 @@ Experimental support for stochastic differential equations (SDEs) is available u

`pharmsol` aims to support the evolving needs of pharmacometric research by providing a modern, efficient platform that can adapt to the increasing complexity of pharmaceutical development while remaining accessible through its open-source licensing model. Future development will focus on additional analytical model implementations, support for common data formats used by other pharmacometric software, non-compartmental analysis and continued performance improvements.

# AI usage disclosure

The authors declare that generative AI has been used during software development and manuscript preparation. For software development, generative AI has been used to generate code by instruction, refactor existing code, produce tests and write documentation. For the manuscript, generative AI was used to improve the language of the submission. The use of generative AI was reviewed, edited, and verified by the authors. The authors take full responsibility for the contents of the submission, and for the software within the scopes of the software license.

# Acknowledgements

We acknowledge the intellectual contributions to the package by members of the Laboratory of Applied Pharmacokinetics and Bioinformatics (LAPKB), and feedback from the pharmacokinetics research group at the University of Oslo.
Expand Down