Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,13 +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 |
-
|
| 58 |
-
# ========= INICIO DE LA CORRECCIÓN DEL NOMBRE DE ARCHIVO ===================
|
| 59 |
-
# =========================================================================
|
| 60 |
-
path_codigos = os.path.join('PLANTILLAS', 'DIC_NOMBRES_CODIGOS_FICHAS.json') # Nombre corregido a mayúsculas
|
| 61 |
-
# =========================================================================
|
| 62 |
-
# ========= FIN DE LA CORRECCIÓN ==========================================
|
| 63 |
-
# =========================================================================
|
| 64 |
path_notificacion = os.path.join('PLANTILLAS', 'DATOS_NOTIFICACION.json')
|
| 65 |
|
| 66 |
with open(path_codigos, 'r', encoding='utf-8') as f:
|
|
@@ -247,6 +241,10 @@ if st.session_state.search_results is not None:
|
|
| 247 |
|
| 248 |
with st.expander(f"**Evento: {info.get('Evento', 'Sin nombre')} (Ficha: {info.get('FICHA', 'N/A')})**", expanded=True):
|
| 249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 250 |
tab1, tab2 = st.tabs(["Información General", "📖 Definición de Caso"])
|
| 251 |
|
| 252 |
with tab1:
|
|
@@ -309,4 +307,45 @@ if st.session_state.search_results is not None:
|
|
| 309 |
md_string = f"{icon} **{display_name}**"
|
| 310 |
|
| 311 |
if i < len(age_fields) / 2:
|
| 312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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:
|
|
|
|
| 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 |
+
# =========================================================================
|