mindee 4.7.2 → 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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +6 -6
  4. data/Rakefile +1 -0
  5. data/lib/mindee/errors/mindee_http_error_v2.rb +23 -4
  6. data/lib/mindee/errors/mindee_http_unknown_error_v2.rb +18 -0
  7. data/lib/mindee/http/endpoint.rb +1 -0
  8. data/lib/mindee/parsing/v2/error_item.rb +21 -0
  9. data/lib/mindee/parsing/v2/error_response.rb +18 -3
  10. data/lib/mindee/parsing/v2/inference_result.rb +4 -0
  11. data/lib/mindee/parsing/v2/rag_metadata.rb +17 -0
  12. data/lib/mindee/version.rb +1 -1
  13. data/mindee.gemspec +1 -0
  14. data/sig/mindee/errors/mindee_http_error_v2.rbs +4 -1
  15. data/sig/mindee/errors/mindee_http_unknown_error_v2.rbs +9 -0
  16. data/sig/mindee/http/endpoint.rbs +1 -0
  17. data/sig/mindee/parsing/v2/error_item.rbs +13 -0
  18. data/sig/mindee/parsing/v2/error_response.rbs +3 -0
  19. data/sig/mindee/parsing/v2/inference_result.rbs +1 -0
  20. data/sig/mindee/parsing/v2/rag_metadata.rbs +13 -0
  21. metadata +22 -34
  22. data/docs/advanced_file_operations.md +0 -109
  23. data/docs/getting_started.md +0 -257
  24. data/docs/global_products/barcode_reader_v1.md +0 -125
  25. data/docs/global_products/bill_of_lading_v1.md +0 -276
  26. data/docs/global_products/business_card_v1.md +0 -194
  27. data/docs/global_products/cropper_v1.md +0 -123
  28. data/docs/global_products/delivery_notes_v1.md +0 -168
  29. data/docs/global_products/driver_license_v1.md +0 -212
  30. data/docs/global_products/expense_receipts_v5.md +0 -415
  31. data/docs/global_products/financial_document_v1.md +0 -615
  32. data/docs/global_products/international_id_v2.md +0 -264
  33. data/docs/global_products/invoice_splitter_v1.md +0 -127
  34. data/docs/global_products/invoices_v4.md +0 -576
  35. data/docs/global_products/multi_receipts_detector_v1.md +0 -131
  36. data/docs/global_products/nutrition_facts_v1.md +0 -399
  37. data/docs/global_products/passport_v1.md +0 -207
  38. data/docs/global_products/resume_v1.md +0 -384
  39. data/docs/global_products/universal.md +0 -113
  40. data/docs/global_products.md +0 -6
  41. data/docs/loading_a_document.md +0 -330
  42. data/docs/localized_products/bank_account_details_v2.md +0 -158
  43. data/docs/localized_products/bank_check_v1.md +0 -205
  44. data/docs/localized_products/bank_statement_fr_v2.md +0 -269
  45. data/docs/localized_products/carte_grise_v1.md +0 -475
  46. data/docs/localized_products/energy_bill_fra_v1.md +0 -342
  47. data/docs/localized_products/french_healthcard_v1.md +0 -142
  48. data/docs/localized_products/idcard_fr_v2.md +0 -284
  49. data/docs/localized_products/ind_passport_v1.md +0 -307
  50. data/docs/localized_products/payslip_fra_v3.md +0 -344
  51. data/docs/localized_products/us_healthcare_cards_v1.md +0 -258
  52. data/docs/localized_products/us_mail_v3.md +0 -152
  53. data/docs/localized_products.md +0 -6
