Skip to main content

Module equation

Module equation 

Expand description

Handwritten equation families and their shared simulation interfaces.

This module is the public home for handwritten ODE, Analytical, and SDE models, plus the shared Equation trait and the metadata types that attach public names to parameters, states, routes, and outputs.

Use this module when you want to:

  • choose between deterministic ODE, analytical, and stochastic SDE models
  • attach metadata so dataset labels such as "iv" and "cp" resolve by name instead of by dense numeric index
  • work with prediction or likelihood APIs across equation families

§Equation Families

  • ODE for deterministic models that must be numerically integrated.
  • Analytical for supported closed-form models.
  • SDE for stochastic models that use particles.

§Labels And Metadata

Input and output labels arrive from public data APIs as strings.

  • Without metadata, handwritten models fall back to numeric labels such as 0 or 1.
  • With metadata::ModelMetadata attached, route and output labels are resolved by name against the declared routes and outputs before simulation.

That label-first path is the preferred public workflow for current authoring.

§Example

use pharmsol::{metadata, ModelKind};

let metadata = metadata::new("one_cmt")
    .kind(ModelKind::Ode)
    .parameters(["cl", "v"])
    .states(["central"])
    .outputs(["cp"])
    .route(metadata::Route::infusion("iv").to_state("central"))
    .validate()
    .unwrap();

assert_eq!(metadata.route("iv").unwrap().destination(), "central");
assert!(metadata.output("cp").is_some());

Modules§

analytical
metadata
Metadata builders and validated metadata views for handwritten models.
ode
sde

Structs§

Analytical
Model equation using analytical solutions.
Covariate
One named covariate plus interpolation semantics.
ModelMetadata
Builder for handwritten model metadata.
ODE
Output
One named output in model order.
Parameter
One named parameter in model order.
Route
One named route declaration.
SDE
Stochastic Differential Equation solver for pharmacometric models.
ValidatedModelMetadata
Validated metadata view used by the execution layer.
ValidatedRoute
One validated route declaration with resolved execution details.

Enums§

AnalyticalKernel
AnalyticalMetadataError
EqnKind
Runtime family tag for handwritten equations.
ExplicitRkTableau
Tableau for OdeSolver::ExplicitRk.
ModelKind
ModelMetadataError
Validation errors for handwritten model metadata.
NameDomain
Name domain used in duplicate-name validation messages.
OdeMetadataError
OdeSolver
ODE solver selection.
RouteInputPolicy
How route inputs should be interpreted by the execution layer.
RouteKind
Route declaration kind.
SdeMetadataError
SdirkTableau
Tableau for OdeSolver::Sdirk.

Traits§

Cache
Trait for enabling prediction caching on equation types.
Equation
Trait for handwritten model equations that can be simulated.
EquationTypes
Associated state and prediction container types for an equation family.
Predictions
Trait for prediction containers.
State
Trait for state vectors that can receive bolus doses.

Functions§

new
Shorthand for ModelMetadata::new.
one_compartment
Analytical solution for one compartment model.
one_compartment_cl
Analytical solution for one compartment model parameterized by clearance.
one_compartment_cl_with_absorption
Analytical solution for one compartment model with first-order absorption, parameterized by clearance.
one_compartment_with_absorption
Analytical solution for one compartment model with first-order absorption.
pm_one_compartment
pm_one_compartment_cl
pm_one_compartment_cl_with_absorption
pm_one_compartment_with_absorption
pm_three_compartments
pm_three_compartments_cl
pm_three_compartments_cl_with_absorption
pm_three_compartments_with_absorption
pm_two_compartments
pm_two_compartments_cl
pm_two_compartments_cl_with_absorption
pm_two_compartments_with_absorption
three_compartments
Analytical for three compartments Assumptions:
three_compartments_cl
Analytical solution for three compartment model parameterized by clearances.
three_compartments_cl_with_absorption
Analytical solution for three compartment model with first-order absorption, parameterized by clearances.
three_compartments_with_absorption
Analytical solution for three compartment model with first-order absorption. Assumptions:
two_compartments
Analytical solution for two compartment model.
two_compartments_cl
Analytical solution for two compartment model parameterized by clearances.
two_compartments_cl_with_absorption
Analytical solution for two compartment model with first-order absorption, parameterized by clearances.
two_compartments_with_absorption
Analytical solution for two compartment model with first-order absorption.