Key Value Extraction (Passport)
Key value extraction can be used to identify values for predefined keys in a MRZ-supported passport. For example, if a passport includes nationality and date of issue, Document Understanding can identify these values and return them as a key value pair.
The supported features are:
- Extract values for predefined key value pairs
- Confidence score
The supported fields are:
Field | Description | API Response Value |
---|---|---|
FirstName | First name (given name) listed on the document. | Extracted Text |
LastName | Last name (family name) listed on the document. | Extracted Text |
Country | Country listed on the document. | Extracted ISO 3166-1 country code |
Nationality | Nationality of the document owner. | Extracted ISO 3166-1 country code |
BirthDate | Date of birth. |
|
ExpiryDate | Date of expiration listed on the document. |
|
Gender | Gender listed on the document. | Extracted Text |
DocumentType | Document type, often listed as a single character, such as "P" for passport or "V" for Visa. | Extracted Text |
DocumentNumber | Document identification number. | Extracted Text |
Key Value Extraction (Passport) Example
An example of the use of key value extraction from a passport in Document Understanding.
- Input document
-
Key Value Extraction (Passport) Input
API Request:
{ "processorConfig": { "processorType": "GENERAL", "features": [ { "featureType": "KEY_VALUE_EXTRACTION" }, "documentType": "PASSPORT" }, "inputLocation": { "sourceType": "OBJECT_STORAGE_LOCATIONS", "objectLocations": [ { "source": "OBJECT_STORAGE", "namespaceName": "", "bucketName": "", "objectName": "" } ] }, "compartmentId": "", "outputLocation": { "namespaceName": "", "bucketName": "", "prefix": "" } }
- Output:
- API Response:
{ "documentMetadata": { "pageCount": 1, "mimeType": "image/png" }, "pages": [ { "pageNumber": 1, "detectedDocumentTypes": [ { "documentType": "PASSPORT", "confidence": 0.99412346 }, { "documentType": "INVOICE", "confidence": 0.0010955964 }, { "documentType": "RECEIPT", "confidence": 0.0009931799 }, { "documentType": "CHECK", "confidence": 0.0008127898 }, { "documentType": "DRIVER_LICENSE", "confidence": 0.00070861256 } ], "documentFields": [ { "fieldType": "KEY_VALUE", "fieldLabel": { "name": "FirstName", "confidence": 0.9979309 }, "fieldValue": { "valueType": "STRING", "value": "HAPPY" } }, { "fieldType": "KEY_VALUE", "fieldLabel": { "name": "LastName", "confidence": 0.9979309 }, "fieldValue": { "valueType": "STRING", "value": "TRAVELER" } }, { "fieldType": "KEY_VALUE", "fieldLabel": { "name": "Country", "confidence": 0.9979309 }, "fieldValue": { "valueType": "STRING", "value": "USA" } }, { "fieldType": "KEY_VALUE", "fieldLabel": { "name": "Nationality", "confidence": 0.9998241 }, "fieldValue": { "valueType": "STRING", "value": "USA" } }, { "fieldType": "KEY_VALUE", "fieldLabel": { "name": "BirthDate", "confidence": 0.9998241 }, "fieldValue": { "valueType": "STRING", "value": "1965/02/05" } }, { "fieldType": "KEY_VALUE", "fieldLabel": { "name": "ExpiryDate", "confidence": 0.9998241 }, "fieldValue": { "valueType": "STRING", "value": "2030/10/14" } }, { "fieldType": "KEY_VALUE", "fieldLabel": { "name": "Gender", "confidence": 0.9998241 }, "fieldValue": { "valueType": "STRING", "value": "F" } }, { "fieldType": "KEY_VALUE", "fieldLabel": { "name": "DocumentType", "confidence": 0.9979309 }, "fieldValue": { "valueType": "STRING", "value": "P" } }, { "fieldType": "KEY_VALUE", "fieldLabel": { "name": "DocumentNumber", "confidence": 0.9998241 }, "fieldValue": { "valueType": "STRING", "value": "E00007734" } } ] } ], "detectedDocumentTypes": [ { "documentType": "PASSPORT", "confidence": 0.99412346 } ], "documentClassificationModelVersion": "*.*.*", "keyValueExtractionModelVersion": "*.*.*(" }