Skip to content

Document Diff API Reference

BoQDiff

BoQDiff

Deterministic document comparison engine for GAEB BoQ files.

Compares items by OZ (lot-aware), detects structural changes, and classifies each field change by significance level.

compare staticmethod

compare(doc_a, doc_b, mode=DEFAULT)

Compare two GAEB documents and return a structured diff result.

Parameters:

Name Type Description Default
doc_a GAEBDocument

The "before" document (base/original).

required
doc_b GAEBDocument

The "after" document (revised/updated).

required
mode DiffMode

Controls strictness of compatibility validation. DEFAULT adds warnings for mismatched projects. STRICT raises ValueError for different projects. FORCE suppresses all compatibility warnings.

DEFAULT

Returns:

Type Description
DiffResult

A DiffResult with item-level, structural, and metadata changes.

Raises:

Type Description
ValueError

If mode is STRICT and documents appear to be from different projects.

TypeError

If either document is not a procurement-type document.

DiffResult

DiffResult

Bases: BaseModel

Complete result of comparing two GAEB documents.

DiffSummary

DiffSummary

Bases: BaseModel

Top-level summary of the comparison.

DiffDocInfo

DiffDocInfo

Bases: BaseModel

Snapshot of a document's identity for the diff result.

Significance

Significance

Bases: str, Enum

How important a change is in a construction context.

DiffMode

DiffMode

Bases: str, Enum

Controls how strictly the diff validates document compatibility.

ItemDiffSummary

ItemDiffSummary

Bases: BaseModel

Summary of all item-level changes.

filter_modified

filter_modified(min_significance=LOW)

Return only modified items with at least one change at or above the threshold.

ItemAdded

ItemAdded

Bases: BaseModel

An item present in document B but not in A.

ItemRemoved

ItemRemoved

Bases: BaseModel

An item present in document A but not in B.

ItemModified

ItemModified

Bases: BaseModel

An item present in both documents with field-level changes.

filter_changes

filter_changes(min_significance)

Return only changes at or above the given significance level.

ItemMoved

ItemMoved

Bases: BaseModel

An item that exists in both documents but under different categories.

FieldChange

FieldChange

Bases: BaseModel

A single field-level change between two items.

StructureDiffSummary

StructureDiffSummary

Bases: BaseModel

Summary of structural (category/section) changes.

SectionChange

SectionChange

Bases: BaseModel

A category/section that was added or removed.

SectionRenamed

SectionRenamed

Bases: BaseModel

A category/section whose label changed.

MetadataChange

MetadataChange

Bases: BaseModel

A single metadata field change.