Update app.py
Browse files
app.py
CHANGED
@@ -31,6 +31,37 @@ def cargar_estudiantes():
|
|
31 |
with open('estudiantes.json', 'r', encoding='utf-8') as f:
|
32 |
return json.load(f)
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
def cargar_desde_airtable():
|
35 |
response = requests.get(url, headers=headers)
|
36 |
|
|
|
31 |
with open('estudiantes.json', 'r', encoding='utf-8') as f:
|
32 |
return json.load(f)
|
33 |
|
34 |
+
def crear_html(normativa):
|
35 |
+
htmlx = f"""
|
36 |
+
<div style="padding: 16px; border: 1px solid #ddd; border-radius: 8px;">
|
37 |
+
<style>
|
38 |
+
p {{ font-size: 20px; }}
|
39 |
+
</style>
|
40 |
+
<h2>{normativa["nombre"]}</h2>
|
41 |
+
<h2>{normativa["titulo"], normativa["a帽o"]}</h2>
|
42 |
+
<p><strong>ID:</strong> {normativa["id"]}</p>
|
43 |
+
<p><strong>Descripci贸n:</strong> {normativa["descripcion"]}</p>
|
44 |
+
<p><strong>Enfoque de Gesti贸n:</strong> {normativa["enfoque_riesgo"]}</p>
|
45 |
+
<p><strong>Opini贸n Docente:</strong> {normativa["opinion_docente"]}</p>
|
46 |
+
<p><strong>Visite <a href={normativa["url"]} target="_blank">este sitio web</a> para m谩s informaci贸n.</strong></p>
|
47 |
+
</div>
|
48 |
+
"""
|
49 |
+
return htmlx
|
50 |
+
|
51 |
+
def mostrar_detalles(normativa_seleccionada):
|
52 |
+
if not normativa_seleccionada:
|
53 |
+
return "<p>Por favor selecciona una normativa</p>", None
|
54 |
+
normativas = cargar_normativas()
|
55 |
+
# Extraer el ID que est谩 al final del string
|
56 |
+
partes = normativa_seleccionada.split()
|
57 |
+
id_normativa = int(partes[-1])
|
58 |
+
# Buscar la normativa con ese ID
|
59 |
+
for normativa in normativas["normativa_peruana_gestion_riesgos"]:
|
60 |
+
if normativa["id"] == id_normativa:
|
61 |
+
# Crear HTML con la informaci贸n detallada
|
62 |
+
html = crear_html(normativa)
|
63 |
+
return html, id_normativa
|
64 |
+
|
65 |
def cargar_desde_airtable():
|
66 |
response = requests.get(url, headers=headers)
|
67 |
|