mindee 4.7.1 → 4.8.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/README.md +6 -6
- data/Rakefile +1 -0
- data/lib/mindee/errors/mindee_http_error_v2.rb +23 -4
- data/lib/mindee/errors/mindee_http_unknown_error_v2.rb +18 -0
- data/lib/mindee/http/endpoint.rb +1 -0
- data/lib/mindee/input/sources/local_input_source.rb +9 -1
- data/lib/mindee/parsing/v2/error_item.rb +21 -0
- data/lib/mindee/parsing/v2/error_response.rb +18 -3
- data/lib/mindee/parsing/v2/inference_result.rb +4 -0
- data/lib/mindee/parsing/v2/rag_metadata.rb +17 -0
- data/lib/mindee/product.rb +0 -1
- data/lib/mindee/version.rb +1 -1
- data/mindee.gemspec +1 -0
- data/sig/mindee/errors/mindee_http_error_v2.rbs +4 -1
- data/sig/mindee/errors/mindee_http_unknown_error_v2.rbs +9 -0
- data/sig/mindee/http/endpoint.rbs +1 -0
- data/sig/mindee/input/sources/local_input_source.rbs +1 -1
- data/sig/mindee/parsing/v2/error_item.rbs +13 -0
- data/sig/mindee/parsing/v2/error_response.rbs +3 -0
- data/sig/mindee/parsing/v2/inference_result.rbs +1 -0
- data/sig/mindee/parsing/v2/rag_metadata.rbs +13 -0
- metadata +22 -47
- data/docs/advanced_file_operations.md +0 -109
- data/docs/code_samples/us_mail_v2_async.txt +0 -24
- data/docs/getting_started.md +0 -257
- data/docs/global_products/barcode_reader_v1.md +0 -125
- data/docs/global_products/bill_of_lading_v1.md +0 -276
- data/docs/global_products/business_card_v1.md +0 -194
- data/docs/global_products/cropper_v1.md +0 -123
- data/docs/global_products/delivery_notes_v1.md +0 -168
- data/docs/global_products/driver_license_v1.md +0 -212
- data/docs/global_products/expense_receipts_v5.md +0 -415
- data/docs/global_products/financial_document_v1.md +0 -615
- data/docs/global_products/international_id_v2.md +0 -264
- data/docs/global_products/invoice_splitter_v1.md +0 -127
- data/docs/global_products/invoices_v4.md +0 -576
- data/docs/global_products/multi_receipts_detector_v1.md +0 -131
- data/docs/global_products/nutrition_facts_v1.md +0 -399
- data/docs/global_products/passport_v1.md +0 -207
- data/docs/global_products/resume_v1.md +0 -384
- data/docs/global_products/universal.md +0 -113
- data/docs/global_products.md +0 -6
- data/docs/loading_a_document.md +0 -330
- data/docs/localized_products/bank_account_details_v2.md +0 -158
- data/docs/localized_products/bank_check_v1.md +0 -205
- data/docs/localized_products/bank_statement_fr_v2.md +0 -269
- data/docs/localized_products/carte_grise_v1.md +0 -475
- data/docs/localized_products/energy_bill_fra_v1.md +0 -342
- data/docs/localized_products/french_healthcard_v1.md +0 -142
- data/docs/localized_products/idcard_fr_v2.md +0 -284
- data/docs/localized_products/ind_passport_v1.md +0 -307
- data/docs/localized_products/payslip_fra_v3.md +0 -344
- data/docs/localized_products/us_healthcare_cards_v1.md +0 -258
- data/docs/localized_products/us_mail_v3.md +0 -152
- data/docs/localized_products.md +0 -6
- data/lib/mindee/product/us/us_mail/us_mail_v2.rb +0 -47
- data/lib/mindee/product/us/us_mail/us_mail_v2_document.rb +0 -105
- data/lib/mindee/product/us/us_mail/us_mail_v2_page.rb +0 -38
- data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb +0 -105
- data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_addresses.rb +0 -63
- data/lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb +0 -66
- data/sig/mindee/product/us/us_mail/us_mail_v2.rbs +0 -13
- data/sig/mindee/product/us/us_mail/us_mail_v2_document.rbs +0 -20
- data/sig/mindee/product/us/us_mail/us_mail_v2_page.rbs +0 -17
- data/sig/mindee/product/us/us_mail/us_mail_v2_recipient_address.rbs +0 -22
- data/sig/mindee/product/us/us_mail/us_mail_v2_recipient_addresses.rbs +0 -15
- data/sig/mindee/product/us/us_mail/us_mail_v2_sender_address.rbs +0 -18
|
@@ -1,615 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Financial Document
|
|
3
|
-
category: 622b805aaec68102ea7fcbc2
|
|
4
|
-
slug: ruby-financial-document-ocr
|
|
5
|
-
parentDoc: 67b49df15b843f3fa9cd622b
|
|
6
|
-
---
|
|
7
|
-
The Ruby Client Library supports the [Financial Document API](https://platform.mindee.com/mindee/financial_document).
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
> 📝 Product Specs
|
|
11
|
-
>
|
|
12
|
-
> | Specification | Details |
|
|
13
|
-
> | ------------------------------ | -------------------------------------------------- |
|
|
14
|
-
> | Endpoint Name | `financial_document` |
|
|
15
|
-
> | Recommended Version | `v1.14` |
|
|
16
|
-
> | Supports Polling/Webhooks | ✔️ Yes |
|
|
17
|
-
> | Support Synchronous HTTP Calls | ✔️ Yes |
|
|
18
|
-
> | Geography | 🌐 Global |
|
|
19
|
-
|
|
20
|
-
> 🔐 Polling Limitations
|
|
21
|
-
>
|
|
22
|
-
> | Setting | Parameter name | Default Value |
|
|
23
|
-
> | ------------------------------- | ----------------------- | ------------- |
|
|
24
|
-
> | Initial Delay Before Polling | `initial_delay_seconds` | 2 seconds |
|
|
25
|
-
> | Default Delay Between Calls | `delay_sec` | 1.5 seconds |
|
|
26
|
-
> | Polling Attempts Before Timeout | `max_retries` | 80 retries |
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/financial_document/default_sample.jpg),
|
|
30
|
-
we are going to illustrate how to extract the data that we want using the Ruby Client Library.
|
|
31
|
-

