@hipolitodev/ocr-bo

1.1.12 • Public • Published

OCR and BO

Install

npm install @hipolitodev/ocr-bo

OCR Cloud

Usage

Creating a new instance

const ocr = new OCR(url);

Where

  • url is the url of the endpoint of the OCR service.

Analyze image

const result = ocr.analyzeImage(type, imageFront, imageBack);

Where

  • type it is the number id corresponding to the document to be analyze.
  • imageFront front image of the document in jpg or png format, with maximum weight of 3MB.
  • imageBack back image of the document in jpg or png format, with maximum weight of 3MB.

Document types:

Type Document
100 DUI
200 NIT
300 LICENCIA
400 PASAPORTE
500 CARNET DE RESIDENCIA

Response Schema

The success response for a request contains the following information.

  • http code: 200.
  • code: response code.
  • success: always returns true when the code is 200.
  • fields: returns an array with the document fields.
  • raw data: collects all the data from the OCR made to the images recopila la data completa de todo el OCR realizado a las imágenes.

Response Examples

DUI
{
	"code": 200,
	"success": true,
	"fields": {
		"uid": "0123456-7",
		"name": {
			"names": "Jane Judy",
			"lastnames": "Doe Roe",
			"name": [
				"Jane",
				"Judy",
				""
			],
			"lastname": [
				"Doe",
				""
			],
			"marriedsurname": "Roe"
		},
		"gender": "F",
		"birthPlace": "San Salvador, San Salvador",
		"birthDate": "01/01/1981”,
		"expeditionDate": “01/01/2018”,
		"expirationDate": “01/01/2026”,
		"zoneCode": "123450000",
		"address": "1A CALLE OTE #1-8 APTO # 3",
		"city": "El Carmen",
		"state": "La Union",
		"status": "Casado(a)",
		"spouseName": "John James Doe Roe",
		"profession": "Estudiante"
	}
}
NIT
{
	"code": 200,
	"success": true,
	"fields": {
		“uid”: ”0123-456789-012-3”,
		“name”: ”John Doe”,
		“nrc”: ”0123-4”,
		“dui”: "01234567-8",
		"expeditionDate": “16/10/2018”
	}
}
Licencia
{
	"code": 200,
	"success": true,
	"fields": {
		“uid”: ”0123-456789-012-3”,
		“name”: ”John Doe”,
		“dui”: "01234567-8",
		"expeditionDate": “16/10/2018”
		“birthDate”: "01/01/1991”,
		“expirationDate”: ”10/2025”,
	}
}
Pasaporte
{
	"code": 200,
	"success": true,
	"fields": {
		“uid”: “A01234567”,
		“countryCode”: ”SVL”,
		“name1”: ”John James”,
		“name2”: ”Doe Roe”,
		“birthDate”: ”01/01/1991”,
		“expirationDate”: ”06/10/2025”,
		“gender”: ”M”,
	}
}

Errors

Error code Type Message
422 Unprocessable Entity The image was not received correctly
422 Unprocessable Entity The limit of 3MB per image has been exceeded.
422 Unprocessable Entity The type value is not valid.
422 Unprocessable Entity The image is not jpg or png format.
422 Unprocessable Entity The request is unacceptable, due to the lack of a required parameter.
401 Unauthorized A valid API KEY was not provided.
402 Request Failed The parameters are valid but the request failed.
403 Forbidden The API KEY does not have permissions to make the request.
500, 502, 503, 504 Server Errors Something went wrong in the infrastructure or software.

Biometric Onboarding Cloud

Usage

Creating a new instance

const bo = new BO(url);

Where

  • url is the url of the endpoint of the BO service.

Create new

const result = bo.new(selfies);

Where

  • selfies the number of selfies that you want to use in the onboarding process, this value must be between 2 and 6.

Response Schema

The success response for a request contains the following information.

  • http code: 200.
  • code: response code.
  • success: always returns true when the code is 200.
  • uuid: is the unique ID of the started onboarding process.
  • selfies: returns an array with the identifiers of selfies to request.
Dictionary of possible selfies:
type document
front-normal Frontal selfie
front-smile Frontal selfie smiling
left-normal selfie looking left
left-smile Selfie looking left smiling
right-normal selfie looking right
right-smile Selfie looking to the right smiling
up-normal Selfie looking slightly up
up-smile Selfie looking slightly up smiling

Response Example

{
    "code": 200,
    "success": true,
    “uuid”: "67b2e5e5-0fc5-41a7-94a3-ad96e1f89bbe",
    "selfies": [
	    “front-normal”,
	    “front-smile”,
	    “left-normal”,
	    “right-smile”,
	    “up-normal”
    ]
}

Errors

Error code Type Message
422 Unprocessable Entity The value of the selfies parameter is not in the correct range.
422 Unprocessable Entity The request is unacceptable, due to the lack of a required parameter.
401 Unauthorized A valid API KEY was not provided.
402 Request Failed The parameters are valid but the request failed.
403 Forbidden The API KEY does not have permissions to make the request.
500, 502, 503, 504 Server Errors Something went wrong in the infrastructure or software.

Verify

const result = bo.verify({ uuid, document, selfies });

Where

  • uuid text
  • document text
  • selfies text

Response Schema

The success response for a request contains the following information.

  • http code: 200.
  • code: response code.
  • success: always returns true when the code is 200.
  • uuid: is the unique ID of the started onboarding process.
  • accuracy: value between 0.00 and 1 that shows the accuracy between the selfies and the document
  • verified: returns true when the accuracy is greater than 60%

Response Example

{
	"code": 200,
	"success": true,
	“uuid”: "67b2e5e5-0fc5-41a7-94a3-ad96e1f89bbe",
	“accuracy”: 0.85,
	“verified”: true
}

Errors

Error code Type Message
422 Unprocessable Entity The uid is not valid.
422 Unprocessable Entity The identity document was not sent.
422 Unprocessable Entity The selfies sent do not match the ones assigned to the uid.
422 Unprocessable Entity The limit of 3MB per image has been exceeded.
422 Unprocessable Entity The image is not jpg or png format.
422 Unprocessable Entity The request is unacceptable, due to the lack of a required parameter.
401 Unauthorized A valid API KEY was not provided.
402 Request Failed The parameters are valid but the request failed.
403 Forbidden The API KEY does not have permissions to make the request.
500, 502, 503, 504 Server Errors Something went wrong in the infrastructure or software.

License

License

Readme

Keywords

none

Package Sidebar

Install

npm i @hipolitodev/ocr-bo

Weekly Downloads

6

Version

1.1.12

License

ISC

Unpacked Size

55.2 kB

Total Files

25

Last publish

Collaborators

  • hipolitodev