thumbnail , ...

This commit is contained in:
hsafaei
2025-12-17 11:43:22 +03:30
parent f4e8832e61
commit 525b429d6a
4 changed files with 198 additions and 74 deletions
+86 -16
View File
@@ -32,6 +32,13 @@ load_dotenv(dotenv_path="config.env")
host = os.getenv("HOST_160")
password = os.getenv("HOST_160_PASS")
# host = os.getenv("HOST_112")
# password = os.getenv("HOST_112_PASS")
# host = os.getenv("HOST_H102")
# password = os.getenv("HOST_H102_PASS")
# print( "---------------->>>>>>>>>>>>>>>", host )
# host=os.getenv('HOST_113')
@@ -43,6 +50,7 @@ print(".... majles_codes_update_steps ......", host)
path_base_map = "G:/Project2/gateway_php/repo/_other/"
elastic = ElasticHelper(host, password, "elastic", path_base_map)
# -------------------------------------
# ----- یک بار فقط
# ----- پشتیبان گیری از داده های جدید داتیک
@@ -105,6 +113,19 @@ file_path = "G:/Project2/160_dotic/mj_rg_section_doctic_14040824.zip"
# elastic.createIndex( 'mj_rg_section', 'majles', 'mj_rg_section', path_base_map+ 'majles/'+'mj_qa_section_new.json')
# restore_correct_date_to_elastic(elastic, file_path, "mj_rg_section", "G:/Project2/160_dotic/date_log_error_rgsection.txt" )
# -------------------------------------
# ----- mj_mashruh
file_path = "G:/Project2/160_dotic/mj_mashruh.zip"
# elastic.backupIndexToZipfile("G:/Project2/160_dotic", "mj_mashruh", "mj_mashruh")
elastic.createIndex( 'mj_mashruh', 'majles', 'mj_mashruh', path_base_map+ 'majles/'+'mj_mashruh.json' )
restore_correct_date_to_elastic(elastic, file_path, "mj_mashruh", "G:/Project2/160_dotic/date_log_error_mashruh.txt" )
# --------------------------------------------- 1 ------------------------------------------------------------------
# ---------------------------------------------------------------------------------------------------------------
# --- مواردی از قانونهای جدید که فیلد زیر را ندارند باید اصلاح شوند
@@ -163,11 +184,15 @@ file_path = "G:/Project2/160_dotic/mj_rg_section_doctic_14040824.zip"
# ctx._source.main_type = 'قانون';
# ctx._source.main_type_key = 'qasection';
# """,
# "lang": "painless",
# },
# "lang": "painless"
# }
# }
# elastic.updateByQueryIndex("mj_df_qanon", body)
#elastic.backupIndexToZipfile("G:/Project2/160_dotic/majles_14040918", "mj_df_qanon", "mj_df_qanon_1_date")
# --------------------------------------------- 3 ------------------------------------------------------------------
# --- درج داده های جدید مقررات و آراء در فهرست همه
# ---------------------------------------------------------------------------------------------------------------
@@ -210,12 +235,12 @@ file_tasmim = "G:/Project2/160_dotic/duplicate_tasmim.json"
# elastic.restorFileToElastic2('G:/Project2/160_dotic/mj_qa_qanon_3_base_dotic.zip', 'mj_qa_qanon', 'majles', False, 'mj_qa_qanon')
# # #------------------------------------------
duplicate_list = {}
file_excel = r"G:\Project2\dataParsers\data\qavanin_files\qavanin_output4.xlsx"
import_excel_before_to_elastic(elastic, file_excel, "mj_qa_qanon", duplicate_list)
# duplicate_list = {}
# file_excel = r"G:\Project2\dataParsers\data\qavanin_files\qavanin_output4.xlsx"
# import_excel_before_to_elastic(elastic, file_excel, "mj_qa_qanon", duplicate_list)
with open(file_before, 'w', encoding='utf8') as f :
json.dump(duplicate_list, f, ensure_ascii=False, indent=4)
# with open(file_before, 'w', encoding='utf8') as f :
# json.dump(duplicate_list, f, ensure_ascii=False, indent=4)
# # # #------------------------------------------
@@ -229,7 +254,7 @@ with open(file_before, 'w', encoding='utf8') as f :
# json.dump(duplicate_list, f, ensure_ascii=False, indent=4)
# # # #------------------------------------------
# # # # #------------------------------------------
# duplicate_list = {}
# with open(file_after, 'r', encoding='utf8') as f :
# duplicate_list = json.loads( f.read())
@@ -243,6 +268,14 @@ with open(file_before, 'w', encoding='utf8') as f :
# elastic.backupIndexToZipfile("G:/Project2/160_dotic", "mj_qa_qanon", "mj_qa_qanon_4_base_excel")
#---------تنظیم شد mj_qa_qanon_new.json
# #----------------------------
# PUT mj_qa_qanon/_settings
# {
# "index" : {
# "max_result_window" : 200000
# }
# }
# .....
@@ -251,18 +284,55 @@ with open(file_before, 'w', encoding='utf8') as f :
# -- اصلاح ساختار اسکیما نماش و تغییرات برای ساختار تاریخ تغییر یافته و تست و بررسی
# .....
# .....
# ------------------------------------
# ------------------------------------
# ------------------------------------------------------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------------
#------------------------------------
#--- mj_qa_section
# elastic.backupIndexToZipfile("G:/Project2/160_dotic", "mj_qa_section", "mj_qa_section_1_base")
# بررسی پر بودن main_type مجلس برای نوع اصلی/تبعی/مهذب # و تغییر به mom_type
#### schema changed --> qasection_mom_type
# # # POST mj_qa_section/_update_by_query
# body = {
# "query": {"terms": {"main_type": ["اصلی", "تبعی"]}},
# "script": {
# "source": """
# ctx._source.mom_type = ctx._source.main_type;
# ctx._source.main_type = 'قانون'
# """,
# "lang": "painless",
# },
# }
# elastic.updateByQueryIndex("mj_qa_section", body)
# elastic.backupIndexToZipfile("G:/Project2/160_dotic", "mj_mashruh", "mj_mashruh")
# elastic.createIndex( 'mj_mashruh', 'majles', 'mj_mashruh', path_base_map+ 'majles/'+'mj_mashruh.json' )
# elastic.restorFileToElastic2('G:/Project2/160_dotic/mj_mashruh.zip', 'mj_mashruh', 'majles', False, 'mj_mashruh')
#--- mj_qa_section ???
# بررسی پر بودن main_type مجلس برای نوع اصلی/تبعی/مهذب
# و تغییر به mom_type
# schema ???
# 'key' => 'mom_type',
# 'label' => 'نوع اصلی/تبعی/مهذب',
# elastic.createIndex( 'mj_qa_qanon', 'majles', 'mj_qa_qanon')
# elastic.restorFileToElastic2('G:/Project2/160_dotic/mj_qa_qanon_base_excel.zip', 'mj_qa_qanon', 'majles', False, 'mj_qa_qanon')
# elastic.createIndex( 'mj_qa_qanon', 'majles', 'mj_qa_qanon', path_base_map+ 'majles/'+'mj_qa_qanon_new.json' )
# elastic.restorFileToElastic2('G:/Project2/160_dotic/majles_14040918/mj_qa_qanon_4_base_excel.zip', 'mj_qa_qanon', 'majles', False, 'mj_qa_qanon')
# elastic.createIndex( 'mj_df_qanon', 'majles', 'mj_df_qanon', path_base_map+ 'majles/'+'mj_df_qanon_new.json' )
# elastic.restorFileToElastic2('G:/Project2/160_dotic/majles_14040918/mj_df_qanon_1_date.zip', 'mj_df_qanon', 'majles', False, 'mj_df_qanon')
# elastic.backupIndexToZipfile("G:/Project2/160_dotic", "mj_qa_semantic_section", "mj_qa_semantic_section")