Skip to content
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

Wrong MRZ type for France ID card issued before 2021 #64

Open
canklot opened this issue Apr 19, 2022 · 1 comment
Open

Wrong MRZ type for France ID card issued before 2021 #64

canklot opened this issue Apr 19, 2022 · 1 comment

Comments

@canklot
Copy link

canklot commented Apr 19, 2022

ID cards issued before 2021 by France has 2 lines with 36 characters. But the order of the fields are different from TD2. And the PassportEye identifies them as TD2 and outputs wrong results

https://en.wikipedia.org/wiki/National_identity_card_(France)
https://www.doubango.org/SDKs/mrz/docs/MRZ_formats.html

@canklot
Copy link
Author

canklot commented Apr 21, 2022

An easy work around for others

def check_france(mrz):
    if mrz.type == "ID" and mrz.country == "FRA" and mrz.valid == False:
        mrz.mrz_type = "TDF"
        raw_text = mrz.aux['raw_text']
        mrz.last_name = raw_text[5:30].replace("<","")
        mrz.surname = mrz.last_name
        mrz.number = raw_text[37:49]
        mrz.check_number =  raw_text[49]
        mrz.names = raw_text[50:63].replace("<<"," ")
        mrz.date_of_birth = raw_text[64:70]
        mrz.check_date_of_birth = raw_text[70]
        mrz.sex = raw_text[71]
        mrz.check_composite = raw_text[72]

        # 731 check
        cal_check_numbers = calculate_checksum( mrz.number)
        cal_check_date_of_birth = calculate_checksum( mrz.date_of_birth)
        
        mrz.valid_date_of_birth = True if cal_check_date_of_birth  == int(mrz.check_date_of_birth)  else False
        mrz.valid_check_number = True if cal_check_numbers  == int(mrz.check_number)  else False

        mrz.expiration_date = " "
        mrz.nationality = " "

        fra_valid_score = 20
        if mrz.valid_date_of_birth : fra_valid_score += 35
        if mrz.valid_check_number : fra_valid_score += 35
        mrz.valid_score = fra_valid_score
    return mrz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant