Skip to content

Commit 875f947

Browse files
✨ update financial document to v1.6 & invoice to v4.6
1 parent 1afb03b commit 875f947

10 files changed

+148
-22
lines changed

docs/financial_document_v1.md

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ puts result.document
3434
########
3535
Document
3636
########
37-
:Mindee ID: a6b54e2d-a7fa-4e08-8de6-6cd296f50f3d
37+
:Mindee ID: 503895c6-eced-42e2-a6fc-0292b7ccf680
3838
:Filename: default_sample.jpg
3939
4040
Inference
4141
#########
42-
:Product: mindee/financial_document v1.2
42+
:Product: mindee/financial_document v1.6
4343
:Rotation applied: Yes
4444
4545
Prediction
4646
==========
47-
:Locale: en; en; USD;
47+
:Locale: en; USD;
4848
:Invoice Number: INT-001
4949
:Reference Numbers: 2412/2019
50-
:Purchase Date: 2019-02-11
50+
:Purchase Date: 2019-11-02
5151
:Due Date: 2019-02-26
5252
:Total Net: 195.00
5353
:Total Amount: 204.75
@@ -63,8 +63,13 @@ Prediction
6363
:Supplier Address: 4490 Oak Drive Albany, NY 12210
6464
:Supplier Phone Number:
6565
:Customer Name: JESSIE M HORNE
66+
:Supplier Website:
67+
:Supplier Email:
6668
:Customer Company Registrations:
6769
:Customer Address: 2019 Redbud Drive New York, NY 10011
70+
:Customer ID: 1234567890
71+
:Shipping Address: 2019 Redbud Drive New York, NY 10011
72+
:Billing Address: 4312 Wood Road New York, NY 10031
6873
:Document Type: INVOICE
6974
:Purchase Subcategory:
7075
:Purchase Category: miscellaneous
@@ -79,18 +84,18 @@ Prediction
7984
+--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
8085
| New set of pedal arms | | 2.00 | | | 50.00 | 25.00 |
8186
+--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
82-
| Labon 3hrs | | 3.00 | | | 45.00 | 15.00 |
87+
| Labor 3hrs | | 3.00 | | | 45.00 | 15.00 |
8388
+--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
8489
8590
Page Predictions
8691
================
8792
8893
Page 0
8994
------
90-
:Locale: en; en; USD;
95+
:Locale: en; USD;
9196
:Invoice Number: INT-001
9297
:Reference Numbers: 2412/2019
93-
:Purchase Date: 2019-02-11
98+
:Purchase Date: 2019-11-02
9499
:Due Date: 2019-02-26
95100
:Total Net: 195.00
96101
:Total Amount: 204.75
@@ -106,8 +111,13 @@ Page 0
106111
:Supplier Address: 4490 Oak Drive Albany, NY 12210
107112
:Supplier Phone Number:
108113
:Customer Name: JESSIE M HORNE
114+
:Supplier Website:
115+
:Supplier Email:
109116
:Customer Company Registrations:
110117
:Customer Address: 2019 Redbud Drive New York, NY 10011
118+
:Customer ID: 1234567890
119+
:Shipping Address: 2019 Redbud Drive New York, NY 10011
120+
:Billing Address: 4312 Wood Road New York, NY 10031
111121
:Document Type: INVOICE
112122
:Purchase Subcategory:
113123
:Purchase Category: miscellaneous
@@ -122,7 +132,7 @@ Page 0
122132
+--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
123133
| New set of pedal arms | | 2.00 | | | 50.00 | 25.00 |
124134
+--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
125-
| Labon 3hrs | | 3.00 | | | 45.00 | 15.00 |
135+
| Labor 3hrs | | 3.00 | | | 45.00 | 15.00 |
126136
+--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
127137
```
128138

@@ -215,6 +225,13 @@ A `FinancialDocumentV1LineItem` implements the following attributes:
215225
# Attributes
216226
The following fields are extracted for Financial Document V1:
217227

228+
## Billing Address
229+
**billing_address** ([StringField](#string-field)): The customer's address used for billing.
230+
231+
```rb
232+
puts result.document.inference.prediction.billing_address.value
233+
```
234+
218235
## Purchase Category
219236
**category** ([ClassificationField](#classification-field)): The purchase category among predefined classes.
220237

@@ -238,6 +255,13 @@ for customer_company_registrations_elem in result.document.inference.prediction.
238255
end
239256
```
240257

