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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -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/input/sources/local_input_source.rb +9 -1
  9. data/lib/mindee/parsing/v2/error_item.rb +21 -0
  10. data/lib/mindee/parsing/v2/error_response.rb +18 -3
  11. data/lib/mindee/parsing/v2/inference_result.rb +4 -0
  12. data/lib/mindee/parsing/v2/rag_metadata.rb +17 -0
  13. data/lib/mindee/product.rb +0 -1
  14. data/lib/mindee/version.rb +1 -1
  15. data/mindee.gemspec +1 -0
  16. data/sig/mindee/errors/mindee_http_error_v2.rbs +4 -1
  17. data/sig/mindee/errors/mindee_http_unknown_error_v2.rbs +9 -0
  18. data/sig/mindee/http/endpoint.rbs +1 -0
  19. data/sig/mindee/input/sources/local_input_source.rbs +1 -1
  20. data/sig/mindee/parsing/v2/error_item.rbs +13 -0
  21. data/sig/mindee/parsing/v2/error_response.rbs +3 -0
  22. data/sig/mindee/parsing/v2/inference_result.rbs +1 -0
  23. data/sig/mindee/parsing/v2/rag_metadata.rbs +13 -0
  24. metadata +22 -47
  25. data/docs/advanced_file_operations.md +0 -109
  26. data/docs/code_samples/us_mail_v2_async.txt +0 -24
  27. data/docs/getting_started.md +0 -257
  28. data/docs/global_products/barcode_reader_v1.md +0 -125
  29. data/docs/global_products/bill_of_lading_v1.md +0 -276
  30. data/docs/global_products/business_card_v1.md +0 -194
  31. data/docs/global_products/cropper_v1.md +0 -123
  32. data/docs/global_products/delivery_notes_v1.md +0 -168
  33. data/docs/global_products/driver_license_v1.md +0 -212
  34. data/docs/global_products/expense_receipts_v5.md +0 -415
  35. data/docs/global_products/financial_document_v1.md +0 -615
  36. data/docs/global_products/international_id_v2.md +0 -264
  37. data/docs/global_products/invoice_splitter_v1.md +0 -127
  38. data/docs/global_products/invoices_v4.md +0 -576
  39. data/docs/global_products/multi_receipts_detector_v1.md +0 -131
  40. data/docs/global_products/nutrition_facts_v1.md +0 -399
  41. data/docs/global_products/passport_v1.md +0 -207
  42. data/docs/global_products/resume_v1.md +0 -384
  43. data/docs/global_products/universal.md +0 -113
  44. data/docs/global_products.md +0 -6
  45. data/docs/loading_a_document.md +0 -330
  46. data/docs/localized_products/bank_account_details_v2.md +0 -158
  47. data/docs/localized_products/bank_check_v1.md +0 -205
  48. data/docs/localized_products/bank_statement_fr_v2.md +0 -269
  49. data/docs/localized_products/carte_grise_v1.md +0 -475
  50. data/docs/localized_products/energy_bill_fra_v1.md +0 -342
  51. data/docs/localized_products/french_healthcard_v1.md +0 -142
  52. data/docs/localized_products/idcard_fr_v2.md +0 -284
  53. data/docs/localized_products/ind_passport_v1.md +0 -307
  54. data/docs/localized_products/payslip_fra_v3.md +0 -344
  55. data/docs/localized_products/us_healthcare_cards_v1.md +0 -258
  56. data/docs/localized_products/us_mail_v3.md +0 -152
  57. data/docs/localized_products.md +0 -6
  58. data/lib/mindee/product/us/us_mail/us_mail_v2.rb +0 -47
  59. data/lib/mindee/product/us/us_mail/us_mail_v2_document.rb +0 -105
  60. data/lib/mindee/product/us/us_mail/us_mail_v2_page.rb +0 -38
  61. data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_address.rb +0 -105
  62. data/lib/mindee/product/us/us_mail/us_mail_v2_recipient_addresses.rb +0 -63
  63. data/lib/mindee/product/us/us_mail/us_mail_v2_sender_address.rb +0 -66
  64. data/sig/mindee/product/us/us_mail/us_mail_v2.rbs +0 -13
  65. data/sig/mindee/product/us/us_mail/us_mail_v2_document.rbs +0 -20
  66. data/sig/mindee/product/us/us_mail/us_mail_v2_page.rbs +0 -17
  67. data/sig/mindee/product/us/us_mail/us_mail_v2_recipient_address.rbs +0 -22
  68. data/sig/mindee/product/us/us_mail/us_mail_v2_recipient_addresses.rbs +0 -15
  69. data/sig/mindee/product/us/us_mail/us_mail_v2_sender_address.rbs +0 -18
@@ -1,168 +0,0 @@
1
- ---
2
- title: Delivery note
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-delivery-note-ocr
5
- parentDoc: 67b49df15b843f3fa9cd622b
6
- ---
7
- The Ruby Client Library supports the [Delivery note API](https://platform.mindee.com/mindee/delivery_notes).
8
-
9
-
10
- > 📝 Product Specs
11
- >
12
- > | Specification | Details |
13
- > | ------------------------------ | -------------------------------------------------- |
14
- > | Endpoint Name | `delivery_notes` |
15
- > | Recommended Version | `v1.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/delivery_notes/default_sample.jpg),
30
- we are going to illustrate how to extract the data that we want using the Ruby Client Library.
31
- ![Delivery note sample](https://github.com/mindee/client-lib-test-data/blob/main/products/delivery_notes/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::DeliveryNote::DeliveryNoteV1
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: d5ead821-edec-4d31-a69a-cf3998d9a506
67
- :Filename: default_sample.jpg
68
-
69
- Inference
70
- #########
71
- :Product: mindee/delivery_notes v1.0
72
- :Rotation applied: Yes
73
-
74
- Prediction
75
- ==========
76
- :Delivery Date: 2019-10-02
77
- :Delivery Number: INT-001
78
- :Supplier Name: John Smith
79
- :Supplier Address: 4490 Oak Drive, Albany, NY 12210
80
- :Customer Name: Jessie M Horne
81
- :Customer Address: 4312 Wood Road, New York, NY 10031
82
- :Total Amount: 204.75
83
- ```
84
-
85
- # Field Types
86
- ## Standard Fields
87
- These fields are generic and used in several products.
88
-
89
- ### Basic Field
90
- Each prediction object contains a set of fields that inherit from the generic `Field` class.
91
- A typical `Field` object will have the following attributes:
92
-
93
- * **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
94
- * **confidence** (Float, nil): the confidence score of the field prediction.
95
- * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
96
- * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
97
- * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
98
- * **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
99
-
100
-
101
- 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.
102
-
103
-
104
- ### Amount Field
105
- The amount field `AmountField` only has one constraint: its **value** is a `Float` (or `nil`).
106
-
107
- ### Date Field
108
- Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
109
-
110
- * **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
111
-
112
- ### String Field
113
- The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
114
-
115
- # Attributes
116
- The following fields are extracted for Delivery note V1:
117
-
118
- ## Customer Address
119
- **customer_address** ([StringField](#string-field)): The address of the customer receiving the goods.
120
-
121
- ```rb
122
- puts result.document.inference.prediction.customer_address.value
123
- ```
124
-
125
- ## Customer Name
126
- **customer_name** ([StringField](#string-field)): The name of the customer receiving the goods.
127
-
128
- ```rb
129
- puts result.document.inference.prediction.customer_name.value
130
- ```
131
-
132
- ## Delivery Date
133
- **delivery_date** ([DateField](#date-field)): The date on which the delivery is scheduled to arrive.
134
-
135
- ```rb
136
- puts result.document.inference.prediction.delivery_date.value
137
- ```
138
-
139
- ## Delivery Number
140
- **delivery_number** ([StringField](#string-field)): A unique identifier for the delivery note.
141
-
142
- ```rb
143
- puts result.document.inference.prediction.delivery_number.value
144
- ```
145
-
146
- ## Supplier Address
147
- **supplier_address** ([StringField](#string-field)): The address of the supplier providing the goods.
148
-
149
- ```rb
150
- puts result.document.inference.prediction.supplier_address.value
151
- ```
152
-
153
- ## Supplier Name
154
- **supplier_name** ([StringField](#string-field)): The name of the supplier providing the goods.
155
-
156
- ```rb
157
- puts result.document.inference.prediction.supplier_name.value
158
- ```
159
-
160
- ## Total Amount
161
- **total_amount** ([AmountField](#amount-field)): The total monetary value of the goods being delivered.
162
-
163
- ```rb
164
- puts result.document.inference.prediction.total_amount.value
165
- ```
166
-
167
- # Questions?
168
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -1,212 +0,0 @@
1
- ---
2
- title: Driver License
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-driver-license-ocr
5
- parentDoc: 67b49df15b843f3fa9cd622b
6
- ---
7
- The Ruby Client Library supports the [Driver License API](https://platform.mindee.com/mindee/driver_license).
8
-
9
-
10
- > 📝 Product Specs
11
- >
12
- > | Specification | Details |
13
- > | ------------------------------ | -------------------------------------------------- |
14
- > | Endpoint Name | `driver_license` |
15
- > | Recommended Version | `v1.0` |
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/driver_license/default_sample.jpg),
30
- we are going to illustrate how to extract the data that we want using the Ruby Client Library.
31
- ![Driver License sample](https://github.com/mindee/client-lib-test-data/blob/main/products/driver_license/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::DriverLicense::DriverLicenseV1
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: fbdeae38-ada3-43ac-aa58-e01a3d47e474
67
- :Filename: default_sample.jpg
68
-
69
- Inference
70
- #########
71
- :Product: mindee/driver_license v1.0
72
- :Rotation applied: Yes
73
-
74
- Prediction
75
- ==========
76
- :Country Code: USA
77
- :State: AZ
78
- :ID: D12345678
79
- :Category: D
80
- :Last Name: Sample
81
- :First Name: Jelani
82
- :Date of Birth: 1957-02-01
83
- :Place of Birth:
84
- :Expiry Date: 2018-02-01
85
- :Issued Date: 2013-01-10
86
- :Issuing Authority:
87
- :MRZ:
88
- :DD Number: DD1234567890123456
89
- ```
90
-
91
- # Field Types
92
- ## Standard Fields
93
- These fields are generic and used in several products.
94
-
95
- ### Basic Field
96
- Each prediction object contains a set of fields that inherit from the generic `Field` class.
97
- A typical `Field` object will have the following attributes:
98
-
99
- * **value** (`String`, `Float`, `Integer`, `bool`): corresponds to the field value. Can be `nil` if no value was extracted.
100
- * **confidence** (Float, nil): the confidence score of the field prediction.
101
- * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
102
- * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
103
- * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
104
- * **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
105
-
106
-
107
- 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.
108
-
109
- ### Date Field
110
- Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
111
-
112
- * **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
113
-
114
- ### String Field
115
- The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
116
-
117
- # Attributes
118
- The following fields are extracted for Driver License V1:
119
-
120
- ## Category
121
- **category** ([StringField](#string-field)): The category or class of the driver license.
122
-
123
- ```rb
124
- puts result.document.inference.prediction.category.value
125
- ```
126
-
127
- ## Country Code
128
- **country_code** ([StringField](#string-field)): The alpha-3 ISO 3166 code of the country where the driver license was issued.
129
-
130
- ```rb
131
- puts result.document.inference.prediction.country_code.value
132
- ```
133
-
134
- ## Date of Birth
135
- **date_of_birth** ([DateField](#date-field)): The date of birth of the driver license holder.
136
-
137
- ```rb
138
- puts result.document.inference.prediction.date_of_birth.value
139
- ```
140
-
141
- ## DD Number
142
- **dd_number** ([StringField](#string-field)): The DD number of the driver license.
143
-
144
- ```rb
145
- puts result.document.inference.prediction.dd_number.value
146
- ```
147
-
148
- ## Expiry Date
149
- **expiry_date** ([DateField](#date-field)): The expiry date of the driver license.
150
-
151
- ```rb
152
- puts result.document.inference.prediction.expiry_date.value
153
- ```
154
-
155
- ## First Name
156
- **first_name** ([StringField](#string-field)): The first name of the driver license holder.
157
-
158
- ```rb
159
- puts result.document.inference.prediction.first_name.value
160
- ```
161
-
162
- ## ID
163
- **id** ([StringField](#string-field)): The unique identifier of the driver license.
164
-
165
- ```rb
166
- puts result.document.inference.prediction.id.value
167
- ```
168
-
169
- ## Issued Date
170
- **issued_date** ([DateField](#date-field)): The date when the driver license was issued.
171
-
172
- ```rb
173
- puts result.document.inference.prediction.issued_date.value
174
- ```
175
-
176
- ## Issuing Authority
177
- **issuing_authority** ([StringField](#string-field)): The authority that issued the driver license.
178
-
179
- ```rb
180
- puts result.document.inference.prediction.issuing_authority.value
181
- ```
182
-
183
- ## Last Name
184
- **last_name** ([StringField](#string-field)): The last name of the driver license holder.
185
-
186
- ```rb
187
- puts result.document.inference.prediction.last_name.value
188
- ```
189
-
190
- ## MRZ
191
- **mrz** ([StringField](#string-field)): The Machine Readable Zone (MRZ) of the driver license.
192
-
193
- ```rb
194
- puts result.document.inference.prediction.mrz.value
195
- ```
196
-
197
- ## Place of Birth
198
- **place_of_birth** ([StringField](#string-field)): The place of birth of the driver license holder.
199
-
200
- ```rb
201
- puts result.document.inference.prediction.place_of_birth.value
202
- ```
203
-
204
- ## State
205
- **state** ([StringField](#string-field)): Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
206
-
207
- ```rb
208
- puts result.document.inference.prediction.state.value
209
- ```
210
-
211
- # Questions?
212
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)