mindee 3.1.1 → 3.3.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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +1 -0
  4. data/CHANGELOG.md +26 -0
  5. data/README.md +57 -7
  6. data/bin/mindee.rb +160 -83
  7. data/docs/bank_account_details_v2.md +137 -0
  8. data/docs/bank_check_v1.md +179 -0
  9. data/docs/barcode_reader_v1.md +104 -0
  10. data/docs/carte_grise_v1.md +454 -0
  11. data/docs/carte_vitale_v1.md +123 -0
  12. data/docs/code_samples/barcode_reader_v1.txt +19 -0
  13. data/docs/code_samples/carte_grise_v1.txt +19 -0
  14. data/docs/code_samples/cropper_v1.txt +16 -0
  15. data/docs/code_samples/idcard_fr_v2.txt +19 -0
  16. data/docs/code_samples/invoice_splitter_v1_async.txt +6 -54
  17. data/docs/code_samples/multi_receipts_detector_v1.txt +19 -0
  18. data/docs/code_samples/us_w9_v1.txt +16 -0
  19. data/docs/cropper_v1.md +97 -0
  20. data/docs/custom_v1.md +109 -0
  21. data/docs/expense_receipts_v5.md +306 -0
  22. data/docs/financial_document_v1.md +384 -0
  23. data/docs/{ruby-getting-started.md → getting_started.md} +22 -6
  24. data/docs/idcard_fr_v2.md +253 -0
  25. data/docs/invoice_splitter_v1.md +85 -0
  26. data/docs/invoices_v4.md +338 -0
  27. data/docs/license_plates_v1.md +91 -0
  28. data/docs/multi_receipts_detector_v1.md +105 -0
  29. data/docs/passport_v1.md +186 -0
  30. data/docs/proof_of_address_v1.md +207 -0
  31. data/docs/us_driver_license_v1.md +268 -0
  32. data/docs/us_w9_v1.md +207 -0
  33. data/lib/mindee/client.rb +95 -16
  34. data/lib/mindee/geometry/quadrilateral.rb +5 -0
  35. data/lib/mindee/http/.rubocop.yml +8 -0
  36. data/lib/mindee/http/endpoint.rb +19 -7
  37. data/lib/mindee/http/error.rb +104 -0
  38. data/lib/mindee/http.rb +1 -0
  39. data/lib/mindee/input/sources.rb +83 -14
  40. data/lib/mindee/parsing/common/api_response.rb +12 -1
  41. data/lib/mindee/parsing/common/document.rb +4 -1
  42. data/lib/mindee/parsing/common/inference.rb +2 -2
  43. data/lib/mindee/parsing/common/ocr/ocr.rb +1 -0
  44. data/lib/mindee/parsing/common.rb +0 -1
  45. data/lib/mindee/parsing/custom/list_field.rb +7 -5
  46. data/lib/mindee/parsing/standard/base_field.rb +1 -1
  47. data/lib/mindee/parsing/standard/company_registration_field.rb +1 -1
  48. data/lib/mindee/parsing/standard/locale_field.rb +1 -1
  49. data/lib/mindee/parsing/standard/payment_details_field.rb +1 -1
  50. data/lib/mindee/parsing/standard/position_field.rb +10 -3
  51. data/lib/mindee/parsing/standard/{text_field.rb → string_field.rb} +1 -1
  52. data/lib/mindee/parsing/standard.rb +1 -1
  53. data/lib/mindee/pdf/pdf_processing.rb +2 -1
  54. data/lib/mindee/product/barcode_reader/barcode_reader_v1.rb +37 -0
  55. data/lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb +44 -0
  56. data/lib/mindee/product/barcode_reader/barcode_reader_v1_page.rb +32 -0
  57. data/lib/mindee/product/cropper/cropper_v1.rb +37 -0
  58. data/lib/mindee/product/cropper/cropper_v1_document.rb +13 -0
  59. data/lib/mindee/product/cropper/cropper_v1_page.rb +49 -0
  60. data/lib/mindee/product/custom/custom_v1.rb +1 -0
  61. data/lib/mindee/product/eu/license_plate/license_plate_v1.rb +1 -0
  62. data/lib/mindee/product/eu/license_plate/license_plate_v1_document.rb +2 -2
  63. data/lib/mindee/product/financial_document/financial_document_v1.rb +1 -0
  64. data/lib/mindee/product/financial_document/financial_document_v1_document.rb +26 -26
  65. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1.rb +1 -0
  66. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rb +6 -6
  67. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2.rb +1 -0
  68. data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rb +6 -6
  69. data/lib/mindee/product/fr/carte_grise/carte_grise_v1.rb +39 -0
  70. data/lib/mindee/product/fr/carte_grise/carte_grise_v1_document.rb +235 -0
  71. data/lib/mindee/product/fr/carte_grise/carte_grise_v1_page.rb +34 -0
  72. data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1.rb +1 -0
  73. data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb +6 -6
  74. data/lib/mindee/product/fr/id_card/id_card_v1.rb +1 -0
  75. data/lib/mindee/product/fr/id_card/id_card_v1_document.rb +16 -16
  76. data/lib/mindee/product/fr/id_card/id_card_v2.rb +39 -0
  77. data/lib/mindee/product/fr/id_card/id_card_v2_document.rb +107 -0
  78. data/lib/mindee/product/fr/id_card/id_card_v2_page.rb +53 -0
  79. data/lib/mindee/product/invoice/invoice_v4.rb +2 -2
  80. data/lib/mindee/product/invoice/invoice_v4_document.rb +115 -155
  81. data/lib/mindee/product/invoice/invoice_v4_line_item.rb +54 -30
  82. data/lib/mindee/product/invoice_splitter/invoice_splitter_v1.rb +1 -0
  83. data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +5 -3
  84. data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rb +37 -0
  85. data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb +35 -0
  86. data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rb +32 -0
  87. data/lib/mindee/product/passport/passport_v1.rb +1 -0
  88. data/lib/mindee/product/passport/passport_v1_document.rb +16 -16
  89. data/lib/mindee/product/proof_of_address/proof_of_address_v1.rb +1 -0
  90. data/lib/mindee/product/proof_of_address/proof_of_address_v1_document.rb +14 -14
  91. data/lib/mindee/product/receipt/receipt_v4_document.rb +6 -6
  92. data/lib/mindee/product/receipt/receipt_v5.rb +1 -0
  93. data/lib/mindee/product/receipt/receipt_v5_document.rb +12 -12
  94. data/lib/mindee/product/us/bank_check/bank_check_v1.rb +1 -0
  95. data/lib/mindee/product/us/bank_check/bank_check_v1_document.rb +8 -8
  96. data/lib/mindee/product/us/driver_license/driver_license_v1.rb +1 -0
  97. data/lib/mindee/product/us/driver_license/driver_license_v1_document.rb +28 -28
  98. data/lib/mindee/product/us/w9/w9_v1.rb +39 -0
  99. data/lib/mindee/product/us/w9/w9_v1_document.rb +15 -0
  100. data/lib/mindee/product/us/w9/w9_v1_page.rb +102 -0
  101. data/lib/mindee/product.rb +6 -0
  102. data/lib/mindee/version.rb +5 -1
  103. data/lib/mindee.rb +45 -1
  104. metadata +48 -9
  105. data/docs/ruby-api-builder.md +0 -123
  106. data/docs/ruby-invoice-ocr.md +0 -271
  107. data/docs/ruby-passport-ocr.md +0 -165
  108. data/docs/ruby-receipt-ocr.md +0 -196
  109. data/lib/mindee/parsing/common/error.rb +0 -24
