Update modules/studentact/student_activities_v2.py
Browse files
modules/studentact/student_activities_v2.py
CHANGED
@@ -135,7 +135,7 @@ def display_current_situation_activities(username: str, t: dict):
|
|
135 |
logger.info(f"Procesando {len(paired_analyses)} pares de an谩lisis")
|
136 |
|
137 |
# Mostrar cada par de an谩lisis
|
138 |
-
for
|
139 |
try:
|
140 |
# Obtener datos de situaci贸n y recomendaci贸n
|
141 |
situation_data = analysis_pair.get('situation', {})
|
@@ -169,30 +169,23 @@ def display_current_situation_activities(username: str, t: dict):
|
|
169 |
}.get(text_type, text_type)
|
170 |
title += f" - {text_type_display}"
|
171 |
|
172 |
-
# Generar clave 煤nica para este expander
|
173 |
-
expander_key = generate_unique_key("situation", f"expander_{i}", username)
|
174 |
-
|
175 |
# Mostrar el an谩lisis en un expander
|
176 |
-
with st.expander(title, expanded=False
|
177 |
# Mostrar texto analizado
|
178 |
st.subheader(t.get('analyzed_text', 'Texto analizado'))
|
179 |
-
# Usar clave 煤nica para el text_area
|
180 |
-
text_area_key = generate_unique_key("situation", f"text_area_{i}", username)
|
181 |
st.text_area(
|
182 |
-
|
183 |
value=text_to_show,
|
184 |
height=100,
|
185 |
disabled=True,
|
186 |
-
|
187 |
-
label_visibility="hidden"
|
188 |
)
|
189 |
|
190 |
# Crear tabs para separar diagn贸stico y recomendaciones
|
191 |
-
tab_key = generate_unique_key("situation", f"tabs_{i}", username)
|
192 |
diagnosis_tab, recommendations_tab = st.tabs([
|
193 |
t.get('diagnosis_tab', 'Diagn贸stico'),
|
194 |
t.get('recommendations_tab', 'Recomendaciones')
|
195 |
-
]
|
196 |
|
197 |
# Tab de diagn贸stico
|
198 |
with diagnosis_tab:
|
@@ -223,45 +216,41 @@ def display_current_situation_activities(username: str, t: dict):
|
|
223 |
color = "#ccffcc" # light green
|
224 |
|
225 |
# Mostrar la m茅trica con estilo
|
226 |
-
metric_key = generate_unique_key("situation", f"metric_{i}_{metric_name}", username)
|
227 |
st.markdown(f"""
|
228 |
<div style="background-color:{color}; padding:10px; border-radius:5px; margin-bottom:10px;">
|
229 |
<b>{emoji} {metric_name.capitalize()}:</b> {score:.2f}
|
230 |
</div>
|
231 |
-
""", unsafe_allow_html=True
|
232 |
|
233 |
# Mostrar detalles adicionales si est谩n disponibles
|
234 |
with col2:
|
235 |
st.subheader(t.get('details', 'Detalles'))
|
236 |
|
237 |
-
# Recursivamente mostrar detalles de las m茅tricas
|
238 |
for metric_name, metric_data in metrics.items():
|
239 |
if isinstance(metric_data, dict) and 'details' in metric_data and metric_data['details']:
|
240 |
-
|
241 |
-
|
242 |
-
st.
|
243 |
-
st.json(metric_data['details'], key=detail_key)
|
244 |
else:
|
245 |
st.info(t.get('no_diagnosis', 'No hay datos de diagn贸stico disponibles'))
|
246 |
|
247 |
# Tab de recomendaciones
|
248 |
with recommendations_tab:
|
249 |
if recommendation_data and 'recommendations' in recommendation_data:
|
250 |
-
recom_key = generate_unique_key("situation", f"recom_{i}", username)
|
251 |
st.markdown(f"""
|
252 |
<div style="padding: 20px; border-radius: 10px;
|
253 |
background-color: #f8f9fa; margin-bottom: 20px;">
|
254 |
{recommendation_data['recommendations']}
|
255 |
</div>
|
256 |
-
""", unsafe_allow_html=True
|
257 |
elif recommendation_data and 'feedback' in recommendation_data:
|
258 |
-
feedback_key = generate_unique_key("situation", f"feedback_{i}", username)
|
259 |
st.markdown(f"""
|
260 |
<div style="padding: 20px; border-radius: 10px;
|
261 |
background-color: #f8f9fa; margin-bottom: 20px;">
|
262 |
{recommendation_data['feedback']}
|
263 |
</div>
|
264 |
-
""", unsafe_allow_html=True
|
265 |
else:
|
266 |
st.info(t.get('no_recommendations', 'No hay recomendaciones disponibles'))
|
267 |
|
|
|
135 |
logger.info(f"Procesando {len(paired_analyses)} pares de an谩lisis")
|
136 |
|
137 |
# Mostrar cada par de an谩lisis
|
138 |
+
for timestamp_key, analysis_pair in paired_analyses:
|
139 |
try:
|
140 |
# Obtener datos de situaci贸n y recomendaci贸n
|
141 |
situation_data = analysis_pair.get('situation', {})
|
|
|
169 |
}.get(text_type, text_type)
|
170 |
title += f" - {text_type_display}"
|
171 |
|
|
|
|
|
|
|
172 |
# Mostrar el an谩lisis en un expander
|
173 |
+
with st.expander(title, expanded=False):
|
174 |
# Mostrar texto analizado
|
175 |
st.subheader(t.get('analyzed_text', 'Texto analizado'))
|
|
|
|
|
176 |
st.text_area(
|
177 |
+
"",
|
178 |
value=text_to_show,
|
179 |
height=100,
|
180 |
disabled=True,
|
181 |
+
label_visibility="collapsed"
|
|
|
182 |
)
|
183 |
|
184 |
# Crear tabs para separar diagn贸stico y recomendaciones
|
|
|
185 |
diagnosis_tab, recommendations_tab = st.tabs([
|
186 |
t.get('diagnosis_tab', 'Diagn贸stico'),
|
187 |
t.get('recommendations_tab', 'Recomendaciones')
|
188 |
+
])
|
189 |
|
190 |
# Tab de diagn贸stico
|
191 |
with diagnosis_tab:
|
|
|
216 |
color = "#ccffcc" # light green
|
217 |
|
218 |
# Mostrar la m茅trica con estilo
|
|
|
219 |
st.markdown(f"""
|
220 |
<div style="background-color:{color}; padding:10px; border-radius:5px; margin-bottom:10px;">
|
221 |
<b>{emoji} {metric_name.capitalize()}:</b> {score:.2f}
|
222 |
</div>
|
223 |
+
""", unsafe_allow_html=True)
|
224 |
|
225 |
# Mostrar detalles adicionales si est谩n disponibles
|
226 |
with col2:
|
227 |
st.subheader(t.get('details', 'Detalles'))
|
228 |
|
229 |
+
# Recursivamente mostrar detalles de las m茅tricas
|
230 |
for metric_name, metric_data in metrics.items():
|
231 |
if isinstance(metric_data, dict) and 'details' in metric_data and metric_data['details']:
|
232 |
+
with st.expander(f"{metric_name.capitalize()} - {t.get('details', 'Detalles')}"):
|
233 |
+
# Mostrar detalles como JSON
|
234 |
+
st.json(metric_data['details'])
|
|
|
235 |
else:
|
236 |
st.info(t.get('no_diagnosis', 'No hay datos de diagn贸stico disponibles'))
|
237 |
|
238 |
# Tab de recomendaciones
|
239 |
with recommendations_tab:
|
240 |
if recommendation_data and 'recommendations' in recommendation_data:
|
|
|
241 |
st.markdown(f"""
|
242 |
<div style="padding: 20px; border-radius: 10px;
|
243 |
background-color: #f8f9fa; margin-bottom: 20px;">
|
244 |
{recommendation_data['recommendations']}
|
245 |
</div>
|
246 |
+
""", unsafe_allow_html=True)
|
247 |
elif recommendation_data and 'feedback' in recommendation_data:
|
|
|
248 |
st.markdown(f"""
|
249 |
<div style="padding: 20px; border-radius: 10px;
|
250 |
background-color: #f8f9fa; margin-bottom: 20px;">
|
251 |
{recommendation_data['feedback']}
|
252 |
</div>
|
253 |
+
""", unsafe_allow_html=True)
|
254 |
else:
|
255 |
st.info(t.get('no_recommendations', 'No hay recomendaciones disponibles'))
|
256 |
|