01314b0c by 周伟奇

add se oct

1 parent 07c844aa
......@@ -2377,9 +2377,10 @@ def se_compare_license_id(license_en, id_res_list, field_list):
result_field_list = []
section_img_info = dict()
field_img_path_dict = dict()
field_last_idx = len(field_list) - 1
# ocr_res_str = ocr_res_dict.get(ocr_field)
for ocr_res_str in id_res_list:
for ca_or_se_idx, ocr_res_str in enumerate(id_res_list):
if is_find:
break
......@@ -2428,16 +2429,11 @@ def se_compare_license_id(license_en, id_res_list, field_list):
result = getattr(cp, compare_logic[name][1])(value, ocr_str, **compare_logic[name][2])
no_key = False
if idx == 0 and result == consts.RESULT_N and length > 1:
if idx == 0 and result == consts.RESULT_N:
if ca_or_se_idx == 0:
break
elif length > 1:
break
is_find = True
section_img_info[consts.SECTION_IMG_PATH_KEY] = ocr_res_list[res_idx].get(consts.SECTION_IMG_PATH_KEY, '')
section_img_info[consts.ALL_POSITION_KEY] = ocr_res_list[res_idx].get(consts.ALL_POSITION_KEY, {})
if special_expiry_date:
section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[res_idx].get(
consts.SECTION_IMG_PATH_KEY_2, '')
section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[res_idx].get(consts.ALL_POSITION_KEY_2, {})
# 过期期限特殊处理
if special_expiry_date and name == 'idExpiryDate' and result == consts.RESULT_N:
......@@ -2448,14 +2444,17 @@ def se_compare_license_id(license_en, id_res_list, field_list):
img_path = empty_str
else:
for expiry_date, (date_img_path, date_res_idx) in expiry_dates.items():
expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date, **compare_logic[name][2])
expiry_date_res = getattr(cp, compare_logic[name][1])(value, expiry_date,
**compare_logic[name][2])
if expiry_date_res == consts.RESULT_N:
ocr_str = expiry_date
img_path = date_img_path
special_expiry_date_slice = True
section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[date_res_idx].get(
section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[
date_res_idx].get(
consts.SECTION_IMG_PATH_KEY_2, '')
section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[date_res_idx].get(
section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[
date_res_idx].get(
consts.ALL_POSITION_KEY_2, {})
break
else:
......@@ -2466,7 +2465,27 @@ def se_compare_license_id(license_en, id_res_list, field_list):
img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY_2, '')
special_expiry_date_slice = True
else:
img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY, '') if result == consts.RESULT_N else empty_str
img_path = ocr_res_list[res_idx].get(consts.IMG_PATH_KEY,
'') if result == consts.RESULT_N else empty_str
if ca_or_se_idx == 0 and result == consts.RESULT_N:
special_expiry_date_slice = False
section_img_info.pop(consts.SECTION_IMG_PATH_KEY_2, None)
section_img_info.pop(consts.ALL_POSITION_KEY_2, None)
break
if ca_or_se_idx == 1:
is_find = True
elif idx == field_last_idx:
is_find = True
section_img_info[consts.SECTION_IMG_PATH_KEY] = ocr_res_list[res_idx].get(consts.SECTION_IMG_PATH_KEY, '')
section_img_info[consts.ALL_POSITION_KEY] = ocr_res_list[res_idx].get(consts.ALL_POSITION_KEY, {})
if special_expiry_date and consts.SECTION_IMG_PATH_KEY_2 not in section_img_info:
section_img_info[consts.SECTION_IMG_PATH_KEY_2] = ocr_res_list[res_idx].get(
consts.SECTION_IMG_PATH_KEY_2, '')
section_img_info[consts.ALL_POSITION_KEY_2] = ocr_res_list[res_idx].get(consts.ALL_POSITION_KEY_2, {})
if isinstance(value, list):
value = json.dumps(value, ensure_ascii=False)
error_type = empty_error_type if result == consts.RESULT_Y else ErrorType.OCR.value
......@@ -3148,8 +3167,8 @@ def compare(application_id, application_entity, uniq_seq, ocr_res_id, is_ca=True
id_res_list = []
for field_name in consts.CA_ADD_COMPARE_FIELDS:
if field_name == consts.IC_OCR_FIELD:
id_res_list.append(ocr_res_dict.get(field_name))
id_res_list.append(ca_ocr_res_dict.get(field_name) if isinstance(ca_ocr_res_dict, dict) else None)
id_res_list.append(ocr_res_dict.get(field_name))
if isinstance(ca_ocr_res_dict, dict) and isinstance(ca_ocr_res_dict.get(field_name), str):
tmp_ca_result = json.loads(ca_ocr_res_dict.get(field_name))
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!