02/02/23 - 22h

master
cherif 2023-02-02 21:15:55 +01:00
parent c177ca409b
commit 292501cdd5
7 changed files with 2687 additions and 34 deletions

View File

@ -1,20 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="30/01/23 - 22h">
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="01/02/23 - 22h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Attestation_Certificat.py" beforeDir="false" afterPath="$PROJECT_DIR$/Attestation_Certificat.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/Inscription_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Template/Mysy_attestion_modele2_tpl.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/Mysy_attestion_modele2_tpl.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Template/invoice_RIB.html" beforeDir="false" afterPath="$PROJECT_DIR$/Template/invoice_RIB.html" afterDir="false" />
<change beforePath="$PROJECT_DIR$/class_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/class_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/data_indexees.csv" beforeDir="false" afterPath="$PROJECT_DIR$/data_indexees.csv" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ela_index_bdd_classes.py" beforeDir="false" afterPath="$PROJECT_DIR$/ela_index_bdd_classes.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/email_inscription_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_inscription_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/email_mgt.py" beforeDir="false" afterPath="$PROJECT_DIR$/email_mgt.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/partners.py" beforeDir="false" afterPath="$PROJECT_DIR$/partners.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -269,7 +263,14 @@
<option name="project" value="LOCAL" />
<updated>1675114173514</updated>
</task>
<option name="localTasksCounter" value="28" />
<task id="LOCAL-00028" summary="01/02/23 - 22h">
<created>1675282357129</created>
<option name="number" value="00028" />
<option name="presentableId" value="LOCAL-00028" />
<option name="project" value="LOCAL" />
<updated>1675282357129</updated>
</task>
<option name="localTasksCounter" value="29" />
<servers />
</component>
<component name="Vcs.Log.Tabs.Properties">
@ -284,7 +285,6 @@
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="18/11/22 - 23h30" />
<MESSAGE value="22/11/22 - 11h30" />
<MESSAGE value="22/11/22 - 22h30" />
<MESSAGE value="23/11/22 - 22h30" />
@ -309,7 +309,8 @@
<MESSAGE value="27/01/23 - 15h" />
<MESSAGE value="27/01:23 - 19h" />
<MESSAGE value="30/01/23 - 22h" />
<option name="LAST_COMMIT_MESSAGE" value="30/01/23 - 22h" />
<MESSAGE value="01/02/23 - 22h" />
<option name="LAST_COMMIT_MESSAGE" value="01/02/23 - 22h" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>

File diff suppressed because it is too large Load Diff

View File

@ -280,7 +280,23 @@ def add_class(diction):
'''
Verification du nombre de mots clée : limite MYSY_GV.MAX_KEYWORD (3)
'''
nb_keyword = mydata['mots_cle'].split(";")
local_val = mydata['mots_cle'];
if (local_val.endswith(';')):
local_val = local_val[:-1]
nb_keyword = local_val.split(";")
for local_nb_keyword in nb_keyword:
if (len(str(local_nb_keyword).strip()) <= 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " : La formation " + str(
mydata['external_code']) + "contient des valeurs vides")
return False, " La formation " + str(
mydata['external_code']) + " contient des valeurs vides"
nb_keyword = local_val.split(";")
if( len(nb_keyword) > MYSY_GV.MAX_KEYWORD ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " : La formation "+str(mydata['external_code'])+" a plus de "+ str(MYSY_GV.MAX_KEYWORD)+" mots clés")
@ -492,8 +508,9 @@ def add_class(diction):
mydata['indexed_desc'] = '0'
mydata['indexed_obj'] = '0'
# A supprimer apres
# A supprimer apres (a reflechir .... me tate)
mydata['freeacces'] = '1'
mydata['isalaune'] = '1'
# fin à supprimer
# Create internal ref. of class
@ -556,7 +573,8 @@ def add_class(diction):
eibdd.ela_index_given_classes_title(training_to_index_title)
# Indexation Title des mots clées
eibdd.ela_index_given_classes_keywords(training_to_index_title)
print(" ### DEBUT indexation mot clée", )
eibdd.ela_index_class_key_word(mydata['external_code'], "keyword")
return True, "La formation a bien été ajoutée"
@ -768,7 +786,29 @@ def update_class(diction):
if ("mots_cle" in diction.keys()):
mydata['mots_cle'] = diction['mots_cle']
mots_cle = diction['mots_cle']
if (mots_cle.endswith(';')):
mots_cle = mots_cle[:-1]
nb_keyword = mots_cle.split(";")
for local_nb_keyword in nb_keyword:
if (len(str(local_nb_keyword).strip()) <= 0):
mycommon.myprint(
str(inspect.stack()[0][3]) + " : La formation " + str(
mydata['external_code']) + "contient des valeurs vides")
return False, " La formation " + str(mydata['external_code']) + " contient des valeurs vides"
if (len(nb_keyword) > MYSY_GV.MAX_KEYWORD):
mycommon.myprint(
str(inspect.stack()[0][3]) + " : La formation " + str(
mydata['external_code']) + " a plus de " + str(MYSY_GV.MAX_KEYWORD) + " mots clés")
return False, " La formation " + str(mydata['external_code']) + " a plus de " + str(
MYSY_GV.MAX_KEYWORD) + " mots clés"
mydata['mots_cle'] =mots_cle
if ("domaine" in diction.keys()):
if diction['domaine']:
@ -946,8 +986,9 @@ def update_class(diction):
'''
mydata['date_update'] = str(datetime.now())
# A supprimer apres
# A supprimer apres (a reflechir .... me tate)
mydata['freeacces'] = '1'
mydata['isalaune'] = '1'
# fin à supprimer
mydata['indexed'] = '0'
@ -2670,11 +2711,7 @@ def add_class_mass(file=None, Folder=None, diction=None):
mydata['plus_produit'] = plus_produit
mots_cle = ""
if ("mots_cle" in df.keys()):
if (str(df['mots_cle'].values[n])):
mots_cle = str(df['mots_cle'].values[n]).strip()
mydata['mots_cle'] = mots_cle
presentiel = "0"
@ -2803,12 +2840,30 @@ def add_class_mass(file=None, Folder=None, diction=None):
'''
Verification du nombre de mots clée : limite MYSY_GV.MAX_KEYWORD (3)
'''
nb_keyword = mydata['mots_cle'].split(";")
mots_cle = ""
if ("mots_cle" in df.keys()):
if (str(df['mots_cle'].values[n])):
mots_cle = str(df['mots_cle'].values[n]).strip()
if( mots_cle.endswith(';')):
mots_cle = mots_cle[:-1]
nb_keyword = mots_cle.split(";")
for local_nb_keyword in nb_keyword:
if(len(str(local_nb_keyword).strip()) <= 0 ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " : La formation " + str(
mydata['external_code']) + "contient des valeur vide")
return False, " La formation " + str(mydata['external_code']) + " contient des valeurs vides"
if( len(nb_keyword) > MYSY_GV.MAX_KEYWORD ):
mycommon.myprint(
str(inspect.stack()[0][3]) + " : La formation "+str(mydata['external_code'])+" a plus de "+ str(MYSY_GV.MAX_KEYWORD)+" mots clés")
return False, " La formation "+str(mydata['external_code'])+" a plus de "+ str(MYSY_GV.MAX_KEYWORD)+" mots clés"
mydata['mots_cle'] = mots_cle
'''
Traitement de la zone de diffusion

View File

@ -1,7 +1,4 @@
,index,mots,occurence,moyenne,id_formation,source_field
0,0,bio,1,0.17,HIFMI_001,title
1,1,vegan,1,0.17,HIFMI_001,title
2,2,casher,1,0.17,HIFMI_001,title
3,3,tracabilite,1,0.17,HIFMI_001,title
4,4,halal,1,0.17,HIFMI_001,title
5,5,alimentaire,1,0.17,HIFMI_001,title
0,0,halal,1,0.33,HIFMI_001,keyword
1,1,cherif_key_word,1,0.33,HIFMI_001,keyword
2,2,tracabilite,1,0.33,HIFMI_001,keyword

1 index mots occurence moyenne id_formation source_field
2 0 0 bio halal 1 0.17 0.33 HIFMI_001 title keyword
3 1 1 vegan cherif_key_word 1 0.17 0.33 HIFMI_001 title keyword
4 2 2 casher tracabilite 1 0.17 0.33 HIFMI_001 title keyword
3 3 tracabilite 1 0.17 HIFMI_001 title
4 4 halal 1 0.17 HIFMI_001 title
5 5 alimentaire 1 0.17 HIFMI_001 title

View File

