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
baf48dff
authored
2022-01-05 19:03:29 +0800
by
周伟奇
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix se bug
1 parent
4c33a6e1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
34 deletions
src/apps/doc/consts.py
src/apps/doc/management/commands/ocr_process.py
src/apps/doc/ocr/wb.py
src/celery_compare/tasks.py
src/common/tools/comparison.py
src/apps/doc/consts.py
View file @
baf48df
...
...
@@ -1413,7 +1413,7 @@ SE_GB_USED_FIELD = ['customerName', 'idNum', 'date']
SE_BS_FIELD
=
[
'户名'
,
'打印日期'
,
'流水日期'
,
'(担保人1)户名'
,
'(担保人1)打印日期'
,
'(担保人1)流水日期'
,
'(担保人2)户名'
,
'(担保人2)打印日期'
,
'(担保人2)流水日期'
]
SE_HMH_FIELD
=
[
'借款人/承租人姓名'
,
'借款人/承租人证件号'
,
'申请号'
,
'渠道'
,
'签字'
]
SE_BD_FIELD
=
[
'被保险人姓名'
,
'被保险人证件号码'
,
'车架号'
,
'机动车损失保险金额'
,
'第三者责任保险金额'
,
'绝对免赔率'
,
'保险起始日期'
,
'保险截止日期'
,
'保单章'
,
'第一受益人'
,
'保险费合计'
]
JDMPV_VALUE
=
[
'-'
,
'--'
,
'0
%
'
,
'0.00'
,
'/'
,
'0'
]
JDMPV_VALUE
=
[
'-'
,
'--'
,
'0
%
'
,
'0.00'
,
'/'
,
'0'
,
''
]
SE_BANK_FIELD
=
[
'accountNo'
,
'bankName'
]
SE_DDA_FIELD
=
[
'applicationId(1)'
,
'applicationId(2)'
,
'bankName'
,
'companyName'
,
'customerName'
,
'idNum'
,
'accountHolderName'
,
'accountNo'
]
...
...
@@ -1568,15 +1568,15 @@ ROLE_LIST = [
(
'保证人日期2'
,
'Guarantor'
,
1
,
'有'
,
False
,
False
),
]
# key, app_type, id_idx, field_idx, is_force, e_write
# key, app_type, id_idx, field_idx, is_force, e_write
, 公户跳过
ROLE_LIST_2
=
[
(
'抵押人'
,
'Borrower'
,
0
,
0
,
True
,
True
),
(
'抵押人证件号码'
,
'Borrower'
,
0
,
2
,
True
,
True
),
(
'抵押人签字'
,
'Borrower'
,
0
,
0
,
True
,
False
),
(
'抵押人'
,
'Borrower'
,
0
,
0
,
True
,
True
,
False
),
(
'抵押人证件号码'
,
'Borrower'
,
0
,
2
,
True
,
True
,
False
),
(
'抵押人签字'
,
'Borrower'
,
0
,
0
,
True
,
False
,
False
),
(
'抵押人配偶'
,
'Co-Borrower'
,
0
,
0
,
False
,
True
),
(
'抵押人配偶证件号码'
,
'Co-Borrower'
,
0
,
2
,
False
,
True
),
(
'抵押人配偶签字'
,
'Co-Borrower'
,
0
,
0
,
False
,
False
),
(
'抵押人配偶'
,
'Co-Borrower'
,
0
,
0
,
False
,
True
,
True
),
(
'抵押人配偶证件号码'
,
'Co-Borrower'
,
0
,
2
,
False
,
True
,
True
),
(
'抵押人配偶签字'
,
'Co-Borrower'
,
0
,
0
,
False
,
False
,
True
),
]
ROLE_LIST_1
=
[
...
...
@@ -1770,7 +1770,7 @@ HMH_COMPARE_LOGIC = {
BD_COMPARE_LOGIC
=
{
'被保险人姓名'
:
(
'被保险人姓名'
,
'se_name_compare'
,
{},
'保单被保险人姓名与系统不一致'
),
'被保险人证件号码'
:
(
'被保险人证件号码'
,
'se_common_compare'
,
{},
'保单身份证号需人工核查'
),
'被保险人证件号码'
:
(
'被保险人证件号码'
,
'se_common_compare'
,
{
'is_bd_id'
:
True
},
'保单身份证号需人工核查'
),
'车架号'
:
(
'车架号'
,
'se_common_compare'
,
{},
'保单车架号与系统不一致'
),
'机动车损失保险金额'
:
(
'机动车损失保险金额'
,
'se_amount_lte_compare'
,
{},
'保单车损险异常'
),
'第三者责任保险金额'
:
(
'机动车第三者责任保险金额'
,
'se_amount_lte_compare'
,
{},
'保单三者险异常'
),
...
...
@@ -1789,9 +1789,9 @@ BS_COMPARE_LOGIC = {
'打印日期'
:
(
'print_time'
,
'se_bs_print_date_compare'
,
{},
'主共借人银行流水打印日期超过15天'
),
'(担保人1)打印日期'
:
(
'print_time'
,
'se_bs_print_date_compare'
,
{},
'担保人1银行流水打印日期超过15天'
),
'(担保人2)打印日期'
:
(
'print_time'
,
'se_bs_print_date_compare'
,
{},
'担保人2银行流水打印日期超过15天'
),
'流水日期'
:
(
'
date
'
,
'se_bs_date_compare'
,
{},
'主共借人银行流水日期不满足3个月'
),
'(担保人1)流水日期'
:
(
'
date
'
,
'se_bs_date_compare'
,
{},
'担保人1银行流水日期不满足3个月'
),
'(担保人2)流水日期'
:
(
'
date
'
,
'se_bs_date_compare'
,
{},
'担保人2银行流水日期不满足3个月'
),
'流水日期'
:
(
'
timedelta
'
,
'se_bs_date_compare'
,
{},
'主共借人银行流水日期不满足3个月'
),
'(担保人1)流水日期'
:
(
'
timedelta
'
,
'se_bs_date_compare'
,
{},
'担保人1银行流水日期不满足3个月'
),
'(担保人2)流水日期'
:
(
'
timedelta
'
,
'se_bs_date_compare'
,
{},
'担保人2银行流水日期不满足3个月'
),
}
SPECIAL_REASON
=
'主共借人未提供银行流水,含担保人需人工查看直系亲属关系'
...
...
src/apps/doc/management/commands/ocr_process.py
View file @
baf48df
...
...
@@ -329,12 +329,18 @@ class Command(BaseCommand, LoggerMixin):
# 保单
if
classify
==
consts
.
INSURANCE_CLASSIFY
:
product_result
=
[
''
,
''
,
''
]
min_char_count_1
=
1000
min_char_count_2
=
1000
for
product
in
license_data
.
get
(
'result'
,
{})
.
get
(
'productList'
,
[]):
name
=
product
.
get
(
'name'
,
{})
.
get
(
'words'
,
''
)
if
name
.
find
(
'机动车损失'
)
!=
-
1
:
if
name
.
find
(
'机动车损失'
)
!=
-
1
or
name
.
find
(
'汽车损失'
)
!=
-
1
:
if
len
(
name
)
<
min_char_count_1
:
min_char_count_1
=
len
(
name
)
product_result
[
0
]
=
product
.
get
(
'coverage'
,
{})
.
get
(
'words'
,
''
)
product_result
[
2
]
=
product
.
get
(
'deductible_franchise'
,
{})
.
get
(
'words'
,
''
)
elif
name
.
find
(
'第三者责任'
)
!=
-
1
:
if
len
(
name
)
<
min_char_count_2
:
min_char_count_2
=
len
(
name
)
product_result
[
1
]
=
product
.
get
(
'coverage'
,
{})
.
get
(
'words'
,
''
)
special_str
=
license_data
.
get
(
'result'
,
{})
.
get
(
'1stBeneficiary'
,
{})
.
get
(
'words'
,
''
)
...
...
@@ -840,19 +846,11 @@ class Command(BaseCommand, LoggerMixin):
print_date
=
bs_info
.
get
(
'print_time'
,
''
)
.
strftime
(
"
%
Y-
%
m-
%
d"
)
except
Exception
as
e
:
print_date
=
''
try
:
start_date
=
bs_info
.
get
(
'start_date'
,
''
)
.
strftime
(
"
%
Y-
%
m-
%
d"
)
except
Exception
as
e
:
start_date
=
''
try
:
end_date
=
bs_info
.
get
(
'end_date'
,
''
)
.
strftime
(
"
%
Y-
%
m-
%
d"
)
except
Exception
as
e
:
end_date
=
''
res
.
append
(
{
'role'
:
bs_info
.
get
(
'role'
,
''
),
'print_time'
:
print_date
,
'
date'
:
[
start_date
,
end_date
]
,
'
timedelta'
:
bs_info
.
get
(
'timedelta'
,
''
)
,
}
)
return
res
...
...
src/apps/doc/ocr/wb.py
View file @
baf48df
...
...
@@ -334,7 +334,7 @@ class BSWorkbook(Workbook):
metadata_rows
.
extend
(
code
)
if
start_date
is
None
or
end_date
is
None
:
timedelta
=
None
timedelta
=
''
else
:
timedelta
=
(
end_date
-
start_date
)
.
days
metadata_rows
.
extend
(
...
...
@@ -344,11 +344,11 @@ class BSWorkbook(Workbook):
self
.
blank_row
,
self
.
interest_keyword_header
]
)
return
metadata_rows
,
verify_highlight_row
return
metadata_rows
,
verify_highlight_row
,
timedelta
def
build_meta_sheet
(
self
,
role_name
,
card
,
confidence
,
code
,
verify_list
,
print_time
,
start_date
,
end_date
,
res_count_tuple
,
is_verify_classify
):
metadata_rows
,
verify_highlight_row
=
self
.
build_metadata_rows
(
metadata_rows
,
verify_highlight_row
,
timedelta
=
self
.
build_metadata_rows
(
confidence
,
code
,
verify_list
,
print_time
,
start_date
,
end_date
,
res_count_tuple
,
is_verify_classify
)
if
not
isinstance
(
role_name
,
str
):
role_name
=
consts
.
UNKNOWN_ROLE
...
...
@@ -367,7 +367,7 @@ class BSWorkbook(Workbook):
cell
.
fill
=
self
.
amount_fill
for
cell
in
ms
[
4
]:
cell
.
fill
=
self
.
amount_fill
return
ms
return
ms
,
timedelta
@staticmethod
def
amount_format
(
amount_str
):
...
...
@@ -682,7 +682,7 @@ class BSWorkbook(Workbook):
# 2.元信息提取表
confidence
=
self
.
get_confidence
(
max_find_count
)
is_verify_classify
=
classify
in
consts
.
BS_VERIFY_CLASSIFY
ms
=
self
.
build_meta_sheet
(
role_name
,
ms
,
timedelta
=
self
.
build_meta_sheet
(
role_name
,
new_card
,
confidence
,
summary
.
get
(
'code'
),
...
...
@@ -693,6 +693,8 @@ class BSWorkbook(Workbook):
res_count_tuple
,
is_verify_classify
)
summary
[
'timedelta'
]
=
timedelta
# 3.创建月份表、提取/高亮关键行
# 倒序处理
is_reverse
=
True
if
sum
(
reverse_trend_list
)
>
0
else
False
...
...
src/celery_compare/tasks.py
View file @
baf48df
This diff is collapsed.
Click to expand it.
src/common/tools/comparison.py
View file @
baf48df
...
...
@@ -258,6 +258,9 @@ class Comparison:
return
self
.
build_res
(
input_s
==
ocr_s
)
def
se_common_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
kwargs
.
get
(
'is_bd_id'
,
False
):
if
ocr_str
==
''
:
return
self
.
RESULT_Y
if
kwargs
.
get
(
'is_gsyh'
,
False
):
if
ocr_str
==
''
or
ocr_str
is
None
:
return
self
.
RESULT_Y
...
...
@@ -517,16 +520,17 @@ class Comparison:
except
Exception
as
e
:
return
self
.
RESULT_N
def
se_bs_date_compare
(
self
,
input_str
,
ocr_str
_list
,
**
kwargs
):
if
isinstance
(
ocr_str_list
,
list
)
and
len
(
ocr_str_list
)
==
2
:
def
se_bs_date_compare
(
self
,
input_str
,
ocr_str
,
**
kwargs
):
if
not
isinstance
(
ocr_str
,
int
)
:
try
:
start_date
=
datetime
.
strptime
(
ocr_str_list
[
0
],
"
%
Y-
%
m-
%
d"
)
end_date
=
datetime
.
strptime
(
ocr_str_list
[
1
],
"
%
Y-
%
m-
%
d"
)
if
end_date
>=
start_date
+
relativedelta
(
months
=
3
):
return
self
.
RESULT_Y
return
self
.
RESULT_N
ocr_int
=
int
(
ocr_str
)
except
Exception
as
e
:
return
self
.
RESULT_N
else
:
ocr_int
=
ocr_str
if
ocr_int
>=
input_str
:
return
self
.
RESULT_Y
else
:
return
self
.
RESULT_N
...
...
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