Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,7 +54,7 @@ model = get_gemini_model()
|
|
| 54 |
def load_data():
|
| 55 |
"""Carga y procesa los archivos JSON, uniéndolos para un acceso rápido."""
|
| 56 |
try:
|
| 57 |
-
path_codigos = os.path.join('PLANTILLAS', '
|
| 58 |
path_notificacion = os.path.join('PLANTILLAS', 'DATOS_NOTIFICACION.json')
|
| 59 |
|
| 60 |
with open(path_codigos, 'r', encoding='utf-8') as f:
|
|
@@ -241,108 +241,111 @@ if st.session_state.search_results is not None:
|
|
| 241 |
|
| 242 |
with st.expander(f"**Evento: {info.get('Evento', 'Sin nombre')} (Ficha: {info.get('FICHA', 'N/A')})**", expanded=True):
|
| 243 |
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
if notif_super:
|
| 248 |
-
st.error(f"**¡ATENCIÓN! Requiere Notificación SUPERINMEDIATA:** {info.get('Descripción superinmedita', '')}")
|
| 249 |
-
elif info.get("Notificación Inmediata", "NO") == "SI":
|
| 250 |
-
st.warning("**Requiere Notificación Inmediata (dentro de las 24 horas).**")
|
| 251 |
-
else:
|
| 252 |
-
st.info("**Notificación Semanal Individual.**")
|
| 253 |
-
|
| 254 |
-
st.markdown(f"**Requisito:** {info.get('REQUISITO', 'No especificado')}")
|
| 255 |
|
| 256 |
-
|
| 257 |
-
st.markdown(f"**Fichas a utilizar:** {fichas_texto}")
|
| 258 |
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
classification_fields = [
|
| 263 |
-
("Sospechoso", "Clasificación Permitida Sospechoso"),
|
| 264 |
-
("Probable", "Clasificación Permitida Probable"),
|
| 265 |
-
("Conf. Clínica", "Clasificación Permitida Conf. Clínica"),
|
| 266 |
-
("Conf. Laboratorio", "Clasificación Permitida Conf. Laboratorio"),
|
| 267 |
-
("Conf. Nexo Epi.", "Clasificación Permitida Conf. Nexo Epi."),
|
| 268 |
-
("Descartado", "Clasificación Permitida Descartado")
|
| 269 |
-
]
|
| 270 |
-
|
| 271 |
-
col1, col2 = st.columns(2)
|
| 272 |
-
|
| 273 |
-
for i, (display_name, field_key) in enumerate(classification_fields):
|
| 274 |
-
value = info.get(field_key, "NO")
|
| 275 |
-
icon = "✅" if value == "SI" else "❌"
|
| 276 |
-
md_string = f"{icon} **{display_name}**"
|
| 277 |
|
| 278 |
-
|
| 279 |
-
|
|
|
|
|
|
|
|
|
|
| 280 |
else:
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
st.markdown("---")
|
| 284 |
-
st.subheader("Rango de Edad Permitido para Notificación")
|
| 285 |
-
|
| 286 |
-
age_fields = [
|
| 287 |
-
("Menor de 1 año", "Menor de 1 año"),
|
| 288 |
-
("De 1 a 4 años", "De 1 a 4 años"),
|
| 289 |
-
("De 5 a 14 años", "De 5 a 14 años"),
|
| 290 |
-
("De 15 a 44 años", "De 15 a 44 años"),
|
| 291 |
-
("De 45 a 59 años", "De 45 a 59 años"),
|
| 292 |
-
("De 60 y más", "De 60 y más")
|
| 293 |
-
]
|
| 294 |
-
|
| 295 |
-
age_col1, age_col2 = st.columns(2)
|
| 296 |
|
| 297 |
-
|
| 298 |
-
value = info.get(field_key, "NO")
|
| 299 |
-
icon = "✅" if value == "SI" else "❌"
|
| 300 |
-
md_string = f"{icon} **{display_name}**"
|
| 301 |
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
else:
|
| 305 |
-
age_col2.markdown(md_string)
|
| 306 |
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
final_condition_fields = [
|
| 311 |
-
("Vivo", "Condición final Vivo"),
|
| 312 |
-
("Muerto", "Condición final Muerto")
|
| 313 |
-
]
|
| 314 |
-
|
| 315 |
-
cond_col1, cond_col2 = st.columns(2)
|
| 316 |
-
|
| 317 |
-
for i, (display_name, field_key) in enumerate(final_condition_fields):
|
| 318 |
-
value = info.get(field_key, "NO")
|
| 319 |
-
icon = "✅" if value == "SI" else "❌"
|
| 320 |
-
md_string = f"{icon} **{display_name}**"
|
| 321 |
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
|
|
|
| 340 |
|
| 341 |
-
if definicion_de_caso: # Solo se muestra si existe la definición en el JSON
|
| 342 |
-
# Se reemplaza el st.expander anidado por un subheader y markdown.
|
| 343 |
-
st.subheader("📖 Definición de Caso Oficial")
|
| 344 |
-
# Se reemplaza \n por dos espacios + \n para forzar el salto de línea en Markdown
|
| 345 |
-
st.markdown(definicion_de_caso.replace('\n', ' \n'))
|
| 346 |
# =========================================================================
|
| 347 |
-
# ========= FIN
|
| 348 |
# =========================================================================
|
|
|
|
| 54 |
def load_data():
|
| 55 |
"""Carga y procesa los archivos JSON, uniéndolos para un acceso rápido."""
|
| 56 |
try:
|
| 57 |
+
path_codigos = os.path.join('PLANTILLAS', 'DIC_Nombres_Codigos_Fichas.json')
|
| 58 |
path_notificacion = os.path.join('PLANTILLAS', 'DATOS_NOTIFICACION.json')
|
| 59 |
|
| 60 |
with open(path_codigos, 'r', encoding='utf-8') as f:
|
|
|
|
| 241 |
|
| 242 |
with st.expander(f"**Evento: {info.get('Evento', 'Sin nombre')} (Ficha: {info.get('FICHA', 'N/A')})**", expanded=True):
|
| 243 |
|
| 244 |
+
# =========================================================================
|
| 245 |
+
# ========= INICIO DEL CAMBIO: ESTRUCTURA CON PESTAÑAS ======================
|
| 246 |
+
# =========================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
|
| 248 |
+
tab1, tab2 = st.tabs(["Información General", "📖 Definición de Caso"])
|
|
|
|
| 249 |
|
| 250 |
+
with tab1:
|
| 251 |
+
st.subheader("Información de Notificación")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
|
| 253 |
+
notif_super = info.get("Notificación superinmedita", "NO") == "SI"
|
| 254 |
+
if notif_super:
|
| 255 |
+
st.error(f"**¡ATENCIÓN! Requiere Notificación SUPERINMEDIATA:** {info.get('Descripción superinmedita', '')}")
|
| 256 |
+
elif info.get("Notificación Inmediata", "NO") == "SI":
|
| 257 |
+
st.warning("**Requiere Notificación Inmediata (dentro de las 24 horas).**")
|
| 258 |
else:
|
| 259 |
+
st.info("**Notificación Semanal Individual.**")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
|
| 261 |
+
st.markdown(f"**Requisito:** {info.get('REQUISITO', 'No especificado')}")
|
|
|
|
|
|
|
|
|
|
| 262 |
|
| 263 |
+
fichas_texto = info.get('Fichas a Utilizar', 'No especificado').replace('+', '\n+ ')
|
| 264 |
+
st.markdown(f"**Fichas a utilizar:** {fichas_texto}")
|
|
|
|
|
|
|
| 265 |
|
| 266 |
+
st.markdown("---")
|
| 267 |
+
st.subheader("Clasificación de Caso Permitida")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
|
| 269 |
+
classification_fields = [
|
| 270 |
+
("Sospechoso", "Clasificación Permitida Sospechoso"),
|
| 271 |
+
("Probable", "Clasificación Permitida Probable"),
|
| 272 |
+
("Conf. Clínica", "Clasificación Permitida Conf. Clínica"),
|
| 273 |
+
("Conf. Laboratorio", "Clasificación Permitida Conf. Laboratorio"),
|
| 274 |
+
("Conf. Nexo Epi.", "Clasificación Permitida Conf. Nexo Epi."),
|
| 275 |
+
("Descartado", "Clasificación Permitida Descartado")
|
| 276 |
+
]
|
| 277 |
+
|
| 278 |
+
col1, col2 = st.columns(2)
|
| 279 |
+
|
| 280 |
+
for i, (display_name, field_key) in enumerate(classification_fields):
|
| 281 |
+
value = info.get(field_key, "NO")
|
| 282 |
+
icon = "✅" if value == "SI" else "❌"
|
| 283 |
+
md_string = f"{icon} **{display_name}**"
|
| 284 |
+
|
| 285 |
+
if i < len(classification_fields) / 2:
|
| 286 |
+
col1.markdown(md_string)
|
| 287 |
+
else:
|
| 288 |
+
col2.markdown(md_string)
|
| 289 |
+
|
| 290 |
+
st.markdown("---")
|
| 291 |
+
st.subheader("Rango de Edad Permitido para Notificación")
|
| 292 |
+
|
| 293 |
+
age_fields = [
|
| 294 |
+
("Menor de 1 año", "Menor de 1 año"),
|
| 295 |
+
("De 1 a 4 años", "De 1 a 4 años"),
|
| 296 |
+
("De 5 a 14 años", "De 5 a 14 años"),
|
| 297 |
+
("De 15 a 44 años", "De 15 a 44 años"),
|
| 298 |
+
("De 45 a 59 años", "De 45 a 59 años"),
|
| 299 |
+
("De 60 y más", "De 60 y más")
|
| 300 |
+
]
|
| 301 |
+
|
| 302 |
+
age_col1, age_col2 = st.columns(2)
|
| 303 |
+
|
| 304 |
+
for i, (display_name, field_key) in enumerate(age_fields):
|
| 305 |
+
value = info.get(field_key, "NO")
|
| 306 |
+
icon = "✅" if value == "SI" else "❌"
|
| 307 |
+
md_string = f"{icon} **{display_name}**"
|
| 308 |
+
|
| 309 |
+
if i < len(age_fields) / 2:
|
| 310 |
+
age_col1.markdown(md_string)
|
| 311 |
+
else:
|
| 312 |
+
age_col2.markdown(md_string)
|
| 313 |
+
|
| 314 |
+
st.markdown("---")
|
| 315 |
+
st.subheader("Condición Final Permitida")
|
| 316 |
+
|
| 317 |
+
final_condition_fields = [
|
| 318 |
+
("Vivo", "Condición final Vivo"),
|
| 319 |
+
("Muerto", "Condición final Muerto")
|
| 320 |
+
]
|
| 321 |
+
|
| 322 |
+
cond_col1, cond_col2 = st.columns(2)
|
| 323 |
+
|
| 324 |
+
for i, (display_name, field_key) in enumerate(final_condition_fields):
|
| 325 |
+
value = info.get(field_key, "NO")
|
| 326 |
+
icon = "✅" if value == "SI" else "❌"
|
| 327 |
+
md_string = f"{icon} **{display_name}**"
|
| 328 |
+
|
| 329 |
+
if i == 0:
|
| 330 |
+
cond_col1.markdown(md_string)
|
| 331 |
+
else:
|
| 332 |
+
cond_col2.markdown(md_string)
|
| 333 |
+
|
| 334 |
+
st.subheader("Códigos Relacionados (CIE-10 y CIE-11)")
|
| 335 |
+
for codigo in codigos:
|
| 336 |
+
st.markdown(f"""
|
| 337 |
+
- **Nombre Protocolo:** `{codigo.get('NOMBRES DE PROTOCOLOS', 'N/A')}`
|
| 338 |
+
- **CIE-10:** `{codigo.get('CIE 10', 'N/A')}`
|
| 339 |
+
- **CIE-11:** `{codigo.get('CIE 11', 'N/A')}` | **Nombre CIE-11:** *{codigo.get('NOMBRES DE CIE 11', 'N/A')}*
|
| 340 |
+
""")
|
| 341 |
|
| 342 |
+
with tab2:
|
| 343 |
+
definicion_de_caso = info.get("Definición de caso", "").strip()
|
| 344 |
+
if definicion_de_caso:
|
| 345 |
+
st.markdown(definicion_de_caso.replace('\n', ' \n'))
|
| 346 |
+
else:
|
| 347 |
+
st.info("No se encontró una definición de caso oficial para este evento.")
|
| 348 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 349 |
# =========================================================================
|
| 350 |
+
# ========= FIN DEL CAMBIO: ESTRUCTURA CON PESTAÑAS =======================
|
| 351 |
# =========================================================================
|