@@ -0,0 +1,454 @@
1
+ ---
2
+ title: FR Carte Grise OCR Ruby
3
+ ---
4
+ The Ruby OCR SDK supports the [Carte Grise API](https://platform.mindee.com/mindee/carte_grise).
5
+
6
+ Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/carte_grise/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
7
+ ![Carte Grise sample](https://github.com/mindee/client-lib-test-data/blob/main/products/carte_grise/default_sample.jpg?raw=true)
8
+
9
+ # Quick-Start
10
+ ```rb
11
+ require 'mindee'
12
+
13
+ # Init a new client
14
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
15
+
16
+ # Load a file from disk
17
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
18
+
19
+ # Parse the file
20
+ result = mindee_client.parse(
21
+ input_source,
22
+ Mindee::Product::FR::CarteGrise::CarteGriseV1
23
+ )
24
+
25
+ # Print a full summary of the parsed data in RST format
26
+ puts result.document
27
+
28
+ # Print the document-level parsed data
29
+ # puts result.document.inference.prediction
30
+ ```
31
+
32
+ **Output (RST):**
33
+ ```rst
34
+ ########
35
+ Document
36
+ ########
37
+ :Mindee ID: f0e0f7a9-0f44-4a3d-92c7-5be262133d33
38
+ :Filename: default_sample.jpg
39
+
40
+ Inference
41
+ #########
42
+ :Product: mindee/carte_grise v1.0
43
+ :Rotation applied: Yes
44
+
45
+ Prediction
46
+ ==========
47
+ :a: AB-123-CD
48
+ :b: 1998-01-05
49
+ :c1: DUPONT YVES
50
+ :c3: 27 RUE DES ROITELETS 59169 FERIN LES BAINS FRANCE
51
+ :c41: 2 DELAROCHE
52
+ :c4a: EST LE PROPRIETAIRE DU VEHICULE
53
+ :d1:
54
+ :d3: MODELE
55
+ :e: VFS1V2009AS1V2009
56
+ :f1: 1915
57
+ :f2: 1915
58
+ :f3: 1915
59
+ :g: 3030
60
+ :g1: 1307
61
+ :i: 2009-12-04
62
+ :j: N1
63
+ :j1: VP
64
+ :j2: AA
65
+ :j3: CI
66
+ :p1: 1900
67
+ :p2: 90
68
+ :p3: GO
69
+ :p6: 6
70
+ :q:
71
+ :s1: 5
72
+ :s2:
73
+ :u1: 77
74
+ :u2: 3000
75
+ :v7: 155
76
+ :x1: 2011-07-06
77
+ :y1:
78
+ :y2:
79
+ :y3: 0
80
+ :y4: 4
81
+ :y5: 2.5
82
+ :y6: 178.35
83
+ :Formula Number: 2009AS05284
84
+ :Owner's First Name: YVES
85
+ :Owner's Surname: DUPONT
86
+ :MRZ Line 1:
87
+ :MRZ Line 2: CI<<MARQUES<<<<<<<MODELE<<<<<<<2009AS0528402
88
+
89
+ Page Predictions
90
+ ================
91
+
92
+ Page 0
93
+ ------
94
+ :a: AB-123-CD
95
+ :b: 1998-01-05
96
+ :c1: DUPONT YVES
97
+ :c3: 27 RUE DES ROITELETS 59169 FERIN LES BAINS FRANCE
98
+ :c41: 2 DELAROCHE
99
+ :c4a: EST LE PROPRIETAIRE DU VEHICULE
100
+ :d1:
101
+ :d3: MODELE
102
+ :e: VFS1V2009AS1V2009
103
+ :f1: 1915
104
+ :f2: 1915
105
+ :f3: 1915
106
+ :g: 3030
107
+ :g1: 1307
108
+ :i: 2009-12-04
109
+ :j: N1
110
+ :j1: VP
111
+ :j2: AA
112
+ :j3: CI
113
+ :p1: 1900
114
+ :p2: 90
115
+ :p3: GO
116
+ :p6: 6
117
+ :q: 006
118
+ :s1: 5
119
+ :s2:
120
+ :u1: 77
121
+ :u2: 3000
122
+ :v7: 155
123
+ :x1: 2011-07-06
124
+ :y1: 17835
125
+ :y2:
126
+ :y3: 0
127
+ :y4: 4
128
+ :y5: 2.5
129
+ :y6: 178.35
130
+ :Formula Number: 2009AS05284
131
+ :Owner's First Name: YVES
132
+ :Owner's Surname: DUPONT
133
+ :MRZ Line 1:
134
+ :MRZ Line 2: CI<<MARQUES<<<<<<<MODELE<<<<<<<2009AS0528402
135
+ ```
136
+
137
+ # Field Types
138
+ ## Standard Fields
139
+ These fields are generic and used in several products.
140
+
141
+ ### Basic Field
142
+ Each prediction object contains a set of fields that inherit from the generic `Field` class.
143
+ A typical `Field` object will have the following attributes:
144
+
145
+ * **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
146
+ * **confidence** (Float, nil): the confidence score of the field prediction.
147
+ * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
148
+ * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
149
+ * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
150
+ * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
151
+
152
+
153
+ 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.
154
+
155
+ ### Date Field
156
+ Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
157
+
158
+ * **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
159
+
160
+ ### String Field
161
+ The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
162
+
163
+ # Attributes
164
+ The following fields are extracted for Carte Grise V1:
165
+
166
+ ## a
167
+ **a** ([StringField](#string-field)): The vehicle's license plate number.
168
+
169
+ ```rb
170
+ puts result.document.inference.prediction.a.value
171
+ ```
172
+
173
+ ## b
174
+ **b** ([DateField](#date-field)): The vehicle's first release date.
175
+
176
+ ```rb
177
+ puts result.document.inference.prediction.b.value
178
+ ```
179
+
180
+ ## c1
181
+ **c1** ([StringField](#string-field)): The vehicle owner's full name including maiden name.
182
+
183
+ ```rb
184
+ puts result.document.inference.prediction.c1.value
185
+ ```
186
+
187
+ ## c3
188
+ **c3** ([StringField](#string-field)): The vehicle owner's address.
189
+
190
+ ```rb
191
+ puts result.document.inference.prediction.c3.value
192
+ ```
193
+
194
+ ## c41
195
+ **c41** ([StringField](#string-field)): Number of owners of the license certificate.
196
+
197
+ ```rb
198
+ puts result.document.inference.prediction.c41.value
199
+ ```
200
+
201
+ ## c4a
202
+ **c4a** ([StringField](#string-field)): Mentions about the ownership of the vehicle.
203
+
204
+ ```rb
205
+ puts result.document.inference.prediction.c4a.value
206
+ ```
207
+
208
+ ## d1
209
+ **d1** ([StringField](#string-field)): The vehicle's brand.
210
+
211
+ ```rb
212
+ puts result.document.inference.prediction.d1.value
213
+ ```
214
+
215
+ ## d3
216
+ **d3** ([StringField](#string-field)): The vehicle's commercial name.
217
+
218
+ ```rb
219
+ puts result.document.inference.prediction.d3.value
220
+ ```
221
+
222
+ ## e
223
+ **e** ([StringField](#string-field)): The Vehicle Identification Number (VIN).
224
+
225
+ ```rb
226
+ puts result.document.inference.prediction.e.value
227
+ ```
228
+
229
+ ## f1
230
+ **f1** ([StringField](#string-field)): The vehicle's maximum admissible weight.
231
+
232
+ ```rb
233
+ puts result.document.inference.prediction.f1.value
234
+ ```
235
+
236
+ ## f2
237
+ **f2** ([StringField](#string-field)): The vehicle's maximum admissible weight within the license's state.
238
+
239
+ ```rb
240
+ puts result.document.inference.prediction.f2.value
241
+ ```
242
+
243
+ ## f3
244
+ **f3** ([StringField](#string-field)): The vehicle's maximum authorized weight with coupling.
245
+
246
+ ```rb
247
+ puts result.document.inference.prediction.f3.value
248
+ ```
249
+
250
+ ## Formula Number
251
+ **formula_number** ([StringField](#string-field)): The document's formula number.
252
+
253
+ ```rb
254
+ puts result.document.inference.prediction.formula_number.value
255
+ ```
256
+
257
+ ## g
258
+ **g** ([StringField](#string-field)): The vehicle's weight with coupling if tractor different than category M1.
259
+
260
+ ```rb
261
+ puts result.document.inference.prediction.g.value
262
+ ```
263
+
264
+ ## g1
265
+ **g1** ([StringField](#string-field)): The vehicle's national empty weight.
266
+
267
+ ```rb
268
+ puts result.document.inference.prediction.g1.value
269
+ ```
270
+
271
+ ## i
272
+ **i** ([DateField](#date-field)): The car registration date of the given certificate.
273
+
274
+ ```rb
275
+ puts result.document.inference.prediction.i.value
276
+ ```
277
+
278
+ ## j
279
+ **j** ([StringField](#string-field)): The vehicle's category.
280
+
281
+ ```rb
282
+ puts result.document.inference.prediction.j.value
283
+ ```
284
+
285
+ ## j1
286
+ **j1** ([StringField](#string-field)): The vehicle's national type.
287
+
288
+ ```rb
289
+ puts result.document.inference.prediction.j1.value
290
+ ```
291
+
292
+ ## j2
293
+ **j2** ([StringField](#string-field)): The vehicle's body type (CE).
294
+
295
+ ```rb
296
+ puts result.document.inference.prediction.j2.value
297
+ ```
298
+
299
+ ## j3
300
+ **j3** ([StringField](#string-field)): The vehicle's body type (National designation).
301
+
302
+ ```rb
303
+ puts result.document.inference.prediction.j3.value
304
+ ```
305
+
306
+ ## MRZ Line 1
307
+ **mrz1** ([StringField](#string-field)): Machine Readable Zone, first line.
308
+
309
+ ```rb
310
+ puts result.document.inference.prediction.mrz1.value
311
+ ```
312
+
313
+ ## MRZ Line 2
314
+ **mrz2** ([StringField](#string-field)): Machine Readable Zone, second line.
315
+
316
+ ```rb
317
+ puts result.document.inference.prediction.mrz2.value
318
+ ```
319
+
320
+ ## Owner's First Name
321
+ **owner_first_name** ([StringField](#string-field)): The vehicle's owner first name.
322
+
323
+ ```rb
324
+ puts result.document.inference.prediction.owner_first_name.value
325
+ ```
326
+
327
+ ## Owner's Surname
328
+ **owner_surname** ([StringField](#string-field)): The vehicle's owner surname.
329
+
330
+ ```rb
331
+ puts result.document.inference.prediction.owner_surname.value
332
+ ```
333
+
334
+ ## p1
335
+ **p1** ([StringField](#string-field)): The vehicle engine's displacement (cm3).
336
+
337
+ ```rb
338
+ puts result.document.inference.prediction.p1.value
339
+ ```
340
+
341
+ ## p2
342
+ **p2** ([StringField](#string-field)): The vehicle's maximum net power (kW).
343
+
344
+ ```rb
345
+ puts result.document.inference.prediction.p2.value
346
+ ```
347
+
348
+ ## p3
349
+ **p3** ([StringField](#string-field)): The vehicle's fuel type or energy source.
350
+
351
+ ```rb
352
+ puts result.document.inference.prediction.p3.value
353
+ ```
354
+
355
+ ## p6
356
+ **p6** ([StringField](#string-field)): The vehicle's administrative power (fiscal horsepower).
357
+
358
+ ```rb
359
+ puts result.document.inference.prediction.p6.value
360
+ ```
361
+
362
+ ## q
363
+ **q** ([StringField](#string-field)): The vehicle's power to weight ratio.
364
+
365
+ ```rb
366
+ puts result.document.inference.prediction.q.value
367
+ ```
368
+
369
+ ## s1
370
+ **s1** ([StringField](#string-field)): The vehicle's number of seats.
371
+
372
+ ```rb
373
+ puts result.document.inference.prediction.s1.value
374
+ ```
375
+
376
+ ## s2
377
+ **s2** ([StringField](#string-field)): The vehicle's number of standing rooms (person).
378
+
379
+ ```rb
380
+ puts result.document.inference.prediction.s2.value
381
+ ```
382
+
383
+ ## u1
384
+ **u1** ([StringField](#string-field)): The vehicle's sound level (dB).
385
+
386
+ ```rb
387
+ puts result.document.inference.prediction.u1.value
388
+ ```
389
+
390
+ ## u2
391
+ **u2** ([StringField](#string-field)): The vehicle engine's rotation speed (RPM).
392
+
393
+ ```rb
394
+ puts result.document.inference.prediction.u2.value
395
+ ```
396
+
397
+ ## v7
398
+ **v7** ([StringField](#string-field)): The vehicle's CO2 emission (g/km).
399
+
400
+ ```rb
401
+ puts result.document.inference.prediction.v7.value
402
+ ```
403
+
404
+ ## x1
405
+ **x1** ([StringField](#string-field)): Next technical control date.
406
+
407
+ ```rb
408
+ puts result.document.inference.prediction.x1.value
409
+ ```
410
+
411
+ ## y1
412
+ **y1** ([StringField](#string-field)): Amount of the regional proportional tax of the registration (in euros).
413
+
414
+ ```rb
415
+ puts result.document.inference.prediction.y1.value
416
+ ```
417
+
418
+ ## y2
419
+ **y2** ([StringField](#string-field)): Amount of the additional parafiscal tax of the registration (in euros).
420
+
421
+ ```rb
422
+ puts result.document.inference.prediction.y2.value
423
+ ```
424
+
425
+ ## y3
426
+ **y3** ([StringField](#string-field)): Amount of the additional CO2 tax of the registration (in euros).
427
+
428
+ ```rb
429
+ puts result.document.inference.prediction.y3.value
430
+ ```
431
+
432
+ ## y4
433
+ **y4** ([StringField](#string-field)): Amount of the fee for managing the registration (in euros).
434
+
435
+ ```rb
436
+ puts result.document.inference.prediction.y4.value
437
+ ```
438
+
439
+ ## y5
440
+ **y5** ([StringField](#string-field)): Amount of the fee for delivery of the registration certificate in euros.
441
+
442
+ ```rb
443
+ puts result.document.inference.prediction.y5.value
444
+ ```
445
+
446
+ ## y6
447
+ **y6** ([StringField](#string-field)): Total amount of registration fee to be paid in euros.
448
+
449
+ ```rb
450
+ puts result.document.inference.prediction.y6.value
451
+ ```
452
+
453
+ # Questions?
454
+ [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
@@ -0,0 +1,123 @@
1
+ ---
2
+ title: FR Carte Vitale OCR Ruby
3
+ ---
4
+ The Ruby OCR SDK supports the [Carte Vitale API](https://platform.mindee.com/mindee/carte_vitale).
5
+
6
+ Using the [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/carte_vitale/default_sample.jpg), we are going to illustrate how to extract the data that we want using the OCR SDK.
7
+ ![Carte Vitale sample](https://github.com/mindee/client-lib-test-data/blob/main/products/carte_vitale/default_sample.jpg?raw=true)
8
+
9
+ # Quick-Start
10
+ ```rb
11
+ require 'mindee'
12
+
13
+ # Init a new client
14
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
15
+
16
+ # Load a file from disk
17
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
18
+
19
+ # Parse the file
20
+ result = mindee_client.parse(
21
+ input_source,
22
+ Mindee::Product::FR::CarteVitale::CarteVitaleV1
23
+ )
24
+
25
+ # Print a full summary of the parsed data in RST format
26
+ puts result.document
27
+
28
+ # Print the document-level parsed data
29
+ # puts result.document.inference.prediction
30
+ ```
31
+
32
+ **Output (RST):**
33
+ ```rst
34
+ ########
35
+ Document
36
+ ########
37
+ :Mindee ID: 8c25cc63-212b-4537-9c9b-3fbd3bd0ee20
38
+ :Filename: default_sample.jpg
39
+
40
+ Inference
41
+ #########
42
+ :Product: mindee/carte_vitale v1.0
43
+ :Rotation applied: Yes
44
+
45
+ Prediction
46
+ ==========
47
+ :Given Name(s): NATHALIE
48
+ :Surname: DURAND
49
+ :Social Security Number: 269054958815780
50
+ :Issuance Date: 2007-01-01
51
+
52
+ Page Predictions
53
+ ================
54
+
55
+ Page 0
56
+ ------
57
+ :Given Name(s): NATHALIE
58
+ :Surname: DURAND
59
+ :Social Security Number: 269054958815780
60
+ :Issuance Date: 2007-01-01
61
+ ```
62
+
63
+ # Field Types
64
+ ## Standard Fields
65
+ These fields are generic and used in several products.
66
+
67
+ ### Basic Field
68
+ Each prediction object contains a set of fields that inherit from the generic `Field` class.
69
+ A typical `Field` object will have the following attributes:
70
+
71
+ * **value** (`String`, `Float`, `Integer`, `Boolean`): corresponds to the field value. Can be `nil` if no value was extracted.
72
+ * **confidence** (Float, nil): the confidence score of the field prediction.
73
+ * **bounding_box** (`Mindee::Geometry::Quadrilateral`, `nil`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
74
+ * **polygon** (`Mindee::Geometry::Polygon`, `nil`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
75
+ * **page_id** (`Integer`, `nil`): the ID of the page, is `nil` when at document-level.
76
+ * **reconstructed** (`Boolean`): indicates whether or not an object was reconstructed (not extracted as the API gave it).
77
+
78
+
79
+ 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.
80
+
81
+ ### Date Field
82
+ Aside from the basic `Field` attributes, the date field `DateField` also implements the following:
83
+
84
+ * **date_object** (`Date`): an accessible representation of the value as a JavaScript object.
85
+
86
+ ### String Field
87
+ The text field `StringField` only has one constraint: it's **value** is a `String` (or `nil`).
88
+
89
+ # Attributes
90
+ The following fields are extracted for Carte Vitale V1:
91
+
92
+ ## Given Name(s)
93
+ **given_names** (Array<[StringField](#string-field)>): The given name(s) of the card holder.
94
+
95
+ ```rb
96
+ for given_names_elem in result.document.inference.prediction.given_names do
97
+ puts given_names_elem.value
98
+ end
99
+ ```
100
+
101
+ ## Issuance Date
102
+ **issuance_date** ([DateField](#date-field)): The date the card was issued.
103
+
104
+ ```rb
105
+ puts result.document.inference.prediction.issuance_date.value
106
+ ```
107
+
108
+ ## Social Security Number
109
+ **social_security** ([StringField](#string-field)): The Social Security Number (Numéro de Sécurité Sociale) of the card holder
110
+
111
+ ```rb
112
+ puts result.document.inference.prediction.social_security.value
113
+ ```
114
+
115
+ ## Surname
116
+ **surname** ([StringField](#string-field)): The surname of the card holder.
117
+
118
+ ```rb
119
+ puts result.document.inference.prediction.surname.value
120
+ ```
121
+
122
+ # Questions?
123
+ [Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-1jv6nawjq-FDgFcF2T5CmMmRpl9LLptw)
@@ -0,0 +1,19 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk
7
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
8
+
9
+ # Parse the file
10
+ result = mindee_client.parse(
11
+ input_source,
12
+ Mindee::Product::BarcodeReader::BarcodeReaderV1
13
+ )
14
+
15
+ # Print a full summary of the parsed data in RST format
16
+ puts result.document
17
+
18
+ # Print the document-level parsed data
19
+ # puts result.document.inference.prediction
@@ -0,0 +1,19 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk
7
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
8
+
9
+ # Parse the file
10
+ result = mindee_client.parse(
11
+ input_source,
12
+ Mindee::Product::FR::CarteGrise::CarteGriseV1
13
+ )
14
+
15
+ # Print a full summary of the parsed data in RST format
16
+ puts result.document
17
+
18
+ # Print the document-level parsed data
19
+ # puts result.document.inference.prediction
@@ -0,0 +1,16 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk
7
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
8
+
9
+ # Parse the file
10
+ result = mindee_client.parse(
11
+ input_source,
12
+ Mindee::Product::Cropper::CropperV1
13
+ )
14
+
15
+ # Print a full summary of the parsed data in RST format
16
+ puts result.document
@@ -0,0 +1,19 @@
1
+ require 'mindee'
2
+
3
+ # Init a new client
4
+ mindee_client = Mindee::Client.new(api_key: 'my-api-key')
5
+
6
+ # Load a file from disk
7
+ input_source = mindee_client.source_from_path('/path/to/the/file.ext')
8
+
9
+ # Parse the file
10
+ result = mindee_client.parse(
11
+ input_source,
12
+ Mindee::Product::FR::IdCard::IdCardV2
13
+ )
14
+
15
+ # Print a full summary of the parsed data in RST format
16
+ puts result.document
17
+
18
+ # Print the document-level parsed data
19
+ # puts result.document.inference.prediction