Skip to content

Models

The unified domain model that all parser tracks produce. Documents are procurement (X80–X89, using AwardInfo/BoQ/Item), trade (X93–X97, using TradeOrder/OrderItem), cost (X50/X51, using ElementalCosting/CostElement), or quantity (X31, using QtyDetermination/QtyItem).

Document

GAEBDocument

Bases: BaseModel

Root model produced by all parser tracks — the unified output contract.

Procurement documents populate award; trade documents populate order; cost documents populate elemental_costing; quantity determination documents populate qty_determination. Use document_kind, is_trade, is_procurement, is_cost, or is_quantity to discriminate, and iter_items() for universal iteration.

grand_total property

grand_total

Sum of all item totals across any document kind.

computed_grand_total property

computed_grand_total

Sum of all item.computed_total (qty x unit_price). Procurement only.

memory_estimate_mb property

memory_estimate_mb

Approximate memory usage in MB (~1 KB per item + attachment sizes).

iter_items

iter_items()

Iterate all items regardless of document kind.

Returns Item instances for procurement documents, OrderItem instances for trade documents, CostElement instances for cost documents, and QtyItem instances for quantity determination documents.

discard_xml

discard_xml()

Release the retained lxml tree and all source_element references.

Call this after you are done with :meth:xpath and source_element access to free the underlying C-level memory held by lxml.

xpath

xpath(expression)

Run an XPath query against the raw XML tree.

Requires keep_xml=True at parse time. When the document has a namespace, it is available as the g prefix::

doc.xpath("//g:Item[@RNoPart='001']")

GAEBInfo

Bases: BaseModel

Metadata about the software that generated the GAEB file.

AwardInfo

Bases: BaseModel

Project-level award information (procurement phases X80-X89).

Fields from both <AwardInfo> and <PrjInfo> are merged here to give a single, developer-friendly project metadata object.

Bill of Quantities

BoQ

Bases: BaseModel

Complete BoQ structure supporting single and multi-lot documents.

iter_items

iter_items()

Iterate all items across all lots.

get_item

get_item(oz)

Find an item by its OZ (ordinal number).

add_item

add_item(oz, category_rno, **kwargs)

Add a new item to the category matching category_rno.

Searches across all lots. Raises ValueError if the category is not found.

Parameters:

Name Type Description Default
oz str

Ordinal number for the new item.

required
category_rno str

Target category rno.

required
**kwargs Any

Additional Item fields (short_text, qty, unit, etc.).

{}

Returns:

Type Description
Item

The newly created Item.

remove_item

remove_item(oz)

Remove an item by OZ from any category across all lots.

Returns:

Type Description
Item | None

The removed Item, or None if not found.

move_item

move_item(oz, target_category_rno)

Move an item from its current category to another.

Parameters:

Name Type Description Default
oz str

OZ of the item to move.

required
target_category_rno str

Destination category rno.

required

Returns:

Type Description
Item

The moved Item.

Raises:

Type Description
ValueError

If item or target category not found.

recalculate_totals

recalculate_totals()

Recompute all Totals from items at category, lot, and BoQ levels.

iter_hierarchy

iter_hierarchy()

Walk the hierarchy tree yielding (depth, label, category_or_none).

Lot

Bases: BaseModel

A single lot within a multi-lot document.

BoQBody

Bases: BaseModel

Top-level BoQ body containing categories.

BoQCtgy

Bases: BaseModel

A category (section) in the BoQ hierarchy, containing items and/or sub-categories.

iter_items

iter_items()

Iterate all items in this category and its subcategories.

add_item

add_item(**kwargs)

Add a new item to this category.

Returns:

Type Description
Item

The newly created Item.

remove_item

remove_item(oz)

Remove an item by OZ from this category (non-recursive).

Returns:

Type Description
Item | None

The removed Item, or None if not found.

BoQBkdn

Bases: BaseModel

Single level in the BoQ breakdown structure.

BoQInfo

Bases: BaseModel

BoQ-level metadata including breakdown definitions.

CostType

Bases: BaseModel

Cost type classification on BoQInfo (X52 Kalkulationsansätze).

Totals & VAT

Financial summary data from <Totals> elements on BoQInfo, BoQCtgy, and Lot. Includes discount breakdowns, per-rate VAT partitions, and net/gross totals.

Totals

Bases: BaseModel

Authoritative financial summary (<Totals>) on BoQInfo, BoQCtgy, or Lot.

Fields mirror the tgTotals schema type. All monetary values use Decimal for precision.

VATPart

Bases: BaseModel

A single VAT rate partition within a Totals block.

GAEB files can have multiple VAT rates (e.g. 19% and 7%) applied to different subsets of items. Each VATPart carries the net amount subject to that rate and the resulting VAT amount.

Item (Procurement)

Item

Bases: BaseModel

A single item (position) in a procurement Bill of Quantities (X80-X89).

Inherits text, quantity, and LLM fields; adds procurement-specific pricing, hierarchy, and attachment support.

computed_total property

computed_total

qty x unit_price, rounded to 2 decimal places (ROUND_HALF_UP).

full_oz property

full_oz

The complete ordinal number (Ordnungszahl), e.g. "01.02.0004".

Joins the ancestor category/lot RNoPart chain (oz_path) with this item's own leaf oz using . as the separator. Falls back to the bare oz when no ancestor chain is available (e.g. items built programmatically). Use :meth:full_oz_with for a custom separator.

full_oz_with

full_oz_with(separator='.')

Like :attr:full_oz but with a caller-chosen separator.

ClassificationResult

Bases: BaseModel

Semantic construction element classification result.

ExtractionResult

Bases: BaseModel

Result of structured extraction for a single item.

RichText

Bases: BaseModel

Parsed long text with structural elements.

QtySplit

Bases: BaseModel

Partial quantity breakdown (e.g., by building section, floor, or time period).

CostEstimate

Bases: BaseModel

Estimated cost for LLM classification of a document.

Attachment

Bases: BaseModel

Base64-decoded binary content from X31 (DA XML 3.3).

CostApproach

Bases: BaseModel

Per-item calculation approach (X52 Kalkulationsansätze).

MarkupSubQty

Bases: BaseModel

Reference to an item being marked up (X52 <MarkupSubQty>).

ValidationResult

Bases: BaseModel

A single validation issue found during parsing or validation.

Trade Order (X93–X97)

TradeOrder

Bases: BaseModel

Container for a GAEB trade order (X93-X97).

Parallel to AwardInfo for procurement phases. Contains flat order items instead of a hierarchical Bill of Quantities.

grand_total property

grand_total

Sum of net_price (or offer_price) across all items.

OrderItem

Bases: BaseModel

A single item in a GAEB trade order (X93-X97).

Carries the same text and LLM fields as a procurement Item so that LLMClassifier and StructuredExtractor work unchanged. Adds trade-specific identification, pricing, and logistics fields.

display_price property

display_price

Return the most relevant price: net_price if available, else offer_price.

OrderInfo

Bases: BaseModel

Metadata on a trade order (order number, dates, references).

SupplierInfo

Bases: BaseModel

Supplier (vendor) details.

CustomerInfo

Bases: BaseModel

Customer (buyer) details.

DeliveryPlaceInfo

Bases: BaseModel

Delivery location details.

PlannerInfo

Bases: BaseModel

Planner / architect details.

InvoiceInfo

Bases: BaseModel

Invoice recipient details.

Address

Bases: BaseModel

Postal address — mirrors the GAEB tgAddress schema type.

Name fields follow the XSD convention: Name1 through Name4. The name field maps to <Name1> (or <Name> in older files).

Elemental Costing (X50/X51)

ElementalCosting

Bases: BaseModel

Root container for X50/X51 cost documents.

Provides iter_items() yielding CostElement instances for universal iteration compatible with doc.iter_items().

iter_items

iter_items()

Yield all CostElements recursively (flat).

iter_hierarchy

iter_hierarchy()

Walk the cost category tree yielding (depth, label, category).

ECInfo

Bases: BaseModel

Metadata for elemental cost estimation.

ECBody

Bases: BaseModel

Body container for the cost hierarchy (categories + elements).

iter_cost_elements

iter_cost_elements()

Yield all CostElements recursively (flat iteration).

ECCtgy

Bases: BaseModel

Cost estimation category (grouping level in the cost hierarchy).

iter_cost_elements

iter_cost_elements()

Yield all CostElements in this category and its subcategories.

CostElement

Bases: BaseModel

Individual cost element — the 'item' of elemental costing documents.

Carries the same text, quantity, and LLM fields as procurement Item and trade OrderItem so that doc.iter_items() and LLM classification/extraction work universally.

display_price property

display_price

Best available total: explicit item_total, or qty * unit_price.

iter_cost_elements

iter_cost_elements()

Yield this element and all descendants (depth-first).

CostProperty

Bases: BaseModel

BIM-integrated property on a cost or dimension element.

RefGroup

Bases: BaseModel

Cross-reference group linking cost elements to BoQ items, categories, etc.

DimensionElement

Bases: BaseModel

Dimensional element (area, volume, length) in a cost hierarchy.

CategoryElement

Bases: BaseModel

Category grouping element in a cost hierarchy.

ECBkdn

Bases: BaseModel

Breakdown level definition for elemental costing.

ConsortiumMember

Bases: BaseModel

