Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📄 add md auto-documentation for products #184

Merged
merged 6 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Here's the TL;DR of getting started.

First, get an [API Key](https://developers.mindee.com/docs/create-api-key)

Then, install this library:
Then, install the library:
sebastianMindee marked this conversation as resolved.
Show resolved Hide resolved
```shell
npm install mindee
```
Expand Down Expand Up @@ -114,11 +114,7 @@ const apiResponse = mindeeClient
```js
// Handle the response Promise
apiResponse.then((resp) => {

// full object
console.log(resp.document);

// string summary
// print a string summary
console.log(resp.document.toString());

// individual pages (array)
Expand All @@ -127,7 +123,6 @@ apiResponse.then((resp) => {
```

### Additional options

#### Apply Cropping

To apply the `Cropper` tool provided by Mindee, set the `cropper` param to `true`:
Expand All @@ -141,20 +136,6 @@ const apiResponse = mindeeClient.parse(
);
```

#### Full-Text extraction (OCR)

To extract all words read on your document, set the `fullText` param to `true`:

```js
//...
const apiResponse = mindeeClient.parse(
mindee.product.InvoiceV4,
inputSource,
{ fullText: true }
);
```
> Note: this parameter is only available on the InvoiceV4, ReceiptV5 & FinancialDocumentV1 APIs for now.

#### Page options

Here's an example on how to apply page options:
Expand All @@ -173,6 +154,23 @@ const apiResponse = mindeeClient.parse(
});
```

Complete details on the working of the library are available in the following guides:

- [Overview](https://developers.mindee.com/docs/nodejs-getting-started)
- [Node.js Custom APIs OCR](https://developers.mindee.com/docs/nodejs-custom-api)
- [Node.js Invoices OCR](https://developers.mindee.com/docs/nodejs-invoice-ocr)
- [Node.js Receipts OCR](https://developers.mindee.com/docs/nodejs-receipt-ocr)
- [Node.js Financial Documents OCR](https://developers.mindee.com/docs/nodejs-financial-document-ocr)
- [Node.js Passports OCR](https://developers.mindee.com/docs/nodejs-passport-ocr)
- [Node.js Proof of Address OCR](https://developers.mindee.com/docs/nodejs-proof-of-address-ocr)
- [Node.js (EU) License Plates OCR](https://developers.mindee.com/docs/nodejs-eu-license-plates-ocr)
- [Node.js (FR) Bank Account Details OCR](https://developers.mindee.com/docs/nodejs-fr-bank-account-details-ocr)
- [Node.js (FR) Carte Vitales OCR](https://developers.mindee.com/docs/nodejs-fr-carte-vitale-ocr)
- [Node.js (US) Bank Checks OCR](https://developers.mindee.com/docs/nodejs-us-bank-checks-ocr)
- [Node.js (US) Driver License OCR](https://developers.mindee.com/docs/nodejs-us-driver-license-ocr)
- [Node.js Cropper API](https://developers.mindee.com/docs/nodejs-cropper-api)
- [Node.js Invoice Splitter API](https://developers.mindee.com/docs/nodejs-invoice-splitter-api)

## Further Reading
There's more to it than that for those that need more features, or want to
customize the experience.
Expand Down
139 changes: 139 additions & 0 deletions docs/bank_account_details_v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
title: Bank Account Details OCR Node.js
---
The Node.js OCR SDK supports the [Bank Account Details API](https://platform.mindee.com/mindee/bank_account_details).
sebastianMindee marked this conversation as resolved.
Show resolved Hide resolved

Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/fr/bank_account_details/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
![Bank Account Details sample](https://github.com/mindee/client-lib-test-data/blob/main/fr/bank_account_details/default_sample.jpg?raw=true)

# Quick-Start
```js
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.parse(
mindee.product.fr.BankAccountDetailsV2,
inputSource
);

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

**Output (RST):**
```rst
########
Document
########
:Mindee ID: bc8f7265-8dab-49fe-810c-d50049605578
:Filename: default_sample.jpg

Inference
#########
:Product: mindee/bank_account_details v2.0
:Rotation applied: Yes

Prediction
==========
:Account Holder's Names: MME HEGALALDIA L ENVOL
:Basic Bank Account Number:
:Bank Code: 13335
:Branch Code: 00040
:Key: 06
:Account Number: 08932891361
:IBAN: FR7613335000400893289136106
:SWIFT Code: CEPAFRPP333

Page Predictions
================

Page 0
------
:Account Holder's Names: MME HEGALALDIA L ENVOL
:Basic Bank Account Number:
:Bank Code: 13335
:Branch Code: 00040
:Key: 06
:Account Number: 08932891361
:IBAN: FR7613335000400893289136106
:SWIFT Code: CEPAFRPP333
```

# Field Types
## Standard Fields
sebastianMindee marked this conversation as resolved.
Show resolved Hide resolved
### 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, is `undefined` when at document-level.
* **reconstructed** (`boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).

> **Note:** 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.

### String Field
The text field `StringField` only has one constraint: it's **value** is a `string` (or `undefined`).

## Custom Fields
Custom Fields implement their own definitions & variables, and usually don't inherit from standard fields.
sebastianMindee marked this conversation as resolved.
Show resolved Hide resolved

### Basic Bank Account Number Field
Full extraction of BBAN, including: branch code, bank code, account and key.

A `BankAccountDetailsV2Bban` implements the following attributes:

* `bbanBankCode` (string): The BBAN bank code outputted as a string.
* `bbanBranchCode` (string): The BBAN branch code outputted as a string.
* `bbanKey` (string): The BBAN key outputted as a string.
* `bbanNumber` (string): The BBAN Account number outputted as a string.

# Attributes
The following fields are extracted for Bank Account Details V2:

## Account Holder's Names
**accountHoldersNames** ([StringField](#string-field)): Full extraction of the account holders names.

```js
console.log(result.document.inference.prediction.accountHoldersNames.value);
```

## Basic Bank Account Number
**bban** ([BankAccountDetailsV2Bban](#basic-bank-account-number)): Full extraction of BBAN, including: branch code, bank code, account and key.

```js
console.log(result.document.inference.prediction.bban.value);
```

## IBAN
**iban** ([StringField](#string-field)): Full extraction of the IBAN number.

```js
console.log(result.document.inference.prediction.iban.value);
```

## SWIFT Code
**swiftCode** ([StringField](#string-field)): Full extraction of the SWIFT code.

```js
console.log(result.document.inference.prediction.swiftCode.value);
```

# Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
173 changes: 173 additions & 0 deletions docs/bank_check_v1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
---
title: Bank Check OCR Node.js
---
The Node.js OCR SDK supports the [Bank Check API](https://platform.mindee.com/mindee/bank_check).

Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/us/bank_check/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
![Bank Check sample](https://github.com/mindee/client-lib-test-data/blob/main/us/bank_check/default_sample.jpg?raw=true)

# Quick-Start
```js
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.parse(
mindee.product.us.BankCheckV1,
inputSource
);

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

**Output (RST):**
```rst
########
Document
########
:Mindee ID: b9809586-57ae-4f84-a35d-a85b2be1f2a2
:Filename: default_sample.jpg

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

Prediction
==========
:Check Issue Date: 2022-03-29
:Amount: 15332.90
:Payees: JOHN DOE
JANE DOE
:Routing Number:
:Account Number: 7789778136
:Check Number: 0003401

Page Predictions
================

Page 0
------
:Check Position: Polygon with 21 points.
:Signature Positions: Polygon with 6 points.
:Check Issue Date: 2022-03-29
:Amount: 15332.90
:Payees: JOHN DOE
JANE DOE
:Routing Number:
:Account Number: 7789778136
:Check Number: 0003401
```

# Field Types
## Standard Fields
### 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, is `undefined` when at document-level.
* **reconstructed** (`boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).

> **Note:** 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.


### Amount Field
The amount field `AmountField` only has one constraint: its **value** is a `number` (or `undefined`).

### 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.


### Position Field
The position field `PositionField` does not implement all the basic `Field` attributes, only `boundingBox`, `polygon` and **pageId**. On top of these, it has access to:

* **rectangle** (`[Point, Point, Point, Point]`): a Polygon with four points that may be oriented (even beyond canvas).
* **quadrangle** (`[Point, Point, Point, Point]`): a free polygon made up of four points.

### String Field
The text field `StringField` only has one constraint: it's **value** is a `string` (or `undefined`).

## Page-Level Fields
Some fields are constrained to the page level, and so will not be retrievable to through the document.

# Attributes
The following fields are extracted for Bank Check V1:

## Account Number
**accountNumber** ([StringField](#string-field)): The check payer's account number.

```js
console.log(result.document.inference.prediction.accountNumber.value);
```

## Amount
**amount** ([AmountField](#amount-field)): The amount of the check.

```js
console.log(result.document.inference.prediction.amount.value);
```

## Check Number
**checkNumber** ([StringField](#string-field)): The issuer's check number.

```js
console.log(result.document.inference.prediction.checkNumber.value);
```

## Check Position
[📄](#page-level-fields "This field is only present on individual pages.")**checkPosition** ([PositionField](#position-field)): The position of the check on the document.

```js
console.log(result.document.inference.pages[0].prediction.checkPosition.polygon);
```

## Check Issue Date
**date** ([DateField](#date-field)): The date the check was issued.

```js
console.log(result.document.inference.prediction.date.value);
```

## Payees
**payees** ([StringField](#string-field)): List of the check's payees (recipients).

```js
console.log(result.document.inference.prediction.payees.value);
```

## Routing Number
**routingNumber** ([StringField](#string-field)): The check issuer's routing number.

```js
console.log(result.document.inference.prediction.routingNumber.value);
```

## Signature Positions
[📄](#page-level-fields "This field is only present on individual pages.")**signaturesPositions** ([PositionField](#position-field)): List of signature positions

```js
console.log(result.document.inference.pages[0].prediction.signaturesPositions.polygon);
```

# Questions?
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
Loading