Spaces:
Sleeping
Sleeping
Upload data_validation.py
Browse files- app/data_validation.py +21 -1
app/data_validation.py
CHANGED
|
@@ -142,7 +142,7 @@ class DataValidation:
|
|
| 142 |
# Check if any components exist
|
| 143 |
if not any(components.values()):
|
| 144 |
is_valid = False
|
| 145 |
-
messages.append("At least one building component (wall, roof, floor, window, or
|
| 146 |
|
| 147 |
# Check wall components
|
| 148 |
for i, wall in enumerate(components.get("walls", [])):
|
|
@@ -228,6 +228,26 @@ class DataValidation:
|
|
| 228 |
is_valid = False
|
| 229 |
messages.append(f"Door #{i+1}: U-value must be greater than zero.")
|
| 230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
# Check for minimum requirements
|
| 232 |
if not components.get("walls", []):
|
| 233 |
messages.append("Warning: No walls defined. At least one wall is recommended.")
|
|
|
|
| 142 |
# Check if any components exist
|
| 143 |
if not any(components.values()):
|
| 144 |
is_valid = False
|
| 145 |
+
messages.append("At least one building component (wall, roof, floor, window, door, or skylight) is required.")
|
| 146 |
|
| 147 |
# Check wall components
|
| 148 |
for i, wall in enumerate(components.get("walls", [])):
|
|
|
|
| 228 |
is_valid = False
|
| 229 |
messages.append(f"Door #{i+1}: U-value must be greater than zero.")
|
| 230 |
|
| 231 |
+
# Check skylight components
|
| 232 |
+
for i, skylight in enumerate(components.get("skylights", [])):
|
| 233 |
+
# Check required fields
|
| 234 |
+
if not skylight.name:
|
| 235 |
+
is_valid = False
|
| 236 |
+
messages.append(f"Skylight #{i+1}: Name is required.")
|
| 237 |
+
|
| 238 |
+
# Check numeric fields
|
| 239 |
+
if skylight.area <= 0:
|
| 240 |
+
is_valid = False
|
| 241 |
+
messages.append(f"Skylight #{i+1}: Area must be greater than zero.")
|
| 242 |
+
|
| 243 |
+
if skylight.u_value <= 0:
|
| 244 |
+
is_valid = False
|
| 245 |
+
messages.append(f"Skylight #{i+1}: U-value must be greater than zero.")
|
| 246 |
+
|
| 247 |
+
if skylight.shgc <= 0 or skylight.shgc > 1:
|
| 248 |
+
is_valid = False
|
| 249 |
+
messages.append(f"Skylight #{i+1}: SHGC must be between 0 and 1.")
|
| 250 |
+
|
| 251 |
# Check for minimum requirements
|
| 252 |
if not components.get("walls", []):
|
| 253 |
messages.append("Warning: No walls defined. At least one wall is recommended.")
|