mindee 4.24.0 → 4.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +0 -5
- package/package.json +3 -3
- package/src/parsing/common/document.js +4 -1
- package/src/parsing/common/page.js +17 -7
- package/src/product/financialDocument/financialDocumentV1Document.d.ts +3 -1
- package/src/product/financialDocument/financialDocumentV1Document.js +5 -1
- package/src/product/invoice/invoiceV4Document.d.ts +3 -1
- package/src/product/invoice/invoiceV4Document.js +5 -1
- package/src/product/us/healthcareCard/healthcareCardV1Copay.js +3 -3
- package/src/product/us/healthcareCard/healthcareCardV1Document.d.ts +3 -1
- package/src/product/us/healthcareCard/healthcareCardV1Document.js +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v4.25.0 - 2025-04-08
|
|
4
|
+
### Changes
|
|
5
|
+
* :sparkles: add support for Financial Document V1.12
|
|
6
|
+
* :sparkles: add support for Invoices V4.10
|
|
7
|
+
* :sparkles: add support for US Healthcare Cards V1.2
|
|
8
|
+
### Fixes
|
|
9
|
+
* :arrow_up: upgrade mocha dependency
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## v4.24.1 - 2025-03-27
|
|
13
|
+
### Fixes
|
|
14
|
+
* :bug: fix null objects being return in extras
|
|
15
|
+
|
|
16
|
+
|
|
3
17
|
## v4.24.0 - 2025-03-27
|
|
4
18
|
### Changes
|
|
5
19
|
* :sparkles: update structure for InvoiceSplitterV1
|
package/README.md
CHANGED
|
@@ -166,15 +166,10 @@ Complete details on the working of the library are available in the following gu
|
|
|
166
166
|
* [Node.js Resume OCR](https://developers.mindee.com/docs/nodejs-resume-ocr)
|
|
167
167
|
* [Node.js Financial Document OCR](https://developers.mindee.com/docs/nodejs-financial-document-ocr)
|
|
168
168
|
* [Node.js Passport OCR](https://developers.mindee.com/docs/nodejs-passport-ocr)
|
|
169
|
-
* [Node.js Proof of Address OCR](https://developers.mindee.com/docs/nodejs-proof-of-address-ocr)
|
|
170
|
-
* [Node.js EU License Plate OCR](https://developers.mindee.com/docs/nodejs-eu-license-plate-ocr)
|
|
171
|
-
* [Node.js EU Driver License OCR](https://developers.mindee.com/docs/nodejs-eu-driver-license-ocr)
|
|
172
169
|
* [Node.js FR Bank Account Detail OCR](https://developers.mindee.com/docs/nodejs-fr-bank-account-details-ocr)
|
|
173
170
|
* [Node.js FR Health Card OCR](https://developers.mindee.com/docs/nodejs-fr-health-card-ocr)
|
|
174
171
|
* [Node.js FR ID Card OCR](https://developers.mindee.com/docs/nodejs-fr-carte-nationale-didentite-ocr)
|
|
175
172
|
* [Node.js US Bank Check OCR](https://developers.mindee.com/docs/nodejs-us-bank-check-ocr)
|
|
176
|
-
* [Node.js US W9 OCR](https://developers.mindee.com/docs/nodejs-us-w9-ocr)
|
|
177
|
-
* [Node.js US Driver License OCR](https://developers.mindee.com/docs/nodejs-us-driver-license-ocr)
|
|
178
173
|
* [Node.js Barcode Reader API](https://developers.mindee.com/docs/nodejs-barcode-reader-ocr)
|
|
179
174
|
* [Node.js Cropper API](https://developers.mindee.com/docs/nodejs-cropper-ocr)
|
|
180
175
|
* [Node.js Invoice Splitter API](https://developers.mindee.com/docs/nodejs-invoice-splitter-ocr)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindee",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.25.0",
|
|
4
4
|
"description": "Mindee Client Library for Node.js",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": "bin/mindee.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"homepage": "https://mindee.com/",
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/chai": "^4.3.4",
|
|
44
|
-
"@types/mocha": "^10.0.
|
|
44
|
+
"@types/mocha": "^10.0.10",
|
|
45
45
|
"@types/node": "^18.15.11",
|
|
46
46
|
"@types/tmp": "^0.2.6",
|
|
47
47
|
"@typescript-eslint/eslint-plugin": "^8.15.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"chai": "^4.3.10",
|
|
50
50
|
"eslint": "^9.15.0",
|
|
51
51
|
"eslint-plugin-jsdoc": "^50.5.0",
|
|
52
|
-
"mocha": "^
|
|
52
|
+
"mocha": "^11.1.0",
|
|
53
53
|
"nock": "^13.5.6",
|
|
54
54
|
"ts-node": "^10.9.2",
|
|
55
55
|
"typedoc": "~0.26.11",
|
|
@@ -52,7 +52,10 @@ ${this.inference?.toString()}`;
|
|
|
52
52
|
injectFullTextOcr(rawPrediction) {
|
|
53
53
|
if (rawPrediction["inference"]["pages"].length < 1 ||
|
|
54
54
|
rawPrediction["inference"]["pages"][0]["extras"].length < 1 ||
|
|
55
|
-
!("full_text_ocr" in rawPrediction["inference"]["pages"][0]["extras"])
|
|
55
|
+
!("full_text_ocr" in rawPrediction["inference"]["pages"][0]["extras"]) ||
|
|
56
|
+
!rawPrediction["inference"]["pages"][0]["extras"]["full_text_ocr"] ||
|
|
57
|
+
!("content" in rawPrediction["inference"]["pages"][0]["extras"]["full_text_ocr"]) ||
|
|
58
|
+
!rawPrediction["inference"]["pages"][0]["extras"]["full_text_ocr"]["content"]) {
|
|
56
59
|
return;
|
|
57
60
|
}
|
|
58
61
|
const fullTextOcr = rawPrediction["inference"]["pages"].filter((e) => "extras" in e).map((e) => e["extras"]["full_text_ocr"]["content"]).join("\n");
|
|
@@ -29,13 +29,15 @@ class Page {
|
|
|
29
29
|
Object.keys(rawPrediction["extras"].length > 0)) {
|
|
30
30
|
const extras = {};
|
|
31
31
|
Object.entries(rawPrediction["extras"]).forEach(([extraKey, extraValue]) => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
if (extraValue) {
|
|
33
|
+
switch (extraKey) {
|
|
34
|
+
case "cropper":
|
|
35
|
+
extras["cropper"] = new extras_1.CropperExtra(extraValue);
|
|
36
|
+
break;
|
|
37
|
+
case "full_text_ocr":
|
|
38
|
+
extras["fullTextOcr"] = new extras_1.FullTextOcrExtra(extraValue);
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
39
41
|
}
|
|
40
42
|
});
|
|
41
43
|
this.extras = new extras_2.Extras(extras);
|
|
@@ -58,6 +60,14 @@ ${this.prediction.toString()}
|
|
|
58
60
|
if (!("extras" in rawPrediction) || !("full_text_ocr" in rawPrediction["extras"])) {
|
|
59
61
|
return;
|
|
60
62
|
}
|
|
63
|
+
if (!rawPrediction["extras"]
|
|
64
|
+
|| rawPrediction["extras"] === null ||
|
|
65
|
+
!rawPrediction["extras"]["full_text_ocr"] ||
|
|
66
|
+
rawPrediction["extras"]["full_text_ocr"] === null ||
|
|
67
|
+
!rawPrediction["extras"]["full_text_ocr"]["content"] ||
|
|
68
|
+
rawPrediction["extras"]["full_text_ocr"]["content"] === null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
61
71
|
const fullTextOcr = rawPrediction["extras"]["full_text_ocr"]["content"];
|
|
62
72
|
const artificialTextObj = {
|
|
63
73
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -2,7 +2,7 @@ import { Prediction, StringDict } from "../../parsing/common";
|
|
|
2
2
|
import { FinancialDocumentV1LineItem } from "./financialDocumentV1LineItem";
|
|
3
3
|
import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
|
|
4
4
|
/**
|
|
5
|
-
* Financial Document API version 1.
|
|
5
|
+
* Financial Document API version 1.12 document data.
|
|
6
6
|
*/
|
|
7
7
|
export declare class FinancialDocumentV1Document implements Prediction {
|
|
8
8
|
/** The customer's address used for billing. */
|
|
@@ -26,6 +26,8 @@ export declare class FinancialDocumentV1Document implements Prediction {
|
|
|
26
26
|
* is a receipt.
|
|
27
27
|
*/
|
|
28
28
|
documentType: ClassificationField;
|
|
29
|
+
/** Document type extended. */
|
|
30
|
+
documentTypeExtended: ClassificationField;
|
|
29
31
|
/** The date on which the payment is due. */
|
|
30
32
|
dueDate: DateField;
|
|
31
33
|
/** The invoice number or identifier only if document is an invoice. */
|
|
@@ -5,7 +5,7 @@ const common_1 = require("../../parsing/common");
|
|
|
5
5
|
const financialDocumentV1LineItem_1 = require("./financialDocumentV1LineItem");
|
|
6
6
|
const standard_1 = require("../../parsing/standard");
|
|
7
7
|
/**
|
|
8
|
-
* Financial Document API version 1.
|
|
8
|
+
* Financial Document API version 1.12 document data.
|
|
9
9
|
*/
|
|
10
10
|
class FinancialDocumentV1Document {
|
|
11
11
|
constructor(rawPrediction, pageId) {
|
|
@@ -54,6 +54,9 @@ class FinancialDocumentV1Document {
|
|
|
54
54
|
this.documentType = new standard_1.ClassificationField({
|
|
55
55
|
prediction: rawPrediction["document_type"],
|
|
56
56
|
});
|
|
57
|
+
this.documentTypeExtended = new standard_1.ClassificationField({
|
|
58
|
+
prediction: rawPrediction["document_type_extended"],
|
|
59
|
+
});
|
|
57
60
|
this.dueDate = new standard_1.DateField({
|
|
58
61
|
prediction: rawPrediction["due_date"],
|
|
59
62
|
pageId: pageId,
|
|
@@ -195,6 +198,7 @@ class FinancialDocumentV1Document {
|
|
|
195
198
|
:Shipping Address: ${this.shippingAddress}
|
|
196
199
|
:Billing Address: ${this.billingAddress}
|
|
197
200
|
:Document Type: ${this.documentType}
|
|
201
|
+
:Document Type Extended: ${this.documentTypeExtended}
|
|
198
202
|
:Purchase Subcategory: ${this.subcategory}
|
|
199
203
|
:Purchase Category: ${this.category}
|
|
200
204
|
:Total Tax: ${this.totalTax}
|
|
@@ -2,7 +2,7 @@ import { Prediction, StringDict } from "../../parsing/common";
|
|
|
2
2
|
import { InvoiceV4LineItem } from "./invoiceV4LineItem";
|
|
3
3
|
import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
|
|
4
4
|
/**
|
|
5
|
-
* Invoice API version 4.
|
|
5
|
+
* Invoice API version 4.10 document data.
|
|
6
6
|
*/
|
|
7
7
|
export declare class InvoiceV4Document implements Prediction {
|
|
8
8
|
/** The customer billing address. */
|
|
@@ -19,6 +19,8 @@ export declare class InvoiceV4Document implements Prediction {
|
|
|
19
19
|
date: DateField;
|
|
20
20
|
/** Document type: INVOICE or CREDIT NOTE. */
|
|
21
21
|
documentType: ClassificationField;
|
|
22
|
+
/** Document type extended. */
|
|
23
|
+
documentTypeExtended: ClassificationField;
|
|
22
24
|
/** The date on which the payment is due. */
|
|
23
25
|
dueDate: DateField;
|
|
24
26
|
/** The invoice number or identifier. */
|
|
@@ -5,7 +5,7 @@ const common_1 = require("../../parsing/common");
|
|
|
5
5
|
const invoiceV4LineItem_1 = require("./invoiceV4LineItem");
|
|
6
6
|
const standard_1 = require("../../parsing/standard");
|
|
7
7
|
/**
|
|
8
|
-
* Invoice API version 4.
|
|
8
|
+
* Invoice API version 4.10 document data.
|
|
9
9
|
*/
|
|
10
10
|
class InvoiceV4Document {
|
|
11
11
|
constructor(rawPrediction, pageId) {
|
|
@@ -47,6 +47,9 @@ class InvoiceV4Document {
|
|
|
47
47
|
this.documentType = new standard_1.ClassificationField({
|
|
48
48
|
prediction: rawPrediction["document_type"],
|
|
49
49
|
});
|
|
50
|
+
this.documentTypeExtended = new standard_1.ClassificationField({
|
|
51
|
+
prediction: rawPrediction["document_type_extended"],
|
|
52
|
+
});
|
|
50
53
|
this.dueDate = new standard_1.DateField({
|
|
51
54
|
prediction: rawPrediction["due_date"],
|
|
52
55
|
pageId: pageId,
|
|
@@ -172,6 +175,7 @@ class InvoiceV4Document {
|
|
|
172
175
|
:Shipping Address: ${this.shippingAddress}
|
|
173
176
|
:Billing Address: ${this.billingAddress}
|
|
174
177
|
:Document Type: ${this.documentType}
|
|
178
|
+
:Document Type Extended: ${this.documentTypeExtended}
|
|
175
179
|
:Line Items: ${lineItemsSummary}`.trimEnd();
|
|
176
180
|
return (0, common_1.cleanOutString)(outStr);
|
|
177
181
|
}
|
|
@@ -54,7 +54,7 @@ class HealthcareCardV1Copay {
|
|
|
54
54
|
return ("| " +
|
|
55
55
|
printable.serviceFees.padEnd(12) +
|
|
56
56
|
" | " +
|
|
57
|
-
printable.serviceName.padEnd(
|
|
57
|
+
printable.serviceName.padEnd(20) +
|
|
58
58
|
" |");
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -63,9 +63,9 @@ _HealthcareCardV1Copay_instances = new WeakSet(), _HealthcareCardV1Copay_printab
|
|
|
63
63
|
return {
|
|
64
64
|
serviceFees: this.serviceFees !== undefined ? (0, common_1.floatToString)(this.serviceFees) : "",
|
|
65
65
|
serviceName: this.serviceName ?
|
|
66
|
-
this.serviceName.length <=
|
|
66
|
+
this.serviceName.length <= 20 ?
|
|
67
67
|
(0, common_1.cleanSpecialChars)(this.serviceName) :
|
|
68
|
-
(0, common_1.cleanSpecialChars)(this.serviceName).slice(0,
|
|
68
|
+
(0, common_1.cleanSpecialChars)(this.serviceName).slice(0, 17) + "..." :
|
|
69
69
|
"",
|
|
70
70
|
};
|
|
71
71
|
};
|
|
@@ -2,7 +2,7 @@ import { Prediction, StringDict } from "../../../parsing/common";
|
|
|
2
2
|
import { HealthcareCardV1Copay } from "./healthcareCardV1Copay";
|
|
3
3
|
import { DateField, StringField } from "../../../parsing/standard";
|
|
4
4
|
/**
|
|
5
|
-
* Healthcare Card API version 1.
|
|
5
|
+
* Healthcare Card API version 1.2 document data.
|
|
6
6
|
*/
|
|
7
7
|
export declare class HealthcareCardV1Document implements Prediction {
|
|
8
8
|
/** The name of the company that provides the healthcare plan. */
|
|
@@ -27,6 +27,8 @@ export declare class HealthcareCardV1Document implements Prediction {
|
|
|
27
27
|
rxBin: StringField;
|
|
28
28
|
/** The group number for prescription drug coverage. */
|
|
29
29
|
rxGrp: StringField;
|
|
30
|
+
/** The ID number for prescription drug coverage. */
|
|
31
|
+
rxId: StringField;
|
|
30
32
|
/** The PCN number for prescription drug coverage. */
|
|
31
33
|
rxPcn: StringField;
|
|
32
34
|
constructor(rawPrediction: StringDict, pageId?: number);
|
|
@@ -5,7 +5,7 @@ const common_1 = require("../../../parsing/common");
|
|
|
5
5
|
const healthcareCardV1Copay_1 = require("./healthcareCardV1Copay");
|
|
6
6
|
const standard_1 = require("../../../parsing/standard");
|
|
7
7
|
/**
|
|
8
|
-
* Healthcare Card API version 1.
|
|
8
|
+
* Healthcare Card API version 1.2 document data.
|
|
9
9
|
*/
|
|
10
10
|
class HealthcareCardV1Document {
|
|
11
11
|
constructor(rawPrediction, pageId) {
|
|
@@ -59,6 +59,10 @@ class HealthcareCardV1Document {
|
|
|
59
59
|
prediction: rawPrediction["rx_grp"],
|
|
60
60
|
pageId: pageId,
|
|
61
61
|
});
|
|
62
|
+
this.rxId = new standard_1.StringField({
|
|
63
|
+
prediction: rawPrediction["rx_id"],
|
|
64
|
+
pageId: pageId,
|
|
65
|
+
});
|
|
62
66
|
this.rxPcn = new standard_1.StringField({
|
|
63
67
|
prediction: rawPrediction["rx_pcn"],
|
|
64
68
|
pageId: pageId,
|
|
@@ -71,10 +75,10 @@ class HealthcareCardV1Document {
|
|
|
71
75
|
const dependents = this.dependents.join("\n ");
|
|
72
76
|
let copaysSummary = "";
|
|
73
77
|
if (this.copays && this.copays.length > 0) {
|
|
74
|
-
const copaysColSizes = [14,
|
|
78
|
+
const copaysColSizes = [14, 22];
|
|
75
79
|
copaysSummary += "\n" + (0, common_1.lineSeparator)(copaysColSizes, "-") + "\n ";
|
|
76
80
|
copaysSummary += "| Service Fees ";
|
|
77
|
-
copaysSummary += "| Service Name
|
|
81
|
+
copaysSummary += "| Service Name ";
|
|
78
82
|
copaysSummary += "|\n" + (0, common_1.lineSeparator)(copaysColSizes, "=");
|
|
79
83
|
copaysSummary += this.copays.map((item) => "\n " + item.toTableLine() + "\n" + (0, common_1.lineSeparator)(copaysColSizes, "-")).join("");
|
|
80
84
|
}
|
|
@@ -86,6 +90,7 @@ class HealthcareCardV1Document {
|
|
|
86
90
|
:Group Number: ${this.groupNumber}
|
|
87
91
|
:Payer ID: ${this.payerId}
|
|
88
92
|
:RX BIN: ${this.rxBin}
|
|
93
|
+
:RX ID: ${this.rxId}
|
|
89
94
|
:RX GRP: ${this.rxGrp}
|
|
90
95
|
:RX PCN: ${this.rxPcn}
|
|
91
96
|
:copays: ${copaysSummary}
|