import pandas as pd
import numpy as np
import datetime
from mvp import xgbreport
from data.analyis import datacal
from mvp import dhb

if __name__ == '__main__':
    # features=[
    #     'third_data_source#xy_pan_newapplyAcredibility',
    #     'third_data_source#xy_pan_newapplyAscore',
    #     'third_data_source#xy_pan_newconsfinAavgAlimit',
    #     'third_data_source#xy_pan_newconsfinAcredibility',
    #     'third_data_source#xy_pan_newconsfinAcreditAlimit',
    #     'third_data_source#xy_pan_newconsfinAmaxAlimit',
    #     'third_data_source#xy_pan_newconsfinAorgAcountq',
    #     'third_data_source#xy_pan_newconsfinAorgAcountx',
    #     'third_data_source#xy_pan_newconsfinAproductAcount',
    #     'third_data_source#xy_pan_newhistoryAfailAfee',
    #     'third_data_source#xy_pan_newhistoryAsucAfee',
    #     'third_data_source#xy_pan_newlatestAoneAmonthAfail',
    #     'third_data_source#xy_pan_newlatestAoneAmonthAsuc',
    #     'third_data_source#xy_pan_newlatestAoneAmonthd',
    #     'third_data_source#xy_pan_newlatestAoneAmonthj',
    #     'third_data_source#xy_pan_newlatestAqueryAtime',
    #     'third_data_source#xy_pan_newlatestAsixAmontha',
    #     'third_data_source#xy_pan_newlatestAsixAmonthv',
    #     'third_data_source#xy_pan_newlatestAthreeAmonthb',
    #     'third_data_source#xy_pan_newlatestAthreeAmonthf',
    #     'third_data_source#xy_pan_newloansAavgAlimit',
    #     'third_data_source#xy_pan_newloansAcashAcount',
    #     'third_data_source#xy_pan_newloansAcount',
    #     'third_data_source#xy_pan_newloansAcredibilityh',
    #     'third_data_source#xy_pan_newloansAcredibilitys',
    #     'third_data_source#xy_pan_newloansAcreditAlimit',
    #     'third_data_source#xy_pan_newloansAlatestAtime',
    #     'third_data_source#xy_pan_newloansAlongAtime',
    #     'third_data_source#xy_pan_newloansAmaxAlimit',
    #     'third_data_source#xy_pan_newloansAorgAcounta',
    #     'third_data_source#xy_pan_newloansAorgAcountg',
    #     'third_data_source#xy_pan_newloansAoverdueAcount',
    #     'third_data_source#xy_pan_newloansAproductAcount',
    #     'third_data_source#xy_pan_newloansAscore',
    #     'third_data_source#xy_pan_newloansAsettleAcount',
    #     'third_data_source#xy_pan_newqueryAcashAcount',
    #     'third_data_source#xy_pan_newqueryAfinanceAcount',
    #     'third_data_source#xy_pan_newqueryAorgAcount',
    #     'third_data_source#xy_pan_newqueryAsumAcount'
    # ]
    dhb = dhb.dhb(start_time_period='2019-01-19 11:00:00',end_time_period='2019-01-20 12:00:00')
    df=dhb.dhb_features_extract()
    label='target'
    # df=pd.read_csv('test.csv')
    dftrain,dftest=datacal.split_train_val(df,trainsplit='timeSeries',trainsplitRatio=0.8,sort_col='applied_at')

    xgbreport.report(dftrain,dftest,dhb.features,label,'','tmp.doc')
