mindee 3.15.0 → 3.17.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 (70) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +18 -0
  3. data/bin/mindee.rb +20 -2
  4. data/docs/business_card_v1.md +169 -0
  5. data/docs/code_samples/{international_id_v1_async.txt → business_card_v1_async.txt} +1 -1
  6. data/docs/code_samples/delivery_notes_v1_async.txt +19 -0
  7. data/docs/code_samples/driver_license_v1_async.txt +19 -0
  8. data/docs/code_samples/expense_receipts_v5_async.txt +19 -0
  9. data/docs/code_samples/french_healthcard_v1_async.txt +19 -0
  10. data/docs/code_samples/ind_passport_v1_async.txt +19 -0
  11. data/docs/code_samples/payslip_fra_v3_async.txt +19 -0
  12. data/docs/code_samples/workflow_execution.txt +29 -0
  13. data/docs/delivery_notes_v1.md +143 -0
  14. data/docs/driver_license_v1.md +156 -0
  15. data/docs/energy_bill_fra_v1.md +2 -2
  16. data/docs/expense_receipts_v5.md +27 -2
  17. data/docs/financial_document_v1.md +8 -4
  18. data/docs/{carte_vitale_v1.md → french_healthcard_v1.md} +14 -24
  19. data/docs/ind_passport_v1.md +281 -0
  20. data/docs/invoices_v4.md +12 -8
  21. data/docs/payslip_fra_v3.md +319 -0
  22. data/docs/resume_v1.md +17 -16
  23. data/lib/mindee/client.rb +48 -8
  24. data/lib/mindee/http/workflow_endpoint.rb +90 -0
  25. data/lib/mindee/http.rb +1 -0
  26. data/lib/mindee/parsing/common/api_response.rb +22 -1
  27. data/lib/mindee/parsing/common/execution.rb +73 -0
  28. data/lib/mindee/parsing/common/execution_file.rb +24 -0
  29. data/lib/mindee/parsing/common/execution_priority.rb +30 -0
  30. data/lib/mindee/parsing/common.rb +3 -0
  31. data/lib/mindee/product/{international_id/international_id_v1.rb → business_card/business_card_v1.rb} +9 -9
  32. data/lib/mindee/product/business_card/business_card_v1_document.rb +85 -0
  33. data/lib/mindee/product/{international_id/international_id_v1_page.rb → business_card/business_card_v1_page.rb} +7 -7
  34. data/lib/mindee/product/delivery_note/delivery_note_v1.rb +39 -0
  35. data/lib/mindee/product/delivery_note/delivery_note_v1_document.rb +61 -0
  36. data/lib/mindee/product/delivery_note/delivery_note_v1_page.rb +32 -0
  37. data/lib/mindee/product/driver_license/driver_license_v1.rb +39 -0
  38. data/lib/mindee/product/driver_license/driver_license_v1_document.rb +91 -0
  39. data/lib/mindee/product/driver_license/driver_license_v1_page.rb +32 -0
  40. data/lib/mindee/product/financial_document/financial_document_v1_document.rb +1 -1
  41. data/lib/mindee/product/financial_document/financial_document_v1_page.rb +1 -1
  42. data/lib/mindee/product/fr/health_card/health_card_v1.rb +41 -0
  43. data/lib/mindee/product/fr/health_card/health_card_v1_document.rb +52 -0
  44. data/lib/mindee/product/fr/health_card/health_card_v1_page.rb +34 -0
  45. data/lib/mindee/product/fr/payslip/payslip_v3.rb +41 -0
  46. data/lib/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rb +54 -0
  47. data/lib/mindee/product/fr/payslip/payslip_v3_document.rb +166 -0
  48. data/lib/mindee/product/fr/payslip/payslip_v3_employee.rb +78 -0
  49. data/lib/mindee/product/fr/payslip/payslip_v3_employer.rb +78 -0
  50. data/lib/mindee/product/fr/payslip/payslip_v3_employment.rb +78 -0
  51. data/lib/mindee/product/fr/payslip/payslip_v3_page.rb +34 -0
  52. data/lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb +89 -0
  53. data/lib/mindee/product/fr/payslip/payslip_v3_pay_detail.rb +100 -0
  54. data/lib/mindee/product/fr/payslip/payslip_v3_pay_period.rb +66 -0
  55. data/lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb +89 -0
  56. data/lib/mindee/product/ind/indian_passport/indian_passport_v1.rb +41 -0
  57. data/lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb +143 -0
  58. data/lib/mindee/product/ind/indian_passport/indian_passport_v1_page.rb +34 -0
  59. data/lib/mindee/product/invoice/invoice_v4_document.rb +1 -1
  60. data/lib/mindee/product/invoice/invoice_v4_page.rb +1 -1
  61. data/lib/mindee/product/resume/resume_v1_document.rb +3 -1
  62. data/lib/mindee/product/resume/resume_v1_page.rb +1 -1
  63. data/lib/mindee/product/resume/resume_v1_professional_experience.rb +8 -0
  64. data/lib/mindee/product.rb +13 -8
  65. data/lib/mindee/version.rb +1 -1
  66. metadata +46 -10
  67. data/docs/eu_driver_license_v1.md +0 -227
  68. data/docs/proof_of_address_v1.md +0 -211
  69. data/docs/us_driver_license_v1.md +0 -272
  70. data/lib/mindee/product/international_id/international_id_v1_document.rb +0 -109
