Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -7,18 +7,18 @@ def validate_inputs(input_data):
|
|
| 7 |
required_fields = [
|
| 8 |
"project_name", "phase", "task", "current_progress",
|
| 9 |
"task_expected_duration", "task_actual_duration", "workforce_gap",
|
| 10 |
-
"workforce_shift_hours", "
|
| 11 |
-
"weather_forecast_date"
|
| 12 |
]
|
| 13 |
for field in required_fields:
|
| 14 |
if not input_data[field]:
|
| 15 |
-
return f"Please select or fill in {field.replace('_', ' ').
|
| 16 |
if not (0 <= input_data["current_progress"] <= 100):
|
| 17 |
return "Current progress must be between 0 and 100"
|
| 18 |
if not (0 <= input_data["workforce_gap"] <= 100):
|
| 19 |
return "Workforce gap must be between 0 and 100"
|
| 20 |
-
|
| 21 |
-
|
|
|
|
| 22 |
return None
|
| 23 |
|
| 24 |
def generate_heatmap(delay_probability, label):
|
|
|
|
| 7 |
required_fields = [
|
| 8 |
"project_name", "phase", "task", "current_progress",
|
| 9 |
"task_expected_duration", "task_actual_duration", "workforce_gap",
|
| 10 |
+
"workforce_shift_hours", "weather_condition", "weather_forecast_date"
|
|
|
|
| 11 |
]
|
| 12 |
for field in required_fields:
|
| 13 |
if not input_data[field]:
|
| 14 |
+
return f"Please select or fill in {field.replace('_', ' ').title()}"
|
| 15 |
if not (0 <= input_data["current_progress"] <= 100):
|
| 16 |
return "Current progress must be between 0 and 100"
|
| 17 |
if not (0 <= input_data["workforce_gap"] <= 100):
|
| 18 |
return "Workforce gap must be between 0 and 100"
|
| 19 |
+
valid_weather_conditions = ["Sunny", "Partly Cloudy", "Cloudy", "Light Rain", "Heavy Rain", "Severe Storm"]
|
| 20 |
+
if input_data["weather_condition"] not in valid_weather_conditions:
|
| 21 |
+
return "Please select a valid weather condition"
|
| 22 |
return None
|
| 23 |
|
| 24 |
def generate_heatmap(delay_probability, label):
|