258+
## Customer ID
259+
**customer_id** ([StringField](#string-field)): The customer account number or identifier from the supplier.
260+
261+
```rb
262+
puts result.document.inference.prediction.customer_id.value
263+
```
264+
241265
## Customer Name
242266
**customer_name** ([StringField](#string-field)): The name of the customer.
243267

@@ -298,6 +322,13 @@ for reference_numbers_elem in result.document.inference.prediction.reference_num
298322
end
299323
```
300324

325+
## Shipping Address
326+
**shipping_address** ([StringField](#string-field)): The customer's address used for shipping.
327+
328+
```rb
329+
puts result.document.inference.prediction.shipping_address.value
330+
```
331+
301332
## Purchase Subcategory
302333
**subcategory** ([ClassificationField](#classification-field)): The purchase subcategory among predefined classes for transport and food.
303334

@@ -321,6 +352,13 @@ for supplier_company_registrations_elem in result.document.inference.prediction.
321352
end
322353
```
323354

355+
## Supplier Email
356+
**supplier_email** ([StringField](#string-field)): The email of the supplier or merchant.
357+
358+
```rb
359+
puts result.document.inference.prediction.supplier_email.value
360+
```
361+
324362
## Supplier Name
325363
**supplier_name** ([StringField](#string-field)): The name of the supplier or merchant.
326364

@@ -347,6 +385,13 @@ end
347385
puts result.document.inference.prediction.supplier_phone_number.value
348386
```
349387

388+
## Supplier Website
389+
**supplier_website** ([StringField](#string-field)): The website URL of the supplier or merchant.
390+
391+
```rb
392+
puts result.document.inference.prediction.supplier_website.value
393+
```
394+
350395
## Taxes
351396
**taxes** (Array<[TaxField](#taxes-field)>): List of tax lines information.
352397

docs/invoices_v4.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ puts result.document
3434
########
3535
Document
3636
########
37-
:Mindee ID: a9062dd1-0d34-42ab-9505-0481a8545106
37+
:Mindee ID: 5c0371d0-1433-43a4-b8fb-a3b11aaf9a0e
3838
:Filename: default_sample.jpg
3939
4040
Inference
4141
#########
42-
:Product: mindee/invoices v4.5
42+
:Product: mindee/invoices v4.6
4343
:Rotation applied: Yes
4444
4545
Prediction
@@ -48,7 +48,7 @@ Prediction
4848
:Invoice Number: 14
4949
:Reference Numbers: AD29094
5050
:Purchase Date: 2018-09-25
51-
:Due Date: 2018-09-25
51+
:Due Date:
5252
:Total Net:
5353
:Total Amount: 2608.20
5454
:Total Tax: 193.20
@@ -61,10 +61,14 @@ Prediction
6161
:Supplier Payment Details:
6262
:Supplier Name: TURNPIKE DESIGNS
6363
:Supplier Company Registrations:
64-
:Supplier Address: 156 University Ave, Toronto ON, Canada M5H 2H7
64+
:Supplier Address: 156 University Ave, Toronto ON, Canada, M5H 2H7
65+
:Supplier Phone Number: 4165551212
66+
:Supplier Website:
67+
:Supplier Email: i_doi@example.com
6568
:Customer Name: JIRO DOI
6669
:Customer Company Registrations:
6770
:Customer Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
71+
:Customer ID:
6872
:Shipping Address:
6973
:Billing Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
7074
:Document Type: INVOICE
@@ -88,7 +92,7 @@ Page 0
8892
:Invoice Number: 14
8993
:Reference Numbers: AD29094
9094
:Purchase Date: 2018-09-25
91-
:Due Date: 2018-09-25
95+
:Due Date:
9296
:Total Net:
9397
:Total Amount: 2608.20
9498
:Total Tax: 193.20
@@ -101,10 +105,14 @@ Page 0
101105
:Supplier Payment Details:
102106
:Supplier Name: TURNPIKE DESIGNS
103107
:Supplier Company Registrations:
104-
:Supplier Address: 156 University Ave, Toronto ON, Canada M5H 2H7
108+
:Supplier Address: 156 University Ave, Toronto ON, Canada, M5H 2H7
109+
:Supplier Phone Number: 4165551212
110+
:Supplier Website:
111+
:Supplier Email: i_doi@example.com
105112
:Customer Name: JIRO DOI
106113
:Customer Company Registrations:
107114
:Customer Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
115+
:Customer ID:
108116
:Shipping Address:
109117
:Billing Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
110118
:Document Type: INVOICE
@@ -232,6 +240,13 @@ for customer_company_registrations_elem in result.document.inference.prediction.
232240
end
233241
```
234242

243+
## Customer ID
244+
**customer_id** ([StringField](#string-field)): The customer account number or identifier from the supplier.
245+
246+
```rb
247+
puts result.document.inference.prediction.customer_id.value
248+
```
249+
235250
## Customer Name
236251
**customer_name** ([StringField](#string-field)): The name of the customer or client.
237252

@@ -315,6 +330,13 @@ for supplier_company_registrations_elem in result.document.inference.prediction.
315330
end
316331
```
317332

333+
## Supplier Email
334+
**supplier_email** ([StringField](#string-field)): The email of the supplier or merchant.
335+
336+
```rb
337+
puts result.document.inference.prediction.supplier_email.value
338+
```
339+
318340
## Supplier Name
319341
**supplier_name** ([StringField](#string-field)): The name of the supplier or merchant.
320342

@@ -334,6 +356,20 @@ for supplier_payment_details_elem in result.document.inference.prediction.suppli
334356
end
335357
```
336358

359+
## Supplier Phone Number
360+
**supplier_phone_number** ([StringField](#string-field)): The phone number of the supplier or merchant.
361+
362+
```rb
363+
puts result.document.inference.prediction.supplier_phone_number.value
364+
```
365+
366+
## Supplier Website
367+
**supplier_website** ([StringField](#string-field)): The website URL of the supplier or merchant.
368+
369+
```rb
370+
puts result.document.inference.prediction.supplier_website.value
371+
```
372+
337373
## Taxes
338374
**taxes** (Array<[TaxField](#taxes-field)>): List of tax line details.
339375

lib/mindee/product/financial_document/financial_document_v1.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Mindee
88
module Product
99
# Financial Document module.
1010
module FinancialDocument
11-
# Financial Document V1 prediction inference.
11+
# Financial Document API version 1 inference prediction.
1212
class FinancialDocumentV1 < Mindee::Parsing::Common::Inference
1313
@endpoint_name = 'financial_document'
1414
@endpoint_version = '1'

lib/mindee/product/financial_document/financial_document_v1_document.rb

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
module Mindee
77
module Product
88
module FinancialDocument
9-
# Financial Document V1 document prediction.
9+
# Financial Document API version 1.6 document data.
1010
class FinancialDocumentV1Document < Mindee::Parsing::Common::Prediction
1111
include Mindee::Parsing::Standard
12+
# The customer's address used for billing.
13+
# @return [Mindee::Parsing::Standard::StringField]
14+
attr_reader :billing_address
1215
# The purchase category among predefined classes.
1316
# @return [Mindee::Parsing::Standard::ClassificationField]
1417
attr_reader :category
@@ -18,6 +21,9 @@ class FinancialDocumentV1Document < Mindee::Parsing::Common::Prediction
1821
# List of company registrations associated to the customer.
1922
# @return [Array<Mindee::Parsing::Standard::CompanyRegistrationField>]
2023
attr_reader :customer_company_registrations
24+
# The customer account number or identifier from the supplier.
25+
# @return [Mindee::Parsing::Standard::StringField]
26+
attr_reader :customer_id
2127
# The name of the customer.
2228
# @return [Mindee::Parsing::Standard::StringField]
2329
attr_reader :customer_name
@@ -42,6 +48,9 @@ class FinancialDocumentV1Document < Mindee::Parsing::Common::Prediction
4248
# List of Reference numbers, including PO number.
4349
# @return [Array<Mindee::Parsing::Standard::StringField>]
4450
attr_reader :reference_numbers
51+
# The customer's address used for shipping.
52+
# @return [Mindee::Parsing::Standard::StringField]
53+
attr_reader :shipping_address
4554
# The purchase subcategory among predefined classes for transport and food.
4655
# @return [Mindee::Parsing::Standard::ClassificationField]
4756
attr_reader :subcategory
@@ -51,6 +60,9 @@ class FinancialDocumentV1Document < Mindee::Parsing::Common::Prediction
5160
# List of company registrations associated to the supplier.
5261
# @return [Array<Mindee::Parsing::Standard::CompanyRegistrationField>]
5362
attr_reader :supplier_company_registrations
63+
# The email of the supplier or merchant.
64+
# @return [Mindee::Parsing::Standard::StringField]
65+
attr_reader :supplier_email
5466
# The name of the supplier or merchant.
5567
# @return [Mindee::Parsing::Standard::StringField]
5668
attr_reader :supplier_name
@@ -60,6 +72,9 @@ class FinancialDocumentV1Document < Mindee::Parsing::Common::Prediction
6072
# The phone number of the supplier or merchant.
6173
# @return [Mindee::Parsing::Standard::StringField]
6274
attr_reader :supplier_phone_number
75+
# The website URL of the supplier or merchant.
76+
# @return [Mindee::Parsing::Standard::StringField]
77+
attr_reader :supplier_website
6378
# List of tax lines information.
6479
# @return [Mindee::Parsing::Standard::Taxes]
6580
attr_reader :taxes
@@ -83,12 +98,14 @@ class FinancialDocumentV1Document < Mindee::Parsing::Common::Prediction
8398
# @param page_id [Integer, nil]
8499
def initialize(prediction, page_id)
85100
super()
101+
@billing_address = StringField.new(prediction['billing_address'], page_id)
86102
@category = ClassificationField.new(prediction['category'], page_id)
87103
@customer_address = StringField.new(prediction['customer_address'], page_id)
88104
@customer_company_registrations = []
89105
prediction['customer_company_registrations'].each do |item|
90106
@customer_company_registrations.push(CompanyRegistrationField.new(item, page_id))
91107
end
108+
@customer_id = StringField.new(prediction['customer_id'], page_id)
92109
@customer_name = StringField.new(prediction['customer_name'], page_id)
93110
@date = DateField.new(prediction['date'], page_id)
94111
@document_type = ClassificationField.new(prediction['document_type'], page_id)
@@ -103,18 +120,21 @@ def initialize(prediction, page_id)
103120
prediction['reference_numbers'].each do |item|
104121
@reference_numbers.push(StringField.new(item, page_id))
105122
end
123+
@shipping_address = StringField.new(prediction['shipping_address'], page_id)
106124
@subcategory = ClassificationField.new(prediction['subcategory'], page_id)
107125
@supplier_address = StringField.new(prediction['supplier_address'], page_id)
108126
@supplier_company_registrations = []
109127
prediction['supplier_company_registrations'].each do |item|
110128
@supplier_company_registrations.push(CompanyRegistrationField.new(item, page_id))
111129
end
130+
@supplier_email = StringField.new(prediction['supplier_email'], page_id)
112131
@supplier_name = StringField.new(prediction['supplier_name'], page_id)
113132
@supplier_payment_details = []
114133
prediction['supplier_payment_details'].each do |item|
115134
@supplier_payment_details.push(PaymentDetailsField.new(item, page_id))
116135
end
117136
@supplier_phone_number = StringField.new(prediction['supplier_phone_number'], page_id)
137+
@supplier_website = StringField.new(prediction['supplier_website'], page_id)
118138
@taxes = Taxes.new(prediction['taxes'], page_id)
119139
@time = StringField.new(prediction['time'], page_id)
120140
@tip = AmountField.new(prediction['tip'], page_id)
@@ -145,8 +165,13 @@ def to_s
145165
out_str << "\n:Supplier Address: #{@supplier_address}".rstrip
146166
out_str << "\n:Supplier Phone Number: #{@supplier_phone_number}".rstrip
147167
out_str << "\n:Customer Name: #{@customer_name}".rstrip
168+
out_str << "\n:Supplier Website: #{@supplier_website}".rstrip
169+
out_str << "\n:Supplier Email: #{@supplier_email}".rstrip
148170
out_str << "\n:Customer Company Registrations: #{customer_company_registrations}".rstrip
149171
out_str << "\n:Customer Address: #{@customer_address}".rstrip
172+
out_str << "\n:Customer ID: #{@customer_id}".rstrip
173+
out_str << "\n:Shipping Address: #{@shipping_address}".rstrip
174+
out_str << "\n:Billing Address: #{@billing_address}".rstrip
150175
out_str << "\n:Document Type: #{@document_type}".rstrip
151176
out_str << "\n:Purchase Subcategory: #{@subcategory}".rstrip
152177
out_str << "\n:Purchase Category: #{@category}".rstrip

lib/mindee/product/financial_document/financial_document_v1_page.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
module Mindee
77
module Product
88
module FinancialDocument
9-
# Financial Document V1 page.
9+
# Financial Document API version 1.6 page data.
1010
class FinancialDocumentV1Page < Mindee::Parsing::Common::Page
1111
# @param prediction [Hash]
1212
def initialize(prediction)

lib/mindee/product/invoice/invoice_v4.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module Mindee
88
module Product
99
# Invoice module.
1010
module Invoice
11-
# Invoice V4 prediction inference.
11+
# Invoice API version 4 inference prediction.
1212
class InvoiceV4 < Mindee::Parsing::Common::Inference
1313
@endpoint_name = 'invoices'
1414
@endpoint_version = '4'

0 commit comments

Comments
 (0)