Skip to content

DocumentAPI

High-level navigation and filtering helper that wraps a GAEBDocument. Works across all document kinds (procurement, trade, cost, quantity).

from pygaeb import DocumentAPI

api = DocumentAPI(doc)

DocumentAPI

DocumentAPI(doc)

Convenience wrapper for navigating a parsed GAEBDocument.

Works with procurement, trade, and cost documents. Use is_trade / is_procurement / is_cost to discriminate, and iter_items() for universal iteration over any document kind.

iter_items

iter_items(lot_index=None)

Iterate all items (universal — works for all document kinds).

For procurement documents, optionally filter to a specific lot.

get_item

get_item(oz)

Find a procurement item by its OZ (ordinal number).

get_order_item

get_order_item(art_no)

Find a trade order item by article number.

get_cost_element

get_cost_element(ele_no)

Find a cost element by its element number.

get_qty_item

get_qty_item(oz)

Find a quantity determination item by its OZ.

iter_hierarchy

iter_hierarchy()

Walk the hierarchy tree (procurement BoQ, cost, or quantity).

filter_items

filter_items(predicate=None, item_type=None, trade=None, min_total=None, has_classification=None)

Filter items by various criteria (works for all document kinds).

xpath

xpath(expression)

Run an XPath query against the raw XML tree.

Requires keep_xml=True at parse time.

custom_tag

custom_tag(item, tag)

Get text content of a custom/vendor tag from an item's source element.

Works for Item, OrderItem, and CostElement. Returns None if the tag is not found or keep_xml was not enabled.

summary

summary()

Return a summary of the document.