mj_plan tested

This commit is contained in:
init_mahdi
2025-11-08 10:06:59 +03:30
parent f4eaf3b831
commit 4f7adb9865
+23 -7
View File
@@ -133,7 +133,20 @@ def import_paln_json_to_elastic(elastic, file_path, index_name):
# with open(file_path, 'w', encoding='utf-8') as f: # with open(file_path, 'w', encoding='utf-8') as f:
# json.dump(list_bulk, f, ensure_ascii=False, indent=4) # json.dump(list_bulk, f, ensure_ascii=False, indent=4)
# print(':D') # print(':D')
def list_json_files(directory):
import os
json_files = []
# مرور در دایرکتوری
for root, _, files in os.walk(directory):
for file in files:
if file.endswith('.json'):
# افزودن مسیر کامل فایل به لیست
json_files.append(os.path.join(root, file))
return json_files
# -------------------------------------------------------------------- Run # -------------------------------------------------------------------- Run
@@ -155,13 +168,16 @@ if __name__ == "__main__":
path_base_map = "G:/Project2/gateway2_main/repo/_other/" path_base_map = "G:/Project2/gateway2_main/repo/_other/"
elastic = ElasticHelper(host, password, "elastic", path_base_map) elastic = ElasticHelper(host, password, "elastic", path_base_map)
file_path=r'data/plans/gpt120b_49_1/data_1/آمار، برنامه و بودجه.json'
index_name='mj_plan' index_name='mj_plan'
import_paln_json_to_elastic( # file_path=r'data/plans/gpt120b_49_1/data_1/آمار، برنامه و بودجه.json'
elastic=elastic, file_path=r'data/plans/gpt120b_49_1/data_1/'
file_path=file_path,
index_name=index_name for file in list_json_files(file_path):
) import_paln_json_to_elastic(
elastic=elastic,
file_path=file,
index_name=index_name
)
# all_codes = [] # all_codes = []
# with open("./data/codes49.json", "r", encoding="utf8") as f: # with open("./data/codes49.json", "r", encoding="utf8") as f: