BoQ Tree API¶
Read-only tree adapter for navigating the BoQ hierarchy with parent references, depth tracking, and indexed lookups.
NodeKind
¶
Bases: str, Enum
Discriminator for the type of model a BoQNode wraps.
BoQNode
¶
Read-only tree node wrapping a single BoQ model object.
Provides O(1) parent/children/depth access and subtree query helpers. Children are stored as an immutable tuple to signal read-only intent.
BoQTree
¶
Read-only tree adapter for a procurement BoQ.
Wraps an existing BoQ instance and builds a navigable node graph
with parent references, depth tracking, and indexed lookups. The
underlying Pydantic models are not modified.
Construction is O(n) where n is the total number of nodes.
find_item
¶
O(1) item lookup by OZ. Accepts either the leaf RNoPart
(e.g. "0004") or the full OZ (e.g. "01.02.0004"). Returns
None if not found.
find_category
¶
First category node with this rno (depth-first). None if not found.
find_all_categories
¶
All category nodes with this rno (e.g. same rno in different lots).