Expand description
Improv core model: categories, items, measures, coordinates, formulas.
GUI-free, storage-free. This is the multidimensional “cube”: each measure is a tensor indexed by a subset of categories; a coordinate names one cell.
Structure follows the project steering doc (AGENT_STEERING.md / IMPROV.txt).
Re-exports§
pub use extfn_def::ExternalFn;pub use extfn_def::Language;pub use formula::BinaryOp;pub use formula::DimensionSpec;pub use formula::Expr;pub use formula::Formula;pub use formula::FuncId;pub use formula::UnaryOp;pub use ids::CategoryId;pub use ids::ItemId;pub use ids::MeasureId;pub use ids::Name;pub use ids::ScenarioId;pub use ids::ViewId;pub use locale::Locale;pub use parser::parse_definition;pub use parser::parse_expr;pub use parser::parse_formula;pub use parser::Definition;pub use parser::FormulaText;pub use parser::LambdaText;pub use parser::ParseError;pub use value::Value;pub use value::ValueError;pub use value::ValueErrorKind;pub use value::ValueType;
Modules§
- extfn_
def - Definitions of external-language functions (Phase 6), as plain, serializable
model data. The runtime that evaluates these lives in the
improv_extfncrate; this module holds only the declaration so aModelcan persist which functions a formula mayCALLand how to type-check them. - formula
- The dimension-aware formula AST.
- functions
- The built-in function registry: ONE table for every function the formula
language knows, read by the parser (names, aliases, arity), the compiler
(argument and result types, kind), the GUI and CNL (spellings), and the
generated function reference (
docs/src/functions.md). - ids
- Opaque, stable identifiers and human-readable names.
- locale
- Locale-aware formula entry: the separators and translated function names
a locale’s users type, mapped onto the one canonical, locale-independent
formula language before parsing (
.decimal,,argument separator, English names, as formulas are stored). - parser
- Textual formula parser:
"Revenue = Price * Quantity"->Formula. - schedule
- Pure refresh-scheduling decisions: given each external-sourced measure’s
RefreshPolicyand when it last ran, decide which measures are due to refresh now. This is intentionally I/O-free and clock-free (times are plain seconds) so a daemon can drive it and tests can exercise it deterministically. The daemon (CLIserve-refresh) does the actual query/eval; this only picks what and when. - value
- Value types and runtime values, including error values that propagate through the dataflow graph.
Structs§
- Canvas
Rect - Where a matrix sits on a view’s canvas: position of its top-left corner and
its size, in abstract layout units (the GUI treats them as egui logical
points; nothing here depends on egui —
core_modelis GUI-free). - Category
- A dimension of the model (e.g. Time, Product, Region).
- Coordinate
- A coordinate maps categories to items: one cell of a measure’s tensor.
- External
Call - A measure defined as
func(arg_measures...)wherefuncis a registered external function. Evaluated host-side per coordinate. - Filter
- Restrict a category to a subset of its items in a view.
- Item
- A member of a category (e.g. 2025, “Widget A”).
- Matrix
Placement - One matrix on a view’s canvas: a measure, that matrix’s own pivot layout,
and where it sits (
rect). A view holds several of these — Quantrix’s free-form canvas, where each matrix is independently pivoted (seedocs/reviews/2026-09-22-gui-reconstruction-plan.mdStep 3). - Measure
- A named variable defined over one or more categories, e.g.
Revenue[Time, Product]. - Model
- The whole model: the multidimensional cube plus its raw input data.
- Named
Lambda - A named LAMBDA: its parameters and its body, in which parameter
iis the referencefunctions::lambda_param(i), or, where the body uses it as a category (MAX(x OVER c)), the categoryfunctions::lambda_category(i). A body reads only its parameters (no measures), so a call depends on just its arguments; it may call lambdas defined before it, never itself. - Scenario
- A what-if scenario: a named overlay of input-cell overrides on the base
model. Applying it produces a model whose
inputsare the base inputs with these overrides taking precedence; derived measures then recompute normally. - SqlSource
- How to refresh an SQL-backed input measure: the query and how its columns map to the measure’s dimensions + value. A live-query measure marked here is nondeterministic (its data comes from outside); determinism tests treat only measures WITHOUT an entry here as pure.
- View
- A saved canvas layout: one primary matrix described by the flat fields
below, plus any number of
placements(additional matrices), each with its own measure, pivot and geometry.
Enums§
- Lambda
Param - How a named LAMBDA’s body uses a parameter, which says what a call
passes for it (
NamedLambda::param_kinds). - Measure
Kind - A measure is either raw input data or derived from a formula.
- Refresh
Policy - When an external-sourced measure (SQL or external-function) should refresh.