Canonical docs
- Rule-Based Strategy — conditions, temporal modifiers and parameter references
- Single-File Decoder
In the research projects
The Python project supplies its own execution signals. The Compiled project allocation scenario includes a declared rule-based primary. In both paths, the execution contract determines fills, costs and availability after a research decision has been formed.
What this package owns
Owns the rule-based decoder building blocks: the RuleBasedConfig schema (with leaf-condition validation) and build_predicate, which compiles a condition tree into an evaluable predicate over a frame.
Does not own the SFD wiring that uses these (owned by the rule_based modules in limen.sfd.foundational_sfd / reference_architecture) or experiment execution.
Key entry points
| Entry point | Use case | Notes |
|---|---|---|
RuleBasedConfig |
Validated rule-strategy configuration | Enforces required fields per leaf condition type |
build_predicate |
Compile a condition tree into a callable predicate | Evaluated against a pl.DataFrame |
Adjacent modules
limen.sfd.reference_architecture.rule_based(RuleBasedStrategy) andlimen.sfd.foundational_sfd.rule_basedbuild on these.limen.data.utils.split_data_to_rule_based_prep_outputproduces thedata_dictvariant that keeps the raw columns predicates reference.
Quick orientation
| Module or family | Responsibility |
|---|---|
config.py |
RuleBasedConfig + leaf-condition validation |
predicates.py |
build_predicate + operator table |
rule_based/├── README.md├── __init__.py├── _conditions.py├── _temporal.py├── common_strategies.py├── config.py└── predicates.pyThings to know
Selected Compiled rule pipelines can be reconstructed through Trainer and consumed by Sensor and binary Cohort. See the canonical selected-rule inference contract, including identical-window comparisons and caller-owned SQL causality.
- Leaf conditions are validated by type: each of
threshold,relative,crossover,slope, andsql_exprhas its own required fields, and a missing field raisesValueError. - Logical nodes combine leaves with
and,or, andnot. - Leaf conditions may specify
persistence_norrecency_n; see the canonical temporal-modifier contract. - Predicate values support
{param}-style formatting, so thresholds can be parameterized from the manifest.