mindee 4.13.0 → 4.14.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/package.json +1 -1
  3. package/src/cli.js +108 -48
  4. package/src/imageOperations/{extractedImage.d.ts → common/extractedImage.d.ts} +6 -3
  5. package/src/imageOperations/{extractedImage.js → common/extractedImage.js} +6 -3
  6. package/src/imageOperations/common/imageExtractor.d.ts +9 -0
  7. package/src/imageOperations/common/imageExtractor.js +34 -0
  8. package/src/imageOperations/common/index.d.ts +2 -0
  9. package/src/imageOperations/common/index.js +7 -0
  10. package/src/imageOperations/index.d.ts +2 -4
  11. package/src/imageOperations/index.js +3 -5
  12. package/src/imageOperations/internal.d.ts +3 -5
  13. package/src/imageOperations/internal.js +5 -7
  14. package/src/imageOperations/{extractedInvoiceSplitterDocument.d.ts → invoiceSplitterExtractor/extractedInvoiceSplitterImage.d.ts} +4 -1
  15. package/src/imageOperations/{extractedInvoiceSplitterDocument.js → invoiceSplitterExtractor/extractedInvoiceSplitterImage.js} +4 -1
  16. package/src/imageOperations/invoiceSplitterExtractor/index.d.ts +2 -0
  17. package/src/imageOperations/invoiceSplitterExtractor/index.js +7 -0
  18. package/src/imageOperations/{invoiceSplitterExtractor.d.ts → invoiceSplitterExtractor/invoiceSplitterExtractor.d.ts} +3 -3
  19. package/src/imageOperations/{invoiceSplitterExtractor.js → invoiceSplitterExtractor/invoiceSplitterExtractor.js} +4 -4
  20. package/src/imageOperations/{extractedMultiReceiptImage.d.ts → multiReceiptsExtractor/extractedMultiReceiptImage.d.ts} +4 -1
  21. package/src/imageOperations/{extractedMultiReceiptImage.js → multiReceiptsExtractor/extractedMultiReceiptImage.js} +5 -2
  22. package/src/imageOperations/multiReceiptsExtractor/index.d.ts +2 -0
  23. package/src/imageOperations/multiReceiptsExtractor/index.js +7 -0
  24. package/src/imageOperations/{multiReceiptsExtractor.d.ts → multiReceiptsExtractor/multiReceiptsExtractor.d.ts} +3 -3
  25. package/src/imageOperations/{multiReceiptsExtractor.js → multiReceiptsExtractor/multiReceiptsExtractor.js} +22 -25
  26. package/src/parsing/standard/companyRegistration.d.ts +3 -0
  27. package/src/parsing/standard/companyRegistration.js +15 -0
  28. package/src/product/financialDocument/financialDocumentV1Document.d.ts +1 -1
  29. package/src/product/financialDocument/financialDocumentV1Document.js +3 -2
  30. package/src/product/financialDocument/financialDocumentV1LineItem.d.ts +2 -0
  31. package/src/product/financialDocument/financialDocumentV1LineItem.js +10 -0
  32. package/src/product/internationalId/internationalIdV2Document.d.ts +1 -1
  33. package/src/product/internationalId/internationalIdV2Document.js +1 -1
  34. package/src/product/invoice/invoiceV4Document.d.ts +1 -1
  35. package/src/product/invoice/invoiceV4Document.js +3 -2
  36. package/src/product/invoice/invoiceV4LineItem.d.ts +2 -0
  37. package/src/product/invoice/invoiceV4LineItem.js +10 -0
  38. package/src/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.d.ts +1 -1
  39. package/src/product/multiReceiptsDetector/multiReceiptsDetectorV1Document.js +1 -1
  40. package/src/product/receipt/receiptV5Document.d.ts +1 -1
  41. package/src/product/receipt/receiptV5Document.js +1 -1
  42. package/src/product/us/healthcareCard/healthcareCardV1.d.ts +16 -0
  43. package/src/product/us/healthcareCard/healthcareCardV1.js +27 -0
  44. package/src/product/us/healthcareCard/healthcareCardV1Copay.d.ts +30 -0
  45. package/src/product/us/healthcareCard/healthcareCardV1Copay.js +66 -0
  46. package/src/product/us/healthcareCard/healthcareCardV1Document.d.ts +37 -0
  47. package/src/product/us/healthcareCard/healthcareCardV1Document.js +96 -0
  48. package/src/product/us/healthcareCard/index.d.ts +3 -0
  49. package/src/product/us/healthcareCard/index.js +9 -0
  50. package/src/product/us/index.d.ts +2 -1
  51. package/src/product/us/index.js +5 -3
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CompanyRegistrationField = void 0;
4
4
  const field_1 = require("./field");
