Spaces:
Sleeping
Sleeping
Update modules/studentact/current_situation_interface.py
Browse files
modules/studentact/current_situation_interface.py
CHANGED
|
@@ -303,23 +303,53 @@ def display_comparison_results(baseline_metrics, current_metrics):
|
|
| 303 |
|
| 304 |
def display_metrics_and_suggestions(metrics, text_type, title, show_suggestions=False):
|
| 305 |
"""
|
| 306 |
-
Muestra métricas y sugerencias de mejora
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 307 |
"""
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
for dimension, values in metrics.items():
|
| 311 |
-
score = values['normalized_score']
|
| 312 |
-
target = thresholds[dimension]['target']
|
| 313 |
|
| 314 |
-
st.
|
| 315 |
-
dimension.title(),
|
| 316 |
-
f"{score:.2f}",
|
| 317 |
-
f"Meta: {target:.2f}",
|
| 318 |
-
delta_color="normal" if score >= target else "inverse"
|
| 319 |
-
)
|
| 320 |
|
| 321 |
-
|
| 322 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
|
| 324 |
def display_radar_chart(metrics_config, thresholds, baseline_metrics=None):
|
| 325 |
"""
|
|
|
|
| 303 |
|
| 304 |
def display_metrics_and_suggestions(metrics, text_type, title, show_suggestions=False):
|
| 305 |
"""
|
| 306 |
+
Muestra métricas y opcionalmente sugerencias de mejora.
|
| 307 |
+
Args:
|
| 308 |
+
metrics: Diccionario con las métricas analizadas
|
| 309 |
+
text_type: Tipo de texto seleccionado
|
| 310 |
+
title: Título para las métricas ("Base" o "Iteración")
|
| 311 |
+
show_suggestions: Booleano para mostrar sugerencias
|
| 312 |
"""
|
| 313 |
+
try:
|
| 314 |
+
thresholds = TEXT_TYPES[text_type]['thresholds']
|
|
|
|
|
|
|
|
|
|
| 315 |
|
| 316 |
+
st.markdown(f"### Métricas {title}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
|
| 318 |
+
for dimension, values in metrics.items():
|
| 319 |
+
score = values['normalized_score']
|
| 320 |
+
target = thresholds[dimension]['target']
|
| 321 |
+
min_val = thresholds[dimension]['min']
|
| 322 |
+
|
| 323 |
+
# Determinar estado y color
|
| 324 |
+
if score < min_val:
|
| 325 |
+
status = "⚠️ Por mejorar"
|
| 326 |
+
color = "inverse"
|
| 327 |
+
elif score < target:
|
| 328 |
+
status = "📈 Aceptable"
|
| 329 |
+
color = "off"
|
| 330 |
+
else:
|
| 331 |
+
status = "✅ Óptimo"
|
| 332 |
+
color = "normal"
|
| 333 |
+
|
| 334 |
+
# Mostrar métrica
|
| 335 |
+
st.metric(
|
| 336 |
+
dimension.title(),
|
| 337 |
+
f"{score:.2f}",
|
| 338 |
+
f"{status} (Meta: {target:.2f})",
|
| 339 |
+
delta_color=color,
|
| 340 |
+
help=f"Meta: {target:.2f}, Mínimo: {min_val:.2f}"
|
| 341 |
+
)
|
| 342 |
+
|
| 343 |
+
# Mostrar sugerencias si es necesario
|
| 344 |
+
if show_suggestions and score < target:
|
| 345 |
+
suggest_improvement_tools(dimension)
|
| 346 |
+
|
| 347 |
+
# Agregar espacio entre métricas
|
| 348 |
+
st.markdown("<div style='margin-bottom: 0.5rem;'></div>", unsafe_allow_html=True)
|
| 349 |
+
|
| 350 |
+
except Exception as e:
|
| 351 |
+
logger.error(f"Error mostrando métricas: {str(e)}")
|
| 352 |
+
st.error("Error al mostrar métricas")
|
| 353 |
|
| 354 |
def display_radar_chart(metrics_config, thresholds, baseline_metrics=None):
|
| 355 |
"""
|