Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@
|
|
| 6 |
# \ VVVV/ \VVVV /
|
| 7 |
# \____/ \____/
|
| 8 |
# __________________________________________________________________________________________________________
|
| 9 |
-
# Versión Final
|
| 10 |
# Adaptado por JAIRO ALEXANDER ERASO MD U Nacional de Colombia, basado en la solicitud del usuario.
|
| 11 |
#
|
| 12 |
|
|
@@ -96,7 +96,6 @@ def search_direct(query, data, notif_map):
|
|
| 96 |
"""
|
| 97 |
query_lower = query.lower().strip()
|
| 98 |
|
| 99 |
-
# 1. Encontrar todos los ítems individuales que coinciden con la búsqueda
|
| 100 |
matching_items = []
|
| 101 |
for item in data:
|
| 102 |
if (query_lower == item.get("CIE 10", "").lower().strip() or
|
|
@@ -108,7 +107,6 @@ def search_direct(query, data, notif_map):
|
|
| 108 |
if not matching_items:
|
| 109 |
return []
|
| 110 |
|
| 111 |
-
# 2. Agrupar los ítems coincidentes por su número de Ficha
|
| 112 |
grouped_by_ficha = {}
|
| 113 |
for item in matching_items:
|
| 114 |
ficha = item.get("FICHA")
|
|
@@ -117,7 +115,6 @@ def search_direct(query, data, notif_map):
|
|
| 117 |
grouped_by_ficha[ficha] = []
|
| 118 |
grouped_by_ficha[ficha].append(item)
|
| 119 |
|
| 120 |
-
# 3. Construir la lista de resultados final con los datos ya filtrados
|
| 121 |
final_results = []
|
| 122 |
for ficha, matched_details in grouped_by_ficha.items():
|
| 123 |
info_notificacion = notif_map.get(ficha)
|
|
@@ -249,6 +246,7 @@ if st.session_state.search_results is not None:
|
|
| 249 |
codigos = result["detalles_codigos"]
|
| 250 |
|
| 251 |
with st.expander(f"**Evento: {info.get('Evento', 'Sin nombre')} (Ficha: {info.get('FICHA', 'N/A')})**", expanded=True):
|
|
|
|
| 252 |
st.subheader("Información de Notificación")
|
| 253 |
|
| 254 |
notif_super = info.get("Notificación superinmedita", "NO") == "SI"
|
|
@@ -263,7 +261,38 @@ if st.session_state.search_results is not None:
|
|
| 263 |
|
| 264 |
fichas_texto = info.get('Fichas a Utilizar', 'No especificado').replace('+', '\n+ ')
|
| 265 |
st.markdown(f"**Fichas a utilizar:** {fichas_texto}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
st.subheader("Códigos Relacionados (CIE-10 y CIE-11)")
|
| 268 |
for codigo in codigos:
|
| 269 |
st.markdown(f"""
|
|
|
|
| 6 |
# \ VVVV/ \VVVV /
|
| 7 |
# \____/ \____/
|
| 8 |
# __________________________________________________________________________________________________________
|
| 9 |
+
# Versión Final con Clasificación de Caso Detallada
|
| 10 |
# Adaptado por JAIRO ALEXANDER ERASO MD U Nacional de Colombia, basado en la solicitud del usuario.
|
| 11 |
#
|
| 12 |
|
|
|
|
| 96 |
"""
|
| 97 |
query_lower = query.lower().strip()
|
| 98 |
|
|
|
|
| 99 |
matching_items = []
|
| 100 |
for item in data:
|
| 101 |
if (query_lower == item.get("CIE 10", "").lower().strip() or
|
|
|
|
| 107 |
if not matching_items:
|
| 108 |
return []
|
| 109 |
|
|
|
|
| 110 |
grouped_by_ficha = {}
|
| 111 |
for item in matching_items:
|
| 112 |
ficha = item.get("FICHA")
|
|
|
|
| 115 |
grouped_by_ficha[ficha] = []
|
| 116 |
grouped_by_ficha[ficha].append(item)
|
| 117 |
|
|
|
|
| 118 |
final_results = []
|
| 119 |
for ficha, matched_details in grouped_by_ficha.items():
|
| 120 |
info_notificacion = notif_map.get(ficha)
|
|
|
|
| 246 |
codigos = result["detalles_codigos"]
|
| 247 |
|
| 248 |
with st.expander(f"**Evento: {info.get('Evento', 'Sin nombre')} (Ficha: {info.get('FICHA', 'N/A')})**", expanded=True):
|
| 249 |
+
|
| 250 |
st.subheader("Información de Notificación")
|
| 251 |
|
| 252 |
notif_super = info.get("Notificación superinmedita", "NO") == "SI"
|
|
|
|
| 261 |
|
| 262 |
fichas_texto = info.get('Fichas a Utilizar', 'No especificado').replace('+', '\n+ ')
|
| 263 |
st.markdown(f"**Fichas a utilizar:** {fichas_texto}")
|
| 264 |
+
|
| 265 |
+
# =========================================================================
|
| 266 |
+
# ========= INICIO DE LA NUEVA SECCIÓN: CLASIFICACIÓN DE CASO ==============
|
| 267 |
+
# =========================================================================
|
| 268 |
+
st.markdown("---") # Separador visual
|
| 269 |
+
st.subheader("Clasificación de Caso Permitida")
|
| 270 |
+
|
| 271 |
+
classification_fields = [
|
| 272 |
+
("Sospechoso", "Clasificación Permitida Sospechoso"),
|
| 273 |
+
("Probable", "Clasificación Permitida Probable"),
|
| 274 |
+
("Conf. Clínica", "Clasificación Permitida Conf. Clínica"),
|
| 275 |
+
("Conf. Laboratorio", "Clasificación Permitida Conf. Laboratorio"),
|
| 276 |
+
("Conf. Nexo Epi.", "Clasificación Permitida Conf. Nexo Epi."),
|
| 277 |
+
("Descartado", "Clasificación Permitida Descartado")
|
| 278 |
+
]
|
| 279 |
+
|
| 280 |
+
col1, col2 = st.columns(2)
|
| 281 |
|
| 282 |
+
for i, (display_name, field_key) in enumerate(classification_fields):
|
| 283 |
+
value = info.get(field_key, "NO")
|
| 284 |
+
icon = "✅" if value == "SI" else "❌"
|
| 285 |
+
|
| 286 |
+
md_string = f"{icon} **{display_name}**"
|
| 287 |
+
|
| 288 |
+
if i < len(classification_fields) / 2:
|
| 289 |
+
col1.markdown(md_string)
|
| 290 |
+
else:
|
| 291 |
+
col2.markdown(md_string)
|
| 292 |
+
# =========================================================================
|
| 293 |
+
# ========= FIN DE LA NUEVA SECCIÓN =======================================
|
| 294 |
+
# =========================================================================
|
| 295 |
+
|
| 296 |
st.subheader("Códigos Relacionados (CIE-10 y CIE-11)")
|
| 297 |
for codigo in codigos:
|
| 298 |
st.markdown(f"""
|