# mrz **Repository Path**: mbed/mrz ## Basic Information - **Project Name**: mrz - **Description**: Machine Readable Zone generator and checker for official travel documents sizes 1, 2, 3, MRVA and MRVB (Passports, Visas, national id cards and other travel documents) - **Primary Language**: Python - **License**: GPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2019-08-03 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # MZR Generator & MRZ Checker ## Description: Machine Readable Zone generator and checker for official travel documents sizes 1, 2, 3, MRVA and MRVB (Passports, Visas, national id cards and other travel documents) MZR Generator and MRZ Checker are built according to International Civil Aviation Organization specifications (ICAO 9303): * [Specifications Common to all Machine Readable Travel Documents (MRTDs)](https://www.icao.int/publications/Documents/9303_p3_cons_en.pdf) * [Specifications for Machine Readable Passports (MRPs)](https://www.icao.int/publications/Documents/9303_p4_cons_en.pdf) * [Specifications for TD1 Size Machine Readable Official Travel Documents (MROTDs)](https://www.icao.int/publications/Documents/9303_p5_cons_en.pdf) * [Specifications for TD2 Size Machine Readable Official Travel Documents (MROTDs)](https://www.icao.int/publications/Documents/9303_p6_cons_en.pdf) * [Specifications for Machine Readable Visas (MRV)](https://www.icao.int/publications/Documents/9303_p7_cons_en.pdf) ## Fields Distribution of Official Travel Documents: ![image](https://raw.githubusercontent.com/Arg0s1080/mrz/master/docs/Fields_Distribution.png) ## Usage Generator: #### TD1's (id cards): Params: Case insensitive document_type (str): The first letter shall be 'I', 'A' or 'C' country_code (str): 3 letters code (ISO 3166-1) or country name (in English) document_number (str): Document number birth_date (str): YYMMDD sex (str): Genre. Male: 'M', Female: 'F' or Undefined 'X' expiry_date (str): YYMMDD nationality (str): 3 letters code (ISO 3166-1) or country name (in English) surname (str): Holder primary identifier(s). This field will be transliterated given_names (str): Holder secondary identifier(s). This field will be transliterated optional_data1 (str): Optional personal data at the discretion of the issuing State. Non-mandatory field. Empty string by default optional_data2 (str): Optional personal data at the discretion of the issuing State. Non-mandatory field. Empty string by default transliteration (dict): Transliteration dictionary for non-ascii chars. Latin based by default force (bool): Disables checks for country, nationality and document_type fields. Allows to use 3-letter-codes not included in the countries dictionary and to use document_type codes without restrictions. #### TD2 Params: Case insensitive document_type (str): The first letter shall be 'I', 'A' or 'C' country_code (str): 3 letters code (ISO 3166-1) or country name (in English) surname (str): Holder primary identifier(s). This field will be transliterated. given_names (str): Holder secondary identifier(s). This field will be transliterated. document_number (str): Document number. nationality (str): 3 letters code (ISO 3166-1) or country name birth_date (str): YYMMDD sex (str): Genre. Male: 'M', Female: 'F' or Undefined 'X' expiry_date (str): YYMMDD optional_data (str): Optional personal data at the discretion of the issuing State. Non-mandatory field. Empty string by default transliteration (dict): Transliteration dictionary for non-ascii chars. Latin based by default force (bool): Disables checks for country, nationality and document_type fields. Allows to use 3-letter-codes not included in the countries dictionary and to use document_type codes without restrictions. #### TD3 (Passports) Params: Case insensitive document_type (str): Normally 'P' for passport country_code (str): 3 letters code (ISO 3166-1) or country name (in English) surname (str): Primary identifier(s) given_names (str): Secondary identifier(s) passport_number (str): Passport number nationality (str): 3 letters code (ISO 3166-1) or country name birth_date (str): YYMMDD sex (str): Genre. Male: 'M', Female: 'F' or Undefined 'X' expiry_date (str): YYMMDD id_number (str): Personal number. In some countries non-mandatory field. Empty string by default transliteration (dict): Transliteration dictionary for non-ascii chars. Latin based by default force (bool): Disables checks for country, nationality and document_type fields. Allows to use 3-letter-codes not included in the countries dictionary and to use document_type codes without restrictions. #### MRVA (Visas type A) Params: Case insensitive document_type (str): The First letter must be 'V' country_code (str): 3 letters code (ISO 3166-1) or country name (in English) surname (str): Primary identifier(s) given_names (str): Secondary identifier(s) passport_number (str): Passport number nationality (str): 3 letters code (ISO 3166-1) or country name birth_date (str): YYMMDD sex (str): Genre. Male: 'M', Female: 'F' or Undefined 'X' expiry_date (str): YYMMDD optional_data (str): Optional personal data at the discretion of the issuing State. Non-mandatory field. Empty string by default. transliteration (dict): Transliteration dictionary for non-ascii chars. Latin based by default force (bool): Disables checks for country, nationality and document_type fields. Allows to use 3-letter-codes not included in the countries dictionary and to use document_type codes without restrictions. #### MRVB (Visas type B) Params: Case insensitive document_type (str): The First letter must be 'V' country_code (str): 3 letters code (ISO 3166-1) or country name (in English) surname (str): Primary identifier(s) given_names (str): Secondary identifier(s) passport_number (str): Passport number nationality (str): 3 letters code (ISO 3166-1) or country name birth_date (str): YYMMDD sex (str): Genre. Male: 'M', Female: 'F' or Undefined 'X' expiry_date (str): YYMMDD optional_data (str): Optional personal data at the discretion of the issuing State. Non-mandatory field. Empty string by default. transliteration (dict): Transliteration dictionary for non-ascii chars. Latin based by default force (bool): Disables checks for country, nationality and document_type fields. Allows to use 3-letter-codes not included in the countries dictionary and to use document_type codes without restrictions. ##### Passport generator example (ICAO9303 Specimen): ![image](https://raw.githubusercontent.com/Arg0s1080/mrz/master/docs/images/passports/ICAO_Example.png) ##### TD3CodeGenerator str: print(TD3CodeGenerator("P", "UTO", "Eriksson", "Anna MarĂ­a", "L898902C3", "UTO", "740812", "F", "120415","ZE184226B")) ##### Output: P "NLD") - [x] Name truncation detection - [x] Error report, warnings report and full report in Checker. - [x] Possibility that warnings compute as errors using compute_warnings keyword in Checker. - [x] Possibility of disabling checks for country code, nationality and type of document, allowing to use 3-letter-codes not included in the countries dictionary and to use document_type codes without restrictions in Generator. - [x] Added new checks for periods of time in Checker. - [x] Visas support ###### TODO: - [ ] Automatic name truncation - [ ] Possibility of disabling checks for country code, nationality and type of document in Checker.