Shakir60 commited on
Commit
a3f65ba
·
verified ·
1 Parent(s): d9a6878

Update knowledge_base.py

Browse files
Files changed (1) hide show
  1. knowledge_base.py +56 -7
knowledge_base.py CHANGED
@@ -1,10 +1,24 @@
 
1
 
 
 
 
 
 
 
2
  KNOWLEDGE_BASE = {
3
  "spalling": [
4
  {
5
  "severity": "Critical",
6
  "description": "Severe concrete spalling with exposed reinforcement and section loss",
7
- "repair_method": ["Install temporary support", "Remove deteriorated concrete", "Clean and treat reinforcement", "Apply corrosion inhibitor", "Apply bonding agent", "High-strength repair mortar"],
 
 
 
 
 
 
 
8
  "estimated_cost": "Very High ($15,000+)",
9
  "timeframe": "3-4 weeks",
10
  "location": "Primary structural elements",
@@ -15,7 +29,12 @@ KNOWLEDGE_BASE = {
15
  {
16
  "severity": "High",
17
  "description": "Surface spalling with visible reinforcement",
18
- "repair_method": ["Remove damaged concrete", "Treat reinforcement", "Apply repair mortar", "Surface treatment"],
 
 
 
 
 
19
  "estimated_cost": "High ($8,000-$15,000)",
20
  "timeframe": "2-3 weeks",
21
  "location": "Structural elements",
@@ -28,7 +47,13 @@ KNOWLEDGE_BASE = {
28
  {
29
  "severity": "Critical",
30
  "description": "Severe corrosion with >30% section loss",
31
- "repair_method": ["Structural support", "Remove concrete", "Replace reinforcement", "Corrosion protection", "Concrete repair"],
 
 
 
 
 
 
32
  "estimated_cost": "Critical ($20,000+)",
33
  "timeframe": "4-6 weeks",
34
  "location": "Load-bearing elements",
@@ -41,7 +66,12 @@ KNOWLEDGE_BASE = {
41
  {
42
  "severity": "High",
43
  "description": "Cracks >5mm in structural elements",
44
- "repair_method": ["Structural analysis", "Epoxy injection", "Carbon fiber reinforcement", "Crack monitoring"],
 
 
 
 
 
45
  "estimated_cost": "High ($10,000-$20,000)",
46
  "timeframe": "2-4 weeks",
47
  "location": "Primary structure",
@@ -54,7 +84,12 @@ KNOWLEDGE_BASE = {
54
  {
55
  "severity": "Medium",
56
  "description": "Active water penetration with efflorescence",
57
- "repair_method": ["Water source identification", "Drainage improvement", "Waterproof membrane", "Ventilation"],
 
 
 
 
 
58
  "estimated_cost": "Medium ($5,000-$10,000)",
59
  "timeframe": "1-2 weeks",
60
  "location": "Various",
@@ -67,7 +102,10 @@ KNOWLEDGE_BASE = {
67
  {
68
  "severity": "Low",
69
  "description": "No significant structural issues",
70
- "repair_method": ["Regular inspection", "Preventive maintenance"],
 
 
 
71
  "estimated_cost": "Low ($500-$2,000)",
72
  "timeframe": "1-2 days",
73
  "location": "General",
@@ -78,10 +116,21 @@ KNOWLEDGE_BASE = {
78
  ]
79
  }
80
 
 
81
  DAMAGE_TYPES = {
82
  0: {'name': 'spalling', 'risk': 'High', 'color': '#ff4d4d'},
83
  1: {'name': 'reinforcement_corrosion', 'risk': 'Critical', 'color': '#800000'},
84
  2: {'name': 'structural_crack', 'risk': 'High', 'color': '#ff6b6b'},
85
  3: {'name': 'dampness', 'risk': 'Medium', 'color': '#4dabf7'},
86
  4: {'name': 'no_damage', 'risk': 'Low', 'color': '#40c057'}
87
- }
 
 
 
 
 
 
 
 
 
 
 
1
+ # knowledge_base.py
2
 
3
+ import logging
4
+
5
+ # Configure logging
6
+ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
7
+
8
+ # Knowledge base containing structural damage information
9
  KNOWLEDGE_BASE = {
10
  "spalling": [
11
  {
12
  "severity": "Critical",
13
  "description": "Severe concrete spalling with exposed reinforcement and section loss",
14
+ "repair_method": [
15
+ "Install temporary support",
16
+ "Remove deteriorated concrete",
17
+ "Clean and treat reinforcement",
18
+ "Apply corrosion inhibitor",
19
+ "Apply bonding agent",
20
+ "High-strength repair mortar"
21
+ ],
22
  "estimated_cost": "Very High ($15,000+)",
23
  "timeframe": "3-4 weeks",
24
  "location": "Primary structural elements",
 
29
  {
30
  "severity": "High",
31
  "description": "Surface spalling with visible reinforcement",
32
+ "repair_method": [
33
+ "Remove damaged concrete",
34
+ "Treat reinforcement",
35
+ "Apply repair mortar",
36
+ "Surface treatment"
37
+ ],
38
  "estimated_cost": "High ($8,000-$15,000)",
39
  "timeframe": "2-3 weeks",
40
  "location": "Structural elements",
 
47
  {
48
  "severity": "Critical",
49
  "description": "Severe corrosion with >30% section loss",
50
+ "repair_method": [
51
+ "Structural support",
52
+ "Remove concrete",
53
+ "Replace reinforcement",
54
+ "Corrosion protection",
55
+ "Concrete repair"
56
+ ],
57
  "estimated_cost": "Critical ($20,000+)",
58
  "timeframe": "4-6 weeks",
59
  "location": "Load-bearing elements",
 
66
  {
67
  "severity": "High",
68
  "description": "Cracks >5mm in structural elements",
69
+ "repair_method": [
70
+ "Structural analysis",
71
+ "Epoxy injection",
72
+ "Carbon fiber reinforcement",
73
+ "Crack monitoring"
74
+ ],
75
  "estimated_cost": "High ($10,000-$20,000)",
76
  "timeframe": "2-4 weeks",
77
  "location": "Primary structure",
 
84
  {
85
  "severity": "Medium",
86
  "description": "Active water penetration with efflorescence",
87
+ "repair_method": [
88
+ "Water source identification",
89
+ "Drainage improvement",
90
+ "Waterproof membrane",
91
+ "Ventilation"
92
+ ],
93
  "estimated_cost": "Medium ($5,000-$10,000)",
94
  "timeframe": "1-2 weeks",
95
  "location": "Various",
 
102
  {
103
  "severity": "Low",
104
  "description": "No significant structural issues",
105
+ "repair_method": [
106
+ "Regular inspection",
107
+ "Preventive maintenance"
108
+ ],
109
  "estimated_cost": "Low ($500-$2,000)",
110
  "timeframe": "1-2 days",
111
  "location": "General",
 
116
  ]
117
  }
118
 
119
+ # Damage type metadata
120
  DAMAGE_TYPES = {
121
  0: {'name': 'spalling', 'risk': 'High', 'color': '#ff4d4d'},
122
  1: {'name': 'reinforcement_corrosion', 'risk': 'Critical', 'color': '#800000'},
123
  2: {'name': 'structural_crack', 'risk': 'High', 'color': '#ff6b6b'},
124
  3: {'name': 'dampness', 'risk': 'Medium', 'color': '#4dabf7'},
125
  4: {'name': 'no_damage', 'risk': 'Low', 'color': '#40c057'}
126
+ }
127
+
128
+ # Validation for knowledge base
129
+ required_keys = ['severity', 'description', 'repair_method', 'estimated_cost', 'timeframe', 'location', 'required_expertise', 'immediate_action', 'prevention']
130
+ for damage_type, cases in KNOWLEDGE_BASE.items():
131
+ for case in cases:
132
+ for key in required_keys:
133
+ if key not in case:
134
+ logging.error(f"Missing required field '{key}' in {damage_type}")
135
+ raise ValueError(f"Missing required field '{key}' in {damage_type}")
136
+ logging.info("Knowledge base validation passed.")