24/02/23 - 23h23

master
cherif 2023-02-24 23:23:49 +01:00
parent 7c49d6f3d3
commit 5e772694e3
5 changed files with 4409 additions and 10 deletions

View File

@ -1,14 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="20/02/23 - 11h"> <list default="true" id="1122d9e2-679f-46d6-8c4f-97e9ae4041b5" name="Changes" comment="22/02/23 20h">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" 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$/Log/log_file.log" beforeDir="false" afterPath="$PROJECT_DIR$/Log/log_file.log" afterDir="false" />
<change beforePath="$PROJECT_DIR$/business_prices.py" beforeDir="false" afterPath="$PROJECT_DIR$/business_prices.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_output_test_file_pandas_2.txt" beforeDir="false" afterPath="$PROJECT_DIR$/ela_output_test_file_pandas_2.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/prj_common.py" beforeDir="false" afterPath="$PROJECT_DIR$/prj_common.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" beforeDir="false" afterPath="$PROJECT_DIR$/tools_cherif/tools_cherif.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/wrapper.py" beforeDir="false" afterPath="$PROJECT_DIR$/wrapper.py" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -319,7 +317,14 @@
<option name="project" value="LOCAL" /> <option name="project" value="LOCAL" />
<updated>1676888825283</updated> <updated>1676888825283</updated>
</task> </task>
<option name="localTasksCounter" value="36" /> <task id="LOCAL-00036" summary="22/02/23 20h">
<created>1677094867932</created>
<option name="number" value="00036" />
<option name="presentableId" value="LOCAL-00036" />
<option name="project" value="LOCAL" />
<updated>1677094867932</updated>
</task>
<option name="localTasksCounter" value="37" />
<servers /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="Vcs.Log.Tabs.Properties">
@ -334,7 +339,6 @@
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration"> <component name="VcsManagerConfiguration">
<MESSAGE value="20/12/22 - 11h30" />
<MESSAGE value="20/12/22 - 15h30" /> <MESSAGE value="20/12/22 - 15h30" />
<MESSAGE value="24/12/2022 - 15h00" /> <MESSAGE value="24/12/2022 - 15h00" />
<MESSAGE value="27/12/2022 - 11h00" /> <MESSAGE value="27/12/2022 - 11h00" />
@ -359,7 +363,8 @@
<MESSAGE value="16/02/23 - 22h" /> <MESSAGE value="16/02/23 - 22h" />
<MESSAGE value="17/02/23 - 14h" /> <MESSAGE value="17/02/23 - 14h" />
<MESSAGE value="20/02/23 - 11h" /> <MESSAGE value="20/02/23 - 11h" />
<option name="LAST_COMMIT_MESSAGE" value="20/02/23 - 11h" /> <MESSAGE value="22/02/23 20h" />
<option name="LAST_COMMIT_MESSAGE" value="22/02/23 20h" />
</component> </component>
<component name="XDebuggerManager"> <component name="XDebuggerManager">
<breakpoint-manager> <breakpoint-manager>

File diff suppressed because it is too large Load Diff

15
main.py
View File

@ -2331,6 +2331,21 @@ def email_validation():
localStatus, message= tools_cherif.email_validation() localStatus, message= tools_cherif.email_validation()
return jsonify(status=localStatus, message=message ) return jsonify(status=localStatus, message=message )
"""
Dirty fonction
"""
@app.route('/myclass/api/dirty/', methods=['POST','GET'])
@crossdomain(origin='*')
def dirty():
# On recupere le corps (payload) de la requete
payload = request.form.to_dict()
print(" ### dirty : payload = ",payload)
localStatus, message= tools_cherif.dirty()
return jsonify(status=localStatus, message=message )
@app.route('/myclass/api/email_validation_mairies/', methods=['POST','GET']) @app.route('/myclass/api/email_validation_mairies/', methods=['POST','GET'])
@crossdomain(origin='*') @crossdomain(origin='*')
def email_validation_mairies(): def email_validation_mairies():

View File

