From 990f859d20073355772ed75a7e5301ade8dd3c69 Mon Sep 17 00:00:00 2001 From: cherif Date: Tue, 1 Nov 2022 14:09:41 +0100 Subject: [PATCH] 01/11/22 - 14h --- class_mgt.py | 17 ++++++++++++++--- data_indexees.csv | 6 +++--- ela_output_test_file_pandas_2.txt | 8 ++++---- wrapper.py | 10 +++++----- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/class_mgt.py b/class_mgt.py index c44c9ea..38e4e97 100644 --- a/class_mgt.py +++ b/class_mgt.py @@ -46,7 +46,7 @@ def add_class(diction): field_list = ['external_code', 'title', 'description', 'trainer', 'institut_formation', 'distantiel', 'presentiel', 'price', 'url','duration', 'duration_unit', 'token', 'plus_produit', 'mots_cle','domaine', 'internal_url', 'zone_diffusion', 'metier', 'date_lieu', 'published', 'img_url', 'objectif', - 'programme', 'prerequis', 'note'] + 'programme', 'prerequis', 'note', 'cpf'] incom_keys = diction.keys() for val in incom_keys: @@ -145,6 +145,10 @@ def add_class(diction): if diction['note']: mydata['note'] = diction['note'] + if ("cpf" in diction.keys()): + if diction['cpf']: + mydata['cpf'] = diction['cpf'] + if ("objectif" in diction.keys()): if diction['objectif']: mydata['objectif'] = diction['objectif'] @@ -509,7 +513,7 @@ def update_class(diction): field_list = ['external_code', 'title', 'description', 'trainer', 'institut_formation', 'distantiel', 'presentiel','price', 'url', 'duration', 'token','plus_produit', 'mots_cle', 'domaine', 'internal_code', 'internal_url','zone_diffusion', 'metier', - 'date_lieu', 'published', 'img_url', 'objectif', 'programme', 'prerequis', 'note'] + 'date_lieu', 'published', 'img_url', 'objectif', 'programme', 'prerequis', 'note', 'cpf'] incom_keys = diction.keys() for val in incom_keys: @@ -583,6 +587,9 @@ def update_class(diction): if ("programme" in diction.keys()): mydata['programme'] = diction['programme'] + if ("cpf" in diction.keys()): + mydata['cpf'] = diction['cpf'] + if ("prerequis" in diction.keys()): mydata['prerequis'] = diction['prerequis'] @@ -2191,7 +2198,7 @@ def add_class_mass(file=None, Folder=None, diction=None): field_list = ['external_code', 'titre', 'description', 'formateur', 'institut_formation', 'distantiel', 'presentiel', 'prix', 'domaine', 'url','duree', 'plus_produit', 'mots_cle', 'zone_diffusion', 'metier', 'date_lieu', 'publie', 'img_url', - 'objectif', 'programme', 'prerequis', 'formateur', 'note'] + 'objectif', 'programme', 'prerequis', 'formateur', 'note', 'cpf'] total_rows = len(df) @@ -2253,6 +2260,10 @@ def add_class_mass(file=None, Folder=None, diction=None): mydata['metier'] = str(df['metier'].values[n]) mydata['published'] = str(df['publie'].values[n]) + if ("cpf" in df.keys()): + if (str(df['cpf'].values[n])): + mydata['cpf'] = str(df['cpf'].values[n]) + if ("objectif" in df.keys()): if (str(df['objectif'].values[n])): mydata['objectif'] = str(df['objectif'].values[n]) diff --git a/data_indexees.csv b/data_indexees.csv index 3e0eb69..78c5696 100644 --- a/data_indexees.csv +++ b/data_indexees.csv @@ -1,4 +1,4 @@ ,index,mots,occurence,moyenne,id_formation,source_field -0,0,effect,1,0.33,VP14120,title -1,1,essentiel,1,0.33,VP14120,title -2,2,after,1,0.33,VP14120,title +0,0,effect,1,0.33,VP10619,title +1,1,effet,1,0.33,VP10619,title +2,2,after,1,0.33,VP10619,title diff --git a/ela_output_test_file_pandas_2.txt b/ela_output_test_file_pandas_2.txt index 9ea3e76..7783baa 100644 --- a/ela_output_test_file_pandas_2.txt +++ b/ela_output_test_file_pandas_2.txt @@ -1,4 +1,4 @@ - mots occurence moyenne id_formation source_field -0 effect 1 0.33 VP14120 title -1 essentiel 1 0.33 VP14120 title -2 after 1 0.33 VP14120 title \ No newline at end of file + mots occurence moyenne id_formation source_field +0 effect 1 0.33 VP10619 title +1 effet 1 0.33 VP10619 title +2 after 1 0.33 VP10619 title \ No newline at end of file diff --git a/wrapper.py b/wrapper.py index c7d1eee..cc9b0f8 100644 --- a/wrapper.py +++ b/wrapper.py @@ -127,7 +127,7 @@ def get_all_class(diction): # Dictionnaire des champs utilisables field_list = ['token', 'user_ip', 'user_country_code', 'user_country_name', 'user_city', 'user_postal', 'user_latitude', 'user_longitude', 'user_state', 'search_text', 'certif', - 'support', 'type', 'lang', 'price', 'distance', 'duration'] + 'support', 'type', 'lang', 'price', 'distance', 'duration', 'cpf'] incom_keys = diction.keys() @@ -251,7 +251,7 @@ def get_all_class(diction): tab_training_inzone.append(JSONEncoder().encode(user)) val_tmp = val_tmp + 1 - #print(" insertObject = ", str(tab_training_inzone)) + #print(" ### insertObject = ", str(tab_training_inzone)) #return True, insertObject return True, tab_training_inzone except Exception as e: @@ -283,7 +283,7 @@ def get_training_in_user_zone(diction): # Dictionnaire des champs utilisables field_list = ['token', 'user_ip', 'user_country_code', 'user_country_name', 'user_city', 'user_postal', 'user_latitude', 'user_longitude', 'user_state', 'search_text', 'certif', - 'support', 'type', 'lang', 'price', 'distance', 'duration'] + 'support', 'type', 'lang', 'price', 'distance', 'duration', 'cpf'] incom_keys = diction.keys() @@ -339,7 +339,7 @@ def get_training_in_user_zone(diction): insertObject = [] - print(" ########## critère de recherche : user_country_code = "+str(mydata['user_country_code']).lower()+" ---- user_city = "+str(mydata['user_city']).lower()) + #print(" ########## critère de recherche : user_country_code = "+str(mydata['user_country_code']).lower()+" ---- user_city = "+str(mydata['user_city']).lower()) for x in coll_name.find({ "$or": [ {'valide':'1', 'locked':'0', 'isalaune':'1','published':'1', "zone_diffusion.country":str(mydata['user_country_code']).lower()}, {'valide':'1', 'locked':'0', 'isalaune':'1', 'published':'1', "zone_diffusion.city":str(mydata['user_city']).lower()} ] }, {"_id": 0, "indexed": 0, "indexed_desc": 0, "indexed_obj": 0, "indexed_title": 0, @@ -401,7 +401,7 @@ def recherche_text_simple(diction): ''' field_list = ['token', 'user_ip', 'user_country_code', 'user_country_name', 'user_city', 'user_postal', 'user_latitude', 'user_longitude', 'user_state', 'search_text', 'certif', - 'support', 'type', 'lang', 'price', 'distance', 'duration'] + 'support', 'type', 'lang', 'price', 'distance', 'duration', 'cpf'] incom_keys = diction.keys() for val in incom_keys: if val not in field_list: