idvpackage 3.0.12__py3-none-any.whl → 3.0.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- idvpackage/common.py +4 -4
- idvpackage/iraq_id_extraction_withopenai.py +1 -1
- idvpackage/ocr.py +10 -8
- idvpackage/ocr_utils.py +10 -9
- {idvpackage-3.0.12.dist-info → idvpackage-3.0.13.dist-info}/METADATA +1 -1
- {idvpackage-3.0.12.dist-info → idvpackage-3.0.13.dist-info}/RECORD +9 -9
- {idvpackage-3.0.12.dist-info → idvpackage-3.0.13.dist-info}/WHEEL +0 -0
- {idvpackage-3.0.12.dist-info → idvpackage-3.0.13.dist-info}/licenses/LICENSE +0 -0
- {idvpackage-3.0.12.dist-info → idvpackage-3.0.13.dist-info}/top_level.txt +0 -0
idvpackage/common.py
CHANGED
|
@@ -284,10 +284,10 @@ def load_and_process_image_deepface(image_input, country=None):
|
|
|
284
284
|
if w < 40 or h < 50:
|
|
285
285
|
logging.info(f"Face too small for SDN: w={w}, h={h}")
|
|
286
286
|
return None, None, 0.0
|
|
287
|
-
else:
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
287
|
+
# else:
|
|
288
|
+
# if w < 80 or h < 90:
|
|
289
|
+
# logging.info(f"Face too small: w={w}, h={h}")
|
|
290
|
+
# return None, None, 0.0
|
|
291
291
|
|
|
292
292
|
# All checks passed
|
|
293
293
|
return biggest_face, img_to_process, confidence
|
|
@@ -146,7 +146,7 @@ class IraqiPassport(BaseModel):
|
|
|
146
146
|
..., description="Date of birth as extracted from MRZ (in DD/MM/YYYY format)"
|
|
147
147
|
)
|
|
148
148
|
id_number_mrz: str = Field(
|
|
149
|
-
..., description="ID number as extracted from MRZ"
|
|
149
|
+
..., min_length=9, max_length=9, description="ID number as extracted from MRZ"
|
|
150
150
|
)
|
|
151
151
|
expiry_date_mrz: str = Field(
|
|
152
152
|
..., description="Expiry date as extracted from MRZ (in DD/MM/YYYY format)"
|
idvpackage/ocr.py
CHANGED
|
@@ -916,14 +916,16 @@ class IdentityVerification:
|
|
|
916
916
|
logging.info( f"----------------Time taken for qatar OpenAI and final extraction front: {time.time() - st} seconds\n")
|
|
917
917
|
|
|
918
918
|
expiry_date = front_data_fields.get("expiry_date", "")
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
if
|
|
924
|
-
front_data[
|
|
925
|
-
|
|
926
|
-
|
|
919
|
+
try:
|
|
920
|
+
if expiry_date:
|
|
921
|
+
logging.info(f"Extracted Expiry Date for expiry verification: {expiry_date}")
|
|
922
|
+
from idvpackage.ocr_utils import is_expired_id
|
|
923
|
+
if is_expired_id(expiry_date):
|
|
924
|
+
front_data['error'] = 'expired_id'
|
|
925
|
+
logging.info(f"ID is expired with expiry date: {expiry_date}")
|
|
926
|
+
return front_data
|
|
927
|
+
except Exception as e:
|
|
928
|
+
logging.info(f"Error in expiry date calculation: {e}")
|
|
927
929
|
|
|
928
930
|
image = np.array(processed_front_id)
|
|
929
931
|
doc_on_pp_result = document_on_printed_paper(image)
|
idvpackage/ocr_utils.py
CHANGED
|
@@ -560,15 +560,16 @@ def data_consistency_check(data, front_id_text, back_id_text, country, back_img)
|
|
|
560
560
|
if country == 'IRQ':
|
|
561
561
|
data_consistency['breakdown']['document_type']['result'] = 'clear'
|
|
562
562
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
563
|
+
if data.get('doc_type') == 'national_identity_card':
|
|
564
|
+
front_id_number = data.get('id_number', '')
|
|
565
|
+
back_id_number = data.get('id_number_mrz', '')
|
|
566
|
+
|
|
567
|
+
logging.info(f'Front ID Number: {front_id_number}')
|
|
568
|
+
logging.info(f'Back ID Number: {back_id_number}')
|
|
568
569
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
570
|
+
if front_id_number and back_id_number:
|
|
571
|
+
if front_id_number != back_id_number:
|
|
572
|
+
data_consistency['breakdown']['multiple_data_sources_present']['result'] = 'consider'
|
|
572
573
|
|
|
573
574
|
if country == 'QAT':
|
|
574
575
|
data_consistency['breakdown']['gender']['result'] = 'clear'
|
|
@@ -684,7 +685,7 @@ def get_name_match_mrz(data, doc_type):
|
|
|
684
685
|
name = data.get("name", "")
|
|
685
686
|
|
|
686
687
|
elif data['nationality'] == 'IRQ':
|
|
687
|
-
name = data.get("
|
|
688
|
+
name = data.get("full_name", "")
|
|
688
689
|
logging.info(f"Name extracted for IRQ: {name}")
|
|
689
690
|
|
|
690
691
|
elif data['nationality'] == 'PSE':
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: idvpackage
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.13
|
|
4
4
|
Summary: This repository contains a Python program designed to execute Optical Character Recognition (OCR) and Facial Recognition on images.
|
|
5
5
|
Home-page: https://github.com/NymCard-Payments/project_idv_package
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
idvpackage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
idvpackage/blur_detection.py,sha256=CtLqTtg2azE4YCM8AT1jYJq6QxGoniMO0VkQYIcMtRI,1883
|
|
3
|
-
idvpackage/common.py,sha256=
|
|
3
|
+
idvpackage/common.py,sha256=YJUuNS7RZ_FkV7h_6oz7cqGe_EqJvMp-QEUB-7MXLOc,15251
|
|
4
4
|
idvpackage/constants.py,sha256=XvQy5ORGsXoQGcXcvUBC17vpFMzgzleS9S_mDN72G4c,7212
|
|
5
|
-
idvpackage/iraq_id_extraction_withopenai.py,sha256=
|
|
5
|
+
idvpackage/iraq_id_extraction_withopenai.py,sha256=j7O94q7tpn1Dq_edicsO6ItWcVuRRvuZHBf-CfSc3Vg,21912
|
|
6
6
|
idvpackage/jor_passport_extraction.py,sha256=O3qzYCbgm_tWzPKJc3b9qrH0VrefCQVPKNJdOHYku84,9214
|
|
7
7
|
idvpackage/lebanon_id_extraction.py,sha256=eqWSpfb83RRk5TEhJNOuiPLt-wCLY5L4TvrpkOckSPs,21192
|
|
8
8
|
idvpackage/liveness_spoofing_v2.py,sha256=G3sCu4LkzhJvL33S75sI_QTpc1nA3wo9SqG1elkaIwg,7409
|
|
9
|
-
idvpackage/ocr.py,sha256=
|
|
10
|
-
idvpackage/ocr_utils.py,sha256=
|
|
9
|
+
idvpackage/ocr.py,sha256=EHwScH-aHgtavTCKnMQogKQADthziugB06XloRI2yZE,157208
|
|
10
|
+
idvpackage/ocr_utils.py,sha256=2dXYE8rFl-TnTkNcjqfp5I1MQDvjsvWgrNwwrO18dGA,77383
|
|
11
11
|
idvpackage/pse_passport_extraction.py,sha256=fDrvCzN9PWhqYYvULVD89EYeBWrcMazpzY02uSlus-0,8627
|
|
12
12
|
idvpackage/qatar_id_extraction.py,sha256=iTGB7j8b7aHi69ZlH4pekPD9klavqXxOSZvzwSZBL2M,9044
|
|
13
13
|
idvpackage/sudan_passport_extraction.py,sha256=fgmRLB5WdA9RqQOkP_J2lDMcgDbdKh9L9XQaWC5UQPY,17504
|
|
@@ -27,8 +27,8 @@ idvpackage/spoof_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
27
27
|
idvpackage/spoof_resources/functional.py,sha256=164aGMvBDHU6HWRyDBr-2EUPeJ4rc4cXl10NJyGB7eE,20138
|
|
28
28
|
idvpackage/spoof_resources/generate_patches.py,sha256=ANvJ5rDl-SXARchS8JwOxuKLhUuabbxLwvz4zsYbADE,1722
|
|
29
29
|
idvpackage/spoof_resources/transform.py,sha256=3Ft9S6g6N0SU24f3feHXquh5qRc85JFt2gNKnCYQwjo,11311
|
|
30
|
-
idvpackage-3.0.
|
|
31
|
-
idvpackage-3.0.
|
|
32
|
-
idvpackage-3.0.
|
|
33
|
-
idvpackage-3.0.
|
|
34
|
-
idvpackage-3.0.
|
|
30
|
+
idvpackage-3.0.13.dist-info/licenses/LICENSE,sha256=JTmNGOPPvG2XBgkW2R2xwzJeR_OEjaFKeePN1jGYVt8,1068
|
|
31
|
+
idvpackage-3.0.13.dist-info/METADATA,sha256=qUpfFenawz8HV7KN7smgbU2s44UFVPOXPX8ZXTS-wq4,4800
|
|
32
|
+
idvpackage-3.0.13.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
33
|
+
idvpackage-3.0.13.dist-info/top_level.txt,sha256=8jL1PsYvKBIWWLGe8jEm7kU5yZ5sld_OCaz0Dzvi6qY,11
|
|
34
|
+
idvpackage-3.0.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|