mindee 3.16.0 → 3.18.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +4 -4
- data/bin/mindee.rb +20 -8
- data/docs/code_samples/{international_id_v1_async.txt → driver_license_v1_async.txt} +1 -1
- data/docs/code_samples/french_healthcard_v1_async.txt +19 -0
- data/docs/code_samples/{carte_vitale_v1.txt → payslip_fra_v3_async.txt} +2 -2
- data/docs/code_samples/workflow_execution.txt +29 -0
- data/docs/custom_v1.md +1 -1
- data/docs/driver_license_v1.md +156 -0
- data/docs/{carte_vitale_v1.md → french_healthcard_v1.md} +14 -24
- data/docs/getting_started.md +5 -5
- data/docs/payslip_fra_v3.md +319 -0
- data/lib/mindee/client.rb +40 -0
- data/lib/mindee/extraction/tax_extractor/tax_extractor.rb +34 -19
- data/lib/mindee/http/workflow_endpoint.rb +90 -0
- data/lib/mindee/http.rb +1 -0
- data/lib/mindee/input/sources/base64_input_source.rb +31 -0
- data/lib/mindee/input/sources/bytes_input_source.rb +21 -0
- data/lib/mindee/input/sources/file_input_source.rb +20 -0
- data/lib/mindee/input/sources/local_input_source.rb +183 -0
- data/lib/mindee/input/sources/path_input_source.rb +20 -0
- data/lib/mindee/input/sources/url_input_source.rb +127 -0
- data/lib/mindee/input/sources.rb +6 -248
- data/lib/mindee/parsing/common/api_response.rb +22 -1
- data/lib/mindee/parsing/common/execution.rb +73 -0
- data/lib/mindee/parsing/common/execution_file.rb +24 -0
- data/lib/mindee/parsing/common/execution_priority.rb +30 -0
- data/lib/mindee/parsing/common.rb +3 -0
- data/lib/mindee/product/{international_id/international_id_v1.rb → driver_license/driver_license_v1.rb} +9 -9
- data/lib/mindee/product/driver_license/driver_license_v1_document.rb +91 -0
- data/lib/mindee/product/{international_id/international_id_v1_page.rb → driver_license/driver_license_v1_page.rb} +7 -7
- data/lib/mindee/product/fr/{carte_vitale/carte_vitale_v1.rb → health_card/health_card_v1.rb} +9 -9
- data/lib/mindee/product/fr/{carte_vitale/carte_vitale_v1_document.rb → health_card/health_card_v1_document.rb} +6 -6
- data/lib/mindee/product/fr/{carte_vitale/carte_vitale_v1_page.rb → health_card/health_card_v1_page.rb} +7 -7
- data/lib/mindee/product/fr/payslip/payslip_v3.rb +41 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rb +54 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_document.rb +166 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_employee.rb +78 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_employer.rb +78 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_employment.rb +78 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_page.rb +34 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb +89 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_pay_detail.rb +100 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_pay_period.rb +66 -0
- data/lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb +89 -0
- data/lib/mindee/product/resume/resume_v1_document.rb +1 -1
- data/lib/mindee/product/resume/resume_v1_page.rb +1 -1
- data/lib/mindee/product.rb +3 -2
- data/lib/mindee/version.rb +1 -1
- metadata +36 -14
- data/docs/eu_driver_license_v1.md +0 -227
- data/docs/proof_of_address_v1.md +0 -211
- data/docs/us_driver_license_v1.md +0 -272
- data/lib/mindee/product/international_id/international_id_v1_document.rb +0 -109
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mindee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindee, SA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: marcel
|
@@ -158,7 +158,6 @@ files:
|
|
158
158
|
- docs/bill_of_lading_v1.md
|
159
159
|
- docs/business_card_v1.md
|
160
160
|
- docs/carte_grise_v1.md
|
161
|
-
- docs/carte_vitale_v1.md
|
162
161
|
- docs/code_samples/bank_account_details_v1.txt
|
163
162
|
- docs/code_samples/bank_account_details_v2.txt
|
164
163
|
- docs/code_samples/bank_check_v1.txt
|
@@ -167,12 +166,12 @@ files:
|
|
167
166
|
- docs/code_samples/bill_of_lading_v1_async.txt
|
168
167
|
- docs/code_samples/business_card_v1_async.txt
|
169
168
|
- docs/code_samples/carte_grise_v1.txt
|
170
|
-
- docs/code_samples/carte_vitale_v1.txt
|
171
169
|
- docs/code_samples/cropper_v1.txt
|
172
170
|
- docs/code_samples/custom_v1.txt
|
173
171
|
- docs/code_samples/default.txt
|
174
172
|
- docs/code_samples/default_async.txt
|
175
173
|
- docs/code_samples/delivery_notes_v1_async.txt
|
174
|
+
- docs/code_samples/driver_license_v1_async.txt
|
176
175
|
- docs/code_samples/energy_bill_fra_v1_async.txt
|
177
176
|
- docs/code_samples/eu_driver_license_v1.txt
|
178
177
|
- docs/code_samples/expense_receipts_v4.txt
|
@@ -180,10 +179,10 @@ files:
|
|
180
179
|
- docs/code_samples/expense_receipts_v5_async.txt
|
181
180
|
- docs/code_samples/financial_document_v1.txt
|
182
181
|
- docs/code_samples/financial_document_v1_async.txt
|
182
|
+
- docs/code_samples/french_healthcard_v1_async.txt
|
183
183
|
- docs/code_samples/idcard_fr_v1.txt
|
184
184
|
- docs/code_samples/idcard_fr_v2.txt
|
185
185
|
- docs/code_samples/ind_passport_v1_async.txt
|
186
|
-
- docs/code_samples/international_id_v1_async.txt
|
187
186
|
- docs/code_samples/international_id_v2_async.txt
|
188
187
|
- docs/code_samples/invoice_splitter_v1_async.txt
|
189
188
|
- docs/code_samples/invoices_v4.txt
|
@@ -193,19 +192,22 @@ files:
|
|
193
192
|
- docs/code_samples/nutrition_facts_v1_async.txt
|
194
193
|
- docs/code_samples/passport_v1.txt
|
195
194
|
- docs/code_samples/payslip_fra_v2_async.txt
|
195
|
+
- docs/code_samples/payslip_fra_v3_async.txt
|
196
196
|
- docs/code_samples/proof_of_address_v1.txt
|
197
197
|
- docs/code_samples/resume_v1_async.txt
|
198
198
|
- docs/code_samples/us_driver_license_v1.txt
|
199
199
|
- docs/code_samples/us_healthcare_cards_v1_async.txt
|
200
200
|
- docs/code_samples/us_mail_v2_async.txt
|
201
201
|
- docs/code_samples/us_w9_v1.txt
|
202
|
+
- docs/code_samples/workflow_execution.txt
|
202
203
|
- docs/cropper_v1.md
|
203
204
|
- docs/custom_v1.md
|
204
205
|
- docs/delivery_notes_v1.md
|
206
|
+
- docs/driver_license_v1.md
|
205
207
|
- docs/energy_bill_fra_v1.md
|
206
|
-
- docs/eu_driver_license_v1.md
|
207
208
|
- docs/expense_receipts_v5.md
|
208
209
|
- docs/financial_document_v1.md
|
210
|
+
- docs/french_healthcard_v1.md
|
209
211
|
- docs/generated_v1.md
|
210
212
|
- docs/getting_started.md
|
211
213
|
- docs/idcard_fr_v2.md
|
@@ -218,9 +220,8 @@ files:
|
|
218
220
|
- docs/nutrition_facts_v1.md
|
219
221
|
- docs/passport_v1.md
|
220
222
|
- docs/payslip_fra_v2.md
|
221
|
-
- docs/
|
223
|
+
- docs/payslip_fra_v3.md
|
222
224
|
- docs/resume_v1.md
|
223
|
-
- docs/us_driver_license_v1.md
|
224
225
|
- docs/us_healthcare_cards_v1.md
|
225
226
|
- docs/us_mail_v2.md
|
226
227
|
- docs/us_w9_v1.md
|
@@ -251,16 +252,26 @@ files:
|
|
251
252
|
- lib/mindee/http/endpoint.rb
|
252
253
|
- lib/mindee/http/error.rb
|
253
254
|
- lib/mindee/http/response_validation.rb
|
255
|
+
- lib/mindee/http/workflow_endpoint.rb
|
254
256
|
- lib/mindee/image.rb
|
255
257
|
- lib/mindee/image/image_compressor.rb
|
256
258
|
- lib/mindee/image/image_utils.rb
|
257
259
|
- lib/mindee/input.rb
|
258
260
|
- lib/mindee/input/local_response.rb
|
259
261
|
- lib/mindee/input/sources.rb
|
262
|
+
- lib/mindee/input/sources/base64_input_source.rb
|
263
|
+
- lib/mindee/input/sources/bytes_input_source.rb
|
264
|
+
- lib/mindee/input/sources/file_input_source.rb
|
265
|
+
- lib/mindee/input/sources/local_input_source.rb
|
266
|
+
- lib/mindee/input/sources/path_input_source.rb
|
267
|
+
- lib/mindee/input/sources/url_input_source.rb
|
260
268
|
- lib/mindee/parsing.rb
|
261
269
|
- lib/mindee/parsing/common.rb
|
262
270
|
- lib/mindee/parsing/common/api_response.rb
|
263
271
|
- lib/mindee/parsing/common/document.rb
|
272
|
+
- lib/mindee/parsing/common/execution.rb
|
273
|
+
- lib/mindee/parsing/common/execution_file.rb
|
274
|
+
- lib/mindee/parsing/common/execution_priority.rb
|
264
275
|
- lib/mindee/parsing/common/extras.rb
|
265
276
|
- lib/mindee/parsing/common/extras/cropper_extra.rb
|
266
277
|
- lib/mindee/parsing/common/extras/extras.rb
|
@@ -320,6 +331,9 @@ files:
|
|
320
331
|
- lib/mindee/product/delivery_note/delivery_note_v1.rb
|
321
332
|
- lib/mindee/product/delivery_note/delivery_note_v1_document.rb
|
322
333
|
- lib/mindee/product/delivery_note/delivery_note_v1_page.rb
|
334
|
+
- lib/mindee/product/driver_license/driver_license_v1.rb
|
335
|
+
- lib/mindee/product/driver_license/driver_license_v1_document.rb
|
336
|
+
- lib/mindee/product/driver_license/driver_license_v1_page.rb
|
323
337
|
- lib/mindee/product/eu/driver_license/driver_license_v1.rb
|
324
338
|
- lib/mindee/product/eu/driver_license/driver_license_v1_document.rb
|
325
339
|
- lib/mindee/product/eu/driver_license/driver_license_v1_page.rb
|
@@ -344,9 +358,6 @@ files:
|
|
344
358
|
- lib/mindee/product/fr/carte_grise/carte_grise_v1.rb
|
345
359
|
- lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb
|
346
360
|
- lib/mindee/product/fr/carte_grise/carte_grise_v1_page.rb
|
347
|
-
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1.rb
|
348
|
-
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb
|
349
|
-
- lib/mindee/product/fr/carte_vitale/carte_vitale_v1_page.rb
|
350
361
|
- lib/mindee/product/fr/energy_bill/energy_bill_v1.rb
|
351
362
|
- lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb
|
352
363
|
- lib/mindee/product/fr/energy_bill/energy_bill_v1_energy_consumer.rb
|
@@ -356,6 +367,9 @@ files:
|
|
356
367
|
- lib/mindee/product/fr/energy_bill/energy_bill_v1_page.rb
|
357
368
|
- lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb
|
358
369
|
- lib/mindee/product/fr/energy_bill/energy_bill_v1_taxes_and_contribution.rb
|
370
|
+
- lib/mindee/product/fr/health_card/health_card_v1.rb
|
371
|
+
- lib/mindee/product/fr/health_card/health_card_v1_document.rb
|
372
|
+
- lib/mindee/product/fr/health_card/health_card_v1_page.rb
|
359
373
|
- lib/mindee/product/fr/id_card/id_card_v1.rb
|
360
374
|
- lib/mindee/product/fr/id_card/id_card_v1_document.rb
|
361
375
|
- lib/mindee/product/fr/id_card/id_card_v1_page.rb
|
@@ -373,6 +387,17 @@ files:
|
|
373
387
|
- lib/mindee/product/fr/payslip/payslip_v2_pay_period.rb
|
374
388
|
- lib/mindee/product/fr/payslip/payslip_v2_pto.rb
|
375
389
|
- lib/mindee/product/fr/payslip/payslip_v2_salary_detail.rb
|
390
|
+
- lib/mindee/product/fr/payslip/payslip_v3.rb
|
391
|
+
- lib/mindee/product/fr/payslip/payslip_v3_bank_account_detail.rb
|
392
|
+
- lib/mindee/product/fr/payslip/payslip_v3_document.rb
|
393
|
+
- lib/mindee/product/fr/payslip/payslip_v3_employee.rb
|
394
|
+
- lib/mindee/product/fr/payslip/payslip_v3_employer.rb
|
395
|
+
- lib/mindee/product/fr/payslip/payslip_v3_employment.rb
|
396
|
+
- lib/mindee/product/fr/payslip/payslip_v3_page.rb
|
397
|
+
- lib/mindee/product/fr/payslip/payslip_v3_paid_time_off.rb
|
398
|
+
- lib/mindee/product/fr/payslip/payslip_v3_pay_detail.rb
|
399
|
+
- lib/mindee/product/fr/payslip/payslip_v3_pay_period.rb
|
400
|
+
- lib/mindee/product/fr/payslip/payslip_v3_salary_detail.rb
|
376
401
|
- lib/mindee/product/generated/generated_v1.rb
|
377
402
|
- lib/mindee/product/generated/generated_v1_document.rb
|
378
403
|
- lib/mindee/product/generated/generated_v1_page.rb
|
@@ -380,9 +405,6 @@ files:
|
|
380
405
|
- lib/mindee/product/ind/indian_passport/indian_passport_v1.rb
|
381
406
|
- lib/mindee/product/ind/indian_passport/indian_passport_v1_document.rb
|
382
407
|
- lib/mindee/product/ind/indian_passport/indian_passport_v1_page.rb
|
383
|
-
- lib/mindee/product/international_id/international_id_v1.rb
|
384
|
-
- lib/mindee/product/international_id/international_id_v1_document.rb
|
385
|
-
- lib/mindee/product/international_id/international_id_v1_page.rb
|
386
408
|
- lib/mindee/product/international_id/international_id_v2.rb
|
387
409
|
- lib/mindee/product/international_id/international_id_v2_document.rb
|
388
410
|
- lib/mindee/product/international_id/international_id_v2_page.rb
|
@@ -1,227 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: EU Driver License OCR Ruby
|
3
|
-
category: 622b805aaec68102ea7fcbc2
|
4
|
-
slug: ruby-eu-driver-license-ocr
|
5
|
-
parentDoc: 6294d97ee723f1008d2ab28e
|
6
|
-
---
|
7
|
-
The Ruby OCR SDK supports the [Driver License API](https://platform.mindee.com/mindee/eu_driver_license).
|
8
|
-
|
9
|
-
Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/eu_driver_license/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
|
10
|
-

|
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::EU::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: b19cc32e-b3e6-4ff9-bdc7-619199355d54
|
42
|
-
:Filename: default_sample.jpg
|
43
|
-
|
44
|
-
Inference
|
45
|
-
#########
|
46
|
-
:Product: mindee/eu_driver_license v1.0
|
47
|
-
:Rotation applied: Yes
|
48
|
-
|
49
|
-
Prediction
|
50
|
-
==========
|
51
|
-
:Country Code: FR
|
52
|
-
:Document ID: 13AA00002
|
53
|
-
:Driver License Category: AM A1 B1 B D BE DE
|
54
|
-
:Last Name: MARTIN
|
55
|
-
:First Name: PAUL
|
56
|
-
:Date Of Birth: 1981-07-14
|
57
|
-
:Place Of Birth: Utopiacity
|
58
|
-
:Expiry Date: 2018-12-31
|
59
|
-
:Issue Date: 2013-01-01
|
60
|
-
:Issue Authority: 99999UpiaCity
|
61
|
-
:MRZ: D1FRA13AA000026181231MARTIN<<9
|
62
|
-
:Address:
|
63
|
-
|
64
|
-
Page Predictions
|
65
|
-
================
|
66
|
-
|
67
|
-
Page 0
|
68
|
-
------
|
69
|
-
:Photo: Polygon with 4 points.
|
70
|
-
:Signature: Polygon with 4 points.
|
71
|
-
:Country Code: FR
|
72
|
-
:Document ID: 13AA00002
|
73
|
-
:Driver License Category: AM A1 B1 B D BE DE
|
74
|
-
:Last Name: MARTIN
|
75
|
-
:First Name: PAUL
|
76
|
-
:Date Of Birth: 1981-07-14
|
77
|
-
:Place Of Birth: Utopiacity
|
78
|
-
:Expiry Date: 2018-12-31
|
79
|
-
:Issue Date: 2013-01-01
|
80
|
-
:Issue Authority: 99999UpiaCity
|
81
|
-
:MRZ: D1FRA13AA000026181231MARTIN<<9
|
82
|
-
:Address:
|
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`, `Boolean`): 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** (`Boolean`): 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
|
-
### Date Field
|
104
|
-
Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
|
105
|
-
|
106
|
-
* **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
|
107
|
-
|
108
|
-
|
109
|
-
### Position Field
|
110
|
-
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:
|
111
|
-
|
112
|
-
* **rectangle** (`Mindee::Geometry::Quadrilateral`): a Polygon with four points that may be oriented (even beyond canvas).
|
113
|
-
* **quadrangle** (`Mindee::Geometry::Quadrilateral`): a free polygon made up of four points.
|
114
|
-
|
115
|
-
### String Field
|
116
|
-
The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
|
117
|
-
|
118
|
-
## Page-Level Fields
|
119
|
-
Some fields are constrained to the page level, and so will not be retrievable at document level.
|
120
|
-
|
121
|
-
# Attributes
|
122
|
-
The following fields are extracted for Driver License V1:
|
123
|
-
|
124
|
-
## Address
|
125
|
-
**address** ([StringField](#string-field)): EU driver license holders address
|
126
|
-
|
127
|
-
```rb
|
128
|
-
puts result.document.inference.prediction.address.value
|
129
|
-
```
|
130
|
-
|
131
|
-
## Driver License Category
|
132
|
-
**category** ([StringField](#string-field)): EU driver license holders categories
|
133
|
-
|
134
|
-
```rb
|
135
|
-
puts result.document.inference.prediction.category.value
|
136
|
-
```
|
137
|
-
|
138
|
-
## Country Code
|
139
|
-
**country_code** ([StringField](#string-field)): Country code extracted as a string.
|
140
|
-
|
141
|
-
```rb
|
142
|
-
puts result.document.inference.prediction.country_code.value
|
143
|
-
```
|
144
|
-
|
145
|
-
## Date Of Birth
|
146
|
-
**date_of_birth** ([DateField](#date-field)): The date of birth of the document holder
|
147
|
-
|
148
|
-
```rb
|
149
|
-
puts result.document.inference.prediction.date_of_birth.value
|
150
|
-
```
|
151
|
-
|
152
|
-
## Document ID
|
153
|
-
**document_id** ([StringField](#string-field)): ID number of the Document.
|
154
|
-
|
155
|
-
```rb
|
156
|
-
puts result.document.inference.prediction.document_id.value
|
157
|
-
```
|
158
|
-
|
159
|
-
## Expiry Date
|
160
|
-
**expiry_date** ([DateField](#date-field)): Date the document expires
|
161
|
-
|
162
|
-
```rb
|
163
|
-
puts result.document.inference.prediction.expiry_date.value
|
164
|
-
```
|
165
|
-
|
166
|
-
## First Name
|
167
|
-
**first_name** ([StringField](#string-field)): First name(s) of the driver license holder
|
168
|
-
|
169
|
-
```rb
|
170
|
-
puts result.document.inference.prediction.first_name.value
|
171
|
-
```
|
172
|
-
|
173
|
-
## Issue Authority
|
174
|
-
**issue_authority** ([StringField](#string-field)): Authority that issued the document
|
175
|
-
|
176
|
-
```rb
|
177
|
-
puts result.document.inference.prediction.issue_authority.value
|
178
|
-
```
|
179
|
-
|
180
|
-
## Issue Date
|
181
|
-
**issue_date** ([DateField](#date-field)): Date the document was issued
|
182
|
-
|
183
|
-
```rb
|
184
|
-
puts result.document.inference.prediction.issue_date.value
|
185
|
-
```
|
186
|
-
|
187
|
-
## Last Name
|
188
|
-
**last_name** ([StringField](#string-field)): Last name of the driver license holder.
|
189
|
-
|
190
|
-
```rb
|
191
|
-
puts result.document.inference.prediction.last_name.value
|
192
|
-
```
|
193
|
-
|
194
|
-
## MRZ
|
195
|
-
**mrz** ([StringField](#string-field)): Machine-readable license number
|
196
|
-
|
197
|
-
```rb
|
198
|
-
puts result.document.inference.prediction.mrz.value
|
199
|
-
```
|
200
|
-
|
201
|
-
## Photo
|
202
|
-
[📄](#page-level-fields "This field is only present on individual pages.")**photo** ([PositionField](#position-field)): Has a photo of the EU driver license holder
|
203
|
-
|
204
|
-
```rb
|
205
|
-
for photo_elem in result.document.photo do
|
206
|
-
puts photo_elem.polygon
|
207
|
-
end
|
208
|
-
```
|
209
|
-
|
210
|
-
## Place Of Birth
|
211
|
-
**place_of_birth** ([StringField](#string-field)): Place where the driver license holder was born
|
212
|
-
|
213
|
-
```rb
|
214
|
-
puts result.document.inference.prediction.place_of_birth.value
|
215
|
-
```
|
216
|
-
|
217
|
-
## Signature
|
218
|
-
[📄](#page-level-fields "This field is only present on individual pages.")**signature** ([PositionField](#position-field)): Has a signature of the EU driver license holder
|
219
|
-
|
220
|
-
```rb
|
221
|
-
for signature_elem in result.document.signature do
|
222
|
-
puts signature_elem.polygon
|
223
|
-
end
|
224
|
-
```
|
225
|
-
|
226
|
-
# Questions?
|
227
|
-
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
|
data/docs/proof_of_address_v1.md
DELETED
@@ -1,211 +0,0 @@
|
|
1
|
-
---
|
2
|
-
title: Proof of Address OCR Ruby
|
3
|
-
category: 622b805aaec68102ea7fcbc2
|
4
|
-
slug: ruby-proof-of-address-ocr
|
5
|
-
parentDoc: 6294d97ee723f1008d2ab28e
|
6
|
-
---
|
7
|
-
The Ruby OCR SDK supports the [Proof of Address API](https://platform.mindee.com/mindee/proof_of_address).
|
8
|
-
|
9
|
-
Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/proof_of_address/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
|
10
|
-

|
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::ProofOfAddress::ProofOfAddressV1
|
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: 5d2361e9-405e-4fc1-8531-f92a3aef0c38
|
42
|
-
:Filename: default_sample.jpg
|
43
|
-
|
44
|
-
Inference
|
45
|
-
#########
|
46
|
-
:Product: mindee/proof_of_address v1.1
|
47
|
-
:Rotation applied: Yes
|
48
|
-
|
49
|
-
Prediction
|
50
|
-
==========
|
51
|
-
:Locale: en; en; USD;
|
52
|
-
:Issuer Name: PPL ELECTRIC UTILITIES
|
53
|
-
:Issuer Company Registrations:
|
54
|
-
:Issuer Address: 2 NORTH 9TH STREET CPC-GENN1 ALLENTOWN.PA 18101-1175
|
55
|
-
:Recipient Name:
|
56
|
-
:Recipient Company Registrations:
|
57
|
-
:Recipient Address: 123 MAIN ST ANYTOWN,PA 18062
|
58
|
-
:Dates: 2011-07-27
|
59
|
-
2011-07-06
|
60
|
-
2011-08-03
|
61
|
-
2011-07-27
|
62
|
-
2011-06-01
|
63
|
-
2011-07-01
|
64
|
-
2010-07-01
|
65
|
-
2010-08-01
|
66
|
-
2011-07-01
|
67
|
-
2009-08-01
|
68
|
-
2010-07-01
|
69
|
-
2011-07-27
|
70
|
-
:Date of Issue: 2011-07-27
|
71
|
-
|
72
|
-
Page Predictions
|
73
|
-
================
|
74
|
-
|
75
|
-
Page 0
|
76
|
-
------
|
77
|
-
:Locale: en; en; USD;
|
78
|
-
:Issuer Name: PPL ELECTRIC UTILITIES
|
79
|
-
:Issuer Company Registrations:
|
80
|
-
:Issuer Address: 2 NORTH 9TH STREET CPC-GENN1 ALLENTOWN.PA 18101-1175
|
81
|
-
:Recipient Name:
|
82
|
-
:Recipient Company Registrations:
|
83
|
-
:Recipient Address: 123 MAIN ST ANYTOWN,PA 18062
|
84
|
-
:Dates: 2011-07-27
|
85
|
-
2011-07-06
|
86
|
-
2011-08-03
|
87
|
-
2011-07-27
|
88
|
-
2011-06-01
|
89
|
-
2011-07-01
|
90
|
-
2010-07-01
|
91
|
-
2010-08-01
|
92
|
-
2011-07-01
|
93
|
-
2009-08-01
|
94
|
-
2010-07-01
|
95
|
-
2011-07-27
|
96
|
-
:Date of Issue: 2011-07-27
|
97
|
-
```
|
98
|
-
|
99
|
-
# Field Types
|
100
|
-
## Standard Fields
|
101
|
-
These fields are generic and used in several products.
|
102
|
-
|
103
|
-
### Basic Field
|
104
|
-
Each prediction object contains a set of fields that inherit from the generic `Field` class.
|
105
|
-
A typical `Field` object will have the following attributes:
|
106
|
-
|
107
|
-
* **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
|
108
|
-
* **confidence** (Float, nil): the confidence score of the field prediction.
|
109
|
-
* **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
|
110
|
-
* **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
|
111
|
-
* **page_id** (`Integer`, `nil`): the ID of the page, always `nil` when at document-level.
|
112
|
-
* **reconstructed** (`Boolean`): indicates whether an object was reconstructed (not extracted as the API gave it).
|
113
|
-
|
114
|
-
|
115
|
-
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.
|
116
|
-
|
117
|
-
|
118
|
-
### Company Registration Field
|
119
|
-
Aside from the basic `Field` attributes, the company registration field `CompanyRegistrationField` also implements the following:
|
120
|
-
|
121
|
-
* **type** (`String`): the type of company.
|
122
|
-
|
123
|
-
### Date Field
|
124
|
-
Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
|
125
|
-
|
126
|
-
* **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
|
127
|
-
|
128
|
-
### Locale Field
|
129
|
-
The locale field `LocaleField` only implements the **value**, **confidence** and **page_id** base `Field` attributes, but it comes with its own:
|
130
|
-
|
131
|
-
* **language** (`String`): ISO 639-1 language code (e.g.: `en` for English). Can be `nil`.
|
132
|
-
* **country** (`String`): ISO 3166-1 alpha-2 or ISO 3166-1 alpha-3 code for countries (e.g.: `GRB` or `GB` for "Great Britain"). Can be `nil`.
|
133
|
-
* **currency** (`String`): ISO 4217 code for currencies (e.g.: `USD` for "US Dollars"). Can be `nil`.
|
134
|
-
|
135
|
-
### String Field
|
136
|
-
The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
|
137
|
-
|
138
|
-
# Attributes
|
139
|
-
The following fields are extracted for Proof of Address V1:
|
140
|
-
|
141
|
-
## Date of Issue
|
142
|
-
**date** ([DateField](#date-field)): The date the document was issued.
|
143
|
-
|
144
|
-
```rb
|
145
|
-
puts result.document.inference.prediction.date.value
|
146
|
-
```
|
147
|
-
|
148
|
-
## Dates
|
149
|
-
**dates** (Array<[DateField](#date-field)>): List of dates found on the document.
|
150
|
-
|
151
|
-
```rb
|
152
|
-
for dates_elem in result.document.inference.prediction.dates do
|
153
|
-
puts dates_elem.value
|
154
|
-
end
|
155
|
-
```
|
156
|
-
|
157
|
-
## Issuer Address
|
158
|
-
**issuer_address** ([StringField](#string-field)): The address of the document's issuer.
|
159
|
-
|
160
|
-
```rb
|
161
|
-
puts result.document.inference.prediction.issuer_address.value
|
162
|
-
```
|
163
|
-
|
164
|
-
## Issuer Company Registrations
|
165
|
-
**issuer_company_registration** (Array<[CompanyRegistrationField](#company-registration-field)>): List of company registrations found for the issuer.
|
166
|
-
|
167
|
-
```rb
|
168
|
-
for issuer_company_registration_elem in result.document.inference.prediction.issuer_company_registration do
|
169
|
-
puts issuer_company_registration_elem.value
|
170
|
-
end
|
171
|
-
```
|
172
|
-
|
173
|
-
## Issuer Name
|
174
|
-
**issuer_name** ([StringField](#string-field)): The name of the person or company issuing the document.
|
175
|
-
|
176
|
-
```rb
|
177
|
-
puts result.document.inference.prediction.issuer_name.value
|
178
|
-
```
|
179
|
-
|
180
|
-
## Locale
|
181
|
-
**locale** ([LocaleField](#locale-field)): The locale detected on the document.
|
182
|
-
|
183
|
-
```rb
|
184
|
-
puts result.document.inference.prediction.locale.value
|
185
|
-
```
|
186
|
-
|
187
|
-
## Recipient Address
|
188
|
-
**recipient_address** ([StringField](#string-field)): The address of the recipient.
|
189
|
-
|
190
|
-
```rb
|
191
|
-
puts result.document.inference.prediction.recipient_address.value
|
192
|
-
```
|
193
|
-
|
194
|
-
## Recipient Company Registrations
|
195
|
-
**recipient_company_registration** (Array<[CompanyRegistrationField](#company-registration-field)>): List of company registrations found for the recipient.
|
196
|
-
|
197
|
-
```rb
|
198
|
-
for recipient_company_registration_elem in result.document.inference.prediction.recipient_company_registration do
|
199
|
-
puts recipient_company_registration_elem.value
|
200
|
-
end
|
201
|
-
```
|
202
|
-
|
203
|
-
## Recipient Name
|
204
|
-
**recipient_name** ([StringField](#string-field)): The name of the person or company receiving the document.
|
205
|
-
|
206
|
-
```rb
|
207
|
-
puts result.document.inference.prediction.recipient_name.value
|
208
|
-
```
|
209
|
-
|
210
|
-
# Questions?
|
211
|
-
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)
|