brushline.exchange
Cost build-up, owner view, contractor bid, bid comparison, approval, and synthetic exchange validation.
Shared plan cost build-up for owner and contractor exchange.
- class brushline.exchange.plan.CostBuildUp(*, schema_version: Literal['brushline.plan-exchange.v1'] = 'brushline.plan-exchange.v1', plan_id: str, currency: str, categories: list[CostCategoryTotal], total_cost: Annotated[float, Ge(ge=0)], action_count: Annotated[int, Ge(ge=1)])[source]
A reproducible plan cost build-up.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class brushline.exchange.plan.CostCategoryTotal(*, category: str, amount: Annotated[float, Ge(ge=0)], line_count: Annotated[int, Ge(ge=0)])[source]
Cost total for one category.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class brushline.exchange.plan.PlanExchange(*, schema_version: Literal['brushline.plan-exchange.v1'] = 'brushline.plan-exchange.v1', plan: Plan, cost_buildup: CostBuildUp)[source]
The single shared plan artifact plus its cost build-up.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- brushline.exchange.plan.build_exchange(plan: Plan) PlanExchange[source]
Validate a plan and attach its cost build-up.
- brushline.exchange.plan.cost_buildup(plan: Plan) CostBuildUp[source]
Build category totals from line items and reject cent-level drift.
- Parameters:
plan (Plan) – Plan artifact.
- Returns:
CostBuildUp – Category totals and exact plan total.
- Raises:
ValueError – When the plan is invalid or totals disagree by more than a cent.
Owner view of a shared plan.
- class brushline.exchange.owner.OwnerView(*, plan_id: str, version: int, currency: str, total_cost: Annotated[float, Ge(ge=0)], budget: Annotated[float, Ge(ge=0)], budget_remaining: float, service_attainment: Annotated[float, Ge(ge=0), Le(le=1)], risk: Annotated[float, Ge(ge=0), Le(le=1)], portfolio: dict[str, float], bau: dict[str, float], assumptions: list[str])[source]
Owner-facing plan summary.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- brushline.exchange.owner.build_owner_view(exchange: PlanExchange, *, budget: float, service_attainment: float, risk: float, portfolio: dict[str, float] | None = None, bau: dict[str, float] | None = None) OwnerView[source]
Build the owner summary from the shared plan exchange.
Contractor bid view of the shared plan.
- class brushline.exchange.contractor.ContractorBid(*, plan_id: str, version: int, contractor_id: str, currency: str, quantities: dict[str, float], access_cost: Annotated[float, Ge(ge=0)], schedule_days: Annotated[int, Ge(ge=1)], productivity: Annotated[float, Gt(gt=0)], cost_lines: dict[str, float], assumptions: list[str], total_cost: Annotated[float, Ge(ge=0)])[source]
Contractor-facing bid built from the same plan actions.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- brushline.exchange.contractor.build_contractor_bid(exchange: PlanExchange, *, contractor_id: str, access_cost: float = 0, schedule_days: int = 1, productivity: float = 1.0, rate_adjustments: dict[str, float] | None = None, assumptions: list[str] | None = None) ContractorBid[source]
Build a contractor bid with named rate adjustments.
Bid normalization and fair-price comparison.
- class brushline.exchange.bids.BidComparison(*, plan_id: str, owner_total: Annotated[float, Ge(ge=0)], bid_total: Annotated[float, Ge(ge=0)], delta: float, fair_low: Annotated[float, Ge(ge=0)], fair_high: Annotated[float, Ge(ge=0)], within_fair_range: bool, named_assumptions: list[str], rate_differences: dict[str, float], scope_differences: list[str], attributable: bool)[source]
Owner-plan versus contractor-bid comparison.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- brushline.exchange.bids.compare_bid(exchange: PlanExchange, bid: ContractorBid, *, fair_low: float, fair_high: float) BidComparison[source]
Compare a bid to the shared plan and record every difference source.
Plan approval and audit record.
- class brushline.exchange.audit.ApprovalRecord(*, schema_version: Literal['brushline.plan-approval.v1'] = 'brushline.plan-approval.v1', plan_id: str, version: Annotated[int, Ge(ge=1)], reviewer: str, status: Literal['pending', 'approved', 'rejected'], comment: str = '', plan_digest: str, created_utc: datetime)[source]
An approval or review record.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- brushline.exchange.audit.plan_digest(exchange: object) str[source]
Return a canonical digest of a plan exchange or plan.
- brushline.exchange.audit.approve_plan(*, plan_id: str, version: int, reviewer: str, status: Literal['pending', 'approved', 'rejected'], plan: object, comment: str = '', created_utc: datetime | None = None) ApprovalRecord[source]
Create an approval record with a plan digest.
- brushline.exchange.audit.write_approval(record: ApprovalRecord, path: str | Path) Path[source]
Write an approval record.
Synthetic owner-contractor exchange validation.
- class brushline.exchange.validation.ExchangeValidation(*, schema_version: Literal['brushline.exchange-validation.v1'] = 'brushline.exchange-validation.v1', plan_id: str, same_artifact: bool, cost_reproduced: bool, bid_attributable: bool, within_fair_range: bool, approval_reviewer: str, checks_passed: bool, created_utc: datetime)[source]
Synthetic exchange checks.
- model_config = {'extra': 'forbid', 'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- brushline.exchange.validation.build_synthetic_exchange(created_utc: datetime | None = None) tuple[PlanExchange, OwnerView, ContractorBid, BidComparison, ApprovalRecord, ExchangeValidation][source]
Build a shared plan, owner view, bid, comparison, approval, and validation.
- brushline.exchange.validation.write_validation(result: ExchangeValidation, path: str | Path) Path[source]
Write validation JSON.