File size: 5,419 Bytes
a3f65ba
d212a90
a3f65ba
 
 
 
 
 
d212a90
 
 
 
 
a3f65ba
 
 
 
 
 
 
 
d212a90
 
 
 
 
 
 
 
 
 
a3f65ba
 
 
 
 
 
d212a90
 
 
 
 
 
 
 
 
 
 
 
a3f65ba
 
 
 
 
 
 
d212a90
 
 
 
 
 
 
 
 
 
 
 
a3f65ba
 
 
 
 
 
d212a90
 
 
 
 
 
 
 
 
 
 
 
a3f65ba
 
 
 
 
 
d212a90
 
 
 
 
 
 
 
 
 
 
 
a3f65ba
 
 
 
d212a90
 
 
 
 
 
 
 
 
 
a3f65ba
d212a90
 
 
 
 
 
a3f65ba
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# knowledge_base.py

import logging

# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')

# Knowledge base containing structural damage information
KNOWLEDGE_BASE = {
    "spalling": [
        {
            "severity": "Critical",
            "description": "Severe concrete spalling with exposed reinforcement and section loss",
            "repair_method": [
                "Install temporary support",
                "Remove deteriorated concrete",
                "Clean and treat reinforcement",
                "Apply corrosion inhibitor",
                "Apply bonding agent",
                "High-strength repair mortar"
            ],
            "estimated_cost": "Very High ($15,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"
        },
        {
            "severity": "High",
            "description": "Surface spalling with visible reinforcement",
            "repair_method": [
                "Remove damaged concrete",
                "Treat reinforcement",
                "Apply repair mortar",
                "Surface treatment"
            ],
            "estimated_cost": "High ($8,000-$15,000)",
            "timeframe": "2-3 weeks",
            "location": "Structural elements",
            "required_expertise": "Structural Engineer",
            "immediate_action": "Area isolation, temporary support assessment",
            "prevention": "Protective coatings, drainage improvement"
        }
    ],
    "reinforcement_corrosion": [
        {
            "severity": "Critical",
            "description": "Severe corrosion with >30% section loss",
            "repair_method": [
                "Structural support",
                "Remove concrete",
                "Replace reinforcement",
                "Corrosion protection",
                "Concrete repair"
            ],
            "estimated_cost": "Critical ($20,000+)",
            "timeframe": "4-6 weeks",
            "location": "Load-bearing elements",
            "required_expertise": "Senior Structural Engineer",
            "immediate_action": "Immediate evacuation, emergency shoring",
            "prevention": "Waterproofing, cathodic protection"
        }
    ],
    "structural_crack": [
        {
            "severity": "High",
            "description": "Cracks >5mm in structural elements",
            "repair_method": [
                "Structural analysis",
                "Epoxy injection",
                "Carbon fiber reinforcement",
                "Crack monitoring"
            ],
            "estimated_cost": "High ($10,000-$20,000)",
            "timeframe": "2-4 weeks",
            "location": "Primary structure",
            "required_expertise": "Structural Engineer",
            "immediate_action": "Install crack monitors, load restriction",
            "prevention": "Load management, joint maintenance"
        }
    ],
    "dampness": [
        {
            "severity": "Medium",
            "description": "Active water penetration with efflorescence",
            "repair_method": [
                "Water source identification",
                "Drainage improvement",
                "Waterproof membrane",
                "Ventilation"
            ],
            "estimated_cost": "Medium ($5,000-$10,000)",
            "timeframe": "1-2 weeks",
            "location": "Various",
            "required_expertise": "Waterproofing Specialist",
            "immediate_action": "Dehumidification, efflorescence cleaning",
            "prevention": "Proper drainage, vapor barriers"
        }
    ],
    "no_damage": [
        {
            "severity": "Low",
            "description": "No significant structural issues",
            "repair_method": [
                "Regular inspection",
                "Preventive maintenance"
            ],
            "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 type metadata
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': 'dampness', 'risk': 'Medium', 'color': '#4dabf7'},
    4: {'name': 'no_damage', 'risk': 'Low', 'color': '#40c057'}
}

# Validation for knowledge base
required_keys = ['severity', 'description', 'repair_method', 'estimated_cost', 'timeframe', 'location', 'required_expertise', 'immediate_action', 'prevention']
for damage_type, cases in KNOWLEDGE_BASE.items():
    for case in cases:
        for key in required_keys:
            if key not in case:
                logging.error(f"Missing required field '{key}' in {damage_type}")
                raise ValueError(f"Missing required field '{key}' in {damage_type}")
logging.info("Knowledge base validation passed.")