39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
# diag_base.py — Captura los numeros ACTUALES (antes de optimizar) para comparar despues.
|
|
import json
|
|
import services as S
|
|
|
|
combos = [
|
|
("2026","2","TODOS","TODOS","TODOS"),
|
|
("2026","2","TODOS","TEAC","LIMA"),
|
|
("2026","2","TODOS","TERC","AREQUIPA"),
|
|
("2026","1","TODOS","TODOS","TODOS"),
|
|
("2026","1","TODOS","SEMINARIOS","LIMA"),
|
|
("2026","7","TODOS","TODOS","TODOS"),
|
|
("2026","7","TODOS","TEAC","PIURA"),
|
|
]
|
|
|
|
def resumen(d):
|
|
k = d["kpis"]
|
|
return {
|
|
"leads_recibidos": k["leads_recibidos"],
|
|
"leads_procesados": k["leads_procesados"],
|
|
"total_matriculados": k["total_matriculados"],
|
|
"cursos_programados": k["cursos_programados"],
|
|
"pauta_total_imp": d["tabla_pauta"]["total"].get("importe"),
|
|
"always_total_imp": d["matriz_always"]["total"]["importe"],
|
|
"webform_total_rec": d["matriz_webform"]["total"]["recibidos"],
|
|
"webform_total_matr": d["matriz_webform"]["total"]["matriculas"],
|
|
"asignados_total": d["matriz_asignados"]["total"],
|
|
"matriz_cursos_filas": len(d["matriz_cursos"]["filas"]),
|
|
}
|
|
|
|
out = {}
|
|
for c in combos:
|
|
d = S.leads_dashboard(*c)
|
|
out["|".join(c)] = resumen(d)
|
|
print("|".join(c), "->", out["|".join(c)])
|
|
|
|
with open("diag_base.json", "w", encoding="utf-8") as f:
|
|
json.dump(out, f, indent=2, ensure_ascii=False)
|
|
print("\nGuardado: diag_base.json (linea base ANTES de optimizar)")
|