mindee 3.11.0 → 3.13.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 (142) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/CHANGELOG.md +27 -0
  4. data/README.md +23 -23
  5. data/Rakefile +5 -0
  6. data/bin/mindee.rb +7 -1
  7. data/docs/bank_account_details_v2.md +5 -1
  8. data/docs/bank_check_v1.md +6 -2
  9. data/docs/bank_statement_fr_v1.md +3 -0
  10. data/docs/barcode_reader_v1.md +5 -1
  11. data/docs/bill_of_lading_v1.md +202 -0
  12. data/docs/carte_grise_v1.md +5 -1
  13. data/docs/carte_vitale_v1.md +5 -1
  14. data/docs/code_samples/bill_of_lading_v1_async.txt +19 -0
  15. data/docs/code_samples/energy_bill_fra_v1_async.txt +19 -0
  16. data/docs/code_samples/financial_document_v1_async.txt +19 -0
  17. data/docs/code_samples/invoices_v4_async.txt +19 -0
  18. data/docs/code_samples/nutrition_facts_v1_async.txt +19 -0
  19. data/docs/code_samples/payslip_fra_v2_async.txt +19 -0
  20. data/docs/code_samples/us_healthcare_cards_v1_async.txt +19 -0
  21. data/docs/cropper_v1.md +6 -2
  22. data/docs/custom_v1.md +5 -3
  23. data/docs/energy_bill_fra_v1.md +249 -0
  24. data/docs/eu_driver_license_v1.md +6 -2
  25. data/docs/expense_receipts_v5.md +38 -11
  26. data/docs/financial_document_v1.md +80 -23
  27. data/docs/generated_v1.md +3 -0
  28. data/docs/getting_started.md +3 -0
  29. data/docs/idcard_fr_v2.md +15 -2
  30. data/docs/international_id_v2.md +13 -1
  31. data/docs/invoice_splitter_v1.md +16 -13
  32. data/docs/invoices_v4.md +57 -23
  33. data/docs/license_plates_v1.md +5 -1
  34. data/docs/multi_receipts_detector_v1.md +5 -1
  35. data/docs/nutrition_facts_v1.md +295 -0
  36. data/docs/passport_v1.md +5 -1
  37. data/docs/payslip_fra_v2.md +218 -0
  38. data/docs/proof_of_address_v1.md +5 -1
  39. data/docs/resume_v1.md +24 -1
  40. data/docs/us_driver_license_v1.md +6 -2
  41. data/docs/us_healthcare_cards_v1.md +208 -0
  42. data/docs/us_mail_v2.md +5 -1
  43. data/docs/us_w9_v1.md +6 -2
  44. data/examples/auto_invoice_splitter_extraction.rb +43 -0
  45. data/lib/mindee/client.rb +20 -8
  46. data/lib/mindee/extraction/common/extracted_image.rb +73 -0
  47. data/lib/mindee/extraction/common/image_extractor.rb +189 -0
  48. data/lib/mindee/extraction/common.rb +4 -0
  49. data/lib/mindee/extraction/multi_receipts_extractor/multi_receipts_extractor.rb +26 -0
  50. data/lib/mindee/extraction/multi_receipts_extractor.rb +3 -0
  51. data/lib/mindee/extraction/pdf_extractor/extracted_pdf.rb +55 -0
  52. data/lib/mindee/extraction/pdf_extractor/pdf_extractor.rb +111 -0
  53. data/lib/mindee/extraction/pdf_extractor.rb +4 -0
  54. data/lib/mindee/extraction/tax_extractor/tax_extractor.rb +322 -0
  55. data/lib/mindee/extraction/tax_extractor.rb +1 -320
  56. data/lib/mindee/extraction.rb +3 -0
  57. data/lib/mindee/http/endpoint.rb +18 -6
  58. data/lib/mindee/input/sources.rb +8 -0
  59. data/lib/mindee/parsing/common/api_response.rb +1 -1
  60. data/lib/mindee/parsing/common/document.rb +31 -1
  61. data/lib/mindee/parsing/common/extras/cropper_extra.rb +29 -0
  62. data/lib/mindee/parsing/common/extras/extras.rb +50 -0
  63. data/lib/mindee/parsing/common/extras/full_text_ocr_extra.rb +32 -0
  64. data/lib/mindee/parsing/common/extras.rb +5 -0
  65. data/lib/mindee/parsing/common/page.rb +5 -0
  66. data/lib/mindee/parsing/standard/base_field.rb +1 -0
  67. data/lib/mindee/parsing/standard/company_registration_field.rb +17 -0
  68. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1.rb +39 -0
  69. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier.rb +52 -0
  70. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_carrier_item.rb +95 -0
  71. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_consignee.rb +58 -0
  72. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_document.rb +136 -0
  73. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_notify_party.rb +58 -0
  74. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_page.rb +32 -0
  75. data/lib/mindee/product/bill_of_lading/bill_of_lading_v1_shipper.rb +58 -0
  76. data/lib/mindee/product/financial_document/financial_document_v1_document.rb +3 -1
  77. data/lib/mindee/product/financial_document/financial_document_v1_line_item.rb +22 -1
  78. data/lib/mindee/product/financial_document/financial_document_v1_page.rb +1 -1
  79. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_bban.rb +4 -15
  80. data/lib/mindee/product/fr/energy_bill/energy_bill_v1.rb +41 -0
  81. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb +235 -0
  82. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rb +48 -0
  83. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_supplier.rb +48 -0
  84. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.rb +97 -0
  85. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.rb +54 -0
  86. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_page.rb +34 -0
  87. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb +97 -0
  88. data/lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rb +97 -0
  89. data/lib/mindee/product/fr/payslip/payslip_v2.rb +41 -0
  90. data/lib/mindee/product/fr/payslip/payslip_v2_bank_account_detail.rb +54 -0
  91. data/lib/mindee/product/fr/payslip/payslip_v2_document.rb +128 -0
  92. data/lib/mindee/product/fr/payslip/payslip_v2_employee.rb +78 -0
  93. data/lib/mindee/product/fr/payslip/payslip_v2_employer.rb +78 -0
  94. data/lib/mindee/product/fr/payslip/payslip_v2_employment.rb +72 -0
  95. data/lib/mindee/product/fr/payslip/payslip_v2_page.rb +34 -0
  96. data/lib/mindee/product/fr/payslip/payslip_v2_pay_detail.rb +100 -0
  97. data/lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb +66 -0
  98. data/lib/mindee/product/fr/payslip/payslip_v2_pto.rb +56 -0
  99. data/lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb +81 -0
  100. data/lib/mindee/product/international_id/international_id_v2_document.rb +1 -1
  101. data/lib/mindee/product/international_id/international_id_v2_page.rb +1 -1
  102. data/lib/mindee/product/invoice/invoice_v4_document.rb +3 -1
  103. data/lib/mindee/product/invoice/invoice_v4_line_item.rb +22 -1
  104. data/lib/mindee/product/invoice/invoice_v4_page.rb +1 -1
  105. data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +1 -1
  106. data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb +1 -1
  107. data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rb +1 -1
  108. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1.rb +39 -0
  109. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_added_sugar.rb +52 -0
  110. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_calorie.rb +52 -0
  111. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_cholesterol.rb +52 -0
  112. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_dietary_fiber.rb +52 -0
  113. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_document.rb +173 -0
  114. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_nutrient.rb +87 -0
  115. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_page.rb +32 -0
  116. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_protein.rb +52 -0
  117. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_saturated_fat.rb +52 -0
  118. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_serving_size.rb +46 -0
  119. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_sodium.rb +58 -0
  120. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_carbohydrate.rb +52 -0
  121. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_fat.rb +52 -0
  122. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_total_sugar.rb +52 -0
  123. data/lib/mindee/product/nutrition_facts_label/nutrition_facts_label_v1_trans_fat.rb +52 -0
  124. data/lib/mindee/product/receipt/receipt_v5_document.rb +1 -1
  125. data/lib/mindee/product/receipt/receipt_v5_line_item.rb +11 -1
  126. data/lib/mindee/product/receipt/receipt_v5_page.rb +1 -1
  127. data/lib/mindee/product/resume/resume_v1_certificate.rb +11 -1
  128. data/lib/mindee/product/resume/resume_v1_education.rb +14 -1
  129. data/lib/mindee/product/resume/resume_v1_language.rb +9 -1
  130. data/lib/mindee/product/resume/resume_v1_professional_experience.rb +15 -1
  131. data/lib/mindee/product/resume/resume_v1_social_networks_url.rb +9 -1
  132. data/lib/mindee/product/us/healthcare_card/healthcare_card_v1.rb +41 -0
  133. data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_copay.rb +65 -0
  134. data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_document.rb +127 -0
  135. data/lib/mindee/product/us/healthcare_card/healthcare_card_v1_page.rb +34 -0
  136. data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb +14 -1
  137. data/lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb +5 -17
  138. data/lib/mindee/product.rb +6 -1
  139. data/lib/mindee/version.rb +1 -1
  140. data/mindee.gemspec +1 -0
  141. metadata +91 -3
  142. /data/lib/mindee/extraction/{ocr_extractor.rb → tax_extractor/ocr_extractor.rb} +0 -0
data/docs/cropper_v1.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: Cropper OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-cropper-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Cropper API](https://platform.mindee.com/mindee/cropper).
5
8
 
@@ -24,6 +27,7 @@ result = mindee_client.parse(
24
27
 
25
28
  # Print a full summary of the parsed data in RST format
26
29
  puts result.document
30
+
27
31
  ```
28
32
 
29
33
  **Output (RST):**
@@ -63,7 +67,7 @@ A typical `Field` object will have the following attributes:
63
67
  * **confidence** (Float, nil): the confidence score of the field prediction.
64
68
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
65
69
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
66
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
70
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
67
71
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
68
72
 
69
73
 
@@ -77,7 +81,7 @@ The position field `PositionField` does not implement all the basic `Field` attr
77
81
  * **quadrangle** (`Mindee::Geometry::Quadrilateral`): a free polygon made up of four points.
78
82
 
79
83
  ## Page-Level Fields
80
- Some fields are constrained to the page level, and so will not be retrievable to through the document.
84
+ Some fields are constrained to the page level, and so will not be retrievable at document level.
81
85
 
82
86
  # Attributes
83
87
  The following fields are extracted for Cropper V1:
data/docs/custom_v1.md CHANGED
@@ -1,8 +1,10 @@
1
1
  ---
2
- title: Custom API Ruby
2
+ title: Custom API Ruby (Deprecated)
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-api-builder-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
- The Ruby OCR SDK supports [custom-built APIs](https://developers.mindee.com/docs/build-your-first-document-parsing-api).
5
- If your document isn't covered by one of Mindee's Off-the-Shelf APIs, you can create your own API using the[API Builder](https://platform.mindee.com/api-builder).
7
+ > 🚧 This product is still supported, but is considered to be deprecated. If you are looking for the DocTI API documentation, you can find it [here](https://developers.mindee.com/docs/ruby-generated-ocr).
6
8
 
7
9
  # Quick-Start
8
10
 
@@ -0,0 +1,249 @@
1
+ ---
2
+ title: FR Energy Bill OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-fr-energy-bill-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
6
+ ---
7
+ The Ruby OCR SDK supports the [Energy Bill API](https://platform.mindee.com/mindee/energy_bill_fra).
8
+
9
+ The [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.jpg) can be used for testing purposes.
10
+ ![Energy Bill sample](https://github.com/mindee/client-lib-test-data/blob/main/products/energy_bill_fra/default_sample.jpg?raw=true)
11
+
12
+ # Quick-Start
13
+ ```rb
14
+ require 'mindee'
15
+
16
+ # Init a new client
17
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
18
+
19
+ # Load a file from disk
20
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
21
+
22
+ # Parse the file
23
+ result = mindee_client.enqueue_and_parse(
24
+ input_source,
25
+ Mindee::Product::FR::EnergyBill::EnergyBillV1
26
+ )
27
+
28
+ # Print a full summary of the parsed data in RST format
29
+ puts result.document
30
+
31
+ # Print the document-level parsed data
32
+ # puts result.document.inference.prediction
33
+
34
+ ```
35
+ # Field Types
36
+ ## Standard Fields
37
+ These fields are generic and used in several products.
38
+
39
+ ### Basic Field
40
+ Each prediction object contains a set of fields that inherit from the generic `Field` class.
41
+ A typical `Field` object will have the following attributes:
42
+
43
+ * **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
44
+ * **confidence** (Float, nil): the confidence score of the field prediction.
45
+ * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
46
+ * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
47
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
48
+ * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
49
+
50
+
51
+ 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.
52
+
53
+
54
+ ### Amount Field
55
+ The amount field `AmountField` only has one constraint: its **value** is a `Float` (or `nil`).
56
+
57
+ ### Date Field
58
+ Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
59
+
60
+ * **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
61
+
62
+ ### String Field
63
+ The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
64
+
65
+ ## Specific Fields
66
+ Fields which are specific to this product; they are not used in any other product.
67
+
68
+ ### Energy Consumer Field
69
+ The entity that consumes the energy.
70
+
71
+ A `EnergyBillV1EnergyConsumer` implements the following attributes:
72
+
73
+ * `address` (String): The address of the energy consumer.
74
+ * `name` (String): The name of the energy consumer.
75
+ Fields which are specific to this product; they are not used in any other product.
76
+
77
+ ### Energy Supplier Field
78
+ The company that supplies the energy.
79
+
80
+ A `EnergyBillV1EnergySupplier` implements the following attributes:
81
+
82
+ * `address` (String): The address of the energy supplier.
83
+ * `name` (String): The name of the energy supplier.
84
+ Fields which are specific to this product; they are not used in any other product.
85
+
86
+ ### Energy Usage Field
87
+ Details of energy consumption.
88
+
89
+ A `EnergyBillV1EnergyUsage` implements the following attributes:
90
+
91
+ * `description` (String): Description or details of the energy usage.
92
+ * `end_date` (String): The end date of the energy usage.
93
+ * `start_date` (String): The start date of the energy usage.
94
+ * `tax_rate` (Float): The rate of tax applied to the total cost.
95
+ * `total` (Float): The total cost of energy consumed.
96
+ * `unit_price` (Float): The price per unit of energy consumed.
97
+ Fields which are specific to this product; they are not used in any other product.
98
+
99
+ ### Meter Details Field
100
+ Information about the energy meter.
101
+
102
+ A `EnergyBillV1MeterDetail` implements the following attributes:
103
+
104
+ * `meter_number` (String): The unique identifier of the energy meter.
105
+ * `meter_type` (String): The type of energy meter.
106
+
107
+ #### Possible values include:
108
+ - electricity
109
+ - gas
110
+ - water
111
+ - None
112
+
113
+ * `unit` (String): The unit of measurement for energy consumption, which can be kW, m³, or L.
114
+ Fields which are specific to this product; they are not used in any other product.
115
+
116
+ ### Subscription Field
117
+ The subscription details fee for the energy service.
118
+
119
+ A `EnergyBillV1Subscription` implements the following attributes:
120
+
121
+ * `description` (String): Description or details of the subscription.
122
+ * `end_date` (String): The end date of the subscription.
123
+ * `start_date` (String): The start date of the subscription.
124
+ * `tax_rate` (Float): The rate of tax applied to the total cost.
125
+ * `total` (Float): The total cost of subscription.
126
+ * `unit_price` (Float): The price per unit of subscription.
127
+ Fields which are specific to this product; they are not used in any other product.
128
+
129
+ ### Taxes and Contributions Field
130
+ Details of Taxes and Contributions.
131
+
132
+ A `EnergyBillV1TaxesAndContribution` implements the following attributes:
133
+
134
+ * `description` (String): Description or details of the Taxes and Contributions.
135
+ * `end_date` (String): The end date of the Taxes and Contributions.
136
+ * `start_date` (String): The start date of the Taxes and Contributions.
137
+ * `tax_rate` (Float): The rate of tax applied to the total cost.
138
+ * `total` (Float): The total cost of Taxes and Contributions.
139
+ * `unit_price` (Float): The price per unit of Taxes and Contributions.
140
+
141
+ # Attributes
142
+ The following fields are extracted for Energy Bill V1:
143
+
144
+ ## Contract ID
145
+ **contract_id** ([StringField](#string-field)): The unique identifier associated with a specific contract.
146
+
147
+ ```rb
148
+ puts result.document.inference.prediction.contract_id.value
149
+ ```
150
+
151
+ ## Delivery Point
152
+ **delivery_point** ([StringField](#string-field)): The unique identifier assigned to each electricity or gas consumption point. It specifies the exact location where the energy is delivered.
153
+
154
+ ```rb
155
+ puts result.document.inference.prediction.delivery_point.value
156
+ ```
157
+
158
+ ## Due Date
159
+ **due_date** ([DateField](#date-field)): The date by which the payment for the energy invoice is due.
160
+
161
+ ```rb
162
+ puts result.document.inference.prediction.due_date.value
163
+ ```
164
+
165
+ ## Energy Consumer
166
+ **energy_consumer** ([EnergyBillV1EnergyConsumer](#energy-consumer-field)): The entity that consumes the energy.
167
+
168
+ ```rb
169
+ puts result.document.inference.prediction.energy_consumer.value
170
+ ```
171
+
172
+ ## Energy Supplier
173
+ **energy_supplier** ([EnergyBillV1EnergySupplier](#energy-supplier-field)): The company that supplies the energy.
174
+
175
+ ```rb
176
+ puts result.document.inference.prediction.energy_supplier.value
177
+ ```
178
+
179
+ ## Energy Usage
180
+ **energy_usage** (Array<[EnergyBillV1EnergyUsage](#energy-usage-field)>): Details of energy consumption.
181
+
182
+ ```rb
183
+ for energy_usage_elem in result.document.inference.prediction.energy_usage do
184
+ puts energy_usage_elem.value
185
+ end
186
+ ```
187
+
188
+ ## Invoice Date
189
+ **invoice_date** ([DateField](#date-field)): The date when the energy invoice was issued.
190
+
191
+ ```rb
192
+ puts result.document.inference.prediction.invoice_date.value
193
+ ```
194
+
195
+ ## Invoice Number
196
+ **invoice_number** ([StringField](#string-field)): The unique identifier of the energy invoice.
197
+
198
+ ```rb
199
+ puts result.document.inference.prediction.invoice_number.value
200
+ ```
201
+
202
+ ## Meter Details
203
+ **meter_details** ([EnergyBillV1MeterDetail](#meter-details-field)): Information about the energy meter.
204
+
205
+ ```rb
206
+ puts result.document.inference.prediction.meter_details.value
207
+ ```
208
+
209
+ ## Subscription
210
+ **subscription** (Array<[EnergyBillV1Subscription](#subscription-field)>): The subscription details fee for the energy service.
211
+
212
+ ```rb
213
+ for subscription_elem in result.document.inference.prediction.subscription do
214
+ puts subscription_elem.value
215
+ end
216
+ ```
217
+
218
+ ## Taxes and Contributions
219
+ **taxes_and_contributions** (Array<[EnergyBillV1TaxesAndContribution](#taxes-and-contributions-field)>): Details of Taxes and Contributions.
220
+
221
+ ```rb
222
+ for taxes_and_contributions_elem in result.document.inference.prediction.taxes_and_contributions do
223
+ puts taxes_and_contributions_elem.value
224
+ end
225
+ ```
226
+
227
+ ## Total Amount
228
+ **total_amount** ([AmountField](#amount-field)): The total amount to be paid for the energy invoice.
229
+
230
+ ```rb
231
+ puts result.document.inference.prediction.total_amount.value
232
+ ```
233
+
234
+ ## Total Before Taxes
235
+ **total_before_taxes** ([AmountField](#amount-field)): The total amount to be paid for the energy invoice before taxes.
236
+
237
+ ```rb
238
+ puts result.document.inference.prediction.total_before_taxes.value
239
+ ```
240
+
241
+ ## Total Taxes
242
+ **total_taxes** ([AmountField](#amount-field)): Total of taxes applied to the invoice.
243
+
244
+ ```rb
245
+ puts result.document.inference.prediction.total_taxes.value
246
+ ```
247
+
248
+ # Questions?
249
+ [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: EU Driver License OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-eu-driver-license-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Driver License API](https://platform.mindee.com/mindee/eu_driver_license).
5
8
 
@@ -27,6 +30,7 @@ puts result.document
27
30
 
28
31
  # Print the document-level parsed data
29
32
  # puts result.document.inference.prediction
33
+
30
34
  ```
31
35
 
32
36
  **Output (RST):**
@@ -90,7 +94,7 @@ A typical `Field` object will have the following attributes:
90
94
  * **confidence** (Float, nil): the confidence score of the field prediction.
91
95
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
92
96
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
93
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
97
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
94
98
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
95
99
 
96
100
 
@@ -112,7 +116,7 @@ The position field `PositionField` does not implement all the basic `Field` attr
112
116
  The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
113
117
 
114
118
  ## Page-Level Fields
115
- Some fields are constrained to the page level, and so will not be retrievable to through the document.
119
+ Some fields are constrained to the page level, and so will not be retrievable at document level.
116
120
 
117
121
  # Attributes
118
122
  The following fields are extracted for Driver License V1:
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: Receipt OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-receipt-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Receipt API](https://platform.mindee.com/mindee/expense_receipts).
5
8
 
@@ -27,6 +30,7 @@ puts result.document
27
30
 
28
31
  # Print the document-level parsed data
29
32
  # puts result.document.inference.prediction
33
+
30
34
  ```
31
35
 
32
36
  **Output (RST):**
@@ -34,12 +38,12 @@ puts result.document
34
38
  ########
35
39
  Document
36
40
  ########
37
- :Mindee ID: ce41e37a-65d8-4de1-b34b-1c92ab04b1ae
41
+ :Mindee ID: d96fb043-8fb8-4adc-820c-387aae83376d
38
42
  :Filename: default_sample.jpg
39
43
 
40
44
  Inference
41
45
  #########
42
- :Product: mindee/expense_receipts v5.0
46
+ :Product: mindee/expense_receipts v5.3
43
47
  :Rotation applied: Yes
44
48
 
45
49
  Prediction
@@ -60,11 +64,12 @@ Prediction
60
64
  +===============+========+==========+===============+
61
65
  | 8.50 | VAT | 20.00 | 1.70 |
62
66
  +---------------+--------+----------+---------------+
63
- :Supplier Name: CLACHAN
64
- :Supplier Company Registrations: 232153895
65
- 232153895
66
- :Supplier Address: 34 kingley street w1b 5qh
67
+ :Supplier Name: clachan
68
+ :Supplier Company Registrations: Type: VAT NUMBER, Value: 232153895
69
+ Type: VAT NUMBER, Value: 232153895
70
+ :Supplier Address: 34 Kingley Street W1B 50H
67
71
  :Supplier Phone Number: 02074940834
72
+ :Receipt Number: 54/7500
68
73
  :Line Items:
69
74
  +--------------------------------------+----------+--------------+------------+
70
75
  | Description | Quantity | Total Amount | Unit Price |
@@ -93,11 +98,12 @@ Page 0
93
98
  +===============+========+==========+===============+
94
99
  | 8.50 | VAT | 20.00 | 1.70 |
95
100
  +---------------+--------+----------+---------------+
96
- :Supplier Name: CLACHAN
97
- :Supplier Company Registrations: 232153895
98
- 232153895
99
- :Supplier Address: 34 kingley street w1b 5qh
101
+ :Supplier Name: clachan
102
+ :Supplier Company Registrations: Type: VAT NUMBER, Value: 232153895
103
+ Type: VAT NUMBER, Value: 232153895
104
+ :Supplier Address: 34 Kingley Street W1B 50H
100
105
  :Supplier Phone Number: 02074940834
106
+ :Receipt Number: 54/7500
101
107
  :Line Items:
102
108
  +--------------------------------------+----------+--------------+------------+
103
109
  | Description | Quantity | Total Amount | Unit Price |
@@ -118,7 +124,7 @@ A typical `Field` object will have the following attributes:
118
124
  * **confidence** (Float, nil): the confidence score of the field prediction.
119
125
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
120
126
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
121
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
127
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
122
128
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
123
129
 
124
130
 
@@ -187,6 +193,16 @@ The following fields are extracted for Receipt V5:
187
193
  ## Purchase Category
188
194
  **category** ([ClassificationField](#classification-field)): The purchase category among predefined classes.
189
195
 
196
+ #### Possible values include:
197
+ - toll
198
+ - food
199
+ - parking
200
+ - transport
201
+ - accommodation
202
+ - gasoline
203
+ - telecom
204
+ - miscellaneous
205
+
190
206
  ```rb
191
207
  puts result.document.inference.prediction.category.value
192
208
  ```
@@ -201,6 +217,10 @@ puts result.document.inference.prediction.date.value
201
217
  ## Document Type
202
218
  **document_type** ([ClassificationField](#classification-field)): One of: 'CREDIT CARD RECEIPT', 'EXPENSE RECEIPT'.
203
219
 
220
+ #### Possible values include:
221
+ - expense_receipt
222
+ - credit_card_receipt
223
+
204
224
  ```rb
205
225
  puts result.document.inference.prediction.document_type.value
206
226
  ```
@@ -231,6 +251,13 @@ puts result.document.inference.prediction.receipt_number.value
231
251
  ## Purchase Subcategory
232
252
  **subcategory** ([ClassificationField](#classification-field)): The purchase subcategory among predefined classes for transport and food.
233
253
 
254
+ #### Possible values include:
255
+ - plane
256
+ - taxi
257
+ - train
258
+ - restaurant
259
+ - shopping
260
+
234
261
  ```rb
235
262
  puts result.document.inference.prediction.subcategory.value
236
263
  ```
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: Financial Document OCR Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-financial-document-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports the [Financial Document API](https://platform.mindee.com/mindee/financial_document).
5
8
 
@@ -27,6 +30,32 @@ puts result.document
27
30
 
28
31
  # Print the document-level parsed data
29
32
  # puts result.document.inference.prediction
33
+
34
+ ```
35
+
36
+ You can also call this product asynchronously:
37
+
38
+ ```rb
39
+ require 'mindee'
40
+
41
+ # Init a new client
42
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
43
+
44
+ # Load a file from disk
45
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
46
+
47
+ # Parse the file
48
+ result = mindee_client.enqueue_and_parse(
49
+ input_source,
50
+ Mindee::Product::FinancialDocument::FinancialDocumentV1
51
+ )
52
+
53
+ # Print a full summary of the parsed data in RST format
54
+ puts result.document
55
+
56
+ # Print the document-level parsed data
57
+ # puts result.document.inference.prediction
58
+
30
59
  ```
31
60
 
32
61
  **Output (RST):**
@@ -34,18 +63,20 @@ puts result.document
34
63
  ########
35
64
  Document
36
65
  ########
37
- :Mindee ID: 503895c6-eced-42e2-a6fc-0292b7ccf680
66
+ :Mindee ID: 3859a462-e05f-4f4c-a736-febca66b9aa9
38
67
  :Filename: default_sample.jpg
39
68
 
40
69
  Inference
41
70
  #########
42
- :Product: mindee/financial_document v1.6
71
+ :Product: mindee/financial_document v1.9
43
72
  :Rotation applied: Yes
44
73
 
45
74
  Prediction
46
75
  ==========
47
- :Locale: en; USD;
76
+ :Locale: en; en; USD;
48
77
  :Invoice Number: INT-001
78
+ :Receipt Number:
79
+ :Document Number: INT-001
49
80
  :Reference Numbers: 2412/2019
50
81
  :Purchase Date: 2019-11-02
51
82
  :Due Date: 2019-02-26
@@ -77,23 +108,25 @@ Prediction
77
108
  :Tip and Gratuity:
78
109
  :Purchase Time:
79
110
  :Line Items:
80
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
81
- | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit Price |
82
- +======================================+==============+==========+============+==============+==============+============+
83
- | Front and rear brake cables | | 1.00 | | | 100.00 | 100.00 |
84
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
85
- | New set of pedal arms | | 2.00 | | | 50.00 | 25.00 |
86
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
87
- | Labor 3hrs | | 3.00 | | | 45.00 | 15.00 |
88
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
111
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
112
+ | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price |
113
+ +======================================+==============+==========+============+==============+==============+=================+============+
114
+ | Front and rear brake cables | | 1.00 | | | 100.00 | | 100.00 |
115
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
116
+ | New set of pedal arms | | 2.00 | | | 50.00 | | 25.00 |
117
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
118
+ | Labor 3hrs | | 3.00 | | | 45.00 | | 15.00 |
119
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
89
120
 
90
121
  Page Predictions
91
122
  ================
92
123
 
93
124
  Page 0
94
125
  ------
95
- :Locale: en; USD;
126
+ :Locale: en; en; USD;
96
127
  :Invoice Number: INT-001
128
+ :Receipt Number:
129
+ :Document Number: INT-001
97
130
  :Reference Numbers: 2412/2019
98
131
  :Purchase Date: 2019-11-02
99
132
  :Due Date: 2019-02-26
@@ -125,15 +158,15 @@ Page 0
125
158
  :Tip and Gratuity:
126
159
  :Purchase Time:
127
160
  :Line Items:
128
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
129
- | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit Price |
130
- +======================================+==============+==========+============+==============+==============+============+
131
- | Front and rear brake cables | | 1.00 | | | 100.00 | 100.00 |
132
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
133
- | New set of pedal arms | | 2.00 | | | 50.00 | 25.00 |
134
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
135
- | Labor 3hrs | | 3.00 | | | 45.00 | 15.00 |
136
- +--------------------------------------+--------------+----------+------------+--------------+--------------+------------+
161
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
162
+ | Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price |
163
+ +======================================+==============+==========+============+==============+==============+=================+============+
164
+ | Front and rear brake cables | | 1.00 | | | 100.00 | | 100.00 |
165
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
166
+ | New set of pedal arms | | 2.00 | | | 50.00 | | 25.00 |
167
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
168
+ | Labor 3hrs | | 3.00 | | | 45.00 | | 15.00 |
169
+ +--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
137
170
  ```
138
171
 
139
172
  # Field Types
@@ -148,7 +181,7 @@ A typical `Field` object will have the following attributes:
148
181
  * **confidence** (Float, nil): the confidence score of the field prediction.
149
182
  * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
150
183
  * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
151
- * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
184
+ * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
152
185
  * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
153
186
 
154
187
 
@@ -220,6 +253,7 @@ A `FinancialDocumentV1LineItem` implements the following attributes:
220
253
  * `tax_amount` (Float): The item tax amount.
221
254
  * `tax_rate` (Float): The item tax rate in percentage.
222
255
  * `total_amount` (Float): The item total amount.
256
+ * `unit_measure` (String): The item unit of measure.
223
257
  * `unit_price` (Float): The item unit price.
224
258
 
225
259
  # Attributes
@@ -235,6 +269,16 @@ puts result.document.inference.prediction.billing_address.value
235
269
  ## Purchase Category
236
270
  **category** ([ClassificationField](#classification-field)): The purchase category among predefined classes.
237
271
 
272
+ #### Possible values include:
273
+ - toll
274
+ - food
275
+ - parking
276
+ - transport
277
+ - accommodation
278
+ - gasoline
279
+ - telecom
280
+ - miscellaneous
281
+
238
282
  ```rb
239
283
  puts result.document.inference.prediction.category.value
240
284
  ```
@@ -286,6 +330,12 @@ puts result.document.inference.prediction.document_number.value
286
330
  ## Document Type
287
331
  **document_type** ([ClassificationField](#classification-field)): One of: 'INVOICE', 'CREDIT NOTE', 'CREDIT CARD RECEIPT', 'EXPENSE RECEIPT'.
288
332
 
333
+ #### Possible values include:
334
+ - INVOICE
335
+ - CREDIT NOTE
336
+ - CREDIT CARD RECEIPT
337
+ - EXPENSE RECEIPT
338
+
289
339
  ```rb
290
340
  puts result.document.inference.prediction.document_type.value
291
341
  ```
@@ -346,6 +396,13 @@ puts result.document.inference.prediction.shipping_address.value
346
396
  ## Purchase Subcategory
347
397
  **subcategory** ([ClassificationField](#classification-field)): The purchase subcategory among predefined classes for transport and food.
348
398
 
399
+ #### Possible values include:
400
+ - plane
401
+ - taxi
402
+ - train
403
+ - restaurant
404
+ - shopping
405
+
349
406
  ```rb
350
407
  puts result.document.inference.prediction.subcategory.value
351
408
  ```
data/docs/generated_v1.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: Generated API Ruby
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-generated-ocr
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  The Ruby OCR SDK supports generated APIs.
5
8
  Generated APIs can theoretically support all APIs in a catch-all generic format.
@@ -1,5 +1,8 @@
1
1
  ---
2
2
  title: Ruby Getting Started
3
+ category: 622b805aaec68102ea7fcbc2
4
+ slug: ruby-getting-started
5
+ parentDoc: 6294d97ee723f1008d2ab28e
3
6
  ---
4
7
  This guide will help you get the most out of the Mindee Ruby client library to easily extract data from your documents.
5
8