@ -361,3 +361,190 @@ def test_tab_mail(tab_mail):
exc_type, exc_obj, exc_tb = sys.exc_info() exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno)) mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de tester le mail" return False, " Impossible de tester le mail"
''' dirty function '''
def dirty():
try:
tab = ['a.maisonneuve@ch-montlucon.fr',
'a.notteghem@ch-stquentin.fr',
'adamasambou@live.fr',
'as.aubert@ch-cannes.fr',
'bduquai@gmail.com',
'berdaguerd@gmail.com',
'bnoetinger@yahoo.fr',
'boucherie.gervais@gmail.com',
'boucherie.laiguillon.lh@gmail.com',
'boucherie.piquenot@gmail.com',
'boucheriebeauvais@gmail.com',
'boucheriefouache@gmail.com',
'boucheriesaintvivien@gmail.com',
'breantbaba@gmail.com',
'c.hugues@ch-stquentin.fr',
'canals.cedric@orange.fr',
'caterinallende@yahoo.es',
'catherine.hardy@ch-ariege-couserans.fr',
'cathysalva@live.fr',
'celine.viteau@ch-soissons.fr',
'charcuterieleger@orange.fr',
'charles@closdesvinsdamour.fr',
'chateaunadalhainaut@gmail.com',
'clotdelorigine@gmail.com',
'contact@bioteafull.fr',
'contact@domainepouderoux.fr',
'contact@herboristerie-moderne.fr',
'contact@lesjardinsdemeraude.fr',
'contact@masbecha.com',
'contact@masdenfelix.com ',
'contact@vins-face-b.fr',
'cyril.marais@ch-soissons.fr',
'cyrilfhal@gmail.com',
'daniel.leclerc@gmail.com',
'direction.ehpad.aixeo@hotmail.fr',
'direction.ehpad.rpc@gmail.com',
'direction@ch-hirson.fr',
'direction@chsi-ainay.fr',
'direction@hi-bsav.fr',
'directiongenerale@ch-stquentin.fr',
'dom.ponsgralet@wanadoo.fr',
'domaine.laguerre@orange.fr',
'domainespiaggia@yahoo.com',
'domitienne@outlook.com',
'drh@cas-forcalquier.fr',
'ducrocq.quentin29@gmail.com',
'ehpad.grdbosquet.villerscotterets@wanadoo.fr',
'ehpad@beauregard-residence.fr',
'enidnamag@hotmail.com',
'eric.heyrman@ch-soissons.fr',
'eric.robart@orange.fr',
'etoiledelabergere486@gmail.com',
'f.mezrouh@ch-stquentin.fr',
'flo.moussellous@gmail.com',
'foyer.occ@wanadoo.fr',
'francoise.moreau@hopcobour.net',
'gdesnoix@chsi-ainay.fr',
'helie.boucherie@orange.fr',
'herve.bessiere@gmail.com',
'hopital.saintmaur@gmail.com',
'info.domainegardies@gmail.com',
'info@masllossanes.fr',
'inge.meierhofer@yahoo.fr',
'j.louisy@ch-stquentin.fr',
'jeanmarie.colin@ch-valvert.fr',
'jfdeu@hotmail.com',
'jp.fardeau@cas-forcalquier.fr',
'labergeriedesabeilles@gmail.com',
'lafermedubiosillon@gmail.com',
'lamerblanche66@gmail.com',
'laurent.lemoux@ch-ghsa.fr',
'laurie@lejardinbiodelaurie.fr ',
'lechantdelaterre66@gmail.com',
'lemasaintantoine@gmail.com',
'lepetitsoleilbio66@outlook.fr',
'les.salicaires.vigneron@gmail.com',
'letempsbio@gmail.com',
'lherberie@protonmail.com',
'ljdt66@gmail.com',
'm.saf@ch-guise.fr',
'marc.veuillet@cgd13.fr',
'masdumoutonnoir@gmail.com',
'maugerdominique@hotmail.com',
'mylene.verdu@gmail.com ',
'n.estin@ch-stquentin.fr',
'naliane@chsi-ainay.fr',
'o.ponties@ch-rodez.fr',
'pierre.espejo2@gmail.com',
'pouletbio@live.fr',
'responsable.rh-log@ehpad-mgasquet.fr',
'romain.cochonbio@yahoo.com',
's.bousmaha@ch-stquentin.fr',
's.junker@ch-montlucon.fr',
'sarlavice76@gmail.com',
'sarlmaisoncuvier@gmail.com',
'scealaroqueta@gmail.com',
'sophie.barbier@ch-ghsa.fr',
'thierry.levionnois@orange.fr',
'veroniquedumont42@gmail.com',
'yanisleroux@orange.fr',
'andre.minyemeck@ehpad-conches.fr',
'anne.quinville@armorsante.bzh',
'audrey.licandro@chu-dijon.fr',
'c.bistue@chuzes.fr',
'ca.doussot@cht-ranceemeraude.fr',
'catherine.lahille@gh-portesdeprovence.fr',
'cecile.chalet@chu-nimes.fr',
'cgreslon@ch-bassindethau.fr',
'christian.soubie@ch-libourne.fr',
'contact-stp@hopitaloleron.net',
'contact@ch-edouard-toulouse.fr',
'contact@hopital-vicfezensac.fr',
'contact@nh-navarre.fr',
'd.faivre@chi-hc.fr',
'david.trouchaud@ght-cdn.fr',
'dg.secretariat@ch-perigueux.fr',
'diandra.tijjini@nh-navarre.fr',
'directeur@ch-saint-renan.fr',
'directeur@hopital-murat.fr',
'direction.generale@ch-perrens.fr',
'direction@ch-claudel.fr',
'direction@ch-condom.com',
'direction@gh-portesdeprovence.fr',
'direction@mr-blamont.fr',
'directionfdcmontpon@orange.fr',
'direhpadsudcher@gmail.com',
'e-barde@chu-montpellier.fr',
'ehpad.gracay@orange.fr',
'ehpad.lebrestalou@wanadoo.fr',
'ehpad.lescedres@outlook.fr',
'florie.bideplan@ch-libourne.fr',
'helene.normand@nh-navarre.fr',
'ifsivierzon@ch-vierzon.fr',
'j-lepage@chu-montpellier.fr',
'jean-baptiste.fleury@armorsante.bzh',
'l.brule@ch-hdn.fr',
'lalliot-bironneau@ch-perrens.fr',
'logistique@hlv.fr',
'logistiqueaudincourt@gmail.com',
'magali.luc@chu-nimes.fr',
'maison-retraite@mr-blamont.fr',
'maisonderetraite.montpon@orange.fr',
'marc.jaffuer@ch-libourne.fr',
'mr.la.guerche@wanadoo.fr',
'mrlaignes@wanadoo.fr',
'p.perrot@ch-stmalo.fr',
'personnel@epms-orbec.fr',
'philippe.charre@gh-portesdeprovence.fr',
'ronan.sanquer@chu-brest.fr',
'sdeduit@ch-vierzon.fr',
'sylvie.briend@ch-dinan.fr',
't-veleine@chu-montpellier.fr',
'tyandudcoz@orange.fr']
coll_bio = MYSY_GV.dbname['collect_list_pos_bio']
coll_ehpad = MYSY_GV.dbname['collect_list_hopitaux_ehpad']
coll_boucherie = MYSY_GV.dbname['collect_list_boucherie']
for val in tab :
for ret1 in coll_bio.find({'email':val}):
if ("email" in ret1.keys()):
print( "'Point de vente BIO', '",ret1['email'], "' => '",ret1['raison_sociale'], "' => '", ret1['adress'], "'=> '", ret1['tel']+"'")
for ret2 in coll_ehpad.find({'email':val}):
if ("email" in ret2.keys()):
print( "'EHPAD & HOPITAUX', '",ret2['email'], "'=> '",ret2['raison_sociale'], "' => '", ret2['adresse'], "'=>' ", ret2['tel']+"'")
for ret3 in coll_boucherie.find({'email':val}):
if ("email" in ret3.keys()):
print("'BOUCHERIE', '", ret3['email'], "'=> '",ret3['raison_sociale'], "' => '---' => '", ret3['tel']+"'")
return True, "ok"
except Exception as e:
exc_type, exc_obj, exc_tb = sys.exc_info()
mycommon.myprint(str(inspect.stack()[0][3]) + " -" + str(e) + " - Line : " + str(exc_tb.tb_lineno))
return False, " Impossible de tester le mail"

View File

@ -636,14 +636,73 @@ def recherche_text_simple(diction):
nb_result = 0 nb_result = 0
insertObject = [] insertObject = []
"""
23/02/2023 : Uniquement pour des raisons de tests
"""
test_client_recid = "7ad3a72c9b161045cc50a7590e5fd18289a41389dca44386c6"
"""
23/02/2023 : FIN Uniquement pour des raisons de tests
"""
"""
for x in coll_name.find({"external_code":{"$in":tab_training}, 'published':'1'}, for x in coll_name.find({"external_code":{"$in":tab_training}, 'published':'1'},
{"_id": 0, "indexed": 0, "indexed_desc": 0, {"_id": 0, "indexed": 0, "indexed_desc": 0,
"indexed_obj": 0, "indexed_title": 0, "valide": 0, "indexed_obj": 0, "indexed_title": 0, "valide": 0,
"locked": 0 }).sort([("display_rank", pymongo.DESCENDING), ("price", pymongo.ASCENDING), ("date_update", pymongo.DESCENDING), ]): "locked": 0 }).sort([("display_rank", pymongo.DESCENDING), ("price", pymongo.ASCENDING), ("date_update", pymongo.DESCENDING), ]):
"""
pipe = [
{ '$match': {'external_code': {"$in": ['AP', 'OP', 'AR']}} },
{ '$project': { '_id': 0, 'indexed': 0, 'indexed_desc': 0, 'indexed_obj': 0, "indexed_title": 0, "valide": 0, "locked": 0} },
{ '$lookup':
{
'from': 'business_prices',
'let': { 'partner_owner_recid': "$partner_owner_recid", 'programme' : '$programme' },
'pipeline': [
{ '$match':
{ '$expr':
{ '$and':
[
{ '$eq': [ "$partner_recid", "$$partner_owner_recid" ] },
{ '$eq': [ "$client_recid", "1ba5aacb6f00d37cf9017858118d281ab8776dbd7916ae1899" ] },
{ '$eq': [ "$valide", "2" ] }
]
}
}
},
],
'as': 'business_prices'
}
}
]
#print(" ### pipe = ", pipe)
for x in coll_name.aggregate(pipe):
nb_result = nb_result + 1 nb_result = nb_result + 1
if ("business_prices" in x.keys()):
if( "discount" in x['business_prices'][0].keys() ):
"""
Calcal du prix discounté
"""
#print(" ### discount = ", x['business_prices'][0]['discount'], " PRIX initial = ", x['price'])
local_discount = mycommon.tryFloat(str(x['business_prices'][0]['discount']))
local_initial_price = mycommon.tryFloat(str(x['price']))
local_discounted_price = round( local_initial_price - (local_initial_price * (local_discount/100)), 2)
x['business_prices'][0]['discounted_price'] = str(local_discounted_price)
#print(" #### local_discounted_price = ", local_discounted_price)
my_recid = {} my_recid = {}
my_recid['user_rec_id'] = str(user_recid) my_recid['user_rec_id'] = str(user_recid)
#print(" XXXXXXXXXX = "+str(x)) #print(" XXXXXXXXXX = "+str(x))
mydict_combined = {**diction, **x, **my_recid} mydict_combined = {**diction, **x, **my_recid}
mydict_combined['date_update'] = str(datetime.now()) mydict_combined['date_update'] = str(datetime.now())
@ -657,6 +716,7 @@ def recherche_text_simple(diction):
''' '''
Statistique : Insertion du recherche - resultat ''' Statistique : Insertion du recherche - resultat '''
ret_val_tmp = coll_search_result.insert_one(mydict_combined) ret_val_tmp = coll_search_result.insert_one(mydict_combined)
if (ret_val_tmp is False): if (ret_val_tmp is False):
mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de mettre à jour la table des resultat" mycommon.myprint(str(inspect.stack()[0][3]) + " - Impossible de mettre à jour la table des resultat"
" d'une recherche de formation. Voir _id = ") " d'une recherche de formation. Voir _id = ")
@ -708,7 +768,7 @@ def recherche_text_simple(diction):
print(str(x['url'])+" existe deja, pas d'ajout à faire ") print(str(x['url'])+" existe deja, pas d'ajout à faire ")
''' '''
#print(str(insertObject)) print("#### #", insertObject)
#print(" result ok ") #print(" result ok ")
''' en cas de resultat vide, enregsitrement de la requete de recherche avec les filtres associé''' ''' en cas de resultat vide, enregsitrement de la requete de recherche avec les filtres associé'''
if (nb_result == 0): if (nb_result == 0):