Skip to main content

pmcore/
lib.rs

1//! PMcore is a framework for developing and running population pharmacokinetic algorithms.
2//!
3//! # Algorithm Types
4//!
5//! ## Non-Parametric Algorithms
6//! Represent the population distribution as a discrete set of support points with associated weights.
7//! - NPAG (Non-Parametric Adaptive Grid)
8//! - NPOD (Non-Parametric Optimal Design)
9//! - NPMAP (Maximum a posteriori reweighting)
10//!
11//! ## Parametric Algorithms (planned)
12//! Represent the population distribution with a parametric form (e.g. a normal distribution) and
13//! estimate the parameters of that distribution. This family is not yet implemented; the API is
14//! present but calling it will panic until a solver (SAEM) is available.
15//!
16//! # Public Interface
17//!
18//! PMcore centers on the estimation interface in [estimation]. Models are defined in
19//! [model], configured with [estimation::EstimationProblem], and then executed with the
20//! selected algorithm.
21//!
22//! # Data format
23//!
24//! PMcore is heavily linked to [pharmsol], which provides the data structures and routines for handling
25//! pharmacokinetic data. The data is stored in a [pharmsol::Data] structure, and can either be read
26//! from a CSV file, using `pharmsol::data::parse_pmetrics::read_pmetrics`, or created dynamically
27//! using the [pharmsol::data::builder::SubjectBuilder].
28//!
29
30/// Provides the various algorithms used within the framework
31pub mod algorithms;
32
33/// Estimation problems and the non-parametric and parametric fitting families.
34pub mod estimation;
35
36/// Model-domain types: parameters, parameter spaces, and metadata.
37pub mod model;
38
39/// Result and summary types shared across algorithms.
40pub mod results;
41
42/// Logging utilities.
43pub mod logs;
44
45// Re-export commonly used items
46pub use anyhow::Result;
47pub use std::collections::HashMap;
48
49/// Dose optimization and forecasting (BestDose).
50pub mod bestdose;
51
52/// SDE-based Inter-Occasion Variability optimization.
53pub mod iov;
54
55/// A collection of commonly used items to simplify imports.
56pub mod prelude {
57    pub use super::logs::Logger;
58    pub use super::HashMap;
59    pub use super::Result;
60    pub use crate::algorithms;
61    pub use crate::algorithms::Algorithm;
62
63    pub use crate::estimation::NonParametric;
64    pub use crate::estimation::Parametric;
65    pub use crate::estimation::{
66        ErrorModels, EstimationProblem, FitProgress, NcnpagConfig, NonParametricAlgorithm,
67        NonparametricCycleProgress, NpagConfig, NpmapConfig, NpodConfig, ParametricAlgorithm,
68        SaemConfig,
69    };
70
71    pub use crate::model::parameter_space::{
72        BoundedParameter, Parameter, ParameterScale, ParameterSpace, UnboundedParameter,
73    };
74
75    pub use crate::algorithms::nonparametric::{CycleFlow, FitController, FitObserver};
76    pub use crate::estimation::nonparametric::{
77        CycleLog, NPCycle, NPPredictions, NonParametricResult, Posterior, Psi, Theta, Weights,
78    };
79    pub use crate::iov::{DiffusionConfig, DiffusionOptimize, DiffusionResult};
80    pub use crate::model::{EquationMetadataSource, ModelMetadata};
81    pub use crate::results::{
82        FitResult, FitSummary, IndividualSummary, ParameterSummary, PopulationSummary,
83    };
84
85    // pharmsol: re-export the crate itself and its curated prelude.
86    pub use pharmsol;
87    pub use pharmsol::prelude::*;
88
89    // Items required by downstream code that are not part of `pharmsol::prelude`.
90    pub use pharmsol::equation::{EquationTypes, Predictions};
91    pub use pharmsol::optimize::effect::get_e2;
92    pub use pharmsol::{ODE, SDE};
93
94    // Organized submodules mirroring pharmsol's grouping.
95    pub mod simulator {
96        pub use pharmsol::prelude::simulator::*;
97    }
98    pub mod data {
99        pub use pharmsol::prelude::data::*;
100    }
101    pub mod models {
102        pub use pharmsol::prelude::models::*;
103    }
104
105    // macros
106    pub use pharmsol::{fa, fetch_cov, fetch_params, lag};
107}