Driver License

The Node.js SDK supports the Mindee V1 Driver License API.

Product Specifications

Specification
Details

Endpoint Name

driver_license

Recommended Version

v1.0

Supports Polling/Webhooks

✔️ Yes

Support Synchronous HTTP Calls

❌ No

Geography

🌐 Global

Quick-Start

Using the sample below, we are going to illustrate how to extract the data that we want using the SDK.

Driver License Sample

Sample Code

const mindee = require("mindee");
// for TS or modules:
// import * as mindee from "mindee";

// Init a new client
const mindeeClient = new mindee.Client({ apiKey: "my-api-key" });

// Load a file from disk
const inputSource = mindeeClient.docFromPath("/path/to/the/file.ext");

// Parse the file
const apiResponse = mindeeClient.enqueueAndParse(
  mindee.product.DriverLicenseV1,
  inputSource
);

// Handle the response Promise
apiResponse.then((resp) => {
  // print a string summary
  console.log(resp.document.toString());
});

Sample Output (rST)

########
Document
########
:Mindee ID: fbdeae38-ada3-43ac-aa58-e01a3d47e474
:Filename: default_sample.jpg

Inference
#########
:Product: mindee/driver_license v1.0
:Rotation applied: Yes

Prediction
==========
:Country Code: USA
:State: AZ
:ID: D12345678
:Category: D
:Last Name: Sample
:First Name: Jelani
:Date of Birth: 1957-02-01
:Place of Birth:
:Expiry Date: 2018-02-01
:Issued Date: 2013-01-10
:Issuing Authority:
:MRZ:
:DD Number: DD1234567890123456

Standard Fields

These fields are generic and used in several products.

Basic Field

Each prediction object contains a set of fields that inherit from the generic Field class.

A typical Field object will have the following attributes:

  • value (number | string): corresponds to the field value. Can be undefined if no value was extracted.

  • confidence (number): the confidence score of the field prediction.

  • boundingBox ([Point, Point, Point, Point]): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.

  • polygon (Point[]): contains the relative vertices coordinates (Point) of a polygon containing the field in the image.

  • pageId (number): the ID of the page, always undefined when at document-level.

  • reconstructed (boolean): indicates whether an object was reconstructed (not extracted as the API gave it).

A Point simply refers to an array of two numbers ([number, number]).

Aside from the previous attributes, all basic fields have access to a toString() method that can be used to print their value as a string.

Date Field

Aside from the basic Field attributes, the date field DateField also implements the following:

  • dateObject (Date): an accessible representation of the value as a JavaScript object.

String Field

The text field StringField only has one constraint: its value is a string (or undefined).

Attributes

The following fields are extracted for Driver License V1:

Category

category (StringField): The category or class of the driver license.

console.log(result.document.inference.prediction.category.value);

Country Code

countryCode (StringField): The alpha-3 ISO 3166 code of the country where the driver license was issued.

console.log(result.document.inference.prediction.countryCode.value);

Date of Birth

dateOfBirth (DateField): The date of birth of the driver license holder.

console.log(result.document.inference.prediction.dateOfBirth.value);

DD Number

ddNumber (StringField): The DD number of the driver license.

console.log(result.document.inference.prediction.ddNumber.value);

Expiry Date

expiryDate (DateField): The expiry date of the driver license.

console.log(result.document.inference.prediction.expiryDate.value);

First Name

firstName (StringField): The first name of the driver license holder.

console.log(result.document.inference.prediction.firstName.value);

ID

id (StringField): The unique identifier of the driver license.

console.log(result.document.inference.prediction.id.value);

Issued Date

issuedDate (DateField): The date when the driver license was issued.

console.log(result.document.inference.prediction.issuedDate.value);

Issuing Authority

issuingAuthority (StringField): The authority that issued the driver license.

console.log(result.document.inference.prediction.issuingAuthority.value);

Last Name

lastName (StringField): The last name of the driver license holder.

console.log(result.document.inference.prediction.lastName.value);

MRZ

mrz (StringField): The Machine Readable Zone (MRZ) of the driver license.

console.log(result.document.inference.prediction.mrz.value);

Place of Birth

placeOfBirth (StringField): The place of birth of the driver license holder.

console.log(result.document.inference.prediction.placeOfBirth.value);

State

state (StringField): Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.

console.log(result.document.inference.prediction.state.value);

Last updated

Was this helpful?