mindee 4.27.1 → 4.28.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 +9 -0
- package/package.json +4 -3
- package/src/imageOperations/common/imageExtractor.d.ts +1 -1
- package/src/imageOperations/common/imageExtractor.js +1 -1
- package/src/imageOperations/invoiceSplitterExtractor/invoiceSplitterExtractor.js +5 -2
- package/src/imageOperations/multiReceiptsExtractor/multiReceiptsExtractor.js +5 -2
- package/src/parsing/common/document.js +1 -0
- package/src/parsing/standard/addressField.d.ts +25 -0
- package/src/parsing/standard/addressField.js +40 -0
- package/src/parsing/standard/index.d.ts +10 -9
- package/src/parsing/standard/index.js +19 -17
- package/src/pdf/pdfCompressor.js +5 -2
- package/src/pdf/pdfOperation.js +3 -1
- package/src/product/financialDocument/financialDocumentV1Document.d.ts +8 -8
- package/src/product/financialDocument/financialDocumentV1Document.js +5 -5
- package/src/product/ind/indianPassport/indianPassportV1Document.js +1 -1
- package/src/product/internationalId/internationalIdV2Document.d.ts +1 -1
- package/src/product/internationalId/internationalIdV2Document.js +1 -1
- package/src/product/invoice/invoiceV4Document.d.ts +10 -6
- package/src/product/invoice/invoiceV4Document.js +13 -5
- package/src/product/invoiceSplitter/invoiceSplitterV1Document.d.ts +1 -1
- package/src/product/invoiceSplitter/invoiceSplitterV1Document.js +1 -1
- package/src/product/receipt/receiptV5Document.d.ts +1 -1
- package/src/product/receipt/receiptV5Document.js +1 -1
- package/src/product/us/healthcareCard/healthcareCardV1Copay.d.ts +3 -3
- package/src/product/us/healthcareCard/healthcareCardV1Copay.js +1 -1
- package/src/product/us/healthcareCard/healthcareCardV1Document.d.ts +4 -2
- package/src/product/us/healthcareCard/healthcareCardV1Document.js +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v4.28.0 - 2025-06-03
|
|
4
|
+
### Changes
|
|
5
|
+
* :sparkles: add support for address fields
|
|
6
|
+
* :sparkles: add support for Financial Document V1.12
|
|
7
|
+
* :sparkles: add support for Invoices V4.10
|
|
8
|
+
* :sparkles: add support for US Healthcare Cards V1.2
|
|
9
|
+
### Fixes
|
|
10
|
+
* :bug: fix default-encrypted & XFA pdfs not opening
|
|
11
|
+
|
|
3
12
|
## v4.27.1 - 2025-04-23
|
|
4
13
|
### Fixes
|
|
5
14
|
* :bug: fix workflow polling not working when ran with ts-node
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindee",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.28.0",
|
|
4
4
|
"description": "Mindee Client Library for Node.js",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": "bin/mindee.js",
|
|
@@ -56,14 +56,15 @@
|
|
|
56
56
|
"typescript": "^5.6.3"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
+
"@cantoo/pdf-lib": "^2.3.2",
|
|
59
60
|
"commander": "~9.4.1",
|
|
60
61
|
"file-type": "~16.5.4",
|
|
61
62
|
"form-data": "~3.0.1",
|
|
62
63
|
"node-poppler": "^7.2.2",
|
|
63
|
-
"pdf-lib": "^1.17.1",
|
|
64
64
|
"pdf.js-extract": "^0.2.1",
|
|
65
65
|
"sharp": "^0.33.5",
|
|
66
|
-
"tmp": "^0.2.3"
|
|
66
|
+
"tmp": "^0.2.3",
|
|
67
|
+
"tslib": "^2.8.1"
|
|
67
68
|
},
|
|
68
69
|
"keywords": [
|
|
69
70
|
"typescript",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractFromPage = extractFromPage;
|
|
4
|
-
const pdf_lib_1 = require("pdf-lib");
|
|
4
|
+
const pdf_lib_1 = require("@cantoo/pdf-lib");
|
|
5
5
|
const geometry_1 = require("../../geometry");
|
|
6
6
|
/**
|
|
7
7
|
* Extracts elements from a page based off of a list of bounding boxes.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractInvoices = extractInvoices;
|
|
4
|
-
const pdf_lib_1 = require("pdf-lib");
|
|
4
|
+
const pdf_lib_1 = require("@cantoo/pdf-lib");
|
|
5
5
|
const errors_1 = require("../../errors");
|
|
6
6
|
const product_1 = require("../../product");
|
|
7
7
|
const extractedInvoiceSplitterImage_1 = require("./extractedInvoiceSplitterImage");
|
|
@@ -30,7 +30,10 @@ async function getPdfDoc(inputFile) {
|
|
|
30
30
|
if (!inputFile.isPdf()) {
|
|
31
31
|
throw new errors_1.MindeeMimeTypeError("Invoice Splitter is only compatible with pdf documents.");
|
|
32
32
|
}
|
|
33
|
-
const pdfDoc = await pdf_lib_1.PDFDocument.load(inputFile.fileObject
|
|
33
|
+
const pdfDoc = await pdf_lib_1.PDFDocument.load(inputFile.fileObject, {
|
|
34
|
+
ignoreEncryption: true,
|
|
35
|
+
password: ""
|
|
36
|
+
});
|
|
34
37
|
if (pdfDoc.getPageCount() < 2) {
|
|
35
38
|
throw new errors_1.MindeeError("Invoice Splitter is only compatible with multi-page-pdf documents.");
|
|
36
39
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.extractReceipts = extractReceipts;
|
|
4
|
-
const pdf_lib_1 = require("pdf-lib");
|
|
4
|
+
const pdf_lib_1 = require("@cantoo/pdf-lib");
|
|
5
5
|
const errors_1 = require("../../errors");
|
|
6
6
|
const extractedMultiReceiptImage_1 = require("./extractedMultiReceiptImage");
|
|
7
7
|
const common_1 = require("../common");
|
|
@@ -30,7 +30,10 @@ async function loadPdfDoc(inputFile) {
|
|
|
30
30
|
'" Currently supported types are .png, .jpg and .pdf');
|
|
31
31
|
}
|
|
32
32
|
else if (inputFile.isPdf()) {
|
|
33
|
-
pdfDoc = await pdf_lib_1.PDFDocument.load(inputFile.fileObject
|
|
33
|
+
pdfDoc = await pdf_lib_1.PDFDocument.load(inputFile.fileObject, {
|
|
34
|
+
ignoreEncryption: true,
|
|
35
|
+
password: ""
|
|
36
|
+
});
|
|
34
37
|
}
|
|
35
38
|
else {
|
|
36
39
|
pdfDoc = await pdf_lib_1.PDFDocument.create();
|
|
@@ -55,6 +55,7 @@ ${this.inference?.toString()}`;
|
|
|
55
55
|
}
|
|
56
56
|
injectFullTextOcr(rawPrediction) {
|
|
57
57
|
if (rawPrediction["inference"]["pages"].length < 1 ||
|
|
58
|
+
!("extras" in rawPrediction["inference"]["pages"][0]) ||
|
|
58
59
|
rawPrediction["inference"]["pages"][0]["extras"].length < 1 ||
|
|
59
60
|
!("full_text_ocr" in rawPrediction["inference"]["pages"][0]["extras"]) ||
|
|
60
61
|
!rawPrediction["inference"]["pages"][0]["extras"]["full_text_ocr"] ||
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StringField, FieldConstructor } from "./text";
|
|
2
|
+
/**
|
|
3
|
+
* A field containing a detailed address value broken down into components
|
|
4
|
+
* (street number, city, postal code, …) while still exposing the full
|
|
5
|
+
* address string through {@link StringField.value}.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AddressField extends StringField {
|
|
8
|
+
/** Street number. */
|
|
9
|
+
streetNumber?: string;
|
|
10
|
+
/** Street name. */
|
|
11
|
+
streetName?: string;
|
|
12
|
+
/** PO-box number. */
|
|
13
|
+
poBox?: string;
|
|
14
|
+
/** Additional address complement. */
|
|
15
|
+
addressComplement?: string;
|
|
16
|
+
/** City or locality. */
|
|
17
|
+
city?: string;
|
|
18
|
+
/** Postal / ZIP code. */
|
|
19
|
+
postalCode?: string;
|
|
20
|
+
/** State, province or region. */
|
|
21
|
+
state?: string;
|
|
22
|
+
/** Country. */
|
|
23
|
+
country?: string;
|
|
24
|
+
constructor({ prediction, valueKey, reconstructed, pageId, }: FieldConstructor);
|
|
25
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddressField = void 0;
|
|
4
|
+
const text_1 = require("./text");
|
|
5
|
+
/**
|
|
6
|
+
* A field containing a detailed address value broken down into components
|
|
7
|
+
* (street number, city, postal code, …) while still exposing the full
|
|
8
|
+
* address string through {@link StringField.value}.
|
|
9
|
+
*/
|
|
10
|
+
class AddressField extends text_1.StringField {
|
|
11
|
+
constructor({ prediction = {}, valueKey = "value", reconstructed = false, pageId, }) {
|
|
12
|
+
super({ prediction, valueKey, reconstructed, pageId });
|
|
13
|
+
// Populate the sub-components if they exist in the prediction object
|
|
14
|
+
if (prediction["street_number"]) {
|
|
15
|
+
this.streetNumber = prediction["street_number"];
|
|
16
|
+
}
|
|
17
|
+
if (prediction["street_name"]) {
|
|
18
|
+
this.streetName = prediction["street_name"];
|
|
19
|
+
}
|
|
20
|
+
if (prediction["po_box"]) {
|
|
21
|
+
this.poBox = prediction["po_box"];
|
|
22
|
+
}
|
|
23
|
+
if (prediction["address_complement"]) {
|
|
24
|
+
this.addressComplement = prediction["address_complement"];
|
|
25
|
+
}
|
|
26
|
+
if (prediction["city"]) {
|
|
27
|
+
this.city = prediction["city"];
|
|
28
|
+
}
|
|
29
|
+
if (prediction["postal_code"]) {
|
|
30
|
+
this.postalCode = prediction["postal_code"];
|
|
31
|
+
}
|
|
32
|
+
if (prediction["state"]) {
|
|
33
|
+
this.state = prediction["state"];
|
|
34
|
+
}
|
|
35
|
+
if (prediction["country"]) {
|
|
36
|
+
this.country = prediction["country"];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.AddressField = AddressField;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { Taxes, TaxField } from "./tax";
|
|
3
|
-
export { PaymentDetailsField } from "./paymentDetails";
|
|
4
|
-
export { BooleanField } from "./boolean";
|
|
5
|
-
export { LocaleField } from "./locale";
|
|
1
|
+
export { AddressField } from "./addressField";
|
|
6
2
|
export { AmountField } from "./amount";
|
|
7
|
-
export { DateField } from "./date";
|
|
8
3
|
export { BaseField, BaseFieldConstructor } from "./base";
|
|
9
|
-
export {
|
|
4
|
+
export { BooleanField } from "./boolean";
|
|
5
|
+
export { ClassificationField } from "./classification";
|
|
10
6
|
export { CompanyRegistrationField } from "./companyRegistration";
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
7
|
+
export { DateField } from "./date";
|
|
8
|
+
export { LocaleField } from "./locale";
|
|
13
9
|
export { Field } from "./field";
|
|
10
|
+
export { Taxes, TaxField } from "./tax";
|
|
11
|
+
export { StringField } from "./text";
|
|
12
|
+
export { PaymentDetailsField } from "./paymentDetails";
|
|
13
|
+
export { PositionField } from "./position";
|
|
14
|
+
export { Word } from "./word";
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PositionField = exports.PaymentDetailsField = exports.StringField = exports.TaxField = exports.Taxes = exports.Field = exports.LocaleField = exports.DateField = exports.CompanyRegistrationField = exports.ClassificationField = exports.BooleanField = exports.BaseField = exports.AmountField = exports.AddressField = void 0;
|
|
4
|
+
var addressField_1 = require("./addressField");
|
|
5
|
+
Object.defineProperty(exports, "AddressField", { enumerable: true, get: function () { return addressField_1.AddressField; } });
|
|
6
|
+
var amount_1 = require("./amount");
|
|
7
|
+
Object.defineProperty(exports, "AmountField", { enumerable: true, get: function () { return amount_1.AmountField; } });
|
|
8
|
+
var base_1 = require("./base");
|
|
9
|
+
Object.defineProperty(exports, "BaseField", { enumerable: true, get: function () { return base_1.BaseField; } });
|
|
10
|
+
var boolean_1 = require("./boolean");
|
|
11
|
+
Object.defineProperty(exports, "BooleanField", { enumerable: true, get: function () { return boolean_1.BooleanField; } });
|
|
4
12
|
var classification_1 = require("./classification");
|
|
5
13
|
Object.defineProperty(exports, "ClassificationField", { enumerable: true, get: function () { return classification_1.ClassificationField; } });
|
|
14
|
+
var companyRegistration_1 = require("./companyRegistration");
|
|
15
|
+
Object.defineProperty(exports, "CompanyRegistrationField", { enumerable: true, get: function () { return companyRegistration_1.CompanyRegistrationField; } });
|
|
16
|
+
var date_1 = require("./date");
|
|
17
|
+
Object.defineProperty(exports, "DateField", { enumerable: true, get: function () { return date_1.DateField; } });
|
|
18
|
+
var locale_1 = require("./locale");
|
|
19
|
+
Object.defineProperty(exports, "LocaleField", { enumerable: true, get: function () { return locale_1.LocaleField; } });
|
|
20
|
+
var field_1 = require("./field");
|
|
21
|
+
Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return field_1.Field; } });
|
|
6
22
|
var tax_1 = require("./tax");
|
|
7
23
|
Object.defineProperty(exports, "Taxes", { enumerable: true, get: function () { return tax_1.Taxes; } });
|
|
8
24
|
Object.defineProperty(exports, "TaxField", { enumerable: true, get: function () { return tax_1.TaxField; } });
|
|
25
|
+
var text_1 = require("./text");
|
|
26
|
+
Object.defineProperty(exports, "StringField", { enumerable: true, get: function () { return text_1.StringField; } });
|
|
9
27
|
var paymentDetails_1 = require("./paymentDetails");
|
|
10
28
|
Object.defineProperty(exports, "PaymentDetailsField", { enumerable: true, get: function () { return paymentDetails_1.PaymentDetailsField; } });
|
|
11
|
-
var boolean_1 = require("./boolean");
|
|
12
|
-
Object.defineProperty(exports, "BooleanField", { enumerable: true, get: function () { return boolean_1.BooleanField; } });
|
|
13
|
-
var locale_1 = require("./locale");
|
|
14
|
-
Object.defineProperty(exports, "LocaleField", { enumerable: true, get: function () { return locale_1.LocaleField; } });
|
|
15
|
-
var amount_1 = require("./amount");
|
|
16
|
-
Object.defineProperty(exports, "AmountField", { enumerable: true, get: function () { return amount_1.AmountField; } });
|
|
17
|
-
var date_1 = require("./date");
|
|
18
|
-
Object.defineProperty(exports, "DateField", { enumerable: true, get: function () { return date_1.DateField; } });
|
|
19
|
-
var base_1 = require("./base");
|
|
20
|
-
Object.defineProperty(exports, "BaseField", { enumerable: true, get: function () { return base_1.BaseField; } });
|
|
21
|
-
var companyRegistration_1 = require("./companyRegistration");
|
|
22
|
-
Object.defineProperty(exports, "CompanyRegistrationField", { enumerable: true, get: function () { return companyRegistration_1.CompanyRegistrationField; } });
|
|
23
29
|
var position_1 = require("./position");
|
|
24
30
|
Object.defineProperty(exports, "PositionField", { enumerable: true, get: function () { return position_1.PositionField; } });
|
|
25
|
-
var text_1 = require("./text");
|
|
26
|
-
Object.defineProperty(exports, "StringField", { enumerable: true, get: function () { return text_1.StringField; } });
|
|
27
|
-
var field_1 = require("./field");
|
|
28
|
-
Object.defineProperty(exports, "Field", { enumerable: true, get: function () { return field_1.Field; } });
|
package/src/pdf/pdfCompressor.js
CHANGED
|
@@ -32,7 +32,7 @@ const tmp_1 = __importDefault(require("tmp"));
|
|
|
32
32
|
const pdfUtils_1 = require("./pdfUtils");
|
|
33
33
|
const fs = __importStar(require("node:fs"));
|
|
34
34
|
const node_poppler_1 = require("node-poppler");
|
|
35
|
-
const pdf_lib_1 = require("pdf-lib");
|
|
35
|
+
const pdf_lib_1 = require("@cantoo/pdf-lib");
|
|
36
36
|
const imageOperations_1 = require("../imageOperations");
|
|
37
37
|
/**
|
|
38
38
|
* Compresses each page of a provided PDF buffer.
|
|
@@ -118,7 +118,10 @@ async function compressPdfPages(pdfData, extractedPdfInfo, imageQuality, disable
|
|
|
118
118
|
* @returns A Promise resolving to an array of compressed page buffers.
|
|
119
119
|
*/
|
|
120
120
|
async function compressPagesWithQuality(pdfData, extractedPdfInfo, imageQuality, disableSourceText, extractedText) {
|
|
121
|
-
const pdfDoc = await pdf_lib_1.PDFDocument.load(pdfData
|
|
121
|
+
const pdfDoc = await pdf_lib_1.PDFDocument.load(pdfData, {
|
|
122
|
+
ignoreEncryption: true,
|
|
123
|
+
password: ""
|
|
124
|
+
});
|
|
122
125
|
const compressedPages = [];
|
|
123
126
|
for (let i = 0; i < extractedPdfInfo.pages.length; i++) {
|
|
124
127
|
const page = pdfDoc.getPages()[i];
|
package/src/pdf/pdfOperation.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.extractPages = extractPages;
|
|
4
4
|
exports.countPages = countPages;
|
|
5
5
|
const handler_1 = require("../errors/handler");
|
|
6
|
-
const pdf_lib_1 = require("pdf-lib");
|
|
6
|
+
const pdf_lib_1 = require("@cantoo/pdf-lib");
|
|
7
7
|
const input_1 = require("../input");
|
|
8
8
|
const errors_1 = require("../errors");
|
|
9
9
|
const logger_1 = require("../logger");
|
|
@@ -16,6 +16,7 @@ const logger_1 = require("../logger");
|
|
|
16
16
|
async function extractPages(file, pageOptions) {
|
|
17
17
|
const currentPdf = await pdf_lib_1.PDFDocument.load(file, {
|
|
18
18
|
ignoreEncryption: true,
|
|
19
|
+
password: ""
|
|
19
20
|
});
|
|
20
21
|
const newPdf = await pdf_lib_1.PDFDocument.create();
|
|
21
22
|
const pageCount = currentPdf.getPageCount();
|
|
@@ -68,6 +69,7 @@ async function extractPages(file, pageOptions) {
|
|
|
68
69
|
async function countPages(file) {
|
|
69
70
|
const currentPdf = await pdf_lib_1.PDFDocument.load(file, {
|
|
70
71
|
ignoreEncryption: true,
|
|
72
|
+
password: ""
|
|
71
73
|
});
|
|
72
74
|
return currentPdf.getPageCount();
|
|
73
75
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
2
|
import { FinancialDocumentV1LineItem } from "./financialDocumentV1LineItem";
|
|
3
|
-
import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
|
|
3
|
+
import { AddressField, 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.14 document data.
|
|
6
6
|
*/
|
|
7
7
|
export declare class FinancialDocumentV1Document implements Prediction {
|
|
8
8
|
/** The customer's address used for billing. */
|
|
9
|
-
billingAddress:
|
|
10
|
-
/** The purchase category
|
|
9
|
+
billingAddress: AddressField;
|
|
10
|
+
/** The purchase category. */
|
|
11
11
|
category: ClassificationField;
|
|
12
12
|
/** The address of the customer. */
|
|
13
|
-
customerAddress:
|
|
13
|
+
customerAddress: AddressField;
|
|
14
14
|
/** List of company registration numbers associated to the customer. */
|
|
15
15
|
customerCompanyRegistrations: CompanyRegistrationField[];
|
|
16
16
|
/** The customer account number or identifier from the supplier. */
|
|
@@ -45,11 +45,11 @@ export declare class FinancialDocumentV1Document implements Prediction {
|
|
|
45
45
|
/** List of Reference numbers, including PO number, only if the document is an invoice. */
|
|
46
46
|
referenceNumbers: StringField[];
|
|
47
47
|
/** The customer's address used for shipping. */
|
|
48
|
-
shippingAddress:
|
|
49
|
-
/** The purchase subcategory for transport
|
|
48
|
+
shippingAddress: AddressField;
|
|
49
|
+
/** The purchase subcategory for transport, food and shooping. */
|
|
50
50
|
subcategory: ClassificationField;
|
|
51
51
|
/** The address of the supplier or merchant. */
|
|
52
|
-
supplierAddress:
|
|
52
|
+
supplierAddress: AddressField;
|
|
53
53
|
/** List of company registration numbers associated to the supplier. */
|
|
54
54
|
supplierCompanyRegistrations: CompanyRegistrationField[];
|
|
55
55
|
/** The email of the supplier or merchant. */
|
|
@@ -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.14 document data.
|
|
9
9
|
*/
|
|
10
10
|
class FinancialDocumentV1Document {
|
|
11
11
|
constructor(rawPrediction, pageId) {
|
|
@@ -19,14 +19,14 @@ class FinancialDocumentV1Document {
|
|
|
19
19
|
this.supplierCompanyRegistrations = [];
|
|
20
20
|
/** List of payment details associated to the supplier (only for invoices). */
|
|
21
21
|
this.supplierPaymentDetails = [];
|
|
22
|
-
this.billingAddress = new standard_1.
|
|
22
|
+
this.billingAddress = new standard_1.AddressField({
|
|
23
23
|
prediction: rawPrediction["billing_address"],
|
|
24
24
|
pageId: pageId,
|
|
25
25
|
});
|
|
26
26
|
this.category = new standard_1.ClassificationField({
|
|
27
27
|
prediction: rawPrediction["category"],
|
|
28
28
|
});
|
|
29
|
-
this.customerAddress = new standard_1.
|
|
29
|
+
this.customerAddress = new standard_1.AddressField({
|
|
30
30
|
prediction: rawPrediction["customer_address"],
|
|
31
31
|
pageId: pageId,
|
|
32
32
|
});
|
|
@@ -90,14 +90,14 @@ class FinancialDocumentV1Document {
|
|
|
90
90
|
prediction: itemPrediction,
|
|
91
91
|
pageId: pageId,
|
|
92
92
|
})));
|
|
93
|
-
this.shippingAddress = new standard_1.
|
|
93
|
+
this.shippingAddress = new standard_1.AddressField({
|
|
94
94
|
prediction: rawPrediction["shipping_address"],
|
|
95
95
|
pageId: pageId,
|
|
96
96
|
});
|
|
97
97
|
this.subcategory = new standard_1.ClassificationField({
|
|
98
98
|
prediction: rawPrediction["subcategory"],
|
|
99
99
|
});
|
|
100
|
-
this.supplierAddress = new standard_1.
|
|
100
|
+
this.supplierAddress = new standard_1.AddressField({
|
|
101
101
|
prediction: rawPrediction["supplier_address"],
|
|
102
102
|
pageId: pageId,
|
|
103
103
|
});
|
|
@@ -121,10 +121,10 @@ class IndianPassportV1Document {
|
|
|
121
121
|
:Name of Mother: ${this.nameOfMother}
|
|
122
122
|
:Old Passport Date of Issue: ${this.oldPassportDateOfIssue}
|
|
123
123
|
:Old Passport Number: ${this.oldPassportNumber}
|
|
124
|
+
:Old Passport Place of Issue: ${this.oldPassportPlaceOfIssue}
|
|
124
125
|
:Address Line 1: ${this.address1}
|
|
125
126
|
:Address Line 2: ${this.address2}
|
|
126
127
|
:Address Line 3: ${this.address3}
|
|
127
|
-
:Old Passport Place of Issue: ${this.oldPassportPlaceOfIssue}
|
|
128
128
|
:File Number: ${this.fileNumber}`.trimEnd();
|
|
129
129
|
return (0, common_1.cleanOutString)(outStr);
|
|
130
130
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
2
|
import { ClassificationField, DateField, StringField } from "../../parsing/standard";
|
|
3
3
|
/**
|
|
4
|
-
* International ID API version 2.
|
|
4
|
+
* International ID API version 2.2 document data.
|
|
5
5
|
*/
|
|
6
6
|
export declare class InternationalIdV2Document implements Prediction {
|
|
7
7
|
/** The physical address of the document holder. */
|
|
@@ -4,7 +4,7 @@ exports.InternationalIdV2Document = void 0;
|
|
|
4
4
|
const common_1 = require("../../parsing/common");
|
|
5
5
|
const standard_1 = require("../../parsing/standard");
|
|
6
6
|
/**
|
|
7
|
-
* International ID API version 2.
|
|
7
|
+
* International ID API version 2.2 document data.
|
|
8
8
|
*/
|
|
9
9
|
class InternationalIdV2Document {
|
|
10
10
|
constructor(rawPrediction, pageId) {
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
2
|
import { InvoiceV4LineItem } from "./invoiceV4LineItem";
|
|
3
|
-
import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
|
|
3
|
+
import { AddressField, AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, PaymentDetailsField, StringField, Taxes } from "../../parsing/standard";
|
|
4
4
|
/**
|
|
5
|
-
* Invoice API version 4.
|
|
5
|
+
* Invoice API version 4.11 document data.
|
|
6
6
|
*/
|
|
7
7
|
export declare class InvoiceV4Document implements Prediction {
|
|
8
8
|
/** The customer billing address. */
|
|
9
|
-
billingAddress:
|
|
9
|
+
billingAddress: AddressField;
|
|
10
|
+
/** The purchase category. */
|
|
11
|
+
category: ClassificationField;
|
|
10
12
|
/** The address of the customer. */
|
|
11
|
-
customerAddress:
|
|
13
|
+
customerAddress: AddressField;
|
|
12
14
|
/** List of company registration numbers associated to the customer. */
|
|
13
15
|
customerCompanyRegistrations: CompanyRegistrationField[];
|
|
14
16
|
/** The customer account number or identifier from the supplier. */
|
|
@@ -36,9 +38,11 @@ export declare class InvoiceV4Document implements Prediction {
|
|
|
36
38
|
/** List of all reference numbers on the invoice, including the purchase order number. */
|
|
37
39
|
referenceNumbers: StringField[];
|
|
38
40
|
/** Customer's delivery address. */
|
|
39
|
-
shippingAddress:
|
|
41
|
+
shippingAddress: AddressField;
|
|
42
|
+
/** The purchase subcategory for transport, food and shopping. */
|
|
43
|
+
subcategory: ClassificationField;
|
|
40
44
|
/** The address of the supplier or merchant. */
|
|
41
|
-
supplierAddress:
|
|
45
|
+
supplierAddress: AddressField;
|
|
42
46
|
/** List of company registration numbers associated to the supplier. */
|
|
43
47
|
supplierCompanyRegistrations: CompanyRegistrationField[];
|
|
44
48
|
/** The email address of the supplier or merchant. */
|
|
@@ -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.11 document data.
|
|
9
9
|
*/
|
|
10
10
|
class InvoiceV4Document {
|
|
11
11
|
constructor(rawPrediction, pageId) {
|
|
@@ -19,11 +19,14 @@ class InvoiceV4Document {
|
|
|
19
19
|
this.supplierCompanyRegistrations = [];
|
|
20
20
|
/** List of payment details associated to the supplier of the invoice. */
|
|
21
21
|
this.supplierPaymentDetails = [];
|
|
22
|
-
this.billingAddress = new standard_1.
|
|
22
|
+
this.billingAddress = new standard_1.AddressField({
|
|
23
23
|
prediction: rawPrediction["billing_address"],
|
|
24
24
|
pageId: pageId,
|
|
25
25
|
});
|
|
26
|
-
this.
|
|
26
|
+
this.category = new standard_1.ClassificationField({
|
|
27
|
+
prediction: rawPrediction["category"],
|
|
28
|
+
});
|
|
29
|
+
this.customerAddress = new standard_1.AddressField({
|
|
27
30
|
prediction: rawPrediction["customer_address"],
|
|
28
31
|
pageId: pageId,
|
|
29
32
|
});
|
|
@@ -79,11 +82,14 @@ class InvoiceV4Document {
|
|
|
79
82
|
prediction: itemPrediction,
|
|
80
83
|
pageId: pageId,
|
|
81
84
|
})));
|
|
82
|
-
this.shippingAddress = new standard_1.
|
|
85
|
+
this.shippingAddress = new standard_1.AddressField({
|
|
83
86
|
prediction: rawPrediction["shipping_address"],
|
|
84
87
|
pageId: pageId,
|
|
85
88
|
});
|
|
86
|
-
this.
|
|
89
|
+
this.subcategory = new standard_1.ClassificationField({
|
|
90
|
+
prediction: rawPrediction["subcategory"],
|
|
91
|
+
});
|
|
92
|
+
this.supplierAddress = new standard_1.AddressField({
|
|
87
93
|
prediction: rawPrediction["supplier_address"],
|
|
88
94
|
pageId: pageId,
|
|
89
95
|
});
|
|
@@ -176,6 +182,8 @@ class InvoiceV4Document {
|
|
|
176
182
|
:Billing Address: ${this.billingAddress}
|
|
177
183
|
:Document Type: ${this.documentType}
|
|
178
184
|
:Document Type Extended: ${this.documentTypeExtended}
|
|
185
|
+
:Purchase Subcategory: ${this.subcategory}
|
|
186
|
+
:Purchase Category: ${this.category}
|
|
179
187
|
:Line Items: ${lineItemsSummary}`.trimEnd();
|
|
180
188
|
return (0, common_1.cleanOutString)(outStr);
|
|
181
189
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Prediction, StringDict } from "../../parsing/common";
|
|
2
2
|
import { InvoiceSplitterV1InvoicePageGroup } from "./invoiceSplitterV1InvoicePageGroup";
|
|
3
3
|
/**
|
|
4
|
-
* Invoice Splitter API version 1.
|
|
4
|
+
* Invoice Splitter API version 1.4 document data.
|
|
5
5
|
*/
|
|
6
6
|
export declare class InvoiceSplitterV1Document implements Prediction {
|
|
7
7
|
/** List of page groups. Each group represents a single invoice within a multi-invoice document. */
|
|
@@ -4,7 +4,7 @@ exports.InvoiceSplitterV1Document = void 0;
|
|
|
4
4
|
const common_1 = require("../../parsing/common");
|
|
5
5
|
const invoiceSplitterV1InvoicePageGroup_1 = require("./invoiceSplitterV1InvoicePageGroup");
|
|
6
6
|
/**
|
|
7
|
-
* Invoice Splitter API version 1.
|
|
7
|
+
* Invoice Splitter API version 1.4 document data.
|
|
8
8
|
*/
|
|
9
9
|
class InvoiceSplitterV1Document {
|
|
10
10
|
constructor(rawPrediction, pageId) {
|
|
@@ -2,7 +2,7 @@ import { Prediction, StringDict } from "../../parsing/common";
|
|
|
2
2
|
import { ReceiptV5LineItem } from "./receiptV5LineItem";
|
|
3
3
|
import { AmountField, ClassificationField, CompanyRegistrationField, DateField, LocaleField, StringField, Taxes } from "../../parsing/standard";
|
|
4
4
|
/**
|
|
5
|
-
* Receipt API version 5.
|
|
5
|
+
* Receipt API version 5.4 document data.
|
|
6
6
|
*/
|
|
7
7
|
export declare class ReceiptV5Document implements Prediction {
|
|
8
8
|
/** The purchase category of the receipt. */
|
|
@@ -5,7 +5,7 @@ const common_1 = require("../../parsing/common");
|
|
|
5
5
|
const receiptV5LineItem_1 = require("./receiptV5LineItem");
|
|
6
6
|
const standard_1 = require("../../parsing/standard");
|
|
7
7
|
/**
|
|
8
|
-
* Receipt API version 5.
|
|
8
|
+
* Receipt API version 5.4 document data.
|
|
9
9
|
*/
|
|
10
10
|
class ReceiptV5Document {
|
|
11
11
|
constructor(rawPrediction, pageId) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { StringDict } from "../../../parsing/common";
|
|
2
2
|
import { Polygon } from "../../../geometry";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Copayments for covered services.
|
|
5
5
|
*/
|
|
6
6
|
export declare class HealthcareCardV1Copay {
|
|
7
7
|
#private;
|
|
8
|
-
/** The price of service. */
|
|
8
|
+
/** The price of the service. */
|
|
9
9
|
serviceFees: number | null;
|
|
10
|
-
/** The name of
|
|
10
|
+
/** The name of the service. */
|
|
11
11
|
serviceName: string | null;
|
|
12
12
|
/** Confidence score */
|
|
13
13
|
confidence: number;
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.HealthcareCardV1Copay = void 0;
|
|
10
10
|
const common_1 = require("../../../parsing/common");
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Copayments for covered services.
|
|
13
13
|
*/
|
|
14
14
|
class HealthcareCardV1Copay {
|
|
15
15
|
constructor({ prediction = {} }) {
|
|
@@ -2,12 +2,12 @@ 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.3 document data.
|
|
6
6
|
*/
|
|
7
7
|
export declare class HealthcareCardV1Document implements Prediction {
|
|
8
8
|
/** The name of the company that provides the healthcare plan. */
|
|
9
9
|
companyName: StringField;
|
|
10
|
-
/**
|
|
10
|
+
/** Copayments for covered services. */
|
|
11
11
|
copays: HealthcareCardV1Copay[];
|
|
12
12
|
/** The list of dependents covered by the healthcare plan. */
|
|
13
13
|
dependents: StringField[];
|
|
@@ -23,6 +23,8 @@ export declare class HealthcareCardV1Document implements Prediction {
|
|
|
23
23
|
memberName: StringField;
|
|
24
24
|
/** The unique identifier for the payer in the healthcare system. */
|
|
25
25
|
payerId: StringField;
|
|
26
|
+
/** The name of the healthcare plan. */
|
|
27
|
+
planName: StringField;
|
|
26
28
|
/** The BIN number for prescription drug coverage. */
|
|
27
29
|
rxBin: StringField;
|
|
28
30
|
/** The group number for prescription drug coverage. */
|
|
@@ -5,11 +5,11 @@ 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.3 document data.
|
|
9
9
|
*/
|
|
10
10
|
class HealthcareCardV1Document {
|
|
11
11
|
constructor(rawPrediction, pageId) {
|
|
12
|
-
/**
|
|
12
|
+
/** Copayments for covered services. */
|
|
13
13
|
this.copays = [];
|
|
14
14
|
/** The list of dependents covered by the healthcare plan. */
|
|
15
15
|
this.dependents = [];
|
|
@@ -51,6 +51,10 @@ class HealthcareCardV1Document {
|
|
|
51
51
|
prediction: rawPrediction["payer_id"],
|
|
52
52
|
pageId: pageId,
|
|
53
53
|
});
|
|
54
|
+
this.planName = new standard_1.StringField({
|
|
55
|
+
prediction: rawPrediction["plan_name"],
|
|
56
|
+
pageId: pageId,
|
|
57
|
+
});
|
|
54
58
|
this.rxBin = new standard_1.StringField({
|
|
55
59
|
prediction: rawPrediction["rx_bin"],
|
|
56
60
|
pageId: pageId,
|
|
@@ -83,6 +87,7 @@ class HealthcareCardV1Document {
|
|
|
83
87
|
copaysSummary += this.copays.map((item) => "\n " + item.toTableLine() + "\n" + (0, common_1.lineSeparator)(copaysColSizes, "-")).join("");
|
|
84
88
|
}
|
|
85
89
|
const outStr = `:Company Name: ${this.companyName}
|
|
90
|
+
:Plan Name: ${this.planName}
|
|
86
91
|
:Member Name: ${this.memberName}
|
|
87
92
|
:Member ID: ${this.memberId}
|
|
88
93
|
:Issuer 80840: ${this.issuer80840}
|
|
@@ -93,7 +98,7 @@ class HealthcareCardV1Document {
|
|
|
93
98
|
:RX ID: ${this.rxId}
|
|
94
99
|
:RX GRP: ${this.rxGrp}
|
|
95
100
|
:RX PCN: ${this.rxPcn}
|
|
96
|
-
:
|
|
101
|
+
:Copays: ${copaysSummary}
|
|
97
102
|
:Enrollment Date: ${this.enrollmentDate}`.trimEnd();
|
|
98
103
|
return (0, common_1.cleanOutString)(outStr);
|
|
99
104
|
}
|