from recommend import *

def offline_recall(uuid_gid):
    temp=defaultdict(list)
    kdsp_personalize_recall_etrec_change_sql=concatSql(kdsp_personalize_recall_etrec_sql,**{"user_id":uuid_gid})
    etrec_df=execmysl('89',kdsp_personalize_recall_etrec_change_sql)
    if etrec_df.empty:
        temp['90011']=[]
    else:
        etrec_df['item_ids']=etrec_df['item_ids'].apply(lambda x:','.join([i.split('::')[0] for i in x.split(',')]))
        temp['90011']=etrec_df['item_ids'].to_list()
    kdsp_personalize_recall_swing_change_sql=concatSql(kdsp_personalize_recall_swing_sql,**{"user_id":uuid_gid})
    swing_df=execmysl('89',kdsp_personalize_recall_swing_change_sql)
    if swing_df.empty:
        temp['90012']=[]
    else:
        swing_df['item_ids']=swing_df['item_ids'].apply(lambda x:','.join([i.split('::')[0] for i in x.split(',')]))
        temp['90012']=swing_df['item_ids'].to_list()
    print("temp['90011']",temp['90011'])
    print("temp['90012']",temp['90012'])
    return temp

if __name__ == '__main__':
    uuid='0005a648-32f1-444a-9ce6-0b63fa010c0d'
    print(offline_recall(uuid))