# Unit Price Database Manager for Construction
## Overview
Manage and maintain construction unit price databases. Update prices from vendors, apply location and time adjustments, track price history, and ensure estimating accuracy.
## Business Case
Accurate unit prices are critical for:
- **Competitive Bids**: Win work with accurate pricing
- **Cost Control**: Avoid budget surprises
- **Vendor Management**: Track supplier pricing
- **Historical Analysis**: Understand price trends
## Technical Implementation
```python
from dataclasses import dataclass, field
from typing import List, Dict, Any, Optional
from datetime import datetime, date
from decimal import Decimal
import pandas as pd
import json
@dataclass
class UnitPrice:
code: str
description: str
unit: str
base_price: Decimal
labor_cost: Decimal
material_cost: Decimal
equipment_cost: Decimal
effective_date: date
expiration_date: Optional[date] = None
source: str = ""
vendor: str = ""
location: str = "National Average"
notes: str = ""
tags: List[str] = field(default_factory=list)
@dataclass
class PriceUpdate:
code: str
old_price: Decimal
new_price: Decimal
change_pct: float
updated_at: datetime
updated_by: str
reason: str
@dataclass
class VendorQuote:
vendor_name: str
item_code: str
quoted_price: Decimal
quote_date: date
valid_until: date
quantity_break: Optional[int] = None
notes: str = ""
class UnitPriceDatabaseManager:
"""Manage construction unit price databases."""
# Location adjustment factors
LOCATION_FACTORS = {
'New York': 1.32, 'San Francisco': 1.28, 'Los Angeles': 1.15,
'Chicago': 1.12, 'Boston': 1.18, 'Seattle': 1.08,
'Denver': 1.02, 'National Average': 1.00,
'Houston': 0.92, 'Dallas': 0.89, 'Phoenix': 0.93,
'Atlanta': 0.91, 'Miami': 0.95
}
def __init...
{ copied = true; setTimeout(() => copied = false, 2000) })"
class="absolute right-3 top-3 rounded-lg bg-slate-700 px-3 py-1.5 text-xs font-bold text-slate-200 hover:bg-slate-600 transition"
x-text="copied ? '已复制' : '复制'">