smart / knowledge_base.py
Shakir60's picture
Update knowledge_base.py
1f13845 verified
# knowledge_base.py
KNOWLEDGE_BASE = {
"spalling": [
{
"severity": "Critical",
"description": "Severe concrete spalling with exposed reinforcement and significant section loss",
"repair_method": [
"Install temporary structural support",
"Remove deteriorated concrete",
"Clean and treat reinforcement",
"Apply rust inhibitor",
"Install additional reinforcement if needed",
"Apply bonding agent",
"Use high-strength repair mortar",
"Apply protective coating"
],
"estimated_cost": "Very High ($15,000-$25,000)",
"timeframe": "3-4 weeks",
"location": "Primary structural elements",
"required_expertise": "Structural Engineer + Specialist Contractor",
"immediate_action": "Evacuate area, install temporary support, prevent access",
"prevention": "Regular inspections, waterproofing, chloride protection, proper drainage"
},
{
"severity": "Moderate",
"description": "Surface spalling with minor reinforcement exposure",
"repair_method": [
"Remove loose concrete",
"Clean reinforcement",
"Apply rust inhibitor",
"Patch with repair mortar",
"Surface treatment"
],
"estimated_cost": "Moderate ($5,000-$15,000)",
"timeframe": "1-2 weeks",
"location": "Non-critical elements",
"required_expertise": "Concrete Repair Specialist",
"immediate_action": "Restrict access, document damage extent",
"prevention": "Surface sealants, regular maintenance"
}
],
"reinforcement_corrosion": [
{
"severity": "Critical",
"description": "Severe corrosion with >30% section loss and delamination",
"repair_method": [
"Install structural support",
"Remove contaminated concrete",
"Replace corroded reinforcement",
"Apply migrating corrosion inhibitor",
"Install cathodic protection",
"Reconstruct with high-performance concrete"
],
"estimated_cost": "Critical ($20,000-$50,000)",
"timeframe": "4-6 weeks",
"location": "Load-bearing elements",
"required_expertise": "Senior Structural Engineer + Corrosion Specialist",
"immediate_action": "Immediate evacuation, emergency shoring, detailed assessment",
"prevention": "Waterproofing, cathodic protection, chloride testing"
}
],
"structural_crack": [
{
"severity": "High",
"description": "Active cracks >5mm with possible structural implications",
"repair_method": [
"Structural analysis",
"Install crack monitors",
"Epoxy injection",
"Carbon fiber reinforcement",
"Surface sealing"
],
"estimated_cost": "High ($10,000-$30,000)",
"timeframe": "2-4 weeks",
"location": "Primary structure",
"required_expertise": "Structural Engineer",
"immediate_action": "Install crack monitors, restrict loads",
"prevention": "Load management, movement joint maintenance"
}
],
"foundation_settlement": [
{
"severity": "Critical",
"description": "Differential settlement causing structural distress",
"repair_method": [
"Geotechnical investigation",
"Underpinning",
"Pressure grouting",
"Install piles",
"Level structure",
"Repair resulting damage"
],
"estimated_cost": "Very High ($50,000-$150,000)",
"timeframe": "8-12 weeks",
"location": "Foundation",
"required_expertise": "Geotechnical Engineer + Structural Engineer",
"immediate_action": "Monitor movement, assess stability, restrict occupancy",
"prevention": "Soil investigation, proper drainage, regular monitoring"
}
],
"water_damage": [
{
"severity": "Medium",
"description": "Active water infiltration with material deterioration",
"repair_method": [
"Identify water source",
"Repair waterproofing",
"Improve drainage",
"Replace damaged materials",
"Install moisture barriers"
],
"estimated_cost": "Medium ($5,000-$15,000)",
"timeframe": "1-3 weeks",
"location": "Various",
"required_expertise": "Waterproofing Specialist",
"immediate_action": "Contain water, protect assets, document damage",
"prevention": "Regular maintenance, proper drainage, waterproofing inspection"
}
],
"delamination": [
{
"severity": "High",
"description": "Concrete layer separation with hollow areas",
"repair_method": [
"Remove delaminated concrete",
"Prepare surface",
"Apply bonding agent",
"Install repair material",
"Surface treatment"
],
"estimated_cost": "High ($8,000-$20,000)",
"timeframe": "2-3 weeks",
"location": "Concrete elements",
"required_expertise": "Concrete Repair Specialist",
"immediate_action": "Remove loose material, protect area",
"prevention": "Quality control during construction, proper curing"
}
],
"alkali_silica_reaction": [
{
"severity": "High",
"description": "Concrete deterioration due to ASR gel formation",
"repair_method": [
"Assess extent of ASR",
"Control moisture",
"Apply lithium treatment",
"Repair cracks",
"Install expansion joints"
],
"estimated_cost": "High ($15,000-$40,000)",
"timeframe": "3-5 weeks",
"location": "Concrete structure",
"required_expertise": "Materials Engineer + Structural Engineer",
"immediate_action": "Monitor expansion, assess strength",
"prevention": "Use non-reactive aggregates, low-alkali cement"
}
],
"freeze_thaw_damage": [
{
"severity": "Medium",
"description": "Surface scaling and internal cracking from freeze-thaw cycles",
"repair_method": [
"Remove damaged concrete",
"Install air-entrained concrete",
"Apply surface sealers",
"Improve drainage"
],
"estimated_cost": "Medium ($6,000-$12,000)",
"timeframe": "1-2 weeks",
"location": "Exposed concrete",
"required_expertise": "Concrete Repair Specialist",
"immediate_action": "Remove loose material, protect from moisture",
"prevention": "Air-entrained concrete, proper drainage, sealers"
}
],
"chemical_attack": [
{
"severity": "High",
"description": "Concrete deterioration from chemical exposure",
"repair_method": [
"Neutralize chemicals",
"Remove contaminated concrete",
"Install chemical-resistant coating",
"Apply protective overlay"
],
"estimated_cost": "High ($12,000-$25,000)",
"timeframe": "2-4 weeks",
"location": "Exposed surfaces",
"required_expertise": "Chemical Resistance Specialist",
"immediate_action": "Stop chemical exposure, neutralize area",
"prevention": "Chemical-resistant coatings, proper containment"
}
],
"fire_damage": [
{
"severity": "Critical",
"description": "Structural damage from high temperature exposure",
"repair_method": [
"Structural assessment",
"Remove damaged material",
"Reinforce structure",
"Replace fire protection",
"Reconstruct affected areas"
],
"estimated_cost": "Very High ($30,000-$100,000)",
"timeframe": "4-8 weeks",
"location": "Fire-affected areas",
"required_expertise": "Fire Damage Specialist + Structural Engineer",
"immediate_action": "Assess stability, prevent access",
"prevention": "Fire protection systems, regular inspections"
}
],
"no_damage": [
{
"severity": "Low",
"description": "No significant structural issues identified",
"repair_method": [
"Regular inspection",
"Routine maintenance",
"Document condition"
],
"estimated_cost": "Low ($500-$2,000)",
"timeframe": "1-2 days",
"location": "General",
"required_expertise": "Building Inspector",
"immediate_action": "Continue monitoring",
"prevention": "Regular maintenance schedule"
}
]
}
DAMAGE_TYPES = {
0: {'name': 'spalling', 'risk': 'High', 'color': '#ff4d4d'},
1: {'name': 'reinforcement_corrosion', 'risk': 'Critical', 'color': '#800000'},
2: {'name': 'structural_crack', 'risk': 'High', 'color': '#ff6b6b'},
3: {'name': 'foundation_settlement', 'risk': 'Critical', 'color': '#8b0000'},
4: {'name': 'water_damage', 'risk': 'Medium', 'color': '#4dabf7'},
5: {'name': 'delamination', 'risk': 'High', 'color': '#ff8c00'},
6: {'name': 'alkali_silica_reaction', 'risk': 'High', 'color': '#9932cc'},
7: {'name': 'freeze_thaw_damage', 'risk': 'Medium', 'color': '#20b2aa'},
8: {'name': 'chemical_attack', 'risk': 'High', 'color': '#dc143c'},
9: {'name': 'fire_damage', 'risk': 'Critical', 'color': '#b22222'},
10: {'name': 'no_damage', 'risk': 'Low', 'color': '#40c057'}
}
# Additional metadata for enhanced analysis
DAMAGE_METADATA = {
'spalling': {
'common_causes': ['Reinforcement corrosion', 'Freeze-thaw cycles', 'Poor concrete quality'],
'test_methods': ['Hammer sounding', 'GPR scanning', 'Core sampling'],
'environmental_factors': ['Chloride exposure', 'Carbonation', 'Moisture'],
'inspection_frequency': 'Every 6-12 months'
},
'reinforcement_corrosion': {
'common_causes': ['Chloride penetration', 'Carbonation', 'Poor concrete cover'],
'test_methods': ['Half-cell potential', 'Chloride testing', 'Resistivity measurement'],
'environmental_factors': ['Marine environment', 'De-icing salts', 'Industrial pollution'],
'inspection_frequency': 'Every 3-6 months'
},
# Add metadata for other damage types...
}
def get_damage_severity(damage_type: str, confidence: float) -> str:
"""Calculate damage severity based on type and confidence"""
base_risk = DAMAGE_TYPES[damage_type]['risk']
if confidence > 80:
return f"High {base_risk}"
elif confidence > 50:
return base_risk
else:
return f"Low {base_risk}"