|
|
32
|
-
|
|
33
|
-
# Quick-Start
|
|
34
|
-
```rb
|
|
35
|
-
#
|
|
36
|
-
# Install the Ruby client library by running:
|
|
37
|
-
# gem install mindee
|
|
38
|
-
#
|
|
39
|
-
|
|
40
|
-
require 'mindee'
|
|
41
|
-
|
|
42
|
-
# Init a new client
|
|
43
|
-
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
|
|
44
|
-
|
|
45
|
-
# Load a file from disk
|
|
46
|
-
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
47
|
-
|
|
48
|
-
# Parse the file
|
|
49
|
-
result = mindee_client.parse(
|
|
50
|
-
input_source,
|
|
51
|
-
Mindee::Product::FinancialDocument::FinancialDocumentV1,
|
|
52
|
-
enqueue: false
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
# Print a full summary of the parsed data in RST format
|
|
56
|
-
puts result.document
|
|
57
|
-
|
|
58
|
-
# Print the document-level parsed data
|
|
59
|
-
# puts result.document.inference.prediction
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
You can also call this product asynchronously:
|
|
63
|
-
|
|
64
|
-
```rb
|
|
65
|
-
#
|
|
66
|
-
# Install the Ruby client library by running:
|
|
67
|
-
# gem install mindee
|
|
68
|
-
#
|
|
69
|
-
|
|
70
|
-
require 'mindee'
|
|
71
|
-
|
|
72
|
-
# Init a new client
|
|
73
|
-
mindee_client = Mindee::Client.new(api_key: 'my-api-key')
|
|
74
|
-
|
|
75
|
-
# Load a file from disk
|
|
76
|
-
input_source = mindee_client.source_from_path('/path/to/the/file.ext')
|
|
77
|
-
|
|
78
|
-
# Parse the file
|
|
79
|
-
result = mindee_client.parse(
|
|
80
|
-
input_source,
|
|
81
|
-
Mindee::Product::FinancialDocument::FinancialDocumentV1
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
# Print a full summary of the parsed data in RST format
|
|
85
|
-
puts result.document
|
|
86
|
-
|
|
87
|
-
# Print the document-level parsed data
|
|
88
|
-
# puts result.document.inference.prediction
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
**Output (RST):**
|
|
92
|
-
```rst
|
|
93
|
-
########
|
|
94
|
-
Document
|
|
95
|
-
########
|
|
96
|
-
:Mindee ID: 6dd26385-719b-4527-bf6f-87d9da619de5
|
|
97
|
-
:Filename: default_sample.jpg
|
|
98
|
-
|
|
99
|
-
Inference
|
|
100
|
-
#########
|
|
101
|
-
:Product: mindee/financial_document v1.14
|
|
102
|
-
:Rotation applied: Yes
|
|
103
|
-
|
|
104
|
-
Prediction
|
|
105
|
-
==========
|
|
106
|
-
:Locale: en-US; en; US; USD;
|
|
107
|
-
:Invoice Number: INT-001
|
|
108
|
-
:Purchase Order Number: 2412/2019
|
|
109
|
-
:Receipt Number:
|
|
110
|
-
:Document Number: INT-001
|
|
111
|
-
:Reference Numbers: 2412/2019
|
|
112
|
-
:Purchase Date: 2019-11-02
|
|
113
|
-
:Due Date: 2019-11-17
|
|
114
|
-
:Payment Date: 2019-11-17
|
|
115
|
-
:Total Net: 195.00
|
|
116
|
-
:Total Amount: 204.75
|
|
117
|
-
:Taxes:
|
|
118
|
-
+---------------+--------+----------+---------------+
|
|
119
|
-
| Base | Code | Rate (%) | Amount |
|
|
120
|
-
+===============+========+==========+===============+
|
|
121
|
-
| 195.00 | | 5.00 | 9.75 |
|
|
122
|
-
+---------------+--------+----------+---------------+
|
|
123
|
-
:Supplier Payment Details:
|
|
124
|
-
:Supplier Name: JOHN SMITH
|
|
125
|
-
:Supplier Company Registrations:
|
|
126
|
-
:Supplier Address: 4490 Oak Drive Albany, NY 12210
|
|
127
|
-
:Supplier Phone Number:
|
|
128
|
-
:Customer Name: JESSIE M HORNE
|
|
129
|
-
:Supplier Website:
|
|
130
|
-
:Supplier Email:
|
|
131
|
-
:Customer Company Registrations:
|
|
132
|
-
:Customer Address: 2019 Redbud Drive New York, NY 10011
|
|
133
|
-
:Customer ID: 1234567890
|
|
134
|
-
:Shipping Address: 2019 Redbud Drive New York, NY 10011
|
|
135
|
-
:Billing Address: 4312 Wood Road New York, NY 10031
|
|
136
|
-
:Document Type: INVOICE
|
|
137
|
-
:Document Type Extended: INVOICE
|
|
138
|
-
:Purchase Subcategory:
|
|
139
|
-
:Purchase Category: miscellaneous
|
|
140
|
-
:Total Tax: 9.75
|
|
141
|
-
:Tip and Gratuity:
|
|
142
|
-
:Purchase Time:
|
|
143
|
-
:Line Items:
|
|
144
|
-
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
|
|
145
|
-
| Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price |
|
|
146
|
-
+======================================+==============+==========+============+==============+==============+=================+============+
|
|
147
|
-
| Front and rear brake cables | | 1.00 | | | 100.00 | | 100.00 |
|
|
148
|
-
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
|
|
149
|
-
| New set of pedal arms | | 2.00 | | | 50.00 | | 25.00 |
|
|
150
|
-
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
|
|
151
|
-
| Labor 3hrs | | 3.00 | | | 45.00 | | 15.00 |
|
|
152
|
-
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
|
|
153
|
-
|
|
154
|
-
Page Predictions
|
|
155
|
-
================
|
|
156
|
-
|
|
157
|
-
Page 0
|
|
158
|
-
------
|
|
159
|
-
:Locale: en-US; en; US; USD;
|
|
160
|
-
:Invoice Number: INT-001
|
|
161
|
-
:Purchase Order Number: 2412/2019
|
|
162
|
-
:Receipt Number:
|
|
163
|
-
:Document Number: INT-001
|
|
164
|
-
:Reference Numbers: 2412/2019
|
|
165
|
-
:Purchase Date: 2019-11-02
|
|
166
|
-
:Due Date: 2019-11-17
|
|
167
|
-
:Payment Date: 2019-11-17
|
|
168
|
-
:Total Net: 195.00
|
|
169
|
-
:Total Amount: 204.75
|
|
170
|
-
:Taxes:
|
|
171
|
-
+---------------+--------+----------+---------------+
|
|
172
|
-
| Base | Code | Rate (%) | Amount |
|
|
173
|
-
+===============+========+==========+===============+
|
|
174
|
-
| 195.00 | | 5.00 | 9.75 |
|
|
175
|
-
+---------------+--------+----------+---------------+
|
|
176
|
-
:Supplier Payment Details:
|
|
177
|
-
:Supplier Name: JOHN SMITH
|
|
178
|
-
:Supplier Company Registrations:
|
|
179
|
-
:Supplier Address: 4490 Oak Drive Albany, NY 12210
|
|
180
|
-
:Supplier Phone Number:
|
|
181
|
-
:Customer Name: JESSIE M HORNE
|
|
182
|
-
:Supplier Website:
|
|
183
|
-
:Supplier Email:
|
|
184
|
-
:Customer Company Registrations:
|
|
185
|
-
:Customer Address: 2019 Redbud Drive New York, NY 10011
|
|
186
|
-
:Customer ID: 1234567890
|
|
187
|
-
:Shipping Address: 2019 Redbud Drive New York, NY 10011
|
|
188
|
-
:Billing Address: 4312 Wood Road New York, NY 10031
|
|
189
|
-
:Document Type: INVOICE
|
|
190
|
-
:Document Type Extended: INVOICE
|
|
191
|
-
:Purchase Subcategory:
|
|
192
|
-
:Purchase Category: miscellaneous
|
|
193
|
-
:Total Tax: 9.75
|
|
194
|
-
:Tip and Gratuity:
|
|
195
|
-
:Purchase Time:
|
|
196
|
-
:Line Items:
|
|
197
|
-
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
|
|
198
|
-
| Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price |
|
|
199
|
-
+======================================+==============+==========+============+==============+==============+=================+============+
|
|
200
|
-
| Front and rear brake cables | | 1.00 | | | 100.00 | | 100.00 |
|
|
201
|
-
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
|
|
202
|
-
| New set of pedal arms | | 2.00 | | | 50.00 | | 25.00 |
|
|
203
|
-
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
|
|
204
|
-
| Labor 3hrs | | 3.00 | | | 45.00 | | 15.00 |
|
|
205
|
-
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
# Field Types
|
|
209
|
-
## Standard Fields
|
|
210
|
-
These fields are generic and used in several products.
|
|
211
|
-
|
|
212
|
-
### Basic Field
|
|
213
|
-
Each prediction object contains a set of fields that inherit from the generic `Field` class.
|
|
214
|
-
A typical `Field` object will have the following attributes:
|
|
215
|
-
|
|
216
|
-
* **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
|
|
217
|
-
* **confidence** (Float, nil): the confidence score of the field prediction.
|
|
218
|
-
* **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
|
|
219
|
-
* **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
|
|
220
|
-
* **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
|
|
221
|
-
* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
Aside from the previous attributes, all basic fields have access to a `to_s` method that can be used to print their value as a string.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
### AddressField
|
|
228
|
-
Aside from the basic `BaseField` attributes, the address field `AddressField` also implements the following:
|
|
229
|
-
|
|
230
|
-
* **street_number** (`String`): String representation of the street number. Can be `nil`.
|
|
231
|
-
* **street_name** (`String`): Name of the street. Can be `nil`.
|
|
232
|
-
* **po_box** (`String`): String representation of the PO Box number. Can be `nil`.
|
|
233
|
-
* **address_complement** (`String`): Address complement. Can be `nil`.
|
|
234
|
-
* **city** (`String`): City name. Can be `nil`.
|
|
235
|
-
* **postal_code** (`String`): String representation of the postal code. Can be `nil`.
|
|
236
|
-
* **state** (`String`): State name. Can be `nil`.
|
|
237
|
-
* **country** (`String`): Country name. Can be `nil`.
|
|
238
|
-
|
|
239
|
-
Note: The `value` field of an AddressField should be a concatenation of the rest of the values.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
### Amount Field
|
|
243
|
-
The amount field `AmountField` only has one constraint: its **value** is a `Float` (or `nil`).
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
### Classification Field
|
|
247
|
-
The classification field `ClassificationField` does not implement all the basic `Field` attributes. It only implements
|
|
248
|
-
**value**, **confidence** and **page_id**.
|
|
249
|
-
|
|
250
|
-
> Note: a classification field's `value is always a `String`.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
### Company Registration Field
|
|
254
|
-
Aside from the basic `Field` attributes, the company registration field `CompanyRegistrationField` also implements the
|
|
255
|
-
following:
|
|
256
|
-
|
|
257
|
-
* **type** (`String`): the type of company.
|
|
258
|
-
|
|
259
|
-
### Date Field
|
|
260
|
-
Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
|
|
261
|
-
|
|
262
|
-
* **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
|
|
263
|
-
|
|
264
|
-
### Locale Field
|
|
265
|
-
The locale field `LocaleField` only implements the **value**, **confidence** and **page_id** base `Field` attributes,
|
|
266
|
-
but it comes with its own:
|
|
267
|
-
|
|
268
|
-
* **language** (`String`): ISO 639-1 language code (e.g.: `en` for English). Can be `nil`.
|
|
269
|
-
* **country** (`String`): ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3 code for countries (e.g.: `GRB` or `GB` for "Great
|
|
270
|
-
Britain"). Can be `nil`.
|
|
271
|
-
* **currency** (`String`): ISO 4217 code for currencies (e.g.: `USD` for "US Dollars"). Can be `nil`.
|
|
272
|
-
|
|
273
|
-
### Payment Details Field
|
|
274
|
-
Aside from the basic `Field` attributes, the payment details field `PaymentDetailsField` also implements the
|
|
275
|
-
following:
|
|
276
|
-
|
|
277
|
-
* **account_number** (`String`): number of an account, expressed as a string. Can be `nil`.
|
|
278
|
-
* **iban** (`String`): International Bank Account Number. Can be `nil`.
|
|
279
|
-
* **routing_number** (`String`): routing number of an account. Can be `nil`.
|
|
280
|
-
* **swift** (`String`): the account holder's bank's SWIFT Business Identifier Code (BIC). Can be `nil`.
|
|
281
|
-
|
|
282
|
-
### String Field
|
|
283
|
-
The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
|
|
284
|
-
|
|
285
|
-
### Taxes Field
|
|
286
|
-
#### Tax
|
|
287
|
-
Aside from the basic `Field` attributes, the tax field `TaxField` also implements the following:
|
|
288
|
-
|
|
289
|
-
* **rate** (`Float`): the tax rate applied to an item can be expressed as a percentage. Can be `nil`.
|
|
290
|
-
* **code** (`String`): tax code (or equivalent, depending on the origin of the document). Can be `nil`.
|
|
291
|
-
* **base** (`Float`): base amount used for the tax. Can be `nil`.
|
|
292
|
-
* **value** (`Float`): the value of the tax. Can be `nil`.
|
|
293
|
-
|
|
294
|
-
> Note: currently `TaxField` is not used on its own, and is accessed through a parent `Taxes` object, an array-like
|
|
295
|
-
structure.
|
|
296
|
-
|
|
297
|
-
#### Taxes (Array)
|
|
298
|
-
The `Taxes` field represents an array-like collection of `TaxField` objects. As it is the representation of several
|
|
299
|
-
objects, it has access to a custom `to_s` method that can render a `TaxField` object as a table line.
|
|
300
|
-
|
|
301
|
-
## Specific Fields
|
|
302
|
-
Fields which are specific to this product; they are not used in any other product.
|
|
303
|
-
|
|
304
|
-
### Line Items Field
|
|
305
|
-
List of line item present on the document.
|
|
306
|
-
|
|
307
|
-
A `FinancialDocumentV1LineItem` implements the following attributes:
|
|
308
|
-
|
|
309
|
-
* `description` (String): The item description.
|
|
310
|
-
* `product_code` (String): The product code referring to the item.
|
|
311
|
-
* `quantity` (Float): The item quantity
|
|
312
|
-
* `tax_amount` (Float): The item tax amount.
|
|
313
|
-
* `tax_rate` (Float): The item tax rate in percentage.
|
|
314
|
-
* `total_amount` (Float): The item total amount.
|
|
315
|
-
* `unit_measure` (String): The item unit of measure.
|
|
316
|
-
* `unit_price` (Float): The item unit price.
|
|
317
|
-
|
|
318
|
-
# Attributes
|
|
319
|
-
The following fields are extracted for Financial Document V1:
|
|
320
|
-
|
|
321
|
-
## Billing Address
|
|
322
|
-
**billing_address** ([AddressField](#address-field)): The customer's address used for billing.
|
|
323
|
-
|
|
324
|
-
```rb
|
|
325
|
-
puts result.document.inference.prediction.billing_address.value
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
## Purchase Category
|
|
329
|
-
**category** ([ClassificationField](#classification-field)): The purchase category.
|
|
330
|
-
|
|
331
|
-
#### Possible values include:
|
|
332
|
-
- 'toll'
|
|
333
|
-
- 'food'
|
|
334
|
-
- 'parking'
|
|
335
|
-
- 'transport'
|
|
336
|
-
- 'accommodation'
|
|
337
|
-
- 'gasoline'
|
|
338
|
-
- 'telecom'
|
|
339
|
-
- 'miscellaneous'
|
|
340
|
-
- 'software'
|
|
341
|
-
- 'shopping'
|
|
342
|
-
- 'energy'
|
|
343
|
-
|
|
344
|
-
```rb
|
|
345
|
-
puts result.document.inference.prediction.category.value
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
## Customer Address
|
|
349
|
-
**customer_address** ([AddressField](#address-field)): The address of the customer.
|
|
350
|
-
|
|
351
|
-
```rb
|
|
352
|
-
puts result.document.inference.prediction.customer_address.value
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
## Customer Company Registrations
|
|
356
|
-
**customer_company_registrations** (Array<[CompanyRegistrationField](#company-registration-field)>): List of company registration numbers associated to the customer.
|
|
357
|
-
|
|
358
|
-
```rb
|
|
359
|
-
result.document.inference.prediction.customer_company_registrations do |customer_company_registrations_elem|
|
|
360
|
-
puts customer_company_registrations_elem.value
|
|
361
|
-
end
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
## Customer ID
|
|
365
|
-
**customer_id** ([StringField](#string-field)): The customer account number or identifier from the supplier.
|
|
366
|
-
|
|
367
|
-
```rb
|
|
368
|
-
puts result.document.inference.prediction.customer_id.value
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
## Customer Name
|
|
372
|
-
**customer_name** ([StringField](#string-field)): The name of the customer.
|
|
373
|
-
|
|
374
|
-
```rb
|
|
375
|
-
puts result.document.inference.prediction.customer_name.value
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
## Purchase Date
|
|
379
|
-
**date** ([DateField](#date-field)): The date the purchase was made.
|
|
380
|
-
|
|
381
|
-
```rb
|
|
382
|
-
puts result.document.inference.prediction.date.value
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
## Document Number
|
|
386
|
-
**document_number** ([StringField](#string-field)): The document number or identifier (invoice number or receipt number).
|
|
387
|
-
|
|
388
|
-
```rb
|
|
389
|
-
puts result.document.inference.prediction.document_number.value
|
|
390
|
-
```
|
|
391
|
-
|
|
392
|
-
## Document Type
|
|
393
|
-
**document_type** ([ClassificationField](#classification-field)): The type of the document: INVOICE or CREDIT NOTE if it is an invoice, CREDIT CARD RECEIPT or EXPENSE RECEIPT if it is a receipt.
|
|
394
|
-
|
|
395
|
-
#### Possible values include:
|
|
396
|
-
- 'INVOICE'
|
|
397
|
-
- 'CREDIT NOTE'
|
|
398
|
-
- 'CREDIT CARD RECEIPT'
|
|
399
|
-
- 'EXPENSE RECEIPT'
|
|
400
|
-
|
|
401
|
-
```rb
|
|
402
|
-
puts result.document.inference.prediction.document_type.value
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
## Document Type Extended
|
|
406
|
-
**document_type_extended** ([ClassificationField](#classification-field)): Document type extended.
|
|
407
|
-
|
|
408
|
-
#### Possible values include:
|
|
409
|
-
- 'CREDIT NOTE'
|
|
410
|
-
- 'INVOICE'
|
|
411
|
-
- 'OTHER'
|
|
412
|
-
- 'OTHER_FINANCIAL'
|
|
413
|
-
- 'PAYSLIP'
|
|
414
|
-
- 'PURCHASE ORDER'
|
|
415
|
-
- 'QUOTE'
|
|
416
|
-
- 'RECEIPT'
|
|
417
|
-
- 'STATEMENT'
|
|
418
|
-
|
|
419
|
-
```rb
|
|
420
|
-
puts result.document.inference.prediction.document_type_extended.value
|
|
421
|
-
```
|
|
422
|
-
|
|
423
|
-
## Due Date
|
|
424
|
-
**due_date** ([DateField](#date-field)): The date on which the payment is due.
|
|
425
|
-
|
|
426
|
-
```rb
|
|
427
|
-
puts result.document.inference.prediction.due_date.value
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
## Invoice Number
|
|
431
|
-
**invoice_number** ([StringField](#string-field)): The invoice number or identifier only if document is an invoice.
|
|
432
|
-
|
|
433
|
-
```rb
|
|
434
|
-
puts result.document.inference.prediction.invoice_number.value
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
## Line Items
|
|
438
|
-
**line_items** (Array<[FinancialDocumentV1LineItem](#line-items-field)>): List of line item present on the document.
|
|
439
|
-
|
|
440
|
-
```rb
|
|
441
|
-
result.document.inference.prediction.line_items do |line_items_elem|
|
|
442
|
-
puts line_items_elem.value
|
|
443
|
-
end
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
## Locale
|
|
447
|
-
**locale** ([LocaleField](#locale-field)): The locale of the document.
|
|
448
|
-
|
|
449
|
-
```rb
|
|
450
|
-
puts result.document.inference.prediction.locale.value
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
## Payment Date
|
|
454
|
-
**payment_date** ([DateField](#date-field)): The date on which the payment is due / fullfilled.
|
|
455
|
-
|
|
456
|
-
```rb
|
|
457
|
-
puts result.document.inference.prediction.payment_date.value
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
## Purchase Order Number
|
|
461
|
-
**po_number** ([StringField](#string-field)): The purchase order number, only if the document is an invoice.
|
|
462
|
-
|
|
463
|
-
```rb
|
|
464
|
-
puts result.document.inference.prediction.po_number.value
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
## Receipt Number
|
|
468
|
-
**receipt_number** ([StringField](#string-field)): The receipt number or identifier only if document is a receipt.
|
|
469
|
-
|
|
470
|
-
```rb
|
|
471
|
-
puts result.document.inference.prediction.receipt_number.value
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
## Reference Numbers
|
|
475
|
-
**reference_numbers** (Array<[StringField](#string-field)>): List of Reference numbers, including PO number, only if the document is an invoice.
|
|
476
|
-
|
|
477
|
-
```rb
|
|
478
|
-
result.document.inference.prediction.reference_numbers do |reference_numbers_elem|
|
|
479
|
-
puts reference_numbers_elem.value
|
|
480
|
-
end
|
|
481
|
-
```
|
|
482
|
-
|
|
483
|
-
## Shipping Address
|
|
484
|
-
**shipping_address** ([AddressField](#address-field)): The customer's address used for shipping.
|
|
485
|
-
|
|
486
|
-
```rb
|
|
487
|
-
puts result.document.inference.prediction.shipping_address.value
|
|
488
|
-
```
|
|
489
|
-
|
|
490
|
-
## Purchase Subcategory
|
|
491
|
-
**subcategory** ([ClassificationField](#classification-field)): The purchase subcategory for transport, food and shooping.
|
|
492
|
-
|
|
493
|
-
#### Possible values include:
|
|
494
|
-
- 'plane'
|
|
495
|
-
- 'taxi'
|
|
496
|
-
- 'train'
|
|
497
|
-
- 'restaurant'
|
|
498
|
-
- 'shopping'
|
|
499
|
-
- 'other'
|
|
500
|
-
- 'groceries'
|
|
501
|
-
- 'cultural'
|
|
502
|
-
- 'electronics'
|
|
503
|
-
- 'office_supplies'
|
|
504
|
-
- 'micromobility'
|
|
505
|
-
- 'car_rental'
|
|
506
|
-
- 'public'
|
|
507
|
-
- 'delivery'
|
|
508
|
-
- nil
|
|
509
|
-
|
|
510
|
-
```rb
|
|
511
|
-
puts result.document.inference.prediction.subcategory.value
|
|
512
|
-
```
|
|
513
|
-
|
|
514
|
-
## Supplier Address
|
|
515
|
-
**supplier_address** ([AddressField](#address-field)): The address of the supplier or merchant.
|
|
516
|
-
|
|
517
|
-
```rb
|
|
518
|
-
puts result.document.inference.prediction.supplier_address.value
|
|
519
|
-
```
|
|
520
|
-
|
|
521
|
-
## Supplier Company Registrations
|
|
522
|
-
**supplier_company_registrations** (Array<[CompanyRegistrationField](#company-registration-field)>): List of company registration numbers associated to the supplier.
|
|
523
|
-
|
|
524
|
-
```rb
|
|
525
|
-
result.document.inference.prediction.supplier_company_registrations do |supplier_company_registrations_elem|
|
|
526
|
-
puts supplier_company_registrations_elem.value
|
|
527
|
-
end
|
|
528
|
-
```
|
|
529
|
-
|
|
530
|
-
## Supplier Email
|
|
531
|
-
**supplier_email** ([StringField](#string-field)): The email of the supplier or merchant.
|
|
532
|
-
|
|
533
|
-
```rb
|
|
534
|
-
puts result.document.inference.prediction.supplier_email.value
|
|
535
|
-
```
|
|
536
|
-
|
|
537
|
-
## Supplier Name
|
|
538
|
-
**supplier_name** ([StringField](#string-field)): The name of the supplier or merchant.
|
|
539
|
-
|
|
540
|
-
```rb
|
|
541
|
-
puts result.document.inference.prediction.supplier_name.value
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
## Supplier Payment Details
|
|
545
|
-
**supplier_payment_details** (Array<[PaymentDetailsField](#payment-details-field)>): List of payment details associated to the supplier (only for invoices).
|
|
546
|
-
|
|
547
|
-
```rb
|
|
548
|
-
result.document.inference.prediction.supplier_payment_details do |supplier_payment_details_elem|
|
|
549
|
-
puts supplier_payment_details_elem.value
|
|
550
|
-
puts supplier_payment_details_elem.rate
|
|
551
|
-
puts supplier_payment_details_elem.code
|
|
552
|
-
puts supplier_payment_details_elem.basis
|
|
553
|
-
end
|
|
554
|
-
```
|
|
555
|
-
|
|
556
|
-
## Supplier Phone Number
|
|
557
|
-
**supplier_phone_number** ([StringField](#string-field)): The phone number of the supplier or merchant.
|
|
558
|
-
|
|
559
|
-
```rb
|
|
560
|
-
puts result.document.inference.prediction.supplier_phone_number.value
|
|
561
|
-
```
|
|
562
|
-
|
|
563
|
-
## Supplier Website
|
|
564
|
-
**supplier_website** ([StringField](#string-field)): The website URL of the supplier or merchant.
|
|
565
|
-
|
|
566
|
-
```rb
|
|
567
|
-
puts result.document.inference.prediction.supplier_website.value
|
|
568
|
-
```
|
|
569
|
-
|
|
570
|
-
## Taxes
|
|
571
|
-
**taxes** (Array<[TaxField](#taxes-field)>): List of all taxes on the document.
|
|
572
|
-
|
|
573
|
-
```rb
|
|
574
|
-
result.document.inference.prediction.taxes do |taxes_elem|
|
|
575
|
-
puts taxes_elem.value
|
|
576
|
-
end
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
## Purchase Time
|
|
580
|
-
**time** ([StringField](#string-field)): The time the purchase was made (only for receipts).
|
|
581
|
-
|
|
582
|
-
```rb
|
|
583
|
-
puts result.document.inference.prediction.time.value
|
|
584
|
-
```
|
|
585
|
-
|
|
586
|
-
## Tip and Gratuity
|
|
587
|
-
**tip** ([AmountField](#amount-field)): The total amount of tip and gratuity
|
|
588
|
-
|
|
589
|
-
```rb
|
|
590
|
-
puts result.document.inference.prediction.tip.value
|
|
591
|
-
```
|
|
592
|
-
|
|
593
|
-
## Total Amount
|
|
594
|
-
**total_amount** ([AmountField](#amount-field)): The total amount paid: includes taxes, tips, fees, and other charges.
|
|
595
|
-
|
|
596
|
-
```rb
|
|
597
|
-
puts result.document.inference.prediction.total_amount.value
|
|
598
|
-
```
|
|
599
|
-
|
|
600
|
-
## Total Net
|
|
601
|
-
**total_net** ([AmountField](#amount-field)): The net amount paid: does not include taxes, fees, and discounts.
|
|
602
|
-
|
|
603
|
-
```rb
|
|
604
|
-
puts result.document.inference.prediction.total_net.value
|
|
605
|
-
```
|
|
606
|
-
|
|
607
|
-
## Total Tax
|
|
608
|
-
**total_tax** ([AmountField](#amount-field)): The sum of all taxes present on the document.
|
|
609
|
-
|
|
610
|
-
```rb
|
|
611
|
-
puts result.document.inference.prediction.total_tax.value
|
|
612
|
-
```
|
|
613
|
-
|
|
614
|
-
# Questions?
|
|
615
|
-
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
|