mindee 3.1.0 → 3.2.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 +21 -0
- data/README.md +57 -7
- data/bin/mindee.rb +160 -83
- data/docs/bank_account_details_v2.md +137 -0
- data/docs/bank_check_v1.md +179 -0
- data/docs/barcode_reader_v1.md +104 -0
- data/docs/carte_vitale_v1.md +123 -0
- data/docs/code_samples/barcode_reader_v1.txt +19 -0
- data/docs/code_samples/cropper_v1.txt +16 -0
- data/docs/code_samples/idcard_fr_v2.txt +19 -0
- data/docs/code_samples/invoice_splitter_v1_async.txt +6 -54
- data/docs/code_samples/multi_receipts_detector_v1.txt +19 -0
- data/docs/code_samples/us_w9_v1.txt +16 -0
- data/docs/cropper_v1.md +97 -0
- data/docs/custom_v1.md +101 -0
- data/docs/expense_receipts_v5.md +306 -0
- data/docs/financial_document_v1.md +384 -0
- data/docs/{ruby-getting-started.md → getting_started.md} +22 -6
- data/docs/idcard_fr_v2.md +253 -0
- data/docs/invoice_splitter_v1.md +85 -0
- data/docs/invoices_v4.md +369 -0
- data/docs/license_plates_v1.md +91 -0
- data/docs/multi_receipts_detector_v1.md +105 -0
- data/docs/passport_v1.md +186 -0
- data/docs/proof_of_address_v1.md +207 -0
- data/docs/us_driver_license_v1.md +268 -0
- data/docs/us_w9_v1.md +207 -0
- data/lib/mindee/client.rb +95 -16
- data/lib/mindee/geometry/quadrilateral.rb +5 -0
- data/lib/mindee/http/.rubocop.yml +8 -0
- data/lib/mindee/http/endpoint.rb +14 -6
- data/lib/mindee/http/error.rb +104 -0
- data/lib/mindee/http.rb +1 -0
- data/lib/mindee/input/sources.rb +84 -15
- data/lib/mindee/parsing/common/api_response.rb +11 -1
- data/lib/mindee/parsing/common/inference.rb +2 -2
- data/lib/mindee/parsing/common/ocr/ocr.rb +1 -0
- data/lib/mindee/parsing/common.rb +0 -1
- data/lib/mindee/parsing/standard/company_registration_field.rb +1 -1
- data/lib/mindee/parsing/standard/locale_field.rb +1 -1
- data/lib/mindee/parsing/standard/payment_details_field.rb +1 -1
- data/lib/mindee/parsing/standard/position_field.rb +10 -3
- data/lib/mindee/parsing/standard/{text_field.rb → string_field.rb} +1 -1
- data/lib/mindee/parsing/standard.rb +1 -1
- data/lib/mindee/pdf/pdf_processing.rb +2 -1
- data/lib/mindee/product/barcode_reader/barcode_reader_v1.rb +37 -0
- data/lib/mindee/product/barcode_reader/barcode_reader_v1_document.rb +44 -0
- data/lib/mindee/product/barcode_reader/barcode_reader_v1_page.rb +32 -0
- data/lib/mindee/product/cropper/cropper_v1.rb +37 -0
- data/lib/mindee/product/cropper/cropper_v1_document.rb +13 -0
- data/lib/mindee/product/cropper/cropper_v1_page.rb +49 -0
- data/lib/mindee/product/custom/custom_v1.rb +1 -0
- data/lib/mindee/product/eu/license_plate/license_plate_v1.rb +1 -0
- data/lib/mindee/product/eu/license_plate/license_plate_v1_document.rb +2 -2
- data/lib/mindee/product/financial_document/financial_document_v1.rb +1 -0
- data/lib/mindee/product/financial_document/financial_document_v1_document.rb +24 -24
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1.rb +1 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v1_document.rb +6 -6
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2.rb +1 -0
- data/lib/mindee/product/fr/bank_account_details/bank_account_details_v2_document.rb +6 -6
- data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1.rb +1 -0
- data/lib/mindee/product/fr/carte_vitale/carte_vitale_v1_document.rb +6 -6
- data/lib/mindee/product/fr/id_card/id_card_v1.rb +1 -0
- data/lib/mindee/product/fr/id_card/id_card_v1_document.rb +16 -16
- data/lib/mindee/product/fr/id_card/id_card_v2.rb +39 -0
- data/lib/mindee/product/fr/id_card/id_card_v2_document.rb +107 -0
- data/lib/mindee/product/fr/id_card/id_card_v2_page.rb +53 -0
- data/lib/mindee/product/invoice/invoice_v4.rb +1 -0
- data/lib/mindee/product/invoice/invoice_v4_document.rb +24 -24
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1.rb +1 -0
- data/lib/mindee/product/invoice_splitter/invoice_splitter_v1_document.rb +5 -3
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1.rb +37 -0
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_document.rb +35 -0
- data/lib/mindee/product/multi_receipts_detector/multi_receipts_detector_v1_page.rb +32 -0
- data/lib/mindee/product/passport/passport_v1.rb +1 -0
- data/lib/mindee/product/passport/passport_v1_document.rb +16 -16
- data/lib/mindee/product/proof_of_address/proof_of_address_v1.rb +1 -0
- data/lib/mindee/product/proof_of_address/proof_of_address_v1_document.rb +14 -14
- data/lib/mindee/product/receipt/receipt_v4_document.rb +6 -6
- data/lib/mindee/product/receipt/receipt_v5.rb +1 -0
- data/lib/mindee/product/receipt/receipt_v5_document.rb +12 -12
- data/lib/mindee/product/us/bank_check/bank_check_v1.rb +1 -0
- data/lib/mindee/product/us/bank_check/bank_check_v1_document.rb +8 -8
- data/lib/mindee/product/us/driver_license/driver_license_v1.rb +1 -0
- data/lib/mindee/product/us/driver_license/driver_license_v1_document.rb +28 -28
- data/lib/mindee/product/us/w9/w9_v1.rb +39 -0
- data/lib/mindee/product/us/w9/w9_v1_document.rb +15 -0
- data/lib/mindee/product/us/w9/w9_v1_page.rb +102 -0
- data/lib/mindee/product.rb +5 -0
- data/lib/mindee/version.rb +5 -1
- data/lib/mindee.rb +47 -0
- metadata +43 -9
- data/docs/ruby-api-builder.md +0 -123
- data/docs/ruby-invoice-ocr.md +0 -271
- data/docs/ruby-passport-ocr.md +0 -165
- data/docs/ruby-receipt-ocr.md +0 -196
- data/lib/mindee/parsing/common/error.rb +0 -24
|
@@ -13,13 +13,13 @@ module Mindee
|
|
|
13
13
|
# @return [Mindee::Parsing::Standard::ClassificationField]
|
|
14
14
|
attr_reader :category
|
|
15
15
|
# The address of the customer.
|
|
16
|
-
# @return [Mindee::Parsing::Standard::
|
|
16
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
17
17
|
attr_reader :customer_address
|
|
18
18
|
# List of company registrations associated to the customer.
|
|
19
|
-
# @return [Array<Mindee::Parsing::Standard::
|
|
19
|
+
# @return [Array<Mindee::Parsing::Standard::CompanyRegistrationField>]
|
|
20
20
|
attr_reader :customer_company_registrations
|
|
21
21
|
# The name of the customer.
|
|
22
|
-
# @return [Mindee::Parsing::Standard::
|
|
22
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
23
23
|
attr_reader :customer_name
|
|
24
24
|
# The date the purchase was made.
|
|
25
25
|
# @return [Mindee::Parsing::Standard::DateField]
|
|
@@ -31,40 +31,40 @@ module Mindee
|
|
|
31
31
|
# @return [Mindee::Parsing::Standard::DateField]
|
|
32
32
|
attr_reader :due_date
|
|
33
33
|
# The invoice number or identifier.
|
|
34
|
-
# @return [Mindee::Parsing::Standard::
|
|
34
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
35
35
|
attr_reader :invoice_number
|
|
36
36
|
# List of line item details.
|
|
37
37
|
# @return [Array<Mindee::Product::FinancialDocument::FinancialDocumentV1LineItem>]
|
|
38
38
|
attr_reader :line_items
|
|
39
39
|
# The locale detected on the document.
|
|
40
|
-
# @return [Mindee::Parsing::Standard::
|
|
40
|
+
# @return [Mindee::Parsing::Standard::LocaleField]
|
|
41
41
|
attr_reader :locale
|
|
42
42
|
# List of Reference numbers, including PO number.
|
|
43
|
-
# @return [Array<Mindee::Parsing::Standard::
|
|
43
|
+
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
|
44
44
|
attr_reader :reference_numbers
|
|
45
45
|
# The purchase subcategory among predefined classes for transport and food.
|
|
46
46
|
# @return [Mindee::Parsing::Standard::ClassificationField]
|
|
47
47
|
attr_reader :subcategory
|
|
48
48
|
# The address of the supplier or merchant.
|
|
49
|
-
# @return [Mindee::Parsing::Standard::
|
|
49
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
50
50
|
attr_reader :supplier_address
|
|
51
51
|
# List of company registrations associated to the supplier.
|
|
52
|
-
# @return [Array<Mindee::Parsing::Standard::
|
|
52
|
+
# @return [Array<Mindee::Parsing::Standard::CompanyRegistrationField>]
|
|
53
53
|
attr_reader :supplier_company_registrations
|
|
54
54
|
# The name of the supplier or merchant.
|
|
55
|
-
# @return [Mindee::Parsing::Standard::
|
|
55
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
56
56
|
attr_reader :supplier_name
|
|
57
57
|
# List of payment details associated to the supplier.
|
|
58
|
-
# @return [Array<Mindee::Parsing::Standard::
|
|
58
|
+
# @return [Array<Mindee::Parsing::Standard::PaymentDetailsField>]
|
|
59
59
|
attr_reader :supplier_payment_details
|
|
60
60
|
# The phone number of the supplier or merchant.
|
|
61
|
-
# @return [Mindee::Parsing::Standard::
|
|
61
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
62
62
|
attr_reader :supplier_phone_number
|
|
63
63
|
# List of tax lines information.
|
|
64
64
|
# @return [Mindee::Parsing::Standard::Taxes]
|
|
65
65
|
attr_reader :taxes
|
|
66
66
|
# The time the purchase was made.
|
|
67
|
-
# @return [Mindee::Parsing::Standard::
|
|
67
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
68
68
|
attr_reader :time
|
|
69
69
|
# The total amount of tip and gratuity
|
|
70
70
|
# @return [Mindee::Parsing::Standard::AmountField]
|
|
@@ -84,39 +84,39 @@ module Mindee
|
|
|
84
84
|
def initialize(prediction, page_id)
|
|
85
85
|
super()
|
|
86
86
|
@category = ClassificationField.new(prediction['category'], page_id)
|
|
87
|
-
@customer_address =
|
|
87
|
+
@customer_address = StringField.new(prediction['customer_address'], page_id)
|
|
88
88
|
@customer_company_registrations = []
|
|
89
89
|
prediction['customer_company_registrations'].each do |item|
|
|
90
|
-
@customer_company_registrations.push(
|
|
90
|
+
@customer_company_registrations.push(CompanyRegistrationField.new(item, page_id))
|
|
91
91
|
end
|
|
92
|
-
@customer_name =
|
|
92
|
+
@customer_name = StringField.new(prediction['customer_name'], page_id)
|
|
93
93
|
@date = DateField.new(prediction['date'], page_id)
|
|
94
94
|
@document_type = ClassificationField.new(prediction['document_type'], page_id)
|
|
95
95
|
@due_date = DateField.new(prediction['due_date'], page_id)
|
|
96
|
-
@invoice_number =
|
|
96
|
+
@invoice_number = StringField.new(prediction['invoice_number'], page_id)
|
|
97
97
|
@line_items = []
|
|
98
98
|
prediction['line_items'].each do |item|
|
|
99
99
|
@line_items.push(FinancialDocumentV1LineItem.new(item, page_id))
|
|
100
100
|
end
|
|
101
|
-
@locale =
|
|
101
|
+
@locale = LocaleField.new(prediction['locale'], page_id)
|
|
102
102
|
@reference_numbers = []
|
|
103
103
|
prediction['reference_numbers'].each do |item|
|
|
104
|
-
@reference_numbers.push(
|
|
104
|
+
@reference_numbers.push(StringField.new(item, page_id))
|
|
105
105
|
end
|
|
106
106
|
@subcategory = ClassificationField.new(prediction['subcategory'], page_id)
|
|
107
|
-
@supplier_address =
|
|
107
|
+
@supplier_address = StringField.new(prediction['supplier_address'], page_id)
|
|
108
108
|
@supplier_company_registrations = []
|
|
109
109
|
prediction['supplier_company_registrations'].each do |item|
|
|
110
|
-
@supplier_company_registrations.push(
|
|
110
|
+
@supplier_company_registrations.push(CompanyRegistrationField.new(item, page_id))
|
|
111
111
|
end
|
|
112
|
-
@supplier_name =
|
|
112
|
+
@supplier_name = StringField.new(prediction['supplier_name'], page_id)
|
|
113
113
|
@supplier_payment_details = []
|
|
114
114
|
prediction['supplier_payment_details'].each do |item|
|
|
115
|
-
@supplier_payment_details.push(
|
|
115
|
+
@supplier_payment_details.push(PaymentDetailsField.new(item, page_id))
|
|
116
116
|
end
|
|
117
|
-
@supplier_phone_number =
|
|
117
|
+
@supplier_phone_number = StringField.new(prediction['supplier_phone_number'], page_id)
|
|
118
118
|
@taxes = Taxes.new(prediction['taxes'], page_id)
|
|
119
|
-
@time =
|
|
119
|
+
@time = StringField.new(prediction['time'], page_id)
|
|
120
120
|
@tip = AmountField.new(prediction['tip'], page_id)
|
|
121
121
|
@total_amount = AmountField.new(prediction['total_amount'], page_id)
|
|
122
122
|
@total_net = AmountField.new(prediction['total_net'], page_id)
|
|
@@ -7,6 +7,7 @@ require_relative 'bank_account_details_v1_page'
|
|
|
7
7
|
module Mindee
|
|
8
8
|
module Product
|
|
9
9
|
module FR
|
|
10
|
+
# Bank Account Details module.
|
|
10
11
|
module BankAccountDetails
|
|
11
12
|
# Bank Account Details V1 prediction inference.
|
|
12
13
|
class BankAccountDetailsV1 < Mindee::Parsing::Common::Inference
|
|
@@ -10,22 +10,22 @@ module Mindee
|
|
|
10
10
|
class BankAccountDetailsV1Document < Mindee::Parsing::Common::Prediction
|
|
11
11
|
include Mindee::Parsing::Standard
|
|
12
12
|
# The name of the account holder as seen on the document.
|
|
13
|
-
# @return [Mindee::Parsing::Standard::
|
|
13
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
14
14
|
attr_reader :account_holder_name
|
|
15
15
|
# The International Bank Account Number (IBAN).
|
|
16
|
-
# @return [Mindee::Parsing::Standard::
|
|
16
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
17
17
|
attr_reader :iban
|
|
18
18
|
# The bank's SWIFT Business Identifier Code (BIC).
|
|
19
|
-
# @return [Mindee::Parsing::Standard::
|
|
19
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
20
20
|
attr_reader :swift
|
|
21
21
|
|
|
22
22
|
# @param prediction [Hash]
|
|
23
23
|
# @param page_id [Integer, nil]
|
|
24
24
|
def initialize(prediction, page_id)
|
|
25
25
|
super()
|
|
26
|
-
@account_holder_name =
|
|
27
|
-
@iban =
|
|
28
|
-
@swift =
|
|
26
|
+
@account_holder_name = StringField.new(prediction['account_holder_name'], page_id)
|
|
27
|
+
@iban = StringField.new(prediction['iban'], page_id)
|
|
28
|
+
@swift = StringField.new(prediction['swift'], page_id)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
# @return [String]
|
|
@@ -7,6 +7,7 @@ require_relative 'bank_account_details_v2_page'
|
|
|
7
7
|
module Mindee
|
|
8
8
|
module Product
|
|
9
9
|
module FR
|
|
10
|
+
# Bank Account Details module.
|
|
10
11
|
module BankAccountDetails
|
|
11
12
|
# Bank Account Details V2 prediction inference.
|
|
12
13
|
class BankAccountDetailsV2 < Mindee::Parsing::Common::Inference
|
|
@@ -11,26 +11,26 @@ module Mindee
|
|
|
11
11
|
class BankAccountDetailsV2Document < Mindee::Parsing::Common::Prediction
|
|
12
12
|
include Mindee::Parsing::Standard
|
|
13
13
|
# Full extraction of the account holders names.
|
|
14
|
-
# @return [Mindee::Parsing::Standard::
|
|
14
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
15
15
|
attr_reader :account_holders_names
|
|
16
16
|
# Full extraction of BBAN, including: branch code, bank code, account and key.
|
|
17
17
|
# @return [Mindee::Product::FR::BankAccountDetails::BankAccountDetailsV2Bban]
|
|
18
18
|
attr_reader :bban
|
|
19
19
|
# Full extraction of the IBAN number.
|
|
20
|
-
# @return [Mindee::Parsing::Standard::
|
|
20
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
21
21
|
attr_reader :iban
|
|
22
22
|
# Full extraction of the SWIFT code.
|
|
23
|
-
# @return [Mindee::Parsing::Standard::
|
|
23
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
24
24
|
attr_reader :swift_code
|
|
25
25
|
|
|
26
26
|
# @param prediction [Hash]
|
|
27
27
|
# @param page_id [Integer, nil]
|
|
28
28
|
def initialize(prediction, page_id)
|
|
29
29
|
super()
|
|
30
|
-
@account_holders_names =
|
|
30
|
+
@account_holders_names = StringField.new(prediction['account_holders_names'], page_id)
|
|
31
31
|
@bban = BankAccountDetailsV2Bban.new(prediction['bban'], page_id)
|
|
32
|
-
@iban =
|
|
33
|
-
@swift_code =
|
|
32
|
+
@iban = StringField.new(prediction['iban'], page_id)
|
|
33
|
+
@swift_code = StringField.new(prediction['swift_code'], page_id)
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# @return [String]
|
|
@@ -10,16 +10,16 @@ module Mindee
|
|
|
10
10
|
class CarteVitaleV1Document < Mindee::Parsing::Common::Prediction
|
|
11
11
|
include Mindee::Parsing::Standard
|
|
12
12
|
# The given name(s) of the card holder.
|
|
13
|
-
# @return [Array<Mindee::Parsing::Standard::
|
|
13
|
+
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
|
14
14
|
attr_reader :given_names
|
|
15
15
|
# The date the card was issued.
|
|
16
16
|
# @return [Mindee::Parsing::Standard::DateField]
|
|
17
17
|
attr_reader :issuance_date
|
|
18
18
|
# The Social Security Number (Numéro de Sécurité Sociale) of the card holder
|
|
19
|
-
# @return [Mindee::Parsing::Standard::
|
|
19
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
20
20
|
attr_reader :social_security
|
|
21
21
|
# The surname of the card holder.
|
|
22
|
-
# @return [Mindee::Parsing::Standard::
|
|
22
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
23
23
|
attr_reader :surname
|
|
24
24
|
|
|
25
25
|
# @param prediction [Hash]
|
|
@@ -28,11 +28,11 @@ module Mindee
|
|
|
28
28
|
super()
|
|
29
29
|
@given_names = []
|
|
30
30
|
prediction['given_names'].each do |item|
|
|
31
|
-
@given_names.push(
|
|
31
|
+
@given_names.push(StringField.new(item, page_id))
|
|
32
32
|
end
|
|
33
33
|
@issuance_date = DateField.new(prediction['issuance_date'], page_id)
|
|
34
|
-
@social_security =
|
|
35
|
-
@surname =
|
|
34
|
+
@social_security = StringField.new(prediction['social_security'], page_id)
|
|
35
|
+
@surname = StringField.new(prediction['surname'], page_id)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
# @return [String]
|
|
@@ -10,53 +10,53 @@ module Mindee
|
|
|
10
10
|
class IdCardV1Document < Mindee::Parsing::Common::Prediction
|
|
11
11
|
include Mindee::Parsing::Standard
|
|
12
12
|
# The name of the issuing authority.
|
|
13
|
-
# @return [Mindee::Parsing::Standard::
|
|
13
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
14
14
|
attr_reader :authority
|
|
15
15
|
# The date of birth of the card holder.
|
|
16
16
|
# @return [Mindee::Parsing::Standard::DateField]
|
|
17
17
|
attr_reader :birth_date
|
|
18
18
|
# The place of birth of the card holder.
|
|
19
|
-
# @return [Mindee::Parsing::Standard::
|
|
19
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
20
20
|
attr_reader :birth_place
|
|
21
21
|
# The expiry date of the identification card.
|
|
22
22
|
# @return [Mindee::Parsing::Standard::DateField]
|
|
23
23
|
attr_reader :expiry_date
|
|
24
24
|
# The gender of the card holder.
|
|
25
|
-
# @return [Mindee::Parsing::Standard::
|
|
25
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
26
26
|
attr_reader :gender
|
|
27
27
|
# The given name(s) of the card holder.
|
|
28
|
-
# @return [Array<Mindee::Parsing::Standard::
|
|
28
|
+
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
|
29
29
|
attr_reader :given_names
|
|
30
30
|
# The identification card number.
|
|
31
|
-
# @return [Mindee::Parsing::Standard::
|
|
31
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
32
32
|
attr_reader :id_number
|
|
33
33
|
# Machine Readable Zone, first line
|
|
34
|
-
# @return [Mindee::Parsing::Standard::
|
|
34
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
35
35
|
attr_reader :mrz1
|
|
36
36
|
# Machine Readable Zone, second line
|
|
37
|
-
# @return [Mindee::Parsing::Standard::
|
|
37
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
38
38
|
attr_reader :mrz2
|
|
39
39
|
# The surname of the card holder.
|
|
40
|
-
# @return [Mindee::Parsing::Standard::
|
|
40
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
41
41
|
attr_reader :surname
|
|
42
42
|
|
|
43
43
|
# @param prediction [Hash]
|
|
44
44
|
# @param page_id [Integer, nil]
|
|
45
45
|
def initialize(prediction, page_id)
|
|
46
46
|
super()
|
|
47
|
-
@authority =
|
|
47
|
+
@authority = StringField.new(prediction['authority'], page_id)
|
|
48
48
|
@birth_date = DateField.new(prediction['birth_date'], page_id)
|
|
49
|
-
@birth_place =
|
|
49
|
+
@birth_place = StringField.new(prediction['birth_place'], page_id)
|
|
50
50
|
@expiry_date = DateField.new(prediction['expiry_date'], page_id)
|
|
51
|
-
@gender =
|
|
51
|
+
@gender = StringField.new(prediction['gender'], page_id)
|
|
52
52
|
@given_names = []
|
|
53
53
|
prediction['given_names'].each do |item|
|
|
54
|
-
@given_names.push(
|
|
54
|
+
@given_names.push(StringField.new(item, page_id))
|
|
55
55
|
end
|
|
56
|
-
@id_number =
|
|
57
|
-
@mrz1 =
|
|
58
|
-
@mrz2 =
|
|
59
|
-
@surname =
|
|
56
|
+
@id_number = StringField.new(prediction['id_number'], page_id)
|
|
57
|
+
@mrz1 = StringField.new(prediction['mrz1'], page_id)
|
|
58
|
+
@mrz2 = StringField.new(prediction['mrz2'], page_id)
|
|
59
|
+
@surname = StringField.new(prediction['surname'], page_id)
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
# @return [String]
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../../../parsing'
|
|
4
|
+
require_relative 'id_card_v2_document'
|
|
5
|
+
require_relative 'id_card_v2_page'
|
|
6
|
+
|
|
7
|
+
module Mindee
|
|
8
|
+
module Product
|
|
9
|
+
module FR
|
|
10
|
+
# Carte Nationale d'Identité module.
|
|
11
|
+
module IdCard
|
|
12
|
+
# Carte Nationale d'Identité V2 prediction inference.
|
|
13
|
+
class IdCardV2 < Mindee::Parsing::Common::Inference
|
|
14
|
+
@endpoint_name = 'idcard_fr'
|
|
15
|
+
@endpoint_version = '2'
|
|
16
|
+
|
|
17
|
+
# @param prediction [Hash]
|
|
18
|
+
def initialize(prediction)
|
|
19
|
+
super
|
|
20
|
+
@prediction = IdCardV2Document.new(prediction['prediction'], nil)
|
|
21
|
+
@pages = []
|
|
22
|
+
prediction['pages'].each do |page|
|
|
23
|
+
@pages.push(IdCardV2Page.new(page))
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class << self
|
|
28
|
+
# Name of the endpoint for this product.
|
|
29
|
+
# @return [String]
|
|
30
|
+
attr_reader :endpoint_name
|
|
31
|
+
# Version for this product.
|
|
32
|
+
# @return [String]
|
|
33
|
+
attr_reader :endpoint_version
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../../../parsing'
|
|
4
|
+
|
|
5
|
+
module Mindee
|
|
6
|
+
module Product
|
|
7
|
+
module FR
|
|
8
|
+
module IdCard
|
|
9
|
+
# Carte Nationale d'Identité V2 document prediction.
|
|
10
|
+
class IdCardV2Document < Mindee::Parsing::Common::Prediction
|
|
11
|
+
include Mindee::Parsing::Standard
|
|
12
|
+
# The alternate name of the card holder.
|
|
13
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
14
|
+
attr_reader :alternate_name
|
|
15
|
+
# The name of the issuing authority.
|
|
16
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
17
|
+
attr_reader :authority
|
|
18
|
+
# The date of birth of the card holder.
|
|
19
|
+
# @return [Mindee::Parsing::Standard::DateField]
|
|
20
|
+
attr_reader :birth_date
|
|
21
|
+
# The place of birth of the card holder.
|
|
22
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
23
|
+
attr_reader :birth_place
|
|
24
|
+
# The card access number (CAN).
|
|
25
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
26
|
+
attr_reader :card_access_number
|
|
27
|
+
# The document number.
|
|
28
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
29
|
+
attr_reader :document_number
|
|
30
|
+
# The expiry date of the identification card.
|
|
31
|
+
# @return [Mindee::Parsing::Standard::DateField]
|
|
32
|
+
attr_reader :expiry_date
|
|
33
|
+
# The gender of the card holder.
|
|
34
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
35
|
+
attr_reader :gender
|
|
36
|
+
# The given name(s) of the card holder.
|
|
37
|
+
# @return [Array<Mindee::Parsing::Standard::StringField>]
|
|
38
|
+
attr_reader :given_names
|
|
39
|
+
# The date of issue of the identification card.
|
|
40
|
+
# @return [Mindee::Parsing::Standard::DateField]
|
|
41
|
+
attr_reader :issue_date
|
|
42
|
+
# The Machine Readable Zone, first line.
|
|
43
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
44
|
+
attr_reader :mrz1
|
|
45
|
+
# The Machine Readable Zone, second line.
|
|
46
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
47
|
+
attr_reader :mrz2
|
|
48
|
+
# The Machine Readable Zone, third line.
|
|
49
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
50
|
+
attr_reader :mrz3
|
|
51
|
+
# The nationality of the card holder.
|
|
52
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
53
|
+
attr_reader :nationality
|
|
54
|
+
# The surname of the card holder.
|
|
55
|
+
# @return [Mindee::Parsing::Standard::StringField]
|
|
56
|
+
attr_reader :surname
|
|
57
|
+
|
|
58
|
+
# @param prediction [Hash]
|
|
59
|
+
# @param page_id [Integer, nil]
|
|
60
|
+
def initialize(prediction, page_id)
|
|
61
|
+
super()
|
|
62
|
+
@alternate_name = StringField.new(prediction['alternate_name'], page_id)
|
|
63
|
+
@authority = StringField.new(prediction['authority'], page_id)
|
|
64
|
+
@birth_date = DateField.new(prediction['birth_date'], page_id)
|
|
65
|
+
@birth_place = StringField.new(prediction['birth_place'], page_id)
|
|
66
|
+
@card_access_number = StringField.new(prediction['card_access_number'], page_id)
|
|
67
|
+
@document_number = StringField.new(prediction['document_number'], page_id)
|
|
68
|
+
@expiry_date = DateField.new(prediction['expiry_date'], page_id)
|
|
69
|
+
@gender = StringField.new(prediction['gender'], page_id)
|
|
70
|
+
@given_names = []
|
|
71
|
+
prediction['given_names'].each do |item|
|
|
72
|
+
@given_names.push(StringField.new(item, page_id))
|
|
73
|
+
end
|
|
74
|
+
@issue_date = DateField.new(prediction['issue_date'], page_id)
|
|
75
|
+
@mrz1 = StringField.new(prediction['mrz1'], page_id)
|
|
76
|
+
@mrz2 = StringField.new(prediction['mrz2'], page_id)
|
|
77
|
+
@mrz3 = StringField.new(prediction['mrz3'], page_id)
|
|
78
|
+
@nationality = StringField.new(prediction['nationality'], page_id)
|
|
79
|
+
@surname = StringField.new(prediction['surname'], page_id)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# @return [String]
|
|
83
|
+
def to_s
|
|
84
|
+
given_names = @given_names.join("\n #{' ' * 15}")
|
|
85
|
+
out_str = String.new
|
|
86
|
+
out_str << "\n:Nationality: #{@nationality}".rstrip
|
|
87
|
+
out_str << "\n:Card Access Number: #{@card_access_number}".rstrip
|
|
88
|
+
out_str << "\n:Document Number: #{@document_number}".rstrip
|
|
89
|
+
out_str << "\n:Given Name(s): #{given_names}".rstrip
|
|
90
|
+
out_str << "\n:Surname: #{@surname}".rstrip
|
|
91
|
+
out_str << "\n:Alternate Name: #{@alternate_name}".rstrip
|
|
92
|
+
out_str << "\n:Date of Birth: #{@birth_date}".rstrip
|
|
93
|
+
out_str << "\n:Place of Birth: #{@birth_place}".rstrip
|
|
94
|
+
out_str << "\n:Gender: #{@gender}".rstrip
|
|
95
|
+
out_str << "\n:Expiry Date: #{@expiry_date}".rstrip
|
|
96
|
+
out_str << "\n:Mrz Line 1: #{@mrz1}".rstrip
|
|
97
|
+
out_str << "\n:Mrz Line 2: #{@mrz2}".rstrip
|
|
98
|
+
out_str << "\n:Mrz Line 3: #{@mrz3}".rstrip
|
|
99
|
+
out_str << "\n:Date of Issue: #{@issue_date}".rstrip
|
|
100
|
+
out_str << "\n:Issuing Authority: #{@authority}".rstrip
|
|
101
|
+
out_str[1..].to_s
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative '../../../parsing'
|
|
4
|
+
require_relative 'id_card_v2_document'
|
|
5
|
+
|
|
6
|
+
module Mindee
|
|
7
|
+
module Product
|
|
8
|
+
module FR
|
|
9
|
+
module IdCard
|
|
10
|
+
# Carte Nationale d'Identité V2 page.
|
|
11
|
+
class IdCardV2Page < Mindee::Parsing::Common::Page
|
|
12
|
+
# @param prediction [Hash]
|
|
13
|
+
def initialize(prediction)
|
|
14
|
+
super(prediction)
|
|
15
|
+
@prediction = IdCardV2PagePrediction.new(
|
|
16
|
+
prediction['prediction'],
|
|
17
|
+
prediction['id']
|
|
18
|
+
)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Carte Nationale d'Identité V2 page prediction.
|
|
23
|
+
class IdCardV2PagePrediction < IdCardV2Document
|
|
24
|
+
include Mindee::Parsing::Standard
|
|
25
|
+
|
|
26
|
+
# The sides of the document which are visible.
|
|
27
|
+
# @return [Mindee::Parsing::Standard::ClassificationField]
|
|
28
|
+
attr_reader :document_side
|
|
29
|
+
# The document type or format.
|
|
30
|
+
# @return [Mindee::Parsing::Standard::ClassificationField]
|
|
31
|
+
attr_reader :document_type
|
|
32
|
+
|
|
33
|
+
# @param prediction [Hash]
|
|
34
|
+
# @param page_id [Integer, nil]
|
|
35
|
+
def initialize(prediction, page_id)
|
|
36
|
+
@document_side = ClassificationField.new(prediction['document_side'], page_id)
|
|
37
|
+
@document_type = ClassificationField.new(prediction['document_type'], page_id)
|
|
38
|
+
super(prediction, page_id)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @return [String]
|
|
42
|
+
def to_s
|
|
43
|
+
out_str = String.new
|
|
44
|
+
out_str << "\n:Document Type: #{@document_type}".rstrip
|
|
45
|
+
out_str << "\n:Document Sides: #{@document_side}".rstrip
|
|
46
|
+
out_str << "\n#{super}"
|
|
47
|
+
out_str
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|