diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/app/common/__init__.py b/app/common/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/common/config_base.py b/app/common/config_base.py similarity index 100% rename from common/config_base.py rename to app/common/config_base.py diff --git a/common/data_helper.py b/app/common/data_helper.py similarity index 100% rename from common/data_helper.py rename to app/common/data_helper.py diff --git a/common/elastic_helper.py b/app/common/elastic_helper.py similarity index 100% rename from common/elastic_helper.py rename to app/common/elastic_helper.py diff --git a/common/elastic_helper_async.py b/app/common/elastic_helper_async.py similarity index 100% rename from common/elastic_helper_async.py rename to app/common/elastic_helper_async.py diff --git a/common/general_functions.py b/app/common/general_functions.py similarity index 99% rename from common/general_functions.py rename to app/common/general_functions.py index a7ec36b..dc43eaa 100644 --- a/common/general_functions.py +++ b/app/common/general_functions.py @@ -1,6 +1,6 @@ -from common.normalizer import Normalizer -from common.tokenizer import * -from common.jalali import Gregorian,Persian +from app.common.normalizer import Normalizer +from app.common.tokenizer import * +from app.common.jalali import Gregorian,Persian import re import sys from re import sub diff --git a/common/jalali.py b/app/common/jalali.py similarity index 100% rename from common/jalali.py rename to app/common/jalali.py diff --git a/common/move_index_to_other.py b/app/common/move_index_to_other.py similarity index 99% rename from common/move_index_to_other.py rename to app/common/move_index_to_other.py index 4e6f857..048e0e7 100644 --- a/common/move_index_to_other.py +++ b/app/common/move_index_to_other.py @@ -1,4 +1,4 @@ -from common.general_functions import * +from app.common.general_functions import * # هدف تغییر در قالب شناسه قانون برای سادگی بیشتر بود # mj_qa_qavanin_1234 --> qq1234 diff --git a/common/normalizer.py b/app/common/normalizer.py similarity index 99% rename from common/normalizer.py rename to app/common/normalizer.py index 01a5ff2..69646b4 100644 --- a/common/normalizer.py +++ b/app/common/normalizer.py @@ -1,8 +1,8 @@ from re import sub import copy import os -from common.tokenizer import Tokenizer -from common.data_helper import DataHelper +from app.common.tokenizer import Tokenizer +from app.common.data_helper import DataHelper import traceback,sys class Normalizer(): diff --git a/common/qanon_functions.py b/app/common/qanon_functions.py similarity index 98% rename from common/qanon_functions.py rename to app/common/qanon_functions.py index 9213d18..1abafdf 100644 --- a/common/qanon_functions.py +++ b/app/common/qanon_functions.py @@ -3,10 +3,10 @@ import re import traceback import json from dotenv import load_dotenv -from common.config_base import * -# from common.general_functions import * -from common.text_normalizer import TextNormalizer -from common.elastic_helper import ElasticHelper +from app.common.config_base import * +# from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer +from app.common.elastic_helper import ElasticHelper # from excel_helper import ExcelHelper import pandas as pd diff --git a/common/sql_helper.py b/app/common/sql_helper.py similarity index 100% rename from common/sql_helper.py rename to app/common/sql_helper.py diff --git a/common/stemmer.py b/app/common/stemmer.py similarity index 100% rename from common/stemmer.py rename to app/common/stemmer.py diff --git a/common/text_normalizer.py b/app/common/text_normalizer.py similarity index 100% rename from common/text_normalizer.py rename to app/common/text_normalizer.py diff --git a/common/tokenizer.py b/app/common/tokenizer.py similarity index 100% rename from common/tokenizer.py rename to app/common/tokenizer.py diff --git a/common/version_util.py b/app/common/version_util.py similarity index 100% rename from common/version_util.py rename to app/common/version_util.py diff --git a/common/__init__.py b/app/for_ai/__init__.py similarity index 100% rename from common/__init__.py rename to app/for_ai/__init__.py diff --git a/for_ai/ai_json_move_to_index.py b/app/for_ai/ai_json_move_to_index.py similarity index 81% rename from for_ai/ai_json_move_to_index.py rename to app/for_ai/ai_json_move_to_index.py index be378e2..0ac37ce 100644 --- a/for_ai/ai_json_move_to_index.py +++ b/app/for_ai/ai_json_move_to_index.py @@ -1,10 +1,13 @@ +import re import os +import sys import zipfile from dotenv import load_dotenv -from common.text_normalizer import TextNormalizer + +from ..common.text_normalizer import TextNormalizer # from general import * -from common.general_functions import * -from common.elastic_helper import ElasticHelper +from ..common.general_functions import * +from ..common.elastic_helper import ElasticHelper ### -------------------------------------------------------------- ## این کد برای استخراج و بهینه سازی کلیدواژه های تولید شده با مدلهای زبانی بزرگ و انتقال به الاستیک نوشته شد @@ -67,7 +70,6 @@ def moveKeywords(elastic, index_name_o, path_file, fields=['content'], body={}): elastic.updateBulkList(list, index_name_o) - ### -------------------------------------------------------------- ## برای انتقال جملات ساده سازی شده توسط مدلهای زبانی بزرگ به الاستیک قانون نوشته شد def moveZipSimplifies(elastic, index_name, file_path): @@ -153,6 +155,28 @@ def moveClassifierAiCodes(elastic, index_name_o, data): ai_code = best_code ai_codes = other_codes + #---------------------------------------------- + for label_doc in ai_codes: + label = label_doc["label"] + label = re.sub(r"\u00AD|\u00AC", "\u200C", label) # نیم اسپیس خاص + label = label.replace(" ", " ") + label = label.replace("ـ", "") + label = label.strip().strip("\u200C") + label_doc["label"] = label + if label_doc["score"] >= 1 : + label_doc["score"] = label_doc["score"] / 100 + + if ai_code["score"] >= 1 : + ai_code["score"] = ai_code["score"] / 100 + + label = ai_code["label"] + label = re.sub(r"\u00AD|\u00AC", "\u200C", label) # نیم اسپیس خاص + label = label.replace(" ", " ") + label = label.replace("ـ", "") + label = label.strip().strip("\u200C") + ai_code["label"] = label + #---------------------------------------------- + list_bulk.append({ '_id': id, '_source': { @@ -173,26 +197,17 @@ def moveClassifierAiCodes(elastic, index_name_o, data): - - - - - - - - - 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') # host=os.getenv('HOST_112') # password=os.getenv('HOST_112_PASS') -# host=os.getenv('HOST_113') -# password=os.getenv('HOST_113_PASS') +host=os.getenv('HOST_113') +password=os.getenv('HOST_113_PASS') # host=os.getenv('HOST_60') # password=os.getenv('HOST_60_PASS') @@ -216,7 +231,14 @@ elastic = ElasticHelper(host, password, "elastic", path_base_map) # classes = json.load(f) #-----نسخه آخر اجرای مدل -with open("./data/all_sections_classes_new_140405.json", "r", encoding="utf-8") as f: +# with open("./data/all_sections_classes_full_140405.json", "r", encoding="utf-8") as f: +# classes = json.load(f) + +# moveClassifierAiCodes(elastic,"mj_qa_section", classes) +# print('finished!') + +#-----داده های جدید نسخه آخر اجرای مدل +with open("./data/all_sections_classes_new_140406.json", "r", encoding="utf-8") as f: classes = json.load(f) moveClassifierAiCodes(elastic,"mj_qa_section", classes) diff --git a/for_ai/concatenace_json.py b/app/for_ai/concatenace_json.py similarity index 94% rename from for_ai/concatenace_json.py rename to app/for_ai/concatenace_json.py index c5d26bf..7f89709 100644 --- a/for_ai/concatenace_json.py +++ b/app/for_ai/concatenace_json.py @@ -1,7 +1,7 @@ import json import datetime -from common.general_functions import read_file_by_address, read_from_json +from app.common.general_functions import read_file_by_address, read_from_json if __name__ == "__main__": start_time = datetime.datetime.now() diff --git a/for_ai/create_context_ai.py b/app/for_ai/create_context_ai.py similarity index 95% rename from for_ai/create_context_ai.py rename to app/for_ai/create_context_ai.py index aaa4caa..7469369 100644 --- a/for_ai/create_context_ai.py +++ b/app/for_ai/create_context_ai.py @@ -1,6 +1,6 @@ -from common.text_normalizer import TextNormalizer -from common.general_functions import * -from common.elastic_helper import ElasticHelper +from app.common.text_normalizer import TextNormalizer +from app.common.general_functions import * +from app.common.elastic_helper import ElasticHelper dict_qanon = {} diff --git a/for_ai/create_relation_tags.py b/app/for_ai/create_relation_tags.py similarity index 97% rename from for_ai/create_relation_tags.py rename to app/for_ai/create_relation_tags.py index 3071b97..743e1f4 100644 --- a/for_ai/create_relation_tags.py +++ b/app/for_ai/create_relation_tags.py @@ -1,8 +1,8 @@ from time import time import requests -from common.general_functions import * -from common.config_base import * -from common.text_normalizer import TextNormalizer +from app.common.general_functions import * +from app.common.config_base import * +from app.common.text_normalizer import TextNormalizer diff --git a/for_ai/extract_tokens_parse_spell.py b/app/for_ai/extract_tokens_parse_spell.py similarity index 97% rename from for_ai/extract_tokens_parse_spell.py rename to app/for_ai/extract_tokens_parse_spell.py index bbbe988..ebdaa34 100644 --- a/for_ai/extract_tokens_parse_spell.py +++ b/app/for_ai/extract_tokens_parse_spell.py @@ -1,9 +1,9 @@ import os from dotenv import load_dotenv -from common.text_normalizer import TextNormalizer +from app.common.text_normalizer import TextNormalizer # from general import * -from common.general_functions import * -from common.elastic_helper import ElasticHelper +from app.common.general_functions import * +from app.common.elastic_helper import ElasticHelper body = { diff --git a/for_ai/ner_tagging_lists.py b/app/for_ai/ner_tagging_lists.py similarity index 99% rename from for_ai/ner_tagging_lists.py rename to app/for_ai/ner_tagging_lists.py index 03008fc..84f1f3e 100644 --- a/for_ai/ner_tagging_lists.py +++ b/app/for_ai/ner_tagging_lists.py @@ -1,6 +1,6 @@ import re import json -from common.text_normalizer import TextNormalizer +from app.common.text_normalizer import TextNormalizer text_normal = TextNormalizer() def tag_separation(text, default_tag): diff --git a/import_elastic_async.py b/app/import_elastic_async.py similarity index 90% rename from import_elastic_async.py rename to app/import_elastic_async.py index cb0633b..35617b3 100644 --- a/import_elastic_async.py +++ b/app/import_elastic_async.py @@ -3,11 +3,11 @@ import sys from dotenv import load_dotenv import asyncio from time import sleep -from common.elastic_helper_async import elastic_helper_async -from common.sql_helper import sql_helper +from app.common.elastic_helper_async import elastic_helper_async +from app.common.sql_helper import sql_helper # from docker import docker_import -# from common.version_util import VersionUtil +# from app.common.version_util import VersionUtil load_dotenv(dotenv_path='config.env') @@ -15,8 +15,11 @@ 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_112') +# password=os.getenv('HOST_112_PASS') + +# host=os.getenv('HOST_113') +# password=os.getenv('HOST_113_PASS') # host=os.getenv('HOST_60') # password=os.getenv('HOST_60_PASS') @@ -38,7 +41,7 @@ default_location_data= current_directory + "\\data" path_base_map = "G:/Project2/gateway2_main/repo/_other/" elasticImport = elastic_helper_async(host, password, "elastic", path_base_map) -name_zip_file = "data_back_0322.zip" +name_zip_file = "data_back040615.zip" # versionUtil = VersionUtil(data_t_location) diff --git a/import_from_sql/__init__.py b/app/import_from_sql/__init__.py similarity index 100% rename from import_from_sql/__init__.py rename to app/import_from_sql/__init__.py diff --git a/import_from_sql/ai_create_index.py b/app/import_from_sql/ai_create_index.py similarity index 99% rename from import_from_sql/ai_create_index.py rename to app/import_from_sql/ai_create_index.py index ecd4b82..83c51c9 100644 --- a/import_from_sql/ai_create_index.py +++ b/app/import_from_sql/ai_create_index.py @@ -1,8 +1,8 @@ from time import time import requests -from common.general_functions import * -from common.config_base import * -from common.text_normalizer import TextNormalizer +from app.common.general_functions import * +from app.common.config_base import * +from app.common.text_normalizer import TextNormalizer #def saveEmbedingContent() diff --git a/import_from_sql/all_elastic_steps.py b/app/import_from_sql/all_elastic_steps.py similarity index 95% rename from import_from_sql/all_elastic_steps.py rename to app/import_from_sql/all_elastic_steps.py index 92c5363..0f0718b 100644 --- a/import_from_sql/all_elastic_steps.py +++ b/app/import_from_sql/all_elastic_steps.py @@ -4,10 +4,10 @@ import os from dotenv import load_dotenv from decimal import Decimal -from common.config_base import * -from common.general_functions import * -from common.elastic_helper import ElasticHelper -from common.create_ai_index import * +from app.common.config_base import * +from app.common.general_functions import * +from app.common.elastic_helper import ElasticHelper +from app.common.create_ai_index import * load_dotenv(dotenv_path='config.env') diff --git a/import_from_sql/all_sql_steps.py b/app/import_from_sql/all_sql_steps.py similarity index 96% rename from import_from_sql/all_sql_steps.py rename to app/import_from_sql/all_sql_steps.py index dfbbcfd..082edbe 100644 --- a/import_from_sql/all_sql_steps.py +++ b/app/import_from_sql/all_sql_steps.py @@ -2,8 +2,8 @@ import requests import json from decimal import Decimal -from common.config_base import * -from common.general_functions import * +from app.common.config_base import * +from app.common.general_functions import * from s1_LWTopic import * from s2_LawSection_ToElastic import * from s3_opinion_ToElastic import * diff --git a/import_from_sql/list_LWTopic.json b/app/import_from_sql/list_LWTopic.json similarity index 100% rename from import_from_sql/list_LWTopic.json rename to app/import_from_sql/list_LWTopic.json diff --git a/import_from_sql/s10_LawReg_lwphase_Info.py b/app/import_from_sql/s10_LawReg_lwphase_Info.py similarity index 98% rename from import_from_sql/s10_LawReg_lwphase_Info.py rename to app/import_from_sql/s10_LawReg_lwphase_Info.py index 9a92ad1..010a43b 100644 --- a/import_from_sql/s10_LawReg_lwphase_Info.py +++ b/app/import_from_sql/s10_LawReg_lwphase_Info.py @@ -6,9 +6,9 @@ from html import escape import json from decimal import Decimal import datetime -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer def import_lawreg_lwphase_info(cursor): query='SELECT ID,CAPTION FROM [Qavanin].[dbo].[cmOrganization]' diff --git a/import_from_sql/s11_Tanghih_plan_move.py b/app/import_from_sql/s11_Tanghih_plan_move.py similarity index 98% rename from import_from_sql/s11_Tanghih_plan_move.py rename to app/import_from_sql/s11_Tanghih_plan_move.py index 1746f6c..13771ac 100644 --- a/import_from_sql/s11_Tanghih_plan_move.py +++ b/app/import_from_sql/s11_Tanghih_plan_move.py @@ -6,9 +6,9 @@ import json from decimal import Decimal import datetime -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer # این برنامه یک بار فقط جهت انتقال کدهای دیتابیس آقای شاهنوش به دیتابیس نهایی قوانین انجام شد # تکرار لازم نیست diff --git a/import_from_sql/s12_LawSection_repair_ref_state.py b/app/import_from_sql/s12_LawSection_repair_ref_state.py similarity index 97% rename from import_from_sql/s12_LawSection_repair_ref_state.py rename to app/import_from_sql/s12_LawSection_repair_ref_state.py index 809f2de..4157217 100644 --- a/import_from_sql/s12_LawSection_repair_ref_state.py +++ b/app/import_from_sql/s12_LawSection_repair_ref_state.py @@ -5,11 +5,11 @@ import json import datetime from dotenv import load_dotenv -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer -from common.elastic_helper import ElasticHelper -from common.qanon_functions import * +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer +from app.common.elastic_helper import ElasticHelper +from app.common.qanon_functions import * # ضرورتا # این برنامه ضرورت دارد اجرا شود diff --git a/import_from_sql/s1_LWTopic.py b/app/import_from_sql/s1_LWTopic.py similarity index 96% rename from import_from_sql/s1_LWTopic.py rename to app/import_from_sql/s1_LWTopic.py index 1b3273a..24dd5bf 100644 --- a/import_from_sql/s1_LWTopic.py +++ b/app/import_from_sql/s1_LWTopic.py @@ -1,8 +1,8 @@ import requests import json -from common.text_normalizer import TextNormalizer -from common.config_base import * -from common.general_functions import * +from app.common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * # cursor, cnxn = create_cursor() diff --git a/import_from_sql/s2_LawSection_ToElastic.py b/app/import_from_sql/s2_LawSection_ToElastic.py similarity index 98% rename from import_from_sql/s2_LawSection_ToElastic.py rename to app/import_from_sql/s2_LawSection_ToElastic.py index e62e566..4b95b79 100644 --- a/import_from_sql/s2_LawSection_ToElastic.py +++ b/app/import_from_sql/s2_LawSection_ToElastic.py @@ -8,9 +8,9 @@ import json from decimal import Decimal import datetime import time -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer # cursor, cnxn = create_cursor() diff --git a/import_from_sql/s3_opinion_ToElastic.py b/app/import_from_sql/s3_opinion_ToElastic.py similarity index 98% rename from import_from_sql/s3_opinion_ToElastic.py rename to app/import_from_sql/s3_opinion_ToElastic.py index 78df5cb..11540fc 100644 --- a/import_from_sql/s3_opinion_ToElastic.py +++ b/app/import_from_sql/s3_opinion_ToElastic.py @@ -9,9 +9,9 @@ from decimal import Decimal import re import datetime -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer def import_opinion_to_elastic(cursor) : query = """ diff --git a/import_from_sql/s4_RegulationSection_ToElastic.py b/app/import_from_sql/s4_RegulationSection_ToElastic.py similarity index 98% rename from import_from_sql/s4_RegulationSection_ToElastic.py rename to app/import_from_sql/s4_RegulationSection_ToElastic.py index e5b3607..aa7dc66 100644 --- a/import_from_sql/s4_RegulationSection_ToElastic.py +++ b/app/import_from_sql/s4_RegulationSection_ToElastic.py @@ -12,9 +12,9 @@ import sys import traceback import re -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer def import_regulation_section_to_elastic(cursor): query = ''' diff --git a/import_from_sql/s5_LawSection_update_ref_state.py b/app/import_from_sql/s5_LawSection_update_ref_state.py similarity index 98% rename from import_from_sql/s5_LawSection_update_ref_state.py rename to app/import_from_sql/s5_LawSection_update_ref_state.py index 639a83c..d5b6646 100644 --- a/import_from_sql/s5_LawSection_update_ref_state.py +++ b/app/import_from_sql/s5_LawSection_update_ref_state.py @@ -11,9 +11,9 @@ import sys import traceback import re -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer # ضرورتا # این برنامه ضرورت دارد اجرا شود diff --git a/import_from_sql/s6_RegulationSection_update_ref_state.py b/app/import_from_sql/s6_RegulationSection_update_ref_state.py similarity index 98% rename from import_from_sql/s6_RegulationSection_update_ref_state.py rename to app/import_from_sql/s6_RegulationSection_update_ref_state.py index 84163a1..b21a159 100644 --- a/import_from_sql/s6_RegulationSection_update_ref_state.py +++ b/app/import_from_sql/s6_RegulationSection_update_ref_state.py @@ -11,9 +11,9 @@ import sys import traceback import re -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer # ضرورتا diff --git a/import_from_sql/s7_LawReg_qanon_ToElastic.py b/app/import_from_sql/s7_LawReg_qanon_ToElastic.py similarity index 97% rename from import_from_sql/s7_LawReg_qanon_ToElastic.py rename to app/import_from_sql/s7_LawReg_qanon_ToElastic.py index 5b0ca97..d1ecb22 100644 --- a/import_from_sql/s7_LawReg_qanon_ToElastic.py +++ b/app/import_from_sql/s7_LawReg_qanon_ToElastic.py @@ -8,9 +8,9 @@ import json from decimal import Decimal import datetime -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer def import_law_reg_qanon_to_elastic(cursor): diff --git a/import_from_sql/s8_Relations_qanon_LWReg.py b/app/import_from_sql/s8_Relations_qanon_LWReg.py similarity index 97% rename from import_from_sql/s8_Relations_qanon_LWReg.py rename to app/import_from_sql/s8_Relations_qanon_LWReg.py index 4097784..f5e6b9c 100644 --- a/import_from_sql/s8_Relations_qanon_LWReg.py +++ b/app/import_from_sql/s8_Relations_qanon_LWReg.py @@ -6,9 +6,9 @@ from html import escape import json from decimal import Decimal import datetime -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer def import_relations_qanon_lwreg(cursor): diff --git a/import_from_sql/s9_Relations_qanon_opinion.py b/app/import_from_sql/s9_Relations_qanon_opinion.py similarity index 97% rename from import_from_sql/s9_Relations_qanon_opinion.py rename to app/import_from_sql/s9_Relations_qanon_opinion.py index 9ccd9e9..4a0b99e 100644 --- a/import_from_sql/s9_Relations_qanon_opinion.py +++ b/app/import_from_sql/s9_Relations_qanon_opinion.py @@ -6,9 +6,9 @@ from html import escape import json from decimal import Decimal import datetime -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer def import_relations_qanon_opinion(cursor): # اجرای کوئری SQL و خواندن داده‌ها به یک DataFrame diff --git a/parvande_qanon/null.txt b/app/parvande_qanon/null.txt similarity index 100% rename from parvande_qanon/null.txt rename to app/parvande_qanon/null.txt diff --git a/repair_data/__init__.py b/app/repair_data/__init__.py similarity index 100% rename from repair_data/__init__.py rename to app/repair_data/__init__.py diff --git a/repair_data/import_ostan_to_list.py b/app/repair_data/import_ostan_to_list.py similarity index 96% rename from repair_data/import_ostan_to_list.py rename to app/repair_data/import_ostan_to_list.py index 2fa0fe0..29a893d 100644 --- a/repair_data/import_ostan_to_list.py +++ b/app/repair_data/import_ostan_to_list.py @@ -2,8 +2,8 @@ import requests import json import os -from common.config_base import * -from common.general_functions import * +from app.common.config_base import * +from app.common.general_functions import * cursor, cnxn = create_cursor() diff --git a/repair_data/import_sysnoym.py b/app/repair_data/import_sysnoym.py similarity index 91% rename from repair_data/import_sysnoym.py rename to app/repair_data/import_sysnoym.py index aac7db0..af73e28 100644 --- a/repair_data/import_sysnoym.py +++ b/app/repair_data/import_sysnoym.py @@ -2,10 +2,10 @@ import os import re import random from dotenv import load_dotenv -from common.text_normalizer import TextNormalizer +from app.common.text_normalizer import TextNormalizer # from general import * -from common.general_functions import * -from common.elastic_helper import ElasticHelper +from app.common.general_functions import * +from app.common.elastic_helper import ElasticHelper from create_relation_tags import * from temp_refactor_gn_dataset import * diff --git a/repair_data/mmm1.json b/app/repair_data/mmm1.json similarity index 100% rename from repair_data/mmm1.json rename to app/repair_data/mmm1.json diff --git a/repair_data/qanon_title_ids.txt b/app/repair_data/qanon_title_ids.txt similarity index 100% rename from repair_data/qanon_title_ids.txt rename to app/repair_data/qanon_title_ids.txt diff --git a/repair_data/qanon_title_ids_old1.txt b/app/repair_data/qanon_title_ids_old1.txt similarity index 100% rename from repair_data/qanon_title_ids_old1.txt rename to app/repair_data/qanon_title_ids_old1.txt diff --git a/repair_data/r1_LawSection_repair1.py b/app/repair_data/r1_LawSection_repair1.py similarity index 99% rename from repair_data/r1_LawSection_repair1.py rename to app/repair_data/r1_LawSection_repair1.py index a29abdc..c749450 100644 --- a/repair_data/r1_LawSection_repair1.py +++ b/app/repair_data/r1_LawSection_repair1.py @@ -10,10 +10,10 @@ import json from decimal import Decimal import datetime import time -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer -from common.elastic_helper import ElasticHelper +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer +from app.common.elastic_helper import ElasticHelper ##-------------------------------- # بخاطر خطایی که در تبدیل داده به الاستیک برای مواردی که حرف کشیده به جای خط تیر استفاده شده بود، ایجاد شد diff --git a/repair_data/r2_model_repair.py b/app/repair_data/r2_model_repair.py similarity index 94% rename from repair_data/r2_model_repair.py rename to app/repair_data/r2_model_repair.py index 4a1818b..6549a43 100644 --- a/repair_data/r2_model_repair.py +++ b/app/repair_data/r2_model_repair.py @@ -10,10 +10,10 @@ import json from decimal import Decimal import datetime import time -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer -from common.elastic_helper import ElasticHelper +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer +from app.common.elastic_helper import ElasticHelper def moveModelToQaSectionMirror(elastic, index_name_i, index_name_o): diff --git a/repair_data/r3_import_excel_tcodes.py b/app/repair_data/r3_import_excel_tcodes.py similarity index 99% rename from repair_data/r3_import_excel_tcodes.py rename to app/repair_data/r3_import_excel_tcodes.py index 99963d1..dc80e23 100644 --- a/repair_data/r3_import_excel_tcodes.py +++ b/app/repair_data/r3_import_excel_tcodes.py @@ -4,10 +4,10 @@ import traceback import json import pandas as pd from dotenv import load_dotenv -# from common.general_functions import * -from common.qanon_functions import * -from common.elastic_helper import ElasticHelper -from common.config_base import * +# from app.common.general_functions import * +from app.common.qanon_functions import * +from app.common.elastic_helper import ElasticHelper +from app.common.config_base import * def importCodesToElastic(elastic, file_excel, index_name_o, tcode_label, tcode_id , file_log, result_path = ""): # excel_helper = ExcelHelper() diff --git a/repair_data/r4_import_50_codes.py b/app/repair_data/r4_import_50_codes.py similarity index 97% rename from repair_data/r4_import_50_codes.py rename to app/repair_data/r4_import_50_codes.py index 5fb27c6..ce9ae7c 100644 --- a/repair_data/r4_import_50_codes.py +++ b/app/repair_data/r4_import_50_codes.py @@ -1,9 +1,9 @@ import pandas as pd import requests import json -from common.text_normalizer import TextNormalizer -# from common.config_base import * -from common.general_functions import * +from app.common.text_normalizer import TextNormalizer +# from app.common.config_base import * +from app.common.general_functions import * ADD_ITEM_ROUTE = "subject/add" # TOKEN='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE3NDgyNTY3MTYsImp0aSI6IlZWejlWRDFGMUx5UkEyd01EaW5od3M3cTJRRkVqYW9kIiwiaXNzIjpudWxsLCJleHAiOjE3NDk1NTY3MTUsImF1ZCI6bnVsbCwiZGF0YSI6eyJpZCI6MSwiZmlyc3RfbmFtZSI6Ilx1MDY0NVx1MDYyZlx1MDZjY1x1MDYzMSBcdTA2NDFcdTA2NDZcdTA2Y2MiLCJsYXN0X25hbWUiOiJcdTA2MzNcdTA2MjdcdTA2NDVcdTA2MjdcdTA2NDZcdTA2NDciLCJlbWFpbCI6ImRldkBnbWFpbC5jb20iLCJ1c2VybmFtZSI6ImRldiIsInVzZXJfbGV2ZWwiOjJ9fQ.QljFs4f0HFT7S8qrib6q54kMWg7z381v2uqoiSFDfR4' diff --git a/repair_data/r5_import_plan_excel.py b/app/repair_data/r5_import_plan_excel.py similarity index 98% rename from repair_data/r5_import_plan_excel.py rename to app/repair_data/r5_import_plan_excel.py index 7470c75..5792aa5 100644 --- a/repair_data/r5_import_plan_excel.py +++ b/app/repair_data/r5_import_plan_excel.py @@ -2,9 +2,9 @@ import pandas as pd import requests import json import os -from common.text_normalizer import TextNormalizer -# from common.config_base import * -from common.general_functions import * +from app.common.text_normalizer import TextNormalizer +# from app.common.config_base import * +from app.common.general_functions import * ADD_ITEM_ROUTE = "subject/add" diff --git a/repair_data/r6_before_excel.py b/app/repair_data/r6_before_excel.py similarity index 99% rename from repair_data/r6_before_excel.py rename to app/repair_data/r6_before_excel.py index 843d0b3..8ebe659 100644 --- a/repair_data/r6_before_excel.py +++ b/app/repair_data/r6_before_excel.py @@ -4,9 +4,9 @@ import traceback import pandas as pd import json from dotenv import load_dotenv -from common.config_base import * -from common.elastic_helper import ElasticHelper -from common.qanon_functions import * +from app.common.config_base import * +from app.common.elastic_helper import ElasticHelper +from app.common.qanon_functions import * def parseBeforeInfos_SearchQanonTitle(elastic, file_excel, file_log, result_path = ""): diff --git a/repair_data/r7_doc_state_update.py b/app/repair_data/r7_doc_state_update.py similarity index 96% rename from repair_data/r7_doc_state_update.py rename to app/repair_data/r7_doc_state_update.py index c29c8c8..6e02156 100644 --- a/repair_data/r7_doc_state_update.py +++ b/app/repair_data/r7_doc_state_update.py @@ -10,10 +10,10 @@ import json from decimal import Decimal import datetime import time -from common.config_base import * -from common.general_functions import * -from common.text_normalizer import TextNormalizer -from common.elastic_helper import ElasticHelper +from app.common.config_base import * +from app.common.general_functions import * +from app.common.text_normalizer import TextNormalizer +from app.common.elastic_helper import ElasticHelper ##-------------------------------- # لازم است این فیلد پرشود تا مجلس بتواند دسترسی تغییر داشته باشد diff --git a/repair_data/repair_log_search_action.py b/app/repair_data/repair_log_search_action.py similarity index 98% rename from repair_data/repair_log_search_action.py rename to app/repair_data/repair_log_search_action.py index 3f60651..32a7b7e 100644 --- a/repair_data/repair_log_search_action.py +++ b/app/repair_data/repair_log_search_action.py @@ -1,9 +1,9 @@ import os from dotenv import load_dotenv -from common.text_normalizer import TextNormalizer +from app.common.text_normalizer import TextNormalizer # from general import * -from common.general_functions import * -from common.elastic_helper import ElasticHelper +from app.common.general_functions import * +from app.common.elastic_helper import ElasticHelper diff --git a/resource/normalizer/Dic1_new.txt b/app/resource/normalizer/Dic1_new.txt similarity index 100% rename from resource/normalizer/Dic1_new.txt rename to app/resource/normalizer/Dic1_new.txt diff --git a/resource/normalizer/Dic2_new.txt b/app/resource/normalizer/Dic2_new.txt similarity index 100% rename from resource/normalizer/Dic2_new.txt rename to app/resource/normalizer/Dic2_new.txt diff --git a/resource/normalizer/Dic3_new.txt b/app/resource/normalizer/Dic3_new.txt similarity index 100% rename from resource/normalizer/Dic3_new.txt rename to app/resource/normalizer/Dic3_new.txt diff --git a/resource/stemmer/mokasar.txt b/app/resource/stemmer/mokasar.txt similarity index 100% rename from resource/stemmer/mokasar.txt rename to app/resource/stemmer/mokasar.txt diff --git a/resource/stemmer/pasvand.txt b/app/resource/stemmer/pasvand.txt similarity index 100% rename from resource/stemmer/pasvand.txt rename to app/resource/stemmer/pasvand.txt diff --git a/resource/stemmer/pishvand.txt b/app/resource/stemmer/pishvand.txt similarity index 100% rename from resource/stemmer/pishvand.txt rename to app/resource/stemmer/pishvand.txt diff --git a/resource/stemmer/verb_tense.txt b/app/resource/stemmer/verb_tense.txt similarity index 100% rename from resource/stemmer/verb_tense.txt rename to app/resource/stemmer/verb_tense.txt diff --git a/resource/tokenizer/TokenMerger.pckl b/app/resource/tokenizer/TokenMerger.pckl similarity index 100% rename from resource/tokenizer/TokenMerger.pckl rename to app/resource/tokenizer/TokenMerger.pckl diff --git a/resource/tokenizer/enDict b/app/resource/tokenizer/enDict similarity index 100% rename from resource/tokenizer/enDict rename to app/resource/tokenizer/enDict diff --git a/resource/tokenizer/faDict b/app/resource/tokenizer/faDict similarity index 100% rename from resource/tokenizer/faDict rename to app/resource/tokenizer/faDict diff --git a/temp_codes.py b/app/temp_codes.py similarity index 96% rename from temp_codes.py rename to app/temp_codes.py index bb45ad5..dce2dc5 100644 --- a/temp_codes.py +++ b/app/temp_codes.py @@ -1,9 +1,9 @@ import os from dotenv import load_dotenv -from common.text_normalizer import TextNormalizer +from app.common.text_normalizer import TextNormalizer # from general import * -from common.general_functions import * -from common.elastic_helper import ElasticHelper +from app.common.general_functions import * +from app.common.elastic_helper import ElasticHelper from for_ai.create_relation_tags import * from temp_refactor_gn_dataset import * @@ -13,8 +13,11 @@ 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_112') +# password=os.getenv('HOST_112_PASS') + +host=os.getenv('HOST_113') +password=os.getenv('HOST_113_PASS') # host=os.getenv('HOST_118') # password=os.getenv('HOST_118_PASS') @@ -62,7 +65,8 @@ elastic = ElasticHelper(host, password, "elastic", path_base_map) # elastic.restorFileToElastic2('G:/Project2/111/mn_sanad.zip', 'mn_sanad', 'monir', False, 'mn_sanad') -#elastic.backupIndexToZipfile("G:/Project2/111", "mj_qa_section") +elastic.backupIndexToZipfile("G:/Project2/111", "mj_qa_section") +# elastic.restorFileToElastic2('G:/Project2/111/mj_qa_section.zip', 'mj_qa_section', 'majles', False, 'mj_qa_section') # elastic.restorFileToElastic2('G:/Project2/111/gn_setting.zip', 'gn_setting', 'general', False, 'gn_setting') #------------------------------------------------------- ## diff --git a/temp_refactor_gn_dataset.py b/app/temp_refactor_gn_dataset.py similarity index 95% rename from temp_refactor_gn_dataset.py rename to app/temp_refactor_gn_dataset.py index 9d49718..6e7d43b 100644 --- a/temp_refactor_gn_dataset.py +++ b/app/temp_refactor_gn_dataset.py @@ -1,8 +1,8 @@ import os -from common.text_normalizer import TextNormalizer +from app.common.text_normalizer import TextNormalizer # from general import * -from common.general_functions import * -from common.elastic_helper import ElasticHelper +from app.common.general_functions import * +from app.common.elastic_helper import ElasticHelper diff --git a/test_import_excel_tcodes.py b/app/test_import_excel_tcodes.py similarity index 99% rename from test_import_excel_tcodes.py rename to app/test_import_excel_tcodes.py index 966da79..921a3ca 100644 --- a/test_import_excel_tcodes.py +++ b/app/test_import_excel_tcodes.py @@ -3,7 +3,7 @@ import re import pandas as pd from arabic_reshaper import reshape from bidi.algorithm import get_display -from common.text_normalizer import TextNormalizer +from app.common.text_normalizer import TextNormalizer text_normalizer = TextNormalizer() diff --git a/test_jokar.py b/app/test_jokar.py similarity index 99% rename from test_jokar.py rename to app/test_jokar.py index 4469500..516c447 100644 --- a/test_jokar.py +++ b/app/test_jokar.py @@ -11,10 +11,10 @@ import sys import traceback from thefuzz import fuzz import re -from common.jalali import Persian -from common.config_base import * -from common.config_base import * -from common.general_functions import * +from app.common.jalali import Persian +from app.common.config_base import * +from app.common.config_base import * +from app.common.general_functions import * def read_section_table(): diff --git a/test_key.py b/app/test_key.py similarity index 92% rename from test_key.py rename to app/test_key.py index 9cdd30e..2707ca7 100644 --- a/test_key.py +++ b/app/test_key.py @@ -1,5 +1,5 @@ -from common.config_base import * -from common.general_functions import * +from app.common.config_base import * +from app.common.general_functions import * import requests diff --git a/test_script.py b/app/test_script.py similarity index 100% rename from test_script.py rename to app/test_script.py diff --git a/temps/11_temp_LawSection_update_qanon_etebar.py b/temps/11_temp_LawSection_update_qanon_etebar.py index 497a9c3..ce691ea 100644 --- a/temps/11_temp_LawSection_update_qanon_etebar.py +++ b/temps/11_temp_LawSection_update_qanon_etebar.py @@ -1,6 +1,6 @@ import json import requests -from common.config_base import * +from app.common.config_base import * import requests from bs4 import BeautifulSoup from html import escape @@ -9,8 +9,8 @@ from decimal import Decimal import datetime -from common.config_base import * -from common.general_functions import * +from app.common.config_base import * +from app.common.general_functions import * # موقت # این برنامه موقتا بخاطر اصلاح داده اجرا شد، اگر از ابتدا انتقال داده انجام شود این بخش خودکار انجام خواهد شد diff --git a/temps/11_temp_RegulationSection_update_qanon_etebar.py b/temps/11_temp_RegulationSection_update_qanon_etebar.py index 60db5d4..8281e76 100644 --- a/temps/11_temp_RegulationSection_update_qanon_etebar.py +++ b/temps/11_temp_RegulationSection_update_qanon_etebar.py @@ -1,6 +1,6 @@ import json import requests -from common.config_base import * +from app.common.config_base import * import requests from bs4 import BeautifulSoup from html import escape @@ -9,8 +9,8 @@ from decimal import Decimal import datetime -from common.config_base import * -from common.general_functions import * +from app.common.config_base import * +from app.common.general_functions import * # موقت # این برنامه موقتا بخاطر اصلاح داده اجرا شد، اگر از ابتدا انتقال داده انجام شود این بخش خودکار انجام خواهد شد diff --git a/temps/1_temp/9_sections_relation.py b/temps/1_temp/9_sections_relation.py index a61bdbb..3a244c9 100644 --- a/temps/1_temp/9_sections_relation.py +++ b/temps/1_temp/9_sections_relation.py @@ -6,7 +6,7 @@ import sys import json from decimal import Decimal -from common.general_functions import * +from app.common.general_functions import * cursor = create_cursor() #Does quasi the same things as json.loads from here: https://pypi.org/project/dynamodb-json/ diff --git a/temps/1_temp_LWTopic_update.py b/temps/1_temp_LWTopic_update.py index 24082e1..7597a71 100644 --- a/temps/1_temp_LWTopic_update.py +++ b/temps/1_temp_LWTopic_update.py @@ -1,8 +1,8 @@ import requests import json -from common.config_base import * -from common.general_functions import * +from app.common.config_base import * +from app.common.general_functions import * # موقت diff --git a/temps/24_temp_Law_title_type.py b/temps/24_temp_Law_title_type.py index c45dd5c..c192586 100644 --- a/temps/24_temp_Law_title_type.py +++ b/temps/24_temp_Law_title_type.py @@ -1,6 +1,6 @@ import json import requests -from common.config_base import * +from app.common.config_base import * import requests from bs4 import BeautifulSoup from html import escape @@ -9,8 +9,8 @@ from decimal import Decimal import datetime -from common.config_base import * -from common.general_functions import * +from app.common.config_base import * +from app.common.general_functions import * # موقت # این برنامه موقتا بخاطر اصلاح داده اجرا شد، اگر از ابتدا انتقال داده انجام شود این بخش خودکار انجام خواهد شد diff --git a/temps/2_temp_update_LawSection_html.py b/temps/2_temp_update_LawSection_html.py index 1d5daad..1bb6102 100644 --- a/temps/2_temp_update_LawSection_html.py +++ b/temps/2_temp_update_LawSection_html.py @@ -1,6 +1,6 @@ import json import requests -from common.config_base import * +from app.common.config_base import * import requests from bs4 import BeautifulSoup from html import escape @@ -9,8 +9,8 @@ from decimal import Decimal import datetime -from common.config_base import * -from common.general_functions import * +from app.common.config_base import * +from app.common.general_functions import * # موقت # این برنامه موقتا بخاطر اصلاح داده اجرا شد، اگر از ابتدا انتقال داده انجام شود این بخش خودکار انجام خواهد شد diff --git a/temps/9_sections_relation.py b/temps/9_sections_relation.py index a61bdbb..3a244c9 100644 --- a/temps/9_sections_relation.py +++ b/temps/9_sections_relation.py @@ -6,7 +6,7 @@ import sys import json from decimal import Decimal -from common.general_functions import * +from app.common.general_functions import * cursor = create_cursor() #Does quasi the same things as json.loads from here: https://pypi.org/project/dynamodb-json/ diff --git a/temps/_back/1_LWTopic1_error.py b/temps/_back/1_LWTopic1_error.py index 602cc11..4e5148d 100644 --- a/temps/_back/1_LWTopic1_error.py +++ b/temps/_back/1_LWTopic1_error.py @@ -1,6 +1,6 @@ import requests import json -from common.general_functions import * +from app.common.general_functions import * cursor = create_cursor() # ----------------------------------------------------------------- diff --git a/temps/_back/5_opopinion_error.py b/temps/_back/5_opopinion_error.py index 9156ca1..8af11aa 100644 --- a/temps/_back/5_opopinion_error.py +++ b/temps/_back/5_opopinion_error.py @@ -2,7 +2,7 @@ import requests import pyodbc import json from decimal import Decimal -from common.general_functions import * +from app.common.general_functions import * cursor = create_cursor() url = "https://api.tavasi.ir/keyvalue/list/add" diff --git a/temps/_back/_two_line.py b/temps/_back/_two_line.py index 43f70ed..9e6ccf7 100644 --- a/temps/_back/_two_line.py +++ b/temps/_back/_two_line.py @@ -3,7 +3,7 @@ import requests from html import escape import json from decimal import Decimal -from common.general_functions import * +from app.common.general_functions import * cursor = create_cursor() diff --git a/temps/import_prev_qanon_info.py b/temps/import_prev_qanon_info.py index 0e98d97..8cb9275 100644 --- a/temps/import_prev_qanon_info.py +++ b/temps/import_prev_qanon_info.py @@ -1,9 +1,9 @@ import os from dotenv import load_dotenv -from common.text_normalizer import TextNormalizer +from app.common.text_normalizer import TextNormalizer # from general import * -from common.general_functions import * -from common.elastic_helper import ElasticHelper +from app.common.general_functions import * +from app.common.elastic_helper import ElasticHelper from create_relation_tags import * from temp_refactor_gn_dataset import *