Crate pmcore

source ·
Expand description

PMcore is a framework for developing and running non-parametric algorithms for population pharmacokinetic modelling

The framework is designed to be modular and flexible, allowing for easy integration of new algorithms and methods. It is heavily designed around the specifications for Pmetrics, a package for R, and is designed to be used in conjunction with it. However, as a general rust library, it can be used for a wide variety of applications, not limited to pharmacometrics.

§Configuration

PMcore is configured using a TOML file, which specifies the settings for the algorithm. The settings file is divided into sections, each of which specifies a different aspect of the algorithm. They are further described in the routines::settings module.

§Model definition

As PMcore is provided as a library, the user must define the model to be used. Some algebraic models are provided, and more will be added, but the user is free to define their own model. The model must implement the [routines::simulation::predict] trait, which specifies the methods that the model must implement. For more information on how to define models with ordinary differential equations, please look at at the examples.

§Data format

Data is provided in a CSV file, and the format is described in the table below. For each subject, there must be at least one dose event.

ColumnDescriptionConditions
IDUnique subject ID
EVIDEvent type; 0 = observation, 1 = dose, 4 = reset
TIMETime of event
DURDuration of an infusionMust be provided if EVID = 1
DOSEThe dose amountMust be provided if EVID = 1
ADDLThe number of additional doses to be given at the interval II
IIInterval for additional doses
INPUTThe compartment the dose should be delivered to
OUTThe observed valueMust be provided if EVID = 0
OUTEQDenotes the output equation for which OUT is provided
C0Optional override of the error polynomial coefficient
C1Optional override of the error polynomial coefficient
C2Optional override of the error polynomial coefficient
C3Optional override of the error polynomial coefficient
COV...Any additional columns are assumed to be covariates, one per columnMust be present for the first event for each subject

§Examples

A couple of examples are provided in the examples directory. The settings.toml file contains the settings for the algorithm, and the data.csv file contains the data.

They can be run using the following command

cargo run --release --example `example_name`

where example_name is the name of the example to run. Currently, the following examples are available:

  • bimodal_ke: A simple, one-compartmental model following an intravenous infusion. The example is named by the bimodal distribution of one of two parameters, Ke, the elimination rate constant. The example is designed to demonstrate the ability of the algorithm to handle multimodal distributions, and detect outliers.
  • simple_covariates: A simple example with a single subject and a single dose event, with covariates.

Modules§

  • Provides the various algorithms used within the framework
  • New data format
  • Entry points for external use of the framework.
  • Logger functionality for the framework using [tracing]
  • A collection of commonly used items to simplify imports.
  • Routines for the crate
  • Terminal-based user interface components.

Macros§

Structs§

Type Aliases§

  • type alias for Result<T, Report>