01d81417 by 周伟奇

SE compare Nov

1 parent a89b45ad
...@@ -1710,6 +1710,16 @@ ID_COMPARE_LOGIC = { ...@@ -1710,6 +1710,16 @@ ID_COMPARE_LOGIC = {
1710 IC_TURE_OR_FALSE: (IC_TURE_OR_FALSE, 'se_common_compare', {}, '身份证件疑似造假,需人工判断'), 1710 IC_TURE_OR_FALSE: (IC_TURE_OR_FALSE, 'se_common_compare', {}, '身份证件疑似造假,需人工判断'),
1711 } 1711 }
1712 1712
1713 ID_COMPARE_LOGIC_AUTO = {
1714 'customerName': ('姓名', 'se_name_compare', {}, '身份证姓名与系统不一致'),
1715 'idNum': ('公民身份号码', 'se_common_compare', {}, '身份证号码与系统不一致'),
1716 'dateOfBirth': ('出生年月', 'se_date_compare', {'input_replace': ''}),
1717 'idExpiryDate': ('有效期限', 'se_date_compare', {'long': True, 'ocr_split': True, 'input_replace': '', 'today': True, 'delayed_date': 1}, '身份证有效期疑似过期'),
1718 'hukouProvince': ('住址', 'se_contain_compare', {}, '身份证住址与系统不一致'),
1719 'hukouCity': ('住址', 'se_contain_compare', {}, '身份证住址与系统不一致'),
1720 IC_TURE_OR_FALSE: (IC_TURE_OR_FALSE, 'se_common_compare', {}, '身份证件疑似造假,需人工判断'),
1721 }
1722
1713 PP_COMPARE_LOGIC = { 1723 PP_COMPARE_LOGIC = {
1714 'customerName': ('英文姓名', 'se_name_compare', {'is_passport': True}, '护照姓名与系统不一致'), # 1 1724 'customerName': ('英文姓名', 'se_name_compare', {'is_passport': True}, '护照姓名与系统不一致'), # 1
1715 'idNum': ('护照号码', 'se_common_compare', {}, '护照号码与系统不一致'), # 2 1725 'idNum': ('护照号码', 'se_common_compare', {}, '护照号码与系统不一致'), # 2
...@@ -2053,6 +2063,7 @@ SE_COMPARE_FIELD = { ...@@ -2053,6 +2063,7 @@ SE_COMPARE_FIELD = {
2053 2063
2054 SE_COMPARE_FIELD_AUTO = { 2064 SE_COMPARE_FIELD_AUTO = {
2055 BS_EN: (BS_FIELD, BS_COMPARE_LOGIC_AUTO, False), 2065 BS_EN: (BS_FIELD, BS_COMPARE_LOGIC_AUTO, False),
2066 ID_EN: (IC_OCR_FIELD, ID_COMPARE_LOGIC, True),
2056 } 2067 }
2057 2068
2058 2069
......
...@@ -2391,7 +2391,10 @@ def se_compare_license(license_en, ocr_res_dict, field_list): ...@@ -2391,7 +2391,10 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
2391 return result_field_list, no_ocr_result, field_img_path_dict 2391 return result_field_list, no_ocr_result, field_img_path_dict
2392 2392
2393 2393
2394 def se_compare_license_id(license_en, id_res_list, field_list): 2394 def se_compare_license_id(license_en, id_res_list, field_list, is_auto):
2395 if is_auto:
2396 ocr_field, compare_logic, special_expiry_date = consts.SE_COMPARE_FIELD_AUTO[license_en]
2397 else:
2395 ocr_field, compare_logic, special_expiry_date = consts.SE_COMPARE_FIELD[license_en] 2398 ocr_field, compare_logic, special_expiry_date = consts.SE_COMPARE_FIELD[license_en]
2396 2399
2397 is_find = False 2400 is_find = False
...@@ -2870,7 +2873,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto, id_res_list ...@@ -2870,7 +2873,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto, id_res_list
2870 # 身份证先SE正反面,后CA正反面 2873 # 身份证先SE正反面,后CA正反面
2871 if license_en == consts.ID_EN: 2874 if license_en == consts.ID_EN:
2872 result_field_list, no_ocr_result, field_img_path_dict = se_compare_license_id( 2875 result_field_list, no_ocr_result, field_img_path_dict = se_compare_license_id(
2873 license_en, id_res_list, strip_list) 2876 license_en, id_res_list, strip_list, is_auto)
2874 else: 2877 else:
2875 result_field_list, no_ocr_result, field_img_path_dict = se_compare_license( 2878 result_field_list, no_ocr_result, field_img_path_dict = se_compare_license(
2876 license_en, ocr_res_dict, strip_list) 2879 license_en, ocr_res_dict, strip_list)
......
...@@ -317,7 +317,7 @@ class Comparison: ...@@ -317,7 +317,7 @@ class Comparison:
317 return self.build_res(input_str == ocr_str) 317 return self.build_res(input_str == ocr_str)
318 318
319 @staticmethod 319 @staticmethod
320 def is_after_today(ocr_str): 320 def is_after_today(ocr_str, delayed_date):
321 dt_array, _ = tslib.array_to_datetime( 321 dt_array, _ = tslib.array_to_datetime(
322 np.array([ocr_str, ], copy=False, dtype=np.object_), 322 np.array([ocr_str, ], copy=False, dtype=np.object_),
323 errors="coerce", 323 errors="coerce",
...@@ -328,7 +328,7 @@ class Comparison: ...@@ -328,7 +328,7 @@ class Comparison:
328 ) 328 )
329 dti = DatetimeIndex(dt_array, tz=None, name=None) 329 dti = DatetimeIndex(dt_array, tz=None, name=None)
330 ts = dti[0] 330 ts = dti[0]
331 if isinstance(ts, NaTType) or ts.date() < (datetime.today() + relativedelta(days=8)).date(): 331 if isinstance(ts, NaTType) or ts.date() < (datetime.today() + relativedelta(days=delayed_date)).date():
332 return False 332 return False
333 else: 333 else:
334 return True 334 return True
...@@ -388,7 +388,8 @@ class Comparison: ...@@ -388,7 +388,8 @@ class Comparison:
388 if kwargs.get('input_replace') is not None: 388 if kwargs.get('input_replace') is not None:
389 input_str = input_str.replace('-', kwargs.get('input_replace')) 389 input_str = input_str.replace('-', kwargs.get('input_replace'))
390 if kwargs.get('today', False): 390 if kwargs.get('today', False):
391 return self.build_res(self.is_after_today(ocr_str)) 391 delayed_date = kwargs.get('delayed_date', 8)
392 return self.build_res(self.is_after_today(ocr_str, delayed_date))
392 if kwargs.get('two_year', False): 393 if kwargs.get('two_year', False):
393 return self.build_res(self.is_predate_two_year(ocr_str)) 394 return self.build_res(self.is_predate_two_year(ocr_str))
394 else: 395 else:
...@@ -631,20 +632,6 @@ class Comparison: ...@@ -631,20 +632,6 @@ class Comparison:
631 return self.RESULT_N 632 return self.RESULT_N
632 return self.se_date_compare_2(input_str, ocr_date_set.pop(), three_month=True) 633 return self.se_date_compare_2(input_str, ocr_date_set.pop(), three_month=True)
633 634
634 # def se_date_compare_pos(self, input_str, ocr_str, **kwargs):
635 # try:
636 # ocr_date = datetime.strptime(ocr_str, "%Y-%m-%d").date()
637 # today = datetime.now().date()
638 # if ocr_date < today:
639 # return self.RESULT_N1
640 # elif today <= ocr_date <= (today + timedelta(days=8)):
641 # return self.RESULT_N2
642 # elif ocr_date > (today + timedelta(days=8)):
643 # return self.RESULT_Y
644 # except Exception as e:
645 # return self.RESULT_N
646 # return self.RESULT_N
647
648 # 'long': True, 'ocr_split': True, 'input_replace': '', 'today': True 635 # 'long': True, 'ocr_split': True, 'input_replace': '', 'today': True
649 def se_date_compare_pre(self, input_str, ocr_str, **kwargs): 636 def se_date_compare_pre(self, input_str, ocr_str, **kwargs):
650 if '长期' in ocr_str or '永久' in ocr_str or '***' in ocr_str or '至今' in ocr_str or '年—月—日' in ocr_str \ 637 if '长期' in ocr_str or '永久' in ocr_str or '***' in ocr_str or '至今' in ocr_str or '年—月—日' in ocr_str \
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!