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.
computed_grand_total
property
¶
Sum of all item.computed_total (qty x unit_price). Procurement only.
memory_estimate_mb
property
¶
Approximate memory usage in MB (~1 KB per item + attachment sizes).
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
¶
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
¶
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.
add_item
¶
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 |
required |
**kwargs
|
Any
|
Additional Item fields (short_text, qty, unit, etc.). |
{}
|
Returns:
| Type | Description |
|---|---|
Item
|
The newly created Item. |
remove_item
¶
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 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 |
required |
Returns:
| Type | Description |
|---|---|
Item
|
The moved Item. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If item or target category not found. |
recalculate_totals
¶
Recompute all Totals from items at category, lot, and BoQ levels.
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.
add_item
¶
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
¶
qty x unit_price, rounded to 2 decimal places (ROUND_HALF_UP).
full_oz
property
¶
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.
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.
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
¶
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().
ECInfo
¶
Bases: BaseModel
Metadata for elemental cost estimation.
ECBody
¶
Bases: BaseModel
Body container for the cost hierarchy (categories + elements).
ECCtgy
¶
Bases: BaseModel
Cost estimation category (grouping level in the cost hierarchy).
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.
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
¶
QtyDetermInfo
¶
Bases: BaseModel
Metadata for the quantity determination.
QtyBoQ
¶
QtyBoQBody
¶
Bases: BaseModel
Top-level body of a quantity determination BoQ.
QtyBoQCtgy
¶
Bases: BaseModel
Category in a quantity determination BoQ.
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 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: |
QtyAttachment
¶
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.
SourceVersion
¶
Bases: str, Enum
GAEB format version detected from source file.
ExchangePhase
¶
Bases: str, Enum
GAEB exchange phase — procurement, trade, and cost workflows.
ItemType
¶
Bases: str, Enum
Item type classification within a BoQ.
BkdnType
¶
ValidationSeverity
¶
ValidationMode
¶
ClassificationFlag
¶
Bases: str, Enum
Classification confidence flags.
Document Navigation¶
DocumentAPI
¶
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
¶
Iterate all items (universal — works for all document kinds).
For procurement documents, optionally filter to a specific lot.
filter_items
¶
Filter items by various criteria (works for all document kinds).
xpath
¶
Run an XPath query against the raw XML tree.
Requires keep_xml=True at parse time.
custom_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.