@@ -1,272 +0,0 @@
1
- ---
2
- title: US Driver License OCR Ruby
3
- category: 622b805aaec68102ea7fcbc2
4
- slug: ruby-us-driver-license-ocr
5
- parentDoc: 6294d97ee723f1008d2ab28e
6
- ---
7
- The Ruby OCR SDK supports the [Driver License API](https://platform.mindee.com/mindee/us_driver_license).
8
-
9
- Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/us_driver_license/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
10
- ![Driver License sample](https://github.com/mindee/client-lib-test-data/blob/main/products/us_driver_license/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.parse(
24
- input_source,
25
- Mindee::Product::US::DriverLicense::DriverLicenseV1
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
-
36
- **Output (RST):**
37
- ```rst
38
- ########
39
- Document
40
- ########
41
- :Mindee ID: bf70068d-d3d6-49dc-b93a-b4b7d156fc3d
42
- :Filename: default_sample.jpg
43
-
44
- Inference
45
- #########
46
- :Product: mindee/us_driver_license v1.0
47
- :Rotation applied: Yes
48
-
49
- Prediction
50
- ==========
51
- :State: AZ
52
- :Driver License ID: D12345678
53
- :Expiry Date: 2018-02-01
54
- :Date Of Issue: 2013-01-10
55
- :Last Name: SAMPLE
56
- :First Name: JELANI
57
- :Address: 123 MAIN STREET PHOENIX AZ 85007
58
- :Date Of Birth: 1957-02-01
59
- :Restrictions: NONE
60
- :Endorsements: NONE
61
- :Driver License Class: D
62
- :Sex: M
63
- :Height: 5-08
64
- :Weight: 185
65
- :Hair Color: BRO
66
- :Eye Color: BRO
67
- :Document Discriminator: 1234567890123456
68
-
69
- Page Predictions
70
- ================
71
-
72
- Page 0
73
- ------
74
- :Photo: Polygon with 4 points.
75
- :Signature: Polygon with 4 points.
76
- :State: AZ
77
- :Driver License ID: D12345678
78
- :Expiry Date: 2018-02-01
79
- :Date Of Issue: 2013-01-10
80
- :Last Name: SAMPLE
81
- :First Name: JELANI
82
- :Address: 123 MAIN STREET PHOENIX AZ 85007
83
- :Date Of Birth: 1957-02-01
84
- :Restrictions: NONE
85
- :Endorsements: NONE
86
- :Driver License Class: D
87
- :Sex: M
88
- :Height: 5-08
89
- :Weight: 185
90
- :Hair Color: BRO
91
- :Eye Color: BRO
92
- :Document Discriminator: 1234567890123456
93
- ```
94
-
95
- # Field Types
96
- ## Standard Fields
97
- These fields are generic and used in several products.
98
-
99
- ### Basic Field
100
- Each prediction object contains a set of fields that inherit from the generic `Field` class.
101
- A typical `Field` object will have the following attributes:
102
-
103
- * **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
104
- * **confidence** (Float, nil): the confidence score of the field prediction.
105
- * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
106
- * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
107
- * **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
108
- * **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
109
-
110
-
111
- 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.
112
-
113
- ### Date Field
114
- Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
115
-
116
- * **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
117
-
118
-
119
- ### Position Field
120
- The position field `PositionField` does not implement all the basic `Field` attributes, only **bounding_box**, **polygon** and **page_id**. On top of these, it has access to:
121
-
122
- * **rectangle** (`Mindee::Geometry::Quadrilateral`): a Polygon with four points that may be oriented (even beyond canvas).
123
- * **quadrangle** (`Mindee::Geometry::Quadrilateral`): a free polygon made up of four points.
124
-
125
- ### String Field
126
- The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
127
-
128
- ## Page-Level Fields
129
- Some fields are constrained to the page level, and so will not be retrievable at document level.
130
-
131
- # Attributes
132
- The following fields are extracted for Driver License V1:
133
-
134
- ## Address
135
- **address** ([StringField](#string-field)): US driver license holders address
136
-
137
- ```rb
138
- puts result.document.inference.prediction.address.value
139
- ```
140
-
141
- ## Date Of Birth
142
- **date_of_birth** ([DateField](#date-field)): US driver license holders date of birth
143
-
144
- ```rb
145
- puts result.document.inference.prediction.date_of_birth.value
146
- ```
147
-
148
- ## Document Discriminator
149
- **dd_number** ([StringField](#string-field)): Document Discriminator Number of the US Driver License
150
-
151
- ```rb
152
- puts result.document.inference.prediction.dd_number.value
153
- ```
154
-
155
- ## Driver License Class
156
- **dl_class** ([StringField](#string-field)): US driver license holders class
157
-
158
- ```rb
159
- puts result.document.inference.prediction.dl_class.value
160
- ```
161
-
162
- ## Driver License ID
163
- **driver_license_id** ([StringField](#string-field)): ID number of the US Driver License.
164
-
165
- ```rb
166
- puts result.document.inference.prediction.driver_license_id.value
167
- ```
168
-
169
- ## Endorsements
170
- **endorsements** ([StringField](#string-field)): US driver license holders endorsements
171
-
172
- ```rb
173
- puts result.document.inference.prediction.endorsements.value
174
- ```
175
-
176
- ## Expiry Date
177
- **expiry_date** ([DateField](#date-field)): Date on which the documents expires.
178
-
179
- ```rb
180
- puts result.document.inference.prediction.expiry_date.value
181
- ```
182
-
183
- ## Eye Color
184
- **eye_color** ([StringField](#string-field)): US driver license holders eye colour
185
-
186
- ```rb
187
- puts result.document.inference.prediction.eye_color.value
188
- ```
189
-
190
- ## First Name
191
- **first_name** ([StringField](#string-field)): US driver license holders first name(s)
192
-
193
- ```rb
194
- puts result.document.inference.prediction.first_name.value
195
- ```
196
-
197
- ## Hair Color
198
- **hair_color** ([StringField](#string-field)): US driver license holders hair colour
199
-
200
- ```rb
201
- puts result.document.inference.prediction.hair_color.value
202
- ```
203
-
204
- ## Height
205
- **height** ([StringField](#string-field)): US driver license holders hight
206
-
207
- ```rb
208
- puts result.document.inference.prediction.height.value
209
- ```
210
-
211
- ## Date Of Issue
212
- **issued_date** ([DateField](#date-field)): Date on which the documents was issued.
213
-
214
- ```rb
215
- puts result.document.inference.prediction.issued_date.value
216
- ```
217
-
218
- ## Last Name
219
- **last_name** ([StringField](#string-field)): US driver license holders last name
220
-
221
- ```rb
222
- puts result.document.inference.prediction.last_name.value
223
- ```
224
-
225
- ## Photo
226
- [📄](#page-level-fields "This field is only present on individual pages.")**photo** ([PositionField](#position-field)): Has a photo of the US driver license holder
227
-
228
- ```rb
229
- for photo_elem in result.document.photo do
230
- puts photo_elem.polygon
231
- end
232
- ```
233
-
234
- ## Restrictions
235
- **restrictions** ([StringField](#string-field)): US driver license holders restrictions
236
-
237
- ```rb
238
- puts result.document.inference.prediction.restrictions.value
239
- ```
240
-
241
- ## Sex
242
- **sex** ([StringField](#string-field)): US driver license holders gender
243
-
244
- ```rb
245
- puts result.document.inference.prediction.sex.value
246
- ```
247
-
248
- ## Signature
249
- [📄](#page-level-fields "This field is only present on individual pages.")**signature** ([PositionField](#position-field)): Has a signature of the US driver license holder
250
-
251
- ```rb
252
- for signature_elem in result.document.signature do
253
- puts signature_elem.polygon
254
- end
255
- ```
256
-
257
- ## State
258
- **state** ([StringField](#string-field)): US State
259
-
260
- ```rb
261
- puts result.document.inference.prediction.state.value
262
- ```
263
-
264
- ## Weight
265
- **weight** ([StringField](#string-field)): US driver license holders weight
266
-
267
- ```rb
268
- puts result.document.inference.prediction.weight.value
269
- ```
270
-
271
- # Questions?
272
- [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
@@ -1,109 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../../parsing'
4
-
5
- module Mindee
6
- module Product
7
- module InternationalId
8
- # International ID V1 document prediction.
9
- class InternationalIdV1Document < Mindee::Parsing::Common::Prediction
10
- include Mindee::Parsing::Standard
11
- # The physical location of the document holder's residence.
12
- # @return [Mindee::Parsing::Standard::StringField]
13
- attr_reader :address
14
- # The date of birth of the document holder.
15
- # @return [Mindee::Parsing::Standard::DateField]
16
- attr_reader :birth_date
17
- # The location where the document holder was born.
18
- # @return [Mindee::Parsing::Standard::StringField]
19
- attr_reader :birth_place
20
- # The country that issued the identification document.
21
- # @return [Mindee::Parsing::Standard::StringField]
22
- attr_reader :country_of_issue
23
- # The unique identifier assigned to the identification document.
24
- # @return [Mindee::Parsing::Standard::StringField]
25
- attr_reader :document_number
26
- # The type of identification document being used.
27
- # @return [Mindee::Parsing::Standard::ClassificationField]
28
- attr_reader :document_type
29
- # The date when the document will no longer be valid for use.
30
- # @return [Mindee::Parsing::Standard::DateField]
31
- attr_reader :expiry_date
32
- # The first names or given names of the document holder.
33
- # @return [Array<Mindee::Parsing::Standard::StringField>]
34
- attr_reader :given_names
35
- # The date when the document was issued.
36
- # @return [Mindee::Parsing::Standard::DateField]
37
- attr_reader :issue_date
38
- # First line of information in a standardized format for easy machine reading and processing.
39
- # @return [Mindee::Parsing::Standard::StringField]
40
- attr_reader :mrz1
41
- # Second line of information in a standardized format for easy machine reading and processing.
42
- # @return [Mindee::Parsing::Standard::StringField]
43
- attr_reader :mrz2
44
- # Third line of information in a standardized format for easy machine reading and processing.
45
- # @return [Mindee::Parsing::Standard::StringField]
46
- attr_reader :mrz3
47
- # Indicates the country of citizenship or nationality of the document holder.
48
- # @return [Mindee::Parsing::Standard::StringField]
49
- attr_reader :nationality
50
- # The document holder's biological sex, such as male or female.
51
- # @return [Mindee::Parsing::Standard::StringField]
52
- attr_reader :sex
53
- # The surnames of the document holder.
54
- # @return [Array<Mindee::Parsing::Standard::StringField>]
55
- attr_reader :surnames
56
-
57
- # @param prediction [Hash]
58
- # @param page_id [Integer, nil]
59
- def initialize(prediction, page_id)
60
- super()
61
- @address = StringField.new(prediction['address'], page_id)
62
- @birth_date = DateField.new(prediction['birth_date'], page_id)
63
- @birth_place = StringField.new(prediction['birth_place'], page_id)
64
- @country_of_issue = StringField.new(prediction['country_of_issue'], page_id)
65
- @document_number = StringField.new(prediction['document_number'], page_id)
66
- @document_type = ClassificationField.new(prediction['document_type'], page_id)
67
- @expiry_date = DateField.new(prediction['expiry_date'], page_id)
68
- @given_names = []
69
- prediction['given_names'].each do |item|
70
- @given_names.push(StringField.new(item, page_id))
71
- end
72
- @issue_date = DateField.new(prediction['issue_date'], page_id)
73
- @mrz1 = StringField.new(prediction['mrz1'], page_id)
74
- @mrz2 = StringField.new(prediction['mrz2'], page_id)
75
- @mrz3 = StringField.new(prediction['mrz3'], page_id)
76
- @nationality = StringField.new(prediction['nationality'], page_id)
77
- @sex = StringField.new(prediction['sex'], page_id)
78
- @surnames = []
79
- prediction['surnames'].each do |item|
80
- @surnames.push(StringField.new(item, page_id))
81
- end
82
- end
83
-
84
- # @return [String]
85
- def to_s
86
- surnames = @surnames.join("\n #{' ' * 10}")
87
- given_names = @given_names.join("\n #{' ' * 13}")
88
- out_str = String.new
89
- out_str << "\n:Document Type: #{@document_type}".rstrip
90
- out_str << "\n:Document Number: #{@document_number}".rstrip
91
- out_str << "\n:Country of Issue: #{@country_of_issue}".rstrip
92
- out_str << "\n:Surnames: #{surnames}".rstrip
93
- out_str << "\n:Given Names: #{given_names}".rstrip
94
- out_str << "\n:Gender: #{@sex}".rstrip
95
- out_str << "\n:Birth date: #{@birth_date}".rstrip
96
- out_str << "\n:Birth Place: #{@birth_place}".rstrip
97
- out_str << "\n:Nationality: #{@nationality}".rstrip
98
- out_str << "\n:Issue Date: #{@issue_date}".rstrip
99
- out_str << "\n:Expiry Date: #{@expiry_date}".rstrip
100
- out_str << "\n:Address: #{@address}".rstrip
101
- out_str << "\n:Machine Readable Zone Line 1: #{@mrz1}".rstrip
102
- out_str << "\n:Machine Readable Zone Line 2: #{@mrz2}".rstrip
103
- out_str << "\n:Machine Readable Zone Line 3: #{@mrz3}".rstrip
104
- out_str[1..].to_s
105
- end
106
- end
107
- end
108
- end
109
- end