Tree Aggregation Strategy
Module
pyqt_reactive.strategies.tree_aggregation
Purpose
Provide explicit, pluggable percent aggregation policies for recursive tree structures.
Core Contracts
TreeAggregationPolicyABCTreeAggregationPolicyRegistry
Built-in Policies
MeanTreeAggregationPolicy: aggregate as arithmetic mean of childrenExplicitPercentTreeAggregationPolicy: preserve node-local percent
Why This Matters
Tree UIs often mix nodes that should be averaged (parent rollups) and nodes that should remain explicit (leaf/detail progress). A typed policy registry prevents hidden ad-hoc math and fails loudly on unknown policy IDs.
Usage
Register policies in
TreeAggregationPolicyRegistry.Assign policy ID per node type in domain builder code.
Aggregate recursively using
registry.aggregate(...).