# -*- coding: utf-8 -*-

import med_data_science_helper.helper_siagie_kpi as hsk
import med_data_science_helper.helper_terceros_kpi as htk
import med_data_science_helper.helper_acces_db as hadb


df_siagie = hadb.get_siagie_por_anio(2021,id_nivel="F0",id_grado=10 , macro_region="norte" , columns_n= ['ID_PERSONA',"COD_MOD","ANEXO"])

df_siagie_ = hsk.generar_kpis_p_deser_by_dist(df_siagie,anio_df=2021 ,cache=True)

df_siagie_2 = hsk.generar_kpis_p_deser_by_codmod(df_siagie,anio_df=2021 ,cache=True)


df_siagie_2.P_DESERCION_COD_MOD_T_MENOS_1.value_counts()

df_p_deser = hsk.get_p_desercion_by_codmod(anio=2021,macro_region="norte",cache=False)


df_siagie2 = htk.agregar_nexus(df_siagie,anio_df=2021,anio_h=2020, cache=False )
df_siagie3 = htk.agregar_pivot_juntos(df_siagie,anio_df=2021,anio_h=2021,t_anios=3,delete_juntos_t_vcc=True, cache=False )

print(df_siagie3.columns)


print(df_siagie3.JUNTOS_T.value_counts())
print(df_siagie3.JUNTOS_T.isna().value_counts())

print(df_siagie3.JUNTOS_T_MENOS_1.isna().value_counts())
print(df_siagie3.JUNTOS_T_MENOS_1.value_counts())

print(df_siagie3.JUNTOS_T_MENOS_2.value_counts())
print(df_siagie3.JUNTOS_T_MENOS_2.isna().value_counts())
