Spaces:
Sleeping
Sleeping
Update modules/studentact/student_activities_v2.py
Browse files
modules/studentact/student_activities_v2.py
CHANGED
|
@@ -96,14 +96,15 @@ def display_morphosyntax_activities(username: str, t: dict):
|
|
| 96 |
def display_semantic_activities(username: str, t: dict):
|
| 97 |
"""Muestra actividades de análisis semántico"""
|
| 98 |
try:
|
|
|
|
| 99 |
analyses = get_student_semantic_analysis(username)
|
|
|
|
| 100 |
if not analyses:
|
| 101 |
st.info(t.get('no_semantic_analyses', 'No hay análisis semánticos registrados'))
|
| 102 |
return
|
| 103 |
|
| 104 |
for analysis in analyses:
|
| 105 |
try:
|
| 106 |
-
# Convertir timestamp a datetime para formato
|
| 107 |
timestamp = datetime.fromisoformat(analysis['timestamp'].replace('Z', '+00:00'))
|
| 108 |
formatted_date = timestamp.strftime("%d/%m/%Y %H:%M:%S")
|
| 109 |
|
|
@@ -111,16 +112,21 @@ def display_semantic_activities(username: str, t: dict):
|
|
| 111 |
f"{t.get('analysis_date', 'Fecha')}: {formatted_date}",
|
| 112 |
expanded=False
|
| 113 |
):
|
| 114 |
-
# Mostrar solo el grafo de conceptos
|
| 115 |
if 'concept_graph' in analysis and analysis['concept_graph']:
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
else:
|
|
|
|
| 120 |
st.info(t.get('no_graph', 'No hay visualización disponible'))
|
| 121 |
|
| 122 |
except Exception as e:
|
| 123 |
-
logger.error(f"Error
|
| 124 |
continue
|
| 125 |
|
| 126 |
except Exception as e:
|
|
@@ -131,14 +137,15 @@ def display_semantic_activities(username: str, t: dict):
|
|
| 131 |
def display_discourse_activities(username: str, t: dict):
|
| 132 |
"""Muestra actividades de análisis del discurso"""
|
| 133 |
try:
|
|
|
|
| 134 |
analyses = get_student_discourse_analysis(username)
|
|
|
|
| 135 |
if not analyses:
|
| 136 |
st.info(t.get('no_discourse_analyses', 'No hay análisis del discurso registrados'))
|
| 137 |
return
|
| 138 |
|
| 139 |
for analysis in analyses:
|
| 140 |
try:
|
| 141 |
-
# Convertir timestamp a datetime para formato
|
| 142 |
timestamp = datetime.fromisoformat(analysis['timestamp'].replace('Z', '+00:00'))
|
| 143 |
formatted_date = timestamp.strftime("%d/%m/%Y %H:%M:%S")
|
| 144 |
|
|
@@ -146,16 +153,21 @@ def display_discourse_activities(username: str, t: dict):
|
|
| 146 |
f"{t.get('analysis_date', 'Fecha')}: {formatted_date}",
|
| 147 |
expanded=False
|
| 148 |
):
|
| 149 |
-
# Mostrar solo el gráfico combinado
|
| 150 |
if 'combined_graph' in analysis and analysis['combined_graph']:
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
else:
|
|
|
|
| 155 |
st.info(t.get('no_visualization', 'No hay visualización comparativa disponible'))
|
| 156 |
|
| 157 |
except Exception as e:
|
| 158 |
-
logger.error(f"Error
|
| 159 |
continue
|
| 160 |
|
| 161 |
except Exception as e:
|
|
|
|
| 96 |
def display_semantic_activities(username: str, t: dict):
|
| 97 |
"""Muestra actividades de análisis semántico"""
|
| 98 |
try:
|
| 99 |
+
logger.info(f"Recuperando análisis semántico para {username}")
|
| 100 |
analyses = get_student_semantic_analysis(username)
|
| 101 |
+
|
| 102 |
if not analyses:
|
| 103 |
st.info(t.get('no_semantic_analyses', 'No hay análisis semánticos registrados'))
|
| 104 |
return
|
| 105 |
|
| 106 |
for analysis in analyses:
|
| 107 |
try:
|
|
|
|
| 108 |
timestamp = datetime.fromisoformat(analysis['timestamp'].replace('Z', '+00:00'))
|
| 109 |
formatted_date = timestamp.strftime("%d/%m/%Y %H:%M:%S")
|
| 110 |
|
|
|
|
| 112 |
f"{t.get('analysis_date', 'Fecha')}: {formatted_date}",
|
| 113 |
expanded=False
|
| 114 |
):
|
|
|
|
| 115 |
if 'concept_graph' in analysis and analysis['concept_graph']:
|
| 116 |
+
logger.debug("Decodificando gráfico de conceptos")
|
| 117 |
+
try:
|
| 118 |
+
image_bytes = base64.b64decode(analysis['concept_graph'])
|
| 119 |
+
st.image(image_bytes)
|
| 120 |
+
logger.debug("Gráfico mostrado exitosamente")
|
| 121 |
+
except Exception as img_error:
|
| 122 |
+
logger.error(f"Error decodificando imagen: {str(img_error)}")
|
| 123 |
+
st.error(t.get('error_loading_graph', 'Error al cargar el gráfico'))
|
| 124 |
else:
|
| 125 |
+
logger.warning("No se encontró gráfico de conceptos")
|
| 126 |
st.info(t.get('no_graph', 'No hay visualización disponible'))
|
| 127 |
|
| 128 |
except Exception as e:
|
| 129 |
+
logger.error(f"Error procesando análisis individual: {str(e)}")
|
| 130 |
continue
|
| 131 |
|
| 132 |
except Exception as e:
|
|
|
|
| 137 |
def display_discourse_activities(username: str, t: dict):
|
| 138 |
"""Muestra actividades de análisis del discurso"""
|
| 139 |
try:
|
| 140 |
+
logger.info(f"Recuperando análisis del discurso para {username}")
|
| 141 |
analyses = get_student_discourse_analysis(username)
|
| 142 |
+
|
| 143 |
if not analyses:
|
| 144 |
st.info(t.get('no_discourse_analyses', 'No hay análisis del discurso registrados'))
|
| 145 |
return
|
| 146 |
|
| 147 |
for analysis in analyses:
|
| 148 |
try:
|
|
|
|
| 149 |
timestamp = datetime.fromisoformat(analysis['timestamp'].replace('Z', '+00:00'))
|
| 150 |
formatted_date = timestamp.strftime("%d/%m/%Y %H:%M:%S")
|
| 151 |
|
|
|
|
| 153 |
f"{t.get('analysis_date', 'Fecha')}: {formatted_date}",
|
| 154 |
expanded=False
|
| 155 |
):
|
|
|
|
| 156 |
if 'combined_graph' in analysis and analysis['combined_graph']:
|
| 157 |
+
logger.debug("Decodificando gráfico combinado")
|
| 158 |
+
try:
|
| 159 |
+
image_bytes = base64.b64decode(analysis['combined_graph'])
|
| 160 |
+
st.image(image_bytes)
|
| 161 |
+
logger.debug("Gráfico mostrado exitosamente")
|
| 162 |
+
except Exception as img_error:
|
| 163 |
+
logger.error(f"Error decodificando imagen: {str(img_error)}")
|
| 164 |
+
st.error(t.get('error_loading_graph', 'Error al cargar el gráfico'))
|
| 165 |
else:
|
| 166 |
+
logger.warning("No se encontró gráfico combinado")
|
| 167 |
st.info(t.get('no_visualization', 'No hay visualización comparativa disponible'))
|
| 168 |
|
| 169 |
except Exception as e:
|
| 170 |
+
logger.error(f"Error procesando análisis individual: {str(e)}")
|
| 171 |
continue
|
| 172 |
|
| 173 |
except Exception as e:
|