Consortium (ARGE) member with optional address.

Cross-Reference Models

Used by RefGroup to link cost elements to BoQ items, other cost elements, dimensions, categories, and consortium members.

BoQItemRef

Bases: BaseModel

Reference from a cost element to a BoQ item.

BoQCtgyRef

Bases: BaseModel

Reference from a cost element to a BoQ category.

CostElementRef

Bases: BaseModel

Reference to another cost element.

DimensionElementRef

Bases: BaseModel

Reference to a dimension element.

CategoryElementRef

Bases: BaseModel

Reference to a category element.

ConsortiumMemberRef

Bases: BaseModel

Reference to a consortium (ARGE) member.

Quantity Determination (X31)

QtyDetermination

Bases: BaseModel

Root model for X31 Quantity Determination documents.

grand_total property

grand_total

Always zero — quantity determination documents have no prices.

iter_items

iter_items()

Iterate all quantity items.

iter_hierarchy

iter_hierarchy()

Walk the BoQ hierarchy tree.

QtyDetermInfo

Bases: BaseModel

Metadata for the quantity determination.

QtyBoQ

Bases: BaseModel

Quantity determination BoQ — simplified BoQ referencing an external procurement BoQ.

get_item

get_item(oz)

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

iter_hierarchy

iter_hierarchy()

Walk the category hierarchy tree.

QtyBoQBody

Bases: BaseModel

Top-level body of a quantity determination BoQ.

QtyBoQCtgy

Bases: BaseModel

Category in a quantity determination BoQ.

iter_items

iter_items()

Iterate all items in this category and its subcategories.

QtyItem

Bases: BaseModel

A quantity-determination item — thin BoQ position with measurement data.

Unlike procurement Item, this model carries no descriptions or prices. The oz field enables cross-referencing with procurement BoQ items.

QDetermItem

Bases: BaseModel

A single quantity determination entry with a take-off row.

QTakeoffRow

Bases: BaseModel

Single quantity take-off row (REB 23.003 format).

The raw field stores the full fixed-width formatted string (typically 80 characters) as specified by the REB 23.003 standard.

Call :meth:parse to extract structured dimensions and computed quantity from the raw string.

parse

parse()

Parse the raw REB 23.003 string into structured fields.

Extracts description, dimensions, formula, and computed quantity from common REB row formats::

"Fundament A  5,00 * 3,20 * 0,75 = 12,000 m3"
"Wand Nord   12,50 * 3,00 = 37,500 m2"

Returns:

Name Type Description
A ParsedTakeoff

class:ParsedTakeoff with extracted fields.

QtyAttachment

Bases: BaseModel

Catalog attachment from X31 quantity determination (photos, sketches, PDFs).

Referenced from QTakeoff rows via #Bild <name> syntax.

mime_type property

mime_type

Derive MIME type from file_type.

data_base64 property

data_base64

Return base64-encoded data string.

PrjInfoQD

Bases: BaseModel

Project reference info for quantity determination.

Catalog System (shared)

Used across all document kinds (procurement, trade, cost, quantity) for DIN 276 cost groups, BIM references, locality catalogs, and work category assignments.

CtlgAssign

Bases: BaseModel

Catalog assignment — links an item/category to a catalog entry.

Used at BoQ, category, item, and measurement-row levels across all GAEB document kinds.

Catalog

Bases: BaseModel

Catalog definition (DIN 276 cost groups, BIM, locality, work category, etc.).

Enumerations

DocumentKind

Bases: str, Enum

Discriminator for procurement, trade, cost, and quantity documents.

PROCUREMENT class-attribute instance-attribute

PROCUREMENT = 'procurement'

TRADE class-attribute instance-attribute

TRADE = 'trade'

COST class-attribute instance-attribute

COST = 'cost'

QUANTITY class-attribute instance-attribute

QUANTITY = 'quantity'

SourceVersion

Bases: str, Enum

GAEB format version detected from source file.

DA_XML_20 class-attribute instance-attribute

DA_XML_20 = '2.0'

DA_XML_21 class-attribute instance-attribute

DA_XML_21 = '2.1'

DA_XML_30 class-attribute instance-attribute

DA_XML_30 = '3.0'

DA_XML_31 class-attribute instance-attribute

DA_XML_31 = '3.1'

DA_XML_32 class-attribute instance-attribute

DA_XML_32 = '3.2'

DA_XML_33 class-attribute instance-attribute

DA_XML_33 = '3.3'

GAEB_90 class-attribute instance-attribute

GAEB_90 = '90'

ExchangePhase

Bases: str, Enum

GAEB exchange phase — procurement, trade, and cost workflows.

X50 class-attribute instance-attribute

X50 = 'X50'

X51 class-attribute instance-attribute

