MRTD

Overview

The Scandit parsing library supports all versions of Machine Readable Travel Documents (MRTD) specified by the International Civil Aviation Organization (ICAO).

The ICAO specifies the following four types of MRTDs:

ICAO MRTDs

Example

Parsing the following code (whitout quotes, source: 2015 ICAO Doc 9303, Specifications for TD1 Sized MRTDs, https://www.icao.int)

"I<UTOD231458907<<<<<<<<<<<<<<<\n7408122F1204159UTO<<<<<<<<<<<6\nERIKSSON<<ANNA<MARIA<<<<<<<<<<"

will result in the following JSON output:

[
   {
          "name" : "documentType",
          "parsed" : "td1",
          "rawString" : ""
   },
   {
          "name" : "documentCode",
          "parsed" : "I",
          "rawString" : "I<"
   },
   {
          "name" : "issuingState",
          "parsed" : "UTO",
          "rawString" : "UTO"
   },
   {
          "name" : "documentNumber",
          "parsed" : "D23145890",
          "rawString" : "D23145890"
   },
   {
          "name" : "optional",
          "parsed" : "",
          "rawString" : "<<<<<<<<<<<<<<<"
   },
   {
          "name" : "birthDate",
          "parsed" : {
                 "day" : 12,
                 "month" : 8,
                 "year" : 74
          },
          "rawString" : "740812"
   },
   {
          "name" : "sex",
          "parsed" : "female",
          "rawString" : "F"
   },
   {
          "name" : "expiryDate",
          "parsed" : {
                 "day" : 15,
                 "month" : 4,
                 "year" : 12
          },
          "rawString" : "120415"
   },
   {
          "name" : "nationality",
          "parsed" : "UTO",
          "rawString" : "UTO"
   },
   {
          "name" : "optional1",
          "parsed" : "",
          "rawString" : "<<<<<<<<<<<"
   },
   {
          "name" : "name",
          "parsed" : {
                 "primary" : [ "ERIKSSON" ],
                 "secondary" : [ "ANNA", "MARIA" ],
                 "truncated" : false
          },
          "rawString" : "ERIKSSON<<ANNA<MARIA<<<<<<<<<<"
   },
   {
          "name" : "metadata",
          "parsed" : {
                 "checksumValidation" : {
                        "birthDate" : true,
                        "compositeChecksum" : true,
                        "documentNumber" : true,
                        "expiryDate" : true
                 }
          },
          "rawString" : ""
   }
]

Common fields

The four types of MRTDs specified by the ICAO share most of the fields encoded in the Machine Readable Zone (MRZ) of the travel document.

The following fields are exposed for all ICAO MRTDs:

Data Element ID Meaning Parsed Content
documentType Document Type

One of the following values:

  • ‘td1’
  • ‘td2’
  • ‘td3/mrp’
  • ‘mrv’
documentCode Document Type Code  
documentNumber Document Number / Passport Number

String with the following interpretation:

  • TD1 & TD2: uniquely identifies the document from all other MROTDs issued by the State or organization.
  • TD3/MRP: Passport number
  • MRV: Either the passport number or the visa number, at the discretion of the issuing State.
expiryDate Date of expiry

Dictionary with these key/value pairs:

  • ‘year’ : YY,
  • ‘month’: MM,
  • ‘day’ : DD

with YY, MM, DD as integers. Entries are omitted from the dictionary if they are not specified by the input.

issuingState Issuing State Three-letter string specified in ICAO document 9303-3.
name Name

Dictionary with these key/value pairs:

  • ‘primary’: [primary identifiers, e.g., surname]
  • ‘secondary’: [secondary identifiers, e.g., given name or titles]
  • ‘truncated’: boolean
birthDate Date of birth

Dictionary with these key/value pairs:

  • ‘year’ : YY,
  • ‘month’: MM,
  • ‘day’ : DD

with YY, MM, DD as integers. Entries are omitted from the dictionary if they are not specified by the input.

sex Sex

One of the following values:

  • ‘female’
  • ‘male’
  • ‘nonspecified’
nationality Nationality Three-letter string specified in ICAO document 9303-3.
optional Optional Data For use of the issuing State or organization.

Please refer to the following sections for deviations from the the above table.

TD3 fields

  • ‘optional’: Usually employed to store the document holder’s personal number.

MRV fields

  • ‘documentNumber’: At the discretion of the issuing State, either the passport number or the visa number shall be used in this field.
  • ‘expiryDate’: In most cases this will be the date of expiry of the MRV and indicates the last day on which the visa can be used to seek entry. For some States this will be the date by or on which the holder should have left.

TD2/FrenchID fields

The French ID format is different then other ICAO formats in Common and does not contain all information described in the common fields section. For clarity, there is a complete example of TD2/FrenchID format.

Parsing the following code:

"IDFRABOITON<<<<<<<<<<<<<<<<<<<382020\n1203382018024PIERRE<<EMMANU8712068M5\n"

will result in the following JSON output:

[
    {
        "name" : "documentCode",
        "parsed" : "ID",
        "rawString" : "ID"
    },
    {
        "name" : "issuingCountry",
        "parsed" : "FRA",
        "rawString" : "FRA"
    },
    {
        "name" : "lastName",
        "parsed" : {
        "lastName" : "BOITON",
        "truncated" : false
        },
        "rawString" : "BOITON<<<<<<<<<<<<<<<<<<<"
    },
    {
        "name" : "officeOfIssuance",
        "parsed" : 20,
        "rawString" : "020"
    },
    {
        "name" : "dateOfIssuance",
        "parsed" : {
            "month" : 3,
            "year" : 12
        },
        "rawString" : "1203"
    },
    {
        "name" : "departmentOfIssuance",
        "parsed" : "382",
        "rawString" : "382"
    },
    {
        "name" : "managementCenterSign",
        "parsed" : 1802,
        "rawString" : "01802"
    },
    {
        "name" : "firstNames",
        "parsed" : {
            "firstNames" : [ "PIERRE", "EMMANU" ],
            "truncated" : true
        },
        "rawString" : "PIERRE<<EMMANU"
    },
    {
        "name" : "birthDate",
        "parsed" : {
            "day" : 6,
            "month" : 12,
            "year" : 87
        },
        "rawString" : "871206"
    },
    {
        "name" : "sex",
        "parsed" : "male",
        "rawString" : "M"
    },
    {
        "name" : "documentType",
        "parsed" : "td2/frenchID",
        "rawString" : ""
    },
    {
        "name" : "metadata",
        "parsed" : {
        "checksumValidation" : {
            "birthDate" : true,
            "compositeChecksum" : true,
            "issuanceInformation" : true
            }
        },
        "rawString" : ""
    }
]

The following fields are exposed for TD2/FrenchID:

Data Element ID Meaning Parsed Content
documentType Document Type Always has string ‘td2/frenchID’.
documentCode Document Type Code  
issuingCountry Issuing Country Always has string ‘FRA’.
lastName Last name / Surname

Dictionary with these key/value pairs:

  • ‘lastName’: [Last name or surname of ID card owner]
  • ‘truncated’: boolean
     
officeOfIssuance Office of issuance Integer that encodes the office of issuance.
dateOfIssuance Date of issuance

Dictionary with these key/value pairs:

  • ‘year’ : YY,
  • ‘month’: MM

with YY, MM as integers.

departmentOfIssuance Department Of issuance String that encodes the department of issuance.
managementCenterSign Management Center Sign Integer assigned by the Management Center in chronological order in relation to the place of issue and the date of application.
firstNames First name and given names

Dictionary with these key/value pairs:

  • ‘firstNames’: [First name followed by given names separated]
  • ‘truncated’: boolean
birthDate Date of birth

Dictionary with these key/value pairs:

  • ‘year’ : YY,
  • ‘month’: MM,
  • ‘day’ : DD

with YY, MM, DD as integers. Entries are omitted from the dictionary if they are not specified by the input.

sex Sex

One of the following values:

  • ‘female’
  • ‘male’
  • ‘nonspecified’

Parser Options

The parser can be configured by providing a JSON string containing key / value pairs. The following configuration options are available:

Key Value Type Description
relaxedChecksumValidation Boolean Enabling this option prevents the parser from failing for invalid checksums. Checksum verification results for the parsed fields are indicated using the ‘metadata’ field.

Metadata

The metadata field provides more information about the parsing of the input’s fields. The dictionary encoded in the JSON string of the ‘parsed’ field contains the following entries:

Key Value Type Description
checksumValidation Dictionary

This dictionary contains a key / value entry for every check digit in the input document with the following properties:

  • key: Name of the field associated with the check digit.
  • value: Boolean indicating the success status of the checksum verification.