-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update identifier validation in _fields.py #29
base: master
Are you sure you want to change the base?
Conversation
Addresses use case where the first line of a valid TD3 MRZ is structured as so: P<XXXAA<<BBBBBB<<CCCCC<DD<<<<<<<<<<<<<<<<<<< Whereby the 'A' component is the primary identifier (surname) and the 'B', 'C' and 'D' components are the secondary identifier (name).
Please let me know if you're okay with merging this @Arg0s1080. Hope all is well on your end! |
Hi! Hello I promise to try to review it this weekend |
Thank you - no rush! Let me know if there's anything you'd like changed! |
Bump @Arg0s1080 :p |
Hi again: Sorry, I'm should have said "next weekend" I dont know if i understand your problem well, but.... The approach you propose is no-valid. ICAO specs say:
So.. following your sample, its structure should be:
instead: For example: More than 2 identifiers: #!/usr/bin/python3
# -*- coding: UTF-8 -*-
from mrz.checker.td3 import TD3CodeChecker
check = TD3CodeChecker("P<XXXAA<<BBBBBB<<CCCCC<DD<<<<<<<<<<<<<<<<<<<\n"
"ZE000509<9XXX8501019F2301147<<<<<<<<<<<<<<08")
print("Result:")
print(bool(check))
print()
print("Detected errors:")
errors = check.report.errors
if len(errors) > 0:
print(check.report.errors)
else:
print("None") Output:
If we repair the full name using only 2 identifiers: Primary: from mrz.checker.td3 import TD3CodeChecker
check = TD3CodeChecker("P<XXXAA<<BBBBBB<CCCCCC<DD<<<<<<<<<<<<<<<<<<<\n"
"ZE000509<9XXX8501019F2301147<<<<<<<<<<<<<<08")
print("Result:")
print(bool(check))
print()
print("Detected errors:")
errors = check.report.errors
if len(errors) > 0:
print(check.report.errors)
else:
print("None") Output:
Sorry for the delay and BR PS: If I have understood something bad tell me |
@Arg0s1080 I don't believe you've misunderstood anything! :) |
It's pretty weird. ICAO specs are quite flexible and leave many things at the discretion of the issuing State, but others are very strict. Its also not very rare to find organizations that do not meet specs. Out of curiosity, may I know what country it is? You can modify the code however you want, but the correct thing would be to add a "special case" (India had a similar problem... I think I remember that there were identifiers that started with Due to a design problem, the format of the class name must:
For example |
Thanks very much for the feedback and solution; will go with that approach. The document was an Indonesian passport document. |
Addresses use case where the first line of a valid TD3 MRZ is structured as so:
P<XXXAA<<BBBBBB<<CCCCC<DD<<<<<<<<<<<<<<<<<<<
Whereby the 'A' component is the primary identifier (surname) and the 'B', 'C' and 'D' components are the secondary identifier (name).