X51 = 'X51'

X52 class-attribute instance-attribute

X52 = 'X52'

X80 class-attribute instance-attribute

X80 = 'X80'

X81 class-attribute instance-attribute

X81 = 'X81'

X82 class-attribute instance-attribute

X82 = 'X82'

X83 class-attribute instance-attribute

X83 = 'X83'

X84 class-attribute instance-attribute

X84 = 'X84'

X85 class-attribute instance-attribute

X85 = 'X85'

X86 class-attribute instance-attribute

X86 = 'X86'

X88 class-attribute instance-attribute

X88 = 'X88'

X89 class-attribute instance-attribute

X89 = 'X89'

X89B class-attribute instance-attribute

X89B = 'X89B'

X31 class-attribute instance-attribute

X31 = 'X31'

X83Z class-attribute instance-attribute

X83Z = 'X83Z'

X84Z class-attribute instance-attribute

X84Z = 'X84Z'

X86ZR class-attribute instance-attribute

X86ZR = 'X86ZR'

X86ZE class-attribute instance-attribute

X86ZE = 'X86ZE'

X93 class-attribute instance-attribute

X93 = 'X93'

X94 class-attribute instance-attribute

X94 = 'X94'

X96 class-attribute instance-attribute

X96 = 'X96'

X97 class-attribute instance-attribute

X97 = 'X97'

D80 class-attribute instance-attribute

D80 = 'D80'

D81 class-attribute instance-attribute

D81 = 'D81'

D82 class-attribute instance-attribute

D82 = 'D82'

D83 class-attribute instance-attribute

D83 = 'D83'

D84 class-attribute instance-attribute

D84 = 'D84'

D85 class-attribute instance-attribute

D85 = 'D85'

D86 class-attribute instance-attribute

D86 = 'D86'

D88 class-attribute instance-attribute

D88 = 'D88'

D89 class-attribute instance-attribute

D89 = 'D89'

D31 class-attribute instance-attribute

D31 = 'D31'

is_cost property

is_cost

True for cost phases (X50, X51).

is_trade property

is_trade

True for trade phases (X93, X94, X96, X97).

is_quantity property

is_quantity

True for quantity determination phases (X31).

normalized

normalized()

Return the X-prefixed canonical form (D83 -> X83, etc.).

ItemType

Bases: str, Enum

Item type classification within a BoQ.

NORMAL class-attribute instance-attribute

NORMAL = 'Normal'

LUMP_SUM class-attribute instance-attribute

LUMP_SUM = 'LumpSum'

ALTERNATIVE class-attribute instance-attribute

ALTERNATIVE = 'Alternative'

EVENTUAL class-attribute instance-attribute

EVENTUAL = 'Eventual'

TEXT_ONLY class-attribute instance-attribute

TEXT_ONLY = 'TextOnly'

BASE_SURCHARGE class-attribute instance-attribute

BASE_SURCHARGE = 'BaseSurcharge'

INDEX class-attribute instance-attribute

INDEX = 'Index'

SUPPLEMENT class-attribute instance-attribute

SUPPLEMENT = 'Supplement'

MARKUP class-attribute instance-attribute

MARKUP = 'Markup'

affects_total property

affects_total

BkdnType

Bases: str, Enum

BoQ breakdown level type.

LOT class-attribute instance-attribute

LOT = 'Lot'

BOQ_LEVEL class-attribute instance-attribute

BOQ_LEVEL = 'BoQLevel'

ITEM class-attribute instance-attribute

ITEM = 'Item'

INDEX class-attribute instance-attribute

INDEX = 'Index'

ValidationSeverity

Bases: str, Enum

Severity level for validation results.

ERROR class-attribute instance-attribute

ERROR = 'ERROR'

WARNING class-attribute instance-attribute

WARNING = 'WARNING'

INFO class-attribute instance-attribute

INFO = 'INFO'

ValidationMode

Bases: str, Enum

Validation strictness mode.

LENIENT class-attribute instance-attribute

LENIENT = 'lenient'

STRICT class-attribute instance-attribute

STRICT = 'strict'

ClassificationFlag

Bases: str, Enum

Classification confidence flags.

AUTO_CLASSIFIED class-attribute instance-attribute

AUTO_CLASSIFIED = 'auto-classified'

NEEDS_SPOT_CHECK class-attribute instance-attribute

NEEDS_SPOT_CHECK = 'needs-spot-check'

NEEDS_REVIEW class-attribute instance-attribute

NEEDS_REVIEW = 'needs-review'

LLM_ERROR class-attribute instance-attribute

LLM_ERROR = 'llm-error'

MANUAL_OVERRIDE class-attribute instance-attribute

MANUAL_OVERRIDE = 'manual-override'

Document Navigation

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.