1.1.12 • Published 2 years ago

@hipolitodev/ocr-bo v1.1.12

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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:

TypeDocument
100DUI
200NIT
300LICENCIA
400PASAPORTE
500CARNET 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 codeTypeMessage
422Unprocessable EntityThe image was not received correctly
422Unprocessable EntityThe limit of 3MB per image has been exceeded.
422Unprocessable EntityThe type value is not valid.
422Unprocessable EntityThe image is not jpg or png format.
422Unprocessable EntityThe request is unacceptable, due to the lack of a required parameter.
401UnauthorizedA valid API KEY was not provided.
402Request FailedThe parameters are valid but the request failed.
403ForbiddenThe API KEY does not have permissions to make the request.
500, 502, 503, 504Server ErrorsSomething 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:
typedocument
front-normalFrontal selfie
front-smileFrontal selfie smiling
left-normalselfie looking left
left-smileSelfie looking left smiling
right-normalselfie looking right
right-smileSelfie looking to the right smiling
up-normalSelfie looking slightly up
up-smileSelfie 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 codeTypeMessage
422Unprocessable EntityThe value of the selfies parameter is not in the correct range.
422Unprocessable EntityThe request is unacceptable, due to the lack of a required parameter.
401UnauthorizedA valid API KEY was not provided.
402Request FailedThe parameters are valid but the request failed.
403ForbiddenThe API KEY does not have permissions to make the request.
500, 502, 503, 504Server ErrorsSomething 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 codeTypeMessage
422Unprocessable EntityThe uid is not valid.
422Unprocessable EntityThe identity document was not sent.
422Unprocessable EntityThe selfies sent do not match the ones assigned to the uid.
422Unprocessable EntityThe limit of 3MB per image has been exceeded.
422Unprocessable EntityThe image is not jpg or png format.
422Unprocessable EntityThe request is unacceptable, due to the lack of a required parameter.
401UnauthorizedA valid API KEY was not provided.
402Request FailedThe parameters are valid but the request failed.
403ForbiddenThe API KEY does not have permissions to make the request.
500, 502, 503, 504Server ErrorsSomething went wrong in the infrastructure or software.

License

License

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago