This commit is contained in:
hsafaei
2025-06-01 17:12:50 +03:30
parent f61ddc18cb
commit 8fa154a8a2
3 changed files with 33 additions and 23 deletions
+17 -15
View File
@@ -215,10 +215,11 @@ def importDataToElastic(elastic, file_excel, index_name_o, tcode_label, tcode_id
qanon_title = row[column_names[2]]
code_state = row[column_names[3]]
row_number = row[column_names[4]]
if code_state :
print ( 'ddddddddddddddcode_state' , code_state)
else :
print ( 'ccccccccccccccode_state' , code_state)
# if code_state :
# print ( 'ddddddddddddddcode_state' , code_state)
# else :
# print ( 'ccccccccccccccode_state' , code_state)
qanon_id = 0
section_id = 0
state = ''
@@ -296,10 +297,11 @@ def importDataToElastic(elastic, file_excel, index_name_o, tcode_label, tcode_id
"label" : tcode_label,
"id" : tcode_id
}
if code_state :
if code_state == True :
tcode_mains.append(code)
else:
tcode_subs.append(code)
data={
'_id':section_id,
'_source' : {
@@ -325,18 +327,18 @@ def importDataToElastic(elastic, file_excel, index_name_o, tcode_label, tcode_id
elastic.updateBulkList(bulk_data, index_name_o)
# columns=['جزء', 'مصوب', 'قانون', 'اصلی', 'ردیف', 'شناسه قانون', 'شناسه جزء', 'وضعیت پردازش']
columns=[0, 1, 2, 3, 4, 5, 6, 7]
new_df = pd.DataFrame(rows_list_new, columns=columns)
if result_path == '' :
directory_path = os.path.dirname(file_excel)
result_path = directory_path + "/result/"
##### columns=['جزء', 'مصوب', 'قانون', 'اصلی', 'ردیف', 'شناسه قانون', 'شناسه جزء', 'وضعیت پردازش']
# columns=[0, 1, 2, 3, 4, 5, 6, 7]
# new_df = pd.DataFrame(rows_list_new, columns=columns)
# if result_path == '' :
# directory_path = os.path.dirname(file_excel)
# result_path = directory_path + "/result/"
file_name = os.path.basename(file_excel)
file_excel2 = result_path + file_name.replace('.xlsx', '_result.xlsx')
# file_name = os.path.basename(file_excel)
# file_excel2 = result_path + file_name.replace('.xlsx', '_result.xlsx')
print('rows_list_new', str(len(rows_list_new)), ' --> ', file_excel2)
new_df.to_excel(file_excel2, index=False, engine='openpyxl')
# print('rows_list_new', str(len(rows_list_new)), ' --> ', file_excel2)
# new_df.to_excel(file_excel2, index=False, engine='openpyxl')
except Exception as e:
+15 -7
View File
@@ -16,8 +16,8 @@ from temp_LawSection_content import *
load_dotenv(dotenv_path='config.env')
# host=os.getenv('HOST_160')
# password=os.getenv('HOST_160_PASS')
host=os.getenv('HOST_160')
password=os.getenv('HOST_160_PASS')
@@ -30,8 +30,8 @@ load_dotenv(dotenv_path='config.env')
# host=os.getenv('HOST_161')
# password=os.getenv('HOST_161_PASS')
host=os.getenv('HOST_80')
password=os.getenv('HOST_80_PASS')
# host=os.getenv('HOST_80')
# password=os.getenv('HOST_80_PASS')
print(host)
@@ -40,9 +40,17 @@ print(host)
path_base_map = "G:/Project2/gateway2_main/repo/_other/"
elastic = ElasticHelper(host, password, "elastic", path_base_map)
# elastic.backupIndexToZipfile("G:/Project2/111/haditha", "dh_volume")
# elastic.backupIndexToZipfile("G:/Project2/111/haditha", "dh_haditha")
# elastic.backupIndexToZipfile("G:/Project2/111", "mj_qa_section-m1")
# elastic.createIndex( 'mj_qa_section-m1', 'majles', 'mj_qa_section')
# elastic.restorFileToElastic2('G:/Project2/111/mj_qa_section-m1.zip', 'mj_qa_section-m1', 'majles', False, 'mj_qa_section')
#elastic.backupIndexToZipfile("G:/Project2/111", "mj_qa_section")
# elastic.restorFileToElastic2('G:/Project2/111/gn_setting.zip', 'gn_setting', 'general', False, 'gn_setting')
#-------------------------------------------------------
##
# elastic.backupIndexToZipfile("G:/Project2/111", "dh_haditha")
@@ -80,7 +88,7 @@ elastic = ElasticHelper(host, password, "elastic", path_base_map)
#-------------------------------------------------------
## backup from 160
#-------------------------------------------------------
# path_back = 'G:/Project2/_back/server160/_back_elastic0126/'
path_back = 'G:/Project2/111/server160/'
# elastic.backupIndexToZipfile(path_back, "gn_log_change")
# elastic.backupIndexToZipfile(path_back, "gn_log_action")
# elastic.backupIndexToZipfile(path_back, "gn_log_search")
@@ -89,7 +97,7 @@ elastic = ElasticHelper(host, password, "elastic", path_base_map)
# elastic.backupIndexToZipfile(path_back, "gn_bayanat")
# elastic.backupIndexToZipfile(path_back, "gn_entity")
# elastic.backupIndexToZipfile(path_back, "gn_research")
# elastic.backupIndexToZipfile(path_back, "gn_dataset")
# elastic.backupIndexToZipfile(path_back, "gn_dataset")
# elastic.backupIndexToZipfile(path_back, "mj_mashruh")