AIdeaText commited on
Commit
f757c7b
·
verified ·
1 Parent(s): e33e4b8

Update modules/studentact/current_situation_interface.py

Browse files
modules/studentact/current_situation_interface.py CHANGED
@@ -20,7 +20,7 @@ from .current_situation_analysis import (
20
  generate_connection_paths,
21
  create_vocabulary_network,
22
  create_syntax_complexity_graph,
23
- create_cohesion_heatmap,
24
  )
25
 
26
  # Configuración del estilo de matplotlib para el gráfico de radar
@@ -293,4 +293,93 @@ def display_radar_chart(metrics_config, thresholds):
293
  except Exception as e:
294
  logger.error(f"Error mostrando gráfico radar: {str(e)}")
295
  st.error("Error al mostrar el gráfico")
296
- #######################################
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  generate_connection_paths,
21
  create_vocabulary_network,
22
  create_syntax_complexity_graph,
23
+ create_cohesion_heatmap
24
  )
25
 
26
  # Configuración del estilo de matplotlib para el gráfico de radar
 
293
  except Exception as e:
294
  logger.error(f"Error mostrando gráfico radar: {str(e)}")
295
  st.error("Error al mostrar el gráfico")
296
+ #######################################
297
+
298
+ def display_recommendations(recommendations, t):
299
+ """
300
+ Muestra las recomendaciones con un diseño de tarjetas.
301
+ """
302
+ # Definir colores para cada categoría
303
+ colors = {
304
+ 'vocabulary': '#2E86C1', # Azul
305
+ 'structure': '#28B463', # Verde
306
+ 'cohesion': '#F39C12', # Naranja
307
+ 'clarity': '#9B59B6', # Púrpura
308
+ 'priority': '#E74C3C' # Rojo para la categoría prioritaria
309
+ }
310
+
311
+ # Iconos para cada categoría
312
+ icons = {
313
+ 'vocabulary': '📚',
314
+ 'structure': '🏗️',
315
+ 'cohesion': '🔄',
316
+ 'clarity': '💡',
317
+ 'priority': '⭐'
318
+ }
319
+
320
+ # Obtener traducciones para cada dimensión
321
+ dimension_names = {
322
+ 'vocabulary': t.get('SITUATION_ANALYSIS', {}).get('vocabulary', "Vocabulario"),
323
+ 'structure': t.get('SITUATION_ANALYSIS', {}).get('structure', "Estructura"),
324
+ 'cohesion': t.get('SITUATION_ANALYSIS', {}).get('cohesion', "Cohesión"),
325
+ 'clarity': t.get('SITUATION_ANALYSIS', {}).get('clarity', "Claridad"),
326
+ 'priority': t.get('SITUATION_ANALYSIS', {}).get('priority', "Prioridad")
327
+ }
328
+
329
+ # Título de la sección prioritaria
330
+ priority_focus = t.get('SITUATION_ANALYSIS', {}).get('priority_focus', 'Área prioritaria para mejorar')
331
+ st.markdown(f"### {icons['priority']} {priority_focus}")
332
+
333
+ # Determinar área prioritaria (la que tiene menor puntuación)
334
+ priority_area = recommendations.get('priority', 'vocabulary')
335
+ priority_title = dimension_names.get(priority_area, "Área prioritaria")
336
+
337
+ # Determinar el contenido para mostrar
338
+ if isinstance(recommendations[priority_area], dict) and 'title' in recommendations[priority_area]:
339
+ priority_title = recommendations[priority_area]['title']
340
+ priority_content = recommendations[priority_area]['content']
341
+ else:
342
+ priority_content = recommendations[priority_area]
343
+
344
+ # Mostrar la recomendación prioritaria con un estilo destacado
345
+ with st.container():
346
+ st.markdown(
347
+ f"""
348
+ <div style="border:2px solid {colors['priority']}; border-radius:5px; padding:15px; margin-bottom:20px;">
349
+ <h4 style="color:{colors['priority']};">{priority_title}</h4>
350
+ <p>{priority_content}</p>
351
+ </div>
352
+ """,
353
+ unsafe_allow_html=True
354
+ )
355
+
356
+ # Crear dos columnas para las tarjetas de recomendaciones restantes
357
+ col1, col2 = st.columns(2)
358
+
359
+ # Distribuir las recomendaciones en las columnas
360
+ categories = ['vocabulary', 'structure', 'cohesion', 'clarity']
361
+ for i, category in enumerate(categories):
362
+ # Saltar si esta categoría ya es la prioritaria
363
+ if category == priority_area:
364
+ continue
365
+
366
+ # Determinar título y contenido
367
+ if isinstance(recommendations[category], dict) and 'title' in recommendations[category]:
368
+ category_title = recommendations[category]['title']
369
+ category_content = recommendations[category]['content']
370
+ else:
371
+ category_title = dimension_names.get(category, category)
372
+ category_content = recommendations[category]
373
+
374
+ # Alternar entre columnas
375
+ with col1 if i % 2 == 0 else col2:
376
+ # Crear tarjeta para cada recomendación
377
+ st.markdown(
378
+ f"""
379
+ <div style="border:1px solid {colors[category]}; border-radius:5px; padding:10px; margin-bottom:15px;">
380
+ <h4 style="color:{colors[category]};">{icons[category]} {category_title}</h4>
381
+ <p>{category_content}</p>
382
+ </div>
383
+ """,
384
+ unsafe_allow_html=True
385
+ )