majles update end

This commit is contained in:
hsafaei
2025-12-20 19:17:29 +03:30
parent 525b429d6a
commit 1e24fc6caf
3 changed files with 90 additions and 43 deletions
@@ -615,6 +615,7 @@ def import_excel_tasmimat_to_elastic(elastic, path_file, index_name_o, duplicate
"term": term,
"ts_date": ts_date,
"ts_ref": ts_ref,
"meet_number": number,
"description": description,
"content": content
}
@@ -100,7 +100,7 @@ def correct_qanon_date_json(data, error_list):
data_new.append(item)
return data_new
def normal_data_json(data):
def normal_mashruh_data_json(data):
data_new = []
for item in data:
id = item["_id"]
@@ -114,6 +114,12 @@ def normal_data_json(data):
if 'title' in item["_source"] :
item["_source"]['title'] = text_normal.normalize_qanon(item["_source"]['title'])
if 'content_type' in item["_source"] :
item["_source"]['content_type'] = text_normal.normalize_qanon(item["_source"]['content_type']).strip()
if 'title_type' in item["_source"] :
item["_source"]['title_type'] = text_normal.normalize_qanon(item["_source"]['title_type']).strip()
if "talker" in item["_source"]:
talker = item["_source"]["talker"]
if 'organ' in talker :
@@ -148,7 +154,8 @@ def restore_correct_date_to_elastic(elastic, file_path, index_name, file_error='
data_new = correct_qanon_date_json(data, error_list)
if index_name == 'mj_mashruh' :
data_new = normal_data_json(data_new)
data_new = normal_mashruh_data_json(data_new)
elastic.importJsonDataToElastic(data_new, index_name, [], True)
counter += len(data)
# print('-'*10, 'len()', str(counter) + '/ ' + str(len(data)) + ' , ' +str(len(data_new)) )