@@ -1,264 +0,0 @@
1
- ---
2
- title: International ID
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-international-id-ocr
5
- parentDoc: 67b49df15b843f3fa9cd622b
6
- ---
7
- The Ruby Client Library supports the [International ID API](https://platform.mindee.com/mindee/international_id).
8
-
9
-
10
- > 📝 Product Specs
11
- >
12
- > | Specification | Details |
13
- > | ------------------------------ | -------------------------------------------------- |
14
- > | Endpoint Name | `international_id` |
15
- > | Recommended Version | `v2.2` |
16
- > | Supports Polling/Webhooks | ✔️ Yes |
17
- > | Support Synchronous HTTP Calls | ❌ No |
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/international_id/default_sample.jpg),
30
- we are going to illustrate how to extract the data that we want using the Ruby Client Library.
31
- ![International ID sample](https://github.com/mindee/client-lib-test-data/blob/main/products/international_id/default_sample.jpg?raw=true)
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::InternationalId::InternationalIdV2
52
- )
53
-
54
- # Print a full summary of the parsed data in RST format
55
- puts result.document
56
-
57
- # Print the document-level parsed data
58
- # puts result.document.inference.prediction
59
- ```
60
-
61
- **Output (RST):**
62
- ```rst
63
- ########
64
- Document
65
- ########
66
- :Mindee ID: cfa20a58-20cf-43b6-8cec-9505fa69d1c2
67
- :Filename: default_sample.jpg
68
-
69
- Inference
70
- #########
71
- :Product: mindee/international_id v2.0
72
- :Rotation applied: No
73
-
74
- Prediction
75
- ==========
76
- :Document Type: IDENTIFICATION_CARD
77
- :Document Number: 12345678A
78
- :Surnames: MUESTRA
79
- MUESTRA
80
- :Given Names: CARMEN
81
- :Sex: F
82
- :Birth Date: 1980-01-01
83
- :Birth Place: CAMPO DE CRIPTANA CIUDAD REAL ESPANA
84
- :Nationality: ESP
85
- :Personal Number: BAB1834284<44282767Q0
86
- :Country of Issue: ESP
87
- :State of Issue: MADRID
88
- :Issue Date:
89
- :Expiration Date: 2030-01-01
90
- :Address: C/REAL N13, 1 DCHA COLLADO VILLALBA MADRID MADRID MADRID
91
- :MRZ Line 1: IDESPBAB1834284<44282767Q0<<<<
92
- :MRZ Line 2: 8001010F1301017ESP<<<<<<<<<<<3
93
- :MRZ Line 3: MUESTRA<MUESTRA<<CARMEN<<<<<<<
94
- ```
95
-
96
- # Field Types
97
- ## Standard Fields
98
- These fields are generic and used in several products.
99
-
100
- ### Basic Field
101
- Each prediction object contains a set of fields that inherit from the generic `Field` class.
102
- A typical `Field` object will have the following attributes:
103
-
104
- * **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
105
- * **confidence** (Float, nil): the confidence score of the field prediction.
106
- * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
107
- * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
108
- * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
109
- * **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
110
-
111
-
112
- 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.
113
-
114
-
115
- ### Classification Field
116
- The classification field `ClassificationField` does not implement all the basic `Field` attributes. It only implements
117
- **value**, **confidence** and **page_id**.
118
-
119
- > Note: a classification field's `value is always a `String`.
120
-
121
- ### Date Field
122
- Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
123
-
124
- * **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
125
-
126
- ### String Field
127
- The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
128
-
129
- # Attributes
130
- The following fields are extracted for International ID V2:
131
-
132
- ## Address
133
- **address** ([StringField](#string-field)): The physical address of the document holder.
134
-
135
- ```rb
136
- puts result.document.inference.prediction.address.value
137
- ```
138
-
139
- ## Birth Date
140
- **birth_date** ([DateField](#date-field)): The date of birth of the document holder.
141
-
142
- ```rb
143
- puts result.document.inference.prediction.birth_date.value
144
- ```
145
-
146
- ## Birth Place
147
- **birth_place** ([StringField](#string-field)): The place of birth of the document holder.
148
-
149
- ```rb
150
- puts result.document.inference.prediction.birth_place.value
151
- ```
152
-
153
- ## Country of Issue
154
- **country_of_issue** ([StringField](#string-field)): The country where the document was issued.
155
-
156
- ```rb
157
- puts result.document.inference.prediction.country_of_issue.value
158
- ```
159
-
160
- ## Document Number
161
- **document_number** ([StringField](#string-field)): The unique identifier assigned to the document.
162
-
163
- ```rb
164
- puts result.document.inference.prediction.document_number.value
165
- ```
166
-
167
- ## Document Type
168
- **document_type** ([ClassificationField](#classification-field)): The type of personal identification document.
169
-
170
- #### Possible values include:
171
- - 'IDENTIFICATION_CARD'
172
- - 'PASSPORT'
173
- - 'DRIVER_LICENSE'
174
- - 'VISA'
175
- - 'RESIDENCY_CARD'
176
- - 'VOTER_REGISTRATION'
177
-
178
- ```rb
179
- puts result.document.inference.prediction.document_type.value
180
- ```
181
-
182
- ## Expiration Date
183
- **expiry_date** ([DateField](#date-field)): The date when the document becomes invalid.
184
-
185
- ```rb
186
- puts result.document.inference.prediction.expiry_date.value
187
- ```
188
-
189
- ## Given Names
190
- **given_names** (Array<[StringField](#string-field)>): The list of the document holder's given names.
191
-
192
- ```rb
193
- result.document.inference.prediction.given_names do |given_names_elem|
194
- puts given_names_elem.value
195
- end
196
- ```
197
-
198
- ## Issue Date
199
- **issue_date** ([DateField](#date-field)): The date when the document was issued.
200
-
201
- ```rb
202
- puts result.document.inference.prediction.issue_date.value
203
- ```
204
-
205
- ## MRZ Line 1
206
- **mrz_line1** ([StringField](#string-field)): The Machine Readable Zone, first line.
207
-
208
- ```rb
209
- puts result.document.inference.prediction.mrz_line1.value
210
- ```
211
-
212
- ## MRZ Line 2
213
- **mrz_line2** ([StringField](#string-field)): The Machine Readable Zone, second line.
214
-
215
- ```rb
216
- puts result.document.inference.prediction.mrz_line2.value
217
- ```
218
-
219
- ## MRZ Line 3
220
- **mrz_line3** ([StringField](#string-field)): The Machine Readable Zone, third line.
221
-
222
- ```rb
223
- puts result.document.inference.prediction.mrz_line3.value
224
- ```
225
-
226
- ## Nationality
227
- **nationality** ([StringField](#string-field)): The country of citizenship of the document holder.
228
-
229
- ```rb
230
- puts result.document.inference.prediction.nationality.value
231
- ```
232
-
233
- ## Personal Number
234
- **personal_number** ([StringField](#string-field)): The unique identifier assigned to the document holder.
235
-
236
- ```rb
237
- puts result.document.inference.prediction.personal_number.value
238
- ```
239
-
240
- ## Sex
241
- **sex** ([StringField](#string-field)): The biological sex of the document holder.
242
-
243
- ```rb
244
- puts result.document.inference.prediction.sex.value
245
- ```
246
-
247
- ## State of Issue
248
- **state_of_issue** ([StringField](#string-field)): The state or territory where the document was issued.
249
-
250
- ```rb
251
- puts result.document.inference.prediction.state_of_issue.value
252
- ```
253
-
254
- ## Surnames
255
- **surnames** (Array<[StringField](#string-field)>): The list of the document holder's family names.
256
-
257
- ```rb
258
- result.document.inference.prediction.surnames do |surnames_elem|
259
- puts surnames_elem.value
260
- end
261
- ```
262
-
263
- # Questions?
264
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -1,127 +0,0 @@
1
- ---
2
- title: Invoice Splitter
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-invoice-splitter-ocr
5
- parentDoc: 67b49df15b843f3fa9cd622b
6
- ---
7
- The Ruby Client Library supports the [Invoice Splitter API](https://platform.mindee.com/mindee/invoice_splitter).
8
-
9
-
10
- > 📝 Product Specs
11
- >
12
- > | Specification | Details |
13
- > | ------------------------------ | -------------------------------------------------- |
14
- > | Endpoint Name | `invoice_splitter` |
15
- > | Recommended Version | `v1.4` |
16
- > | Supports Polling/Webhooks | ✔️ Yes |
17
- > | Support Synchronous HTTP Calls | ❌ No |
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/invoice_splitter/default_sample.pdf),
30
- we are going to illustrate how to extract the data that we want using the Ruby Client Library.
31
- ![Invoice Splitter sample](https://github.com/mindee/client-lib-test-data/blob/main/products/invoice_splitter/default_sample.pdf?raw=true)
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::InvoiceSplitter::InvoiceSplitterV1
52
- )
53
-
54
- # Print a full summary of the parsed data in RST format
55
- puts result.document
56
-
57
- # Print the document-level parsed data
58
- # puts result.document.inference.prediction
59
- ```
60
-
61
- **Output (RST):**
62
- ```rst
63
- ########
64
- Document
65
- ########
66
- :Mindee ID: 15ad7a19-7b75-43d0-b0c6-9a641a12b49b
67
- :Filename: default_sample.pdf
68
-
69
- Inference
70
- #########
71
- :Product: mindee/invoice_splitter v1.2
72
- :Rotation applied: No
73
-
74
- Prediction
75
- ==========
76
- :Invoice Page Groups:
77
- +--------------------------------------------------------------------------+
78
- | Page Indexes |
79
- +==========================================================================+
80
- | 0 |
81
- +--------------------------------------------------------------------------+
82
- | 1 |
83
- +--------------------------------------------------------------------------+
84
- ```
85
-
86
- # Field Types
87
- ## Standard Fields
88
- These fields are generic and used in several products.
89
-
90
- ### Basic Field
91
- Each prediction object contains a set of fields that inherit from the generic `Field` class.
92
- A typical `Field` object will have the following attributes:
93
-
94
- * **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
95
- * **confidence** (Float, nil): the confidence score of the field prediction.
96
- * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
97
- * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
98
- * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
99
- * **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
100
-
101
-
102
- 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.
103
-
104
- ## Specific Fields
105
- Fields which are specific to this product; they are not used in any other product.
106
-
107
- ### Invoice Page Groups Field
108
- List of page groups. Each group represents a single invoice within a multi-invoice document.
109
-
110
- A `InvoiceSplitterV1InvoicePageGroup` implements the following attributes:
111
-
112
- * `page_indexes` (Array<Integer>): List of page indexes that belong to the same invoice (group).
113
-
114
- # Attributes
115
- The following fields are extracted for Invoice Splitter V1:
116
-
117
- ## Invoice Page Groups
118
- **invoice_page_groups** (Array<[InvoiceSplitterV1InvoicePageGroup](#invoice-page-groups-field)>): List of page groups. Each group represents a single invoice within a multi-invoice document.
119
-
120
- ```rb
121
- result.document.inference.prediction.invoice_page_groups do |invoice_page_groups_elem|
122
- puts invoice_page_groups_elem.value
123
- end
124
- ```
125
-
126
- # Questions?
127
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)