Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
周伟奇
/
bmw-ocr
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
01d81417
authored
2022-10-31 16:49:15 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
SE compare Nov
1 parent
a89b45ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
20 deletions
src/apps/doc/consts.py
src/celery_compare/tasks.py
src/common/tools/comparison.py
src/apps/doc/consts.py
View file @
01d8141
...
...
@@ -1710,6 +1710,16 @@ ID_COMPARE_LOGIC = {
IC_TURE_OR_FALSE
:
(
IC_TURE_OR_FALSE
,
'se_common_compare'
,
{},
'身份证件疑似造假,需人工判断'
),
}
ID_COMPARE_LOGIC_AUTO
=
{
'customerName'
:
(
'姓名'
,
'se_name_compare'
,
{},
'身份证姓名与系统不一致'
),
'idNum'
:
(
'公民身份号码'
,
'se_common_compare'
,
{},
'身份证号码与系统不一致'
),
'dateOfBirth'
:
(
'出生年月'
,
'se_date_compare'
,
{
'input_replace'
:
''
}),
'idExpiryDate'
:
(
'有效期限'
,
'se_date_compare'
,
{
'long'
:
True
,
'ocr_split'
:
True
,
'input_replace'
:
''
,
'today'
:
True
,
'delayed_date'
:
1
},
'身份证有效期疑似过期'
),
'hukouProvince'
:
(
'住址'
,
'se_contain_compare'
,
{},
'身份证住址与系统不一致'
),
'hukouCity'
:
(
'住址'
,
'se_contain_compare'
,
{},
'身份证住址与系统不一致'
),
IC_TURE_OR_FALSE
:
(
IC_TURE_OR_FALSE
,
'se_common_compare'
,
{},
'身份证件疑似造假,需人工判断'
),
}
PP_COMPARE_LOGIC
=
{
'customerName'
:
(
'英文姓名'
,
'se_name_compare'
,
{
'is_passport'
:
True
},
'护照姓名与系统不一致'
),
# 1
'idNum'
:
(
'护照号码'
,
'se_common_compare'
,
{},
'护照号码与系统不一致'
),
# 2
...
...
@@ -2053,6 +2063,7 @@ SE_COMPARE_FIELD = {
SE_COMPARE_FIELD_AUTO
=
{
BS_EN
:
(
BS_FIELD
,
BS_COMPARE_LOGIC_AUTO
,
False
),
ID_EN
:
(
IC_OCR_FIELD
,
ID_COMPARE_LOGIC
,
True
),
}
...
...
src/celery_compare/tasks.py
View file @
01d8141
...
...
@@ -2391,8 +2391,11 @@ def se_compare_license(license_en, ocr_res_dict, field_list):
return
result_field_list
,
no_ocr_result
,
field_img_path_dict
def
se_compare_license_id
(
license_en
,
id_res_list
,
field_list
):
ocr_field
,
compare_logic
,
special_expiry_date
=
consts
.
SE_COMPARE_FIELD
[
license_en
]
def
se_compare_license_id
(
license_en
,
id_res_list
,
field_list
,
is_auto
):
if
is_auto
:
ocr_field
,
compare_logic
,
special_expiry_date
=
consts
.
SE_COMPARE_FIELD_AUTO
[
license_en
]
else
:
ocr_field
,
compare_logic
,
special_expiry_date
=
consts
.
SE_COMPARE_FIELD
[
license_en
]
is_find
=
False
no_ocr_result
=
True
...
...
@@ -2870,7 +2873,7 @@ def se_compare_process(compare_info, ocr_res_dict, is_gsyh, is_auto, id_res_list
# 身份证先SE正反面,后CA正反面
if
license_en
==
consts
.
ID_EN
:
result_field_list
,
no_ocr_result
,
field_img_path_dict
=
se_compare_license_id
(
license_en
,
id_res_list
,
strip_list
)
license_en
,
id_res_list
,
strip_list
,
is_auto
)
else
:
result_field_list
,
no_ocr_result
,
field_img_path_dict
=
se_compare_license
(
license_en
,
ocr_res_dict
,
strip_list
)
...
...
src/common/tools/comparison.py
View file @
01d8141
...
...
@@ -317,7 +317,7 @@ class Comparison:
return
self
.
build_res
(
input_str
==
ocr_str
)
@staticmethod
def
is_after_today
(
ocr_str
):
def
is_after_today
(
ocr_str
,
delayed_date
):
dt_array
,
_
=
tslib
.
array_to_datetime
(
np
.
array
([
ocr_str
,
],
copy
=
False
,
dtype
=
np
.
object_
),
errors
=
"coerce"
,
...
...
@@ -328,7 +328,7 @@ class Comparison:
)
dti
=
DatetimeIndex
(
dt_array
,
tz
=
None
,
name
=
None
)
ts
=
dti
[
0
]
if
isinstance
(
ts
,
NaTType
)
or
ts
.
date
()
<
(
datetime
.
today
()
+
relativedelta
(
days
=
8
))
.
date
():
if
isinstance
(
ts
,
NaTType
)
or
ts
.
date
()
<
(
datetime
.
today
()
+
relativedelta
(
days
=
delayed_date
))
.
date
():
return
False
else
:
return
True
...
...
@@ -388,7 +388,8 @@ class Comparison:
if
kwargs
.
get
(
'input_replace'
)
is
not
None
:
input_str
=
input_str
.
replace
(
'-'
,
kwargs
.
get
(
'input_replace'
))
if
kwargs
.
get
(
'today'
,
False
):
return
self
.
build_res
(
self
.
is_after_today
(
ocr_str
))
delayed_date
=
kwargs
.
get
(
'delayed_date'
,
8
)
return
self
.
build_res
(
self
.
is_after_today
(
ocr_str
,
delayed_date
))
if
kwargs
.
get
(
'two_year'
,
False
):
return
self
.
build_res
(
self
.
is_predate_two_year
(
ocr_str
))
else
:
...
...
@@ -631,20 +632,6 @@ class Comparison:
return
self
.
RESULT_N
return
self
.
se_date_compare_2
(
input_str
,
ocr_date_set
.
pop
(),
three_month
=
True
)
# def se_date_compare_pos(self, input_str, ocr_str, **kwargs):
# try:
# ocr_date = datetime.strptime(ocr_str, "%Y-%m-%d").date()
# today = datetime.now().date()
# if ocr_date < today:
# return self.RESULT_N1
# elif today <= ocr_date <= (today + timedelta(days=8)):
# return self.RESULT_N2
# elif ocr_date > (today + timedelta(days=8)):
# return self.RESULT_Y
# except Exception as e:
# return self.RESULT_N
# return self.RESULT_N
# 'long': True, 'ocr_split': True, 'input_replace': '', 'today': True
def
se_date_compare_pre
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
'长期'
in
ocr_str
or
'永久'
in
ocr_str
or
'***'
in
ocr_str
or
'至今'
in
ocr_str
or
'年—月—日'
in
ocr_str
\
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment