A smart pricing engine for bathroom renovation projects that generates structured quotes from natural language transcripts.
cd bathroom-pricing-engine
python3 demo_scenarios.pyThis repository contains a complete bathroom pricing engine that:
- Parses natural language transcripts to extract project requirements
- Generates structured JSON quotes with detailed cost breakdowns
- Supports city-based pricing (Paris, Marseille, Lyon, etc.)
- Includes confidence scoring for quote accuracy
- Provides comprehensive testing and demo scenarios
bathroom-pricing-engine/
├── pricing_engine.py # Main engine
├── demo_scenarios.py # Demo scenarios for testing
├── pricing_logic/
│ ├── material_db.py # Material costs
│ ├── labor_calc.py # Labor calculations
│ └── vat_rules.py # VAT calculations
├── data/
│ ├── materials.json # Material database
│ └── price_templates.csv # Pricing templates
├── output/
│ └── sample_quote.json # Sample output for reference
├── tests/
│ └── test_logic.py # Test suite
└── DELIVERABLES_SUMMARY.md # Project summary
python3 demo_scenarios.pycd tests && python3 test_logic.pyThe engine generates comprehensive JSON quotes with:
- Grouped by zone/task: Demolition, Plumbing, Tiling, etc.
- Labor costs: Hours, rates, and total labor cost per task
- Material breakdown: Detailed material costs with quantities
- VAT calculations: Proper French VAT rates
- Confidence scores: Accuracy assessment for each quote
- Transcript Parsing: Extracts area, location, tasks, budget consciousness
- City-based Pricing: Different multipliers for Paris, Marseille, Lyon, etc.
- Budget Detection: Automatic material downgrades for budget-conscious clients
- Comprehensive Testing: 19 test cases covering all functionality
- Production Ready: Error handling and edge cases covered
- Deliverables Summary - Project overview
- Sample Output - Example quote format
- Python 3.8+ - No external dependencies
- JSON - Structured output format
- Modular Architecture - Clean separation of concerns
- Python 3.8+
- No external dependencies required
cd bathroom-pricing-engine
# Run the main engine
python3 pricing_engine.py
# Run demo scenarios for testing
python3 demo_scenarios.py
# Run the test suite
cd tests && python3 test_logic.pyfrom pricing_engine import BathroomPricingEngine
engine = BathroomPricingEngine()
transcript = """
Client wants to renovate a small 4m² bathroom. They'll remove the old tiles,
redo the plumbing for the shower, replace the toilet, install a vanity,
repaint the walls, and lay new ceramic floor tiles. Budget-conscious.
Located in Marseille.
"""
quote = engine.generate_quote(transcript)
output_file = engine.export_quote_json(quote)
print(f"Total Price: €{quote.total_price:.2f}")
print(f"Confidence: {quote.confidence_score:.1%}")The engine generates structured JSON quotes:
{
"quote_id": "BATH-20241201-143022",
"client_description": "Original transcript text",
"location": "marseille",
"total_area": 4.0,
"total_materials": 1250.50,
"total_labor": 1800.75,
"total_vat": 610.25,
"total_price": 3661.50,
"confidence_score": 0.85,
"generated_at": "2024-12-01T14:30:22.123456",
"assumptions": [
"Standard bathroom layout for 4.0m²",
"Location multiplier applied: 1.1x",
"Prices include basic fixtures and fittings",
"Does not include design fees or project management",
"Valid for 30 days from quote date",
"Budget-friendly materials and labor rates applied"
],
"items": [
{
"task_name": "tile_removal",
"zone": "Demolition",
"materials": [...],
"labor_hours": 2.0,
"labor_rate": 25.0,
"material_cost": 4.0,
"labor_cost": 50.0,
"subtotal": 54.0,
"vat_rate": 0.20,
"vat_amount": 10.8,
"total": 64.8,
"confidence_score": 0.85,
"notes": "Includes disposal of old materials"
}
]
}- Area: Detected from patterns like "4m²", "small bathroom"
- Location: City-based pricing (Paris, Marseille, Lyon, etc.)
- Tasks: Identified from keywords (tile removal, plumbing, tiling, etc.)
- Budget Consciousness: Detected from words like "budget", "cheap", "affordable"
- Database-driven with costs, availability, and quality levels
- Budget-conscious selection of cheaper alternatives
- Location multipliers (Paris: 1.4x, Marseille: 1.1x)
- Trade-specific rates (plumbers, electricians, tilers, etc.)
- Location-based pricing
- Area-based complexity adjustments
- Task-specific hours
- Task-based VAT rates
- Material VAT rates
- French compliance (20% standard, 10% reduced, 5.5% super-reduced)
- Area-based confidence
- Material availability
- Task complexity
- Tile removal and demolition
- Plumbing work (shower, toilet, sink, vanity)
- Tiling (walls and floors)
- Painting and finishing
- Flooring installation
- Electrical work
- Fixture installation
- Paris (1.4x multiplier)
- Marseille (1.1x multiplier)
- Lyon (1.2x multiplier)
- Toulouse (1.15x multiplier)
- Nice (1.25x multiplier)
- Default locations (1.0x multiplier)
- Budget level: Cheaper alternatives
- Standard level: Mid-range quality
- Premium level: High-end materials
# In pricing_logic/material_db.py
self.materials['new_material'] = Material(
name='New Material',
cost_per_unit=50.0,
unit='m²',
coverage_per_unit=1.0,
available=True,
quality_level='standard',
supplier='Supplier Name'
)# In pricing_logic/labor_calc.py
self.labor_calc.update_labor_rate('paris', 'plumber', 60.0)# In pricing_logic/vat_rules.py
self.vat_rules.update_vat_rate('standard', 0.22)This project is part of the Donizo founding data engineer test case.