5
+ const common_1 = require("../common");
5
6
  /**
6
7
  * A company registration item.
7
8
  */
@@ -10,5 +11,19 @@ class CompanyRegistrationField extends field_1.Field {
10
11
  super({ prediction, valueKey, reconstructed, pageId });
11
12
  this.type = prediction["type"];
12
13
  }
14
+ toTableLine() {
15
+ const printable = this.printableValues();
16
+ return `| ${printable["type"].padEnd(15)} | ${printable["value"].padEnd(20)} `;
17
+ }
18
+ toString() {
19
+ const printable = this.printableValues();
20
+ return `Type: ${printable["type"]}, Value: ${printable["value"]}`;
21
+ }
22
+ printableValues() {
23
+ const printable = {};
24
+ printable["type"] = (0, common_1.cleanOutString)(this.type);
25
+ printable["value"] = (0, common_1.cleanOutString)((this.value ?? "").toString());
26
+ return printable;
27
+ }
13
28
  }
14
29
  exports.CompanyRegistrationField = CompanyRegistrationField;
@@ -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.7 document data.
5
+ * Financial Document API version 1.9 document data.
6
6
  */
7
7
  export declare class FinancialDocumentV1Document implements Prediction {
8
8
  /** The customer's address used for billing. */
@@ -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.7 document data.
8
+ * Financial Document API version 1.9 document data.
9
9
  */
10
10
  class FinancialDocumentV1Document {
11
11
  constructor(rawPrediction, pageId) {
@@ -148,7 +148,7 @@ class FinancialDocumentV1Document {
148
148
  const customerCompanyRegistrations = this.customerCompanyRegistrations.join("\n ");
149
149
  let lineItemsSummary = "";
150
150
  if (this.lineItems && this.lineItems.length > 0) {
151
- const lineItemsColSizes = [38, 14, 10, 12, 14, 14, 12];
151
+ const lineItemsColSizes = [38, 14, 10, 12, 14, 14, 17, 12];
152
152
  lineItemsSummary += "\n" + (0, common_1.lineSeparator)(lineItemsColSizes, "-") + "\n ";
153
153
  lineItemsSummary += "| Description ";
154
154
  lineItemsSummary += "| Product code ";
@@ -156,6 +156,7 @@ class FinancialDocumentV1Document {
156
156
  lineItemsSummary += "| Tax Amount ";
157
157
  lineItemsSummary += "| Tax Rate (%) ";
158
158
  lineItemsSummary += "| Total Amount ";
159
+ lineItemsSummary += "| Unit of measure ";
159
160
  lineItemsSummary += "| Unit Price ";
160
161
  lineItemsSummary += "|\n" + (0, common_1.lineSeparator)(lineItemsColSizes, "=");
161
162
  lineItemsSummary += this.lineItems.map((item) => "\n " + item.toTableLine() + "\n" + (0, common_1.lineSeparator)(lineItemsColSizes, "-")).join("");
@@ -17,6 +17,8 @@ export declare class FinancialDocumentV1LineItem {
17
17
  taxRate: number | undefined;
18
18
  /** The item total amount. */
19
19
  totalAmount: number | undefined;
20
+ /** The item unit of measure. */
21
+ unitMeasure: string | undefined;
20
22
  /** The item unit price. */
21
23
  unitPrice: number | undefined;
22
24
  /** Confidence score */
@@ -35,6 +35,7 @@ class FinancialDocumentV1LineItem {
35
35
  if (prediction["total_amount"] && !isNaN(prediction["total_amount"])) {
36
36
  this.totalAmount = +parseFloat(prediction["total_amount"]).toFixed(3);
37
37
  }
38
+ this.unitMeasure = prediction["unit_measure"];
38
39
  if (prediction["unit_price"] && !isNaN(prediction["unit_price"])) {
39
40
  this.unitPrice = +parseFloat(prediction["unit_price"]).toFixed(3);
40
41
  }
@@ -61,6 +62,8 @@ class FinancialDocumentV1LineItem {
61
62
  printable.taxRate +
62
63
  ", Total Amount: " +
63
64
  printable.totalAmount +
65
+ ", Unit of measure: " +
66
+ printable.unitMeasure +
64
67
  ", Unit Price: " +
65
68
  printable.unitPrice);
66
69
  }
@@ -82,6 +85,8 @@ class FinancialDocumentV1LineItem {
82
85
  " | " +
83
86
  printable.totalAmount.padEnd(12) +
84
87
  " | " +
88
+ printable.unitMeasure.padEnd(15) +
89
+ " | " +
85
90
  printable.unitPrice.padEnd(10) +
86
91
  " |");
87
92
  }
@@ -103,6 +108,11 @@ _FinancialDocumentV1LineItem_instances = new WeakSet(), _FinancialDocumentV1Line
103
108
  taxAmount: this.taxAmount !== undefined ? (0, standard_1.floatToString)(this.taxAmount) : "",
104
109
  taxRate: this.taxRate !== undefined ? (0, standard_1.floatToString)(this.taxRate) : "",
105
110
  totalAmount: this.totalAmount !== undefined ? (0, standard_1.floatToString)(this.totalAmount) : "",
111
+ unitMeasure: this.unitMeasure ?
112
+ this.unitMeasure.length <= 15 ?
113
+ this.unitMeasure :
114
+ this.unitMeasure.slice(0, 12) + "..." :
115
+ "",
106
116
  unitPrice: this.unitPrice !== undefined ? (0, standard_1.floatToString)(this.unitPrice) : "",
107
117
  };
108
118
  };
@@ -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.0 document data.
4
+ * International ID API version 2.1 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.0 document data.
7
+ * International ID API version 2.1 document data.
8
8
  */
9
9
  class InternationalIdV2Document {
10
10
  constructor(rawPrediction, pageId) {
@@ -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.6 document data.
5
+ * Invoice API version 4.7 document data.
6
6
  */
7
7
  export declare class InvoiceV4Document implements Prediction {
8
8
  /** The customer's address used for billing. */
@@ -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.6 document data.
8
+ * Invoice API version 4.7 document data.
9
9
  */
10
10
  class InvoiceV4Document {
11
11
  constructor(rawPrediction, pageId) {
@@ -126,7 +126,7 @@ class InvoiceV4Document {
126
126
  const customerCompanyRegistrations = this.customerCompanyRegistrations.join("\n ");
127
127
  let lineItemsSummary = "";
128
128
  if (this.lineItems && this.lineItems.length > 0) {
129
- const lineItemsColSizes = [38, 14, 10, 12, 14, 14, 12];
129
+ const lineItemsColSizes = [38, 14, 10, 12, 14, 14, 17, 12];
130
130
  lineItemsSummary += "\n" + (0, common_1.lineSeparator)(lineItemsColSizes, "-") + "\n ";
131
131
  lineItemsSummary += "| Description ";
132
132
  lineItemsSummary += "| Product code ";
@@ -134,6 +134,7 @@ class InvoiceV4Document {
134
134
  lineItemsSummary += "| Tax Amount ";
135
135
  lineItemsSummary += "| Tax Rate (%) ";
136
136
  lineItemsSummary += "| Total Amount ";
137
+ lineItemsSummary += "| Unit of measure ";
137
138
  lineItemsSummary += "| Unit Price ";
138
139
  lineItemsSummary += "|\n" + (0, common_1.lineSeparator)(lineItemsColSizes, "=");
139
140
  lineItemsSummary += this.lineItems.map((item) => "\n " + item.toTableLine() + "\n" + (0, common_1.lineSeparator)(lineItemsColSizes, "-")).join("");
@@ -17,6 +17,8 @@ export declare class InvoiceV4LineItem {
17
17
  taxRate: number | undefined;
18
18
  /** The item total amount. */
19
19
  totalAmount: number | undefined;
20
+ /** The item unit of measure. */
21
+ unitMeasure: string | undefined;
20
22
  /** The item unit price. */
21
23
  unitPrice: number | undefined;
22
24
  /** Confidence score */
@@ -35,6 +35,7 @@ class InvoiceV4LineItem {
35
35
  if (prediction["total_amount"] && !isNaN(prediction["total_amount"])) {
36
36
  this.totalAmount = +parseFloat(prediction["total_amount"]).toFixed(3);
37
37
  }
38
+ this.unitMeasure = prediction["unit_measure"];
38
39
  if (prediction["unit_price"] && !isNaN(prediction["unit_price"])) {
39
40
  this.unitPrice = +parseFloat(prediction["unit_price"]).toFixed(3);
40
41
  }
@@ -61,6 +62,8 @@ class InvoiceV4LineItem {
61
62
  printable.taxRate +
62
63
  ", Total Amount: " +
63
64
  printable.totalAmount +
65
+ ", Unit of measure: " +
66
+ printable.unitMeasure +
64
67
  ", Unit Price: " +
65
68
  printable.unitPrice);
66
69
  }
@@ -82,6 +85,8 @@ class InvoiceV4LineItem {
82
85
  " | " +
83
86
  printable.totalAmount.padEnd(12) +
84
87
  " | " +
88
+ printable.unitMeasure.padEnd(15) +
89
+ " | " +
85
90
  printable.unitPrice.padEnd(10) +
86
91
  " |");
87
92
  }
@@ -103,6 +108,11 @@ _InvoiceV4LineItem_instances = new WeakSet(), _InvoiceV4LineItem_printableValues
103
108
  taxAmount: this.taxAmount !== undefined ? (0, standard_1.floatToString)(this.taxAmount) : "",
104
109
  taxRate: this.taxRate !== undefined ? (0, standard_1.floatToString)(this.taxRate) : "",
105
110
  totalAmount: this.totalAmount !== undefined ? (0, standard_1.floatToString)(this.totalAmount) : "",
111
+ unitMeasure: this.unitMeasure ?
112
+ this.unitMeasure.length <= 15 ?
113
+ this.unitMeasure :
114
+ this.unitMeasure.slice(0, 12) + "..." :
115
+ "",
106
116
  unitPrice: this.unitPrice !== undefined ? (0, standard_1.floatToString)(this.unitPrice) : "",
107
117
  };
108
118
  };
@@ -1,7 +1,7 @@
1
1
  import { Prediction, StringDict } from "../../parsing/common";
2
2
  import { PositionField } from "../../parsing/standard";
3
3
  /**
4
- * Multi Receipts Detector API version 1.0 document data.
4
+ * Multi Receipts Detector API version 1.1 document data.
5
5
  */
6
6
  export declare class MultiReceiptsDetectorV1Document implements Prediction {
7
7
  /** Positions of the receipts on the document. */
@@ -4,7 +4,7 @@ exports.MultiReceiptsDetectorV1Document = void 0;
4
4
  const common_1 = require("../../parsing/common");
5
5
  const standard_1 = require("../../parsing/standard");
6
6
  /**
7
- * Multi Receipts Detector API version 1.0 document data.
7
+ * Multi Receipts Detector API version 1.1 document data.
8
8
  */
9
9
  class MultiReceiptsDetectorV1Document {
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.2 document data.
5
+ * Receipt API version 5.3 document data.
6
6
  */
7
7
  export declare class ReceiptV5Document implements Prediction {
8
8
  /** The purchase category among predefined classes. */
@@ -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.2 document data.
8
+ * Receipt API version 5.3 document data.
9
9
  */
10
10
  class ReceiptV5Document {
11
11
  constructor(rawPrediction, pageId) {
@@ -0,0 +1,16 @@
1
+ import { Inference, StringDict, Page } from "../../../parsing/common";
2
+ import { HealthcareCardV1Document } from "./healthcareCardV1Document";
3
+ /**
4
+ * Healthcare Card API version 1 inference prediction.
5
+ */
6
+ export declare class HealthcareCardV1 extends Inference {
7
+ /** The endpoint's name. */
8
+ endpointName: string;
9
+ /** The endpoint's version. */
10
+ endpointVersion: string;
11
+ /** The document-level prediction. */
12
+ prediction: HealthcareCardV1Document;
13
+ /** The document's pages. */
14
+ pages: Page<HealthcareCardV1Document>[];
15
+ constructor(rawPrediction: StringDict);
16
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HealthcareCardV1 = void 0;
4
+ const common_1 = require("../../../parsing/common");
5
+ const healthcareCardV1Document_1 = require("./healthcareCardV1Document");
6
+ /**
7
+ * Healthcare Card API version 1 inference prediction.
8
+ */
9
+ class HealthcareCardV1 extends common_1.Inference {
10
+ constructor(rawPrediction) {
11
+ super(rawPrediction);
12
+ /** The endpoint's name. */
13
+ this.endpointName = "us_healthcare_cards";
14
+ /** The endpoint's version. */
15
+ this.endpointVersion = "1";
16
+ /** The document's pages. */
17
+ this.pages = [];
18
+ this.prediction = new healthcareCardV1Document_1.HealthcareCardV1Document(rawPrediction["prediction"]);
19
+ rawPrediction["pages"].forEach((page) => {
20
+ if (page.prediction !== undefined && page.prediction !== null &&
21
+ Object.keys(page.prediction).length > 0) {
22
+ this.pages.push(new common_1.Page(healthcareCardV1Document_1.HealthcareCardV1Document, page, page["id"], page["orientation"]));
23
+ }
24
+ });
25
+ }
26
+ }
27
+ exports.HealthcareCardV1 = HealthcareCardV1;
@@ -0,0 +1,30 @@
1
+ import { StringDict } from "../../../parsing/common";
2
+ import { Polygon } from "../../../geometry";
3
+ /**
4
+ * Is a fixed amount for a covered service.
5
+ */
6
+ export declare class HealthcareCardV1Copay {
7
+ #private;
8
+ /** The price of service. */
9
+ serviceFees: number | undefined;
10
+ /** The name of service of the copay. */
11
+ serviceName: string | undefined;
12
+ /** Confidence score */
13
+ confidence: number;
14
+ /** The document page on which the information was found. */
15
+ pageId: number;
16
+ /**
17
+ * Contains the relative vertices coordinates (points) of a polygon containing
18
+ * the field in the document.
19
+ */
20
+ polygon: Polygon;
21
+ constructor({ prediction }: StringDict);
22
+ /**
23
+ * Default string representation.
24
+ */
25
+ toString(): string;
26
+ /**
27
+ * Output in a format suitable for inclusion in an rST table.
28
+ */
29
+ toTableLine(): string;
30
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _HealthcareCardV1Copay_instances, _HealthcareCardV1Copay_printableValues;
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.HealthcareCardV1Copay = void 0;
10
+ const standard_1 = require("../../../parsing/standard");
11
+ /**
12
+ * Is a fixed amount for a covered service.
13
+ */
14
+ class HealthcareCardV1Copay {
15
+ constructor({ prediction = {} }) {
16
+ _HealthcareCardV1Copay_instances.add(this);
17
+ /** Confidence score */
18
+ this.confidence = 0.0;
19
+ /**
20
+ * Contains the relative vertices coordinates (points) of a polygon containing
21
+ * the field in the document.
22
+ */
23
+ this.polygon = [];
24
+ if (prediction["service_fees"] && !isNaN(prediction["service_fees"])) {
25
+ this.serviceFees = +parseFloat(prediction["service_fees"]).toFixed(3);
26
+ }
27
+ this.serviceName = prediction["service_name"];
28
+ this.pageId = prediction["page_id"];
29
+ this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
30
+ if (prediction["polygon"]) {
31
+ this.polygon = prediction.polygon;
32
+ }
33
+ }
34
+ /**
35
+ * Default string representation.
36
+ */
37
+ toString() {
38
+ const printable = __classPrivateFieldGet(this, _HealthcareCardV1Copay_instances, "m", _HealthcareCardV1Copay_printableValues).call(this);
39
+ return ("Service Fees: " +
40
+ printable.serviceFees +
41
+ ", Service Name: " +
42
+ printable.serviceName);
43
+ }
44
+ /**
45
+ * Output in a format suitable for inclusion in an rST table.
46
+ */
47
+ toTableLine() {
48
+ const printable = __classPrivateFieldGet(this, _HealthcareCardV1Copay_instances, "m", _HealthcareCardV1Copay_printableValues).call(this);
49
+ return ("| " +
50
+ printable.serviceFees.padEnd(12) +
51
+ " | " +
52
+ printable.serviceName.padEnd(12) +
53
+ " |");
54
+ }
55
+ }
56
+ exports.HealthcareCardV1Copay = HealthcareCardV1Copay;
57
+ _HealthcareCardV1Copay_instances = new WeakSet(), _HealthcareCardV1Copay_printableValues = function _HealthcareCardV1Copay_printableValues() {
58
+ return {
59
+ serviceFees: this.serviceFees !== undefined ? (0, standard_1.floatToString)(this.serviceFees) : "",
60
+ serviceName: this.serviceName ?
61
+ this.serviceName.length <= 12 ?
62
+ this.serviceName :
63
+ this.serviceName.slice(0, 9) + "..." :
64
+ "",
65
+ };
66
+ };
@@ -0,0 +1,37 @@
1
+ import { Prediction, StringDict } from "../../../parsing/common";
2
+ import { HealthcareCardV1Copay } from "./healthcareCardV1Copay";
3
+ import { DateField, StringField } from "../../../parsing/standard";
4
+ /**
5
+ * Healthcare Card API version 1.0 document data.
6
+ */
7
+ export declare class HealthcareCardV1Document implements Prediction {
8
+ /** The name of the company that provides the healthcare plan. */
9
+ companyName: StringField;
10
+ /** Is a fixed amount for a covered service. */
11
+ copays: HealthcareCardV1Copay[];
12
+ /** The list of dependents covered by the healthcare plan. */
13
+ dependents: StringField[];
14
+ /** The date when the member enrolled in the healthcare plan. */
15
+ enrollmentDate: DateField;
16
+ /** The group number associated with the healthcare plan. */
17
+ groupNumber: StringField;
18
+ /** The organization that issued the healthcare plan. */
19
+ issuer80840: StringField;
20
+ /** The unique identifier for the member in the healthcare system. */
21
+ memberId: StringField;
22
+ /** The name of the member covered by the healthcare plan. */
23
+ memberName: StringField;
24
+ /** The unique identifier for the payer in the healthcare system. */
25
+ payerId: StringField;
26
+ /** The BIN number for prescription drug coverage. */
27
+ rxBin: StringField;
28
+ /** The group number for prescription drug coverage. */
29
+ rxGrp: StringField;
30
+ /** The PCN number for prescription drug coverage. */
31
+ rxPcn: StringField;
32
+ constructor(rawPrediction: StringDict, pageId?: number);
33
+ /**
34
+ * Default string representation.
35
+ */
36
+ toString(): string;
37
+ }
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HealthcareCardV1Document = void 0;
4
+ const common_1 = require("../../../parsing/common");
5
+ const healthcareCardV1Copay_1 = require("./healthcareCardV1Copay");
6
+ const standard_1 = require("../../../parsing/standard");
7
+ /**
8
+ * Healthcare Card API version 1.0 document data.
9
+ */
10
+ class HealthcareCardV1Document {
11
+ constructor(rawPrediction, pageId) {
12
+ /** Is a fixed amount for a covered service. */
13
+ this.copays = [];
14
+ /** The list of dependents covered by the healthcare plan. */
15
+ this.dependents = [];
16
+ this.companyName = new standard_1.StringField({
17
+ prediction: rawPrediction["company_name"],
18
+ pageId: pageId,
19
+ });
20
+ rawPrediction["copays"] &&
21
+ rawPrediction["copays"].map((itemPrediction) => this.copays.push(new healthcareCardV1Copay_1.HealthcareCardV1Copay({
22
+ prediction: itemPrediction,
23
+ pageId: pageId,
24
+ })));
25
+ rawPrediction["dependents"] &&
26
+ rawPrediction["dependents"].map((itemPrediction) => this.dependents.push(new standard_1.StringField({
27
+ prediction: itemPrediction,
28
+ pageId: pageId,
29
+ })));
30
+ this.enrollmentDate = new standard_1.DateField({
31
+ prediction: rawPrediction["enrollment_date"],
32
+ pageId: pageId,
33
+ });
34
+ this.groupNumber = new standard_1.StringField({
35
+ prediction: rawPrediction["group_number"],
36
+ pageId: pageId,
37
+ });
38
+ this.issuer80840 = new standard_1.StringField({
39
+ prediction: rawPrediction["issuer_80840"],
40
+ pageId: pageId,
41
+ });
42
+ this.memberId = new standard_1.StringField({
43
+ prediction: rawPrediction["member_id"],
44
+ pageId: pageId,
45
+ });
46
+ this.memberName = new standard_1.StringField({
47
+ prediction: rawPrediction["member_name"],
48
+ pageId: pageId,
49
+ });
50
+ this.payerId = new standard_1.StringField({
51
+ prediction: rawPrediction["payer_id"],
52
+ pageId: pageId,
53
+ });
54
+ this.rxBin = new standard_1.StringField({
55
+ prediction: rawPrediction["rx_bin"],
56
+ pageId: pageId,
57
+ });
58
+ this.rxGrp = new standard_1.StringField({
59
+ prediction: rawPrediction["rx_grp"],
60
+ pageId: pageId,
61
+ });
62
+ this.rxPcn = new standard_1.StringField({
63
+ prediction: rawPrediction["rx_pcn"],
64
+ pageId: pageId,
65
+ });
66
+ }
67
+ /**
68
+ * Default string representation.
69
+ */
70
+ toString() {
71
+ const dependents = this.dependents.join("\n ");
72
+ let copaysSummary = "";
73
+ if (this.copays && this.copays.length > 0) {
74
+ const copaysColSizes = [14, 14];
75
+ copaysSummary += "\n" + (0, common_1.lineSeparator)(copaysColSizes, "-") + "\n ";
76
+ copaysSummary += "| Service Fees ";
77
+ copaysSummary += "| Service Name ";
78
+ copaysSummary += "|\n" + (0, common_1.lineSeparator)(copaysColSizes, "=");
79
+ copaysSummary += this.copays.map((item) => "\n " + item.toTableLine() + "\n" + (0, common_1.lineSeparator)(copaysColSizes, "-")).join("");
80
+ }
81
+ const outStr = `:Company Name: ${this.companyName}
82
+ :Member Name: ${this.memberName}
83
+ :Member ID: ${this.memberId}
84
+ :Issuer 80840: ${this.issuer80840}
85
+ :Dependents: ${dependents}
86
+ :Group Number: ${this.groupNumber}
87
+ :Payer ID: ${this.payerId}
88
+ :RX BIN: ${this.rxBin}
89
+ :RX GRP: ${this.rxGrp}
90
+ :RX PCN: ${this.rxPcn}
91
+ :copays: ${copaysSummary}
92
+ :Enrollment Date: ${this.enrollmentDate}`.trimEnd();
93
+ return (0, common_1.cleanOutString)(outStr);
94
+ }
95
+ }
96
+ exports.HealthcareCardV1Document = HealthcareCardV1Document;
@@ -0,0 +1,3 @@
1
+ export { HealthcareCardV1 } from "./healthcareCardV1";
2
+ export { HealthcareCardV1Copay } from "./healthcareCardV1Copay";
3
+ export { HealthcareCardV1Document } from "./healthcareCardV1Document";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HealthcareCardV1Document = exports.HealthcareCardV1Copay = exports.HealthcareCardV1 = void 0;
4
+ var healthcareCardV1_1 = require("./healthcareCardV1");
5
+ Object.defineProperty(exports, "HealthcareCardV1", { enumerable: true, get: function () { return healthcareCardV1_1.HealthcareCardV1; } });
6
+ var healthcareCardV1Copay_1 = require("./healthcareCardV1Copay");
7
+ Object.defineProperty(exports, "HealthcareCardV1Copay", { enumerable: true, get: function () { return healthcareCardV1Copay_1.HealthcareCardV1Copay; } });
8
+ var healthcareCardV1Document_1 = require("./healthcareCardV1Document");
9
+ Object.defineProperty(exports, "HealthcareCardV1Document", { enumerable: true, get: function () { return healthcareCardV1Document_1.HealthcareCardV1Document; } });
@@ -1,4 +1,5 @@
1
1
  export { BankCheckV1 } from "./bankCheck/bankCheckV1";
2
2
  export { DriverLicenseV1 } from "./driverLicense/driverLicenseV1";
3
- export { W9V1 } from "./w9/w9V1";
3
+ export { HealthcareCardV1 } from "./healthcareCard/healthcareCardV1";
4
4
  export { UsMailV2 } from "./usMail/usMailV2";
5
+ export { W9V1 } from "./w9/w9V1";
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UsMailV2 = exports.W9V1 = exports.DriverLicenseV1 = exports.BankCheckV1 = void 0;
3
+ exports.W9V1 = exports.UsMailV2 = exports.HealthcareCardV1 = exports.DriverLicenseV1 = exports.BankCheckV1 = void 0;
4
4
  var bankCheckV1_1 = require("./bankCheck/bankCheckV1");
5
5
  Object.defineProperty(exports, "BankCheckV1", { enumerable: true, get: function () { return bankCheckV1_1.BankCheckV1; } });
6
6
  var driverLicenseV1_1 = require("./driverLicense/driverLicenseV1");
7
7
  Object.defineProperty(exports, "DriverLicenseV1", { enumerable: true, get: function () { return driverLicenseV1_1.DriverLicenseV1; } });
8
- var w9V1_1 = require("./w9/w9V1");
9
- Object.defineProperty(exports, "W9V1", { enumerable: true, get: function () { return w9V1_1.W9V1; } });
8
+ var healthcareCardV1_1 = require("./healthcareCard/healthcareCardV1");
9
+ Object.defineProperty(exports, "HealthcareCardV1", { enumerable: true, get: function () { return healthcareCardV1_1.HealthcareCardV1; } });
10
10
  var usMailV2_1 = require("./usMail/usMailV2");
11
11
  Object.defineProperty(exports, "UsMailV2", { enumerable: true, get: function () { return usMailV2_1.UsMailV2; } });
12
+ var w9V1_1 = require("./w9/w9V1");
13
+ Object.defineProperty(exports, "W9V1", { enumerable: true, get: function () { return w9V1_1.W9V1; } });