@ -7,6 +7,7 @@ import inspect
import sys, os
from operator import itemgetter, attrgetter
import GlobalVariable as MYSY_GV
from datetime import datetime
'''
Cette fonction indexe une formation
@ -190,6 +191,77 @@ def ela_index_class(external_code="", source_field = ""):
return False
"""
Indexation des mots clés.
Ceci etant particulier, il n'ya pas de gestion d'occurence.
/!\ : A faire.
Pour chaque mot clé,
1 - Ajouter le mot dans la collection "word_not_stem" pour eviter les effets de traduction
2 - Ajouter les mot dans la collection "elaindex" avec une occurrence par defaut de 1000, source_field = 'keyword', moyanne = "1"
"""
def ela_index_class_key_word(external_code="", source_field = ""):
try:
if( str(external_code).strip() == "" or str(source_field).strip() == "" ):
mycommon.myprint( str(inspect.stack()[0][3]) + " Toutes les information ne sont pas fournies (1) ")
return False,
if( str(source_field).strip() != "keyword"):
mycommon.myprint(str(inspect.stack()[0][3]) + " Il ne s'agit pas d'une indexation de mot clés")
return False
# Recuperation de la liste des mots clée
print(" ### external_code = ", external_code)
local_class = MYSY_GV.dbname['myclass'].find_one({"external_code": external_code, 'valide':'1', 'locked':'0'})
print(" ## local_class = ", local_class)
if( local_class is None or local_class['mots_cle'] is None):
mycommon.myprint(str(inspect.stack()[0][3]) + " Aucune formation à indexer")
return False
"""
On supprimer les anciens mots indexé
"""
MYSY_GV.dbname['elaindex'].delete_many({ 'source_field': 'keyword',
'id_formation': str(local_class['external_code'])})
MYSY_GV.dbname['word_not_stem'].delete_many({'id_formation': str(local_class['external_code'])})
now = str(datetime.now())
"""
Ajouter les mots dans la collection word_not_stem
"""
cpt = 0
list_keyword = str(local_class['mots_cle']).replace(",",";").split(";")
for val in list_keyword :
if(len(str(val).strip()) > 0 ):
cpt = cpt + 1
# Ajout dant not_stem
MYSY_GV.dbname['word_not_stem'].insert_one({'mot':str(val).strip(), 'date_update':str(now), 'id_formation':str(local_class['external_code'])})
# Ajouter les mot dans la collection "elaindex" avec une occurrence par defaut de 1000, source_field = 'keyword', moyanne = "1"
MYSY_GV.dbname['elaindex'].insert_one({'mots': str(val).strip(), 'occurence': 1000,
'source_field':'keyword', 'moyenne':"1",
'id_formation':str(local_class['external_code'])})
mycommon.myprint(str(inspect.stack()[0][3]) + " " +str(cpt)+" mot(s) clé(s) ont été indexés pour la formation "+str(local_class['external_code']))
return True
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - ERRORRRR AT Line : " + str(exc_tb.tb_lineno))
return False
'''
La fonction "ela_index_all_classes" va aller chercher chaque cours dans la BDD
et créer les mots clées qui sont ensuite enregister dans la table "elaindex"
@ -349,8 +421,8 @@ def ela_index_given_classes_keywords(diction) :
print(" QUERY INDEX keyword ="+str(myquery))
for doc in collection.find(myquery):
if ("title" in doc.keys()):
chaine = doc["title"]
if ("mots_cle" in doc.keys()):
chaine = doc["mots_cle"]
mycommon.myprint(" external_code = " + str(doc["external_code"]) + " ==> " + str(chaine))
retval = ela_index_class(str(doc["external_code"]), "keyword")
print(" apres : ela_index_given_classes_keywords retval = " + str(retval))

View File

@ -1,3 +1,4 @@
Empty DataFrame
Columns: [mots, occurence, moyenne, id_formation, source_field]
Index: []
mots occurence moyenne id_formation source_field
0 halal 1 0.33 HIFMI_001 keyword
1 cherif_key_word 1 0.33 HIFMI_001 keyword
2 tracabilite 1 0.33 HIFMI_001 keyword

View File

@ -519,7 +519,7 @@ def update_partner_account(diction):
'contact_mail', 'token', 'link_facebook', 'link_twitter', 'invoice_vat_num',
'invoice_nom', 'invoice_adr_street', 'invoice_adr_city', 'invoice_adr_zip',
'invoice_adr_country', 'invoice_email', 'invoice_telephone', 'invoice_vat_num',
'siren', 'num_nda', 'iscertitrace', 'isdatadock', 'isqualiopi']
'siren', 'num_nda', 'iscertitrace', 'isdatadock', 'isqualiopi', 'website']
incom_keys = diction.keys()
@ -591,6 +591,9 @@ def update_partner_account(diction):
if ("isqualiopi" in diction.keys()):
mydata['isqualiopi'] = diction['isqualiopi']
if ("website" in diction.keys()):
mydata['website'] = diction['website']
if ("email" in diction.keys()):
my_email = diction['email']