Class: Mindee::Product::InternationalId::InternationalIdV1Document
- Inherits:
-
Mindee::Parsing::Common::Prediction
- Object
- Mindee::Parsing::Common::Prediction
- Mindee::Product::InternationalId::InternationalIdV1Document
- Includes:
- Mindee::Parsing::Standard
- Defined in:
- lib/mindee/product/international_id/international_id_v1_document.rb
Overview
International ID V1 document prediction.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#address ⇒ Mindee::Parsing::Standard::StringField
readonly
The physical location of the document holder's residence.
-
#birth_date ⇒ Mindee::Parsing::Standard::DateField
readonly
The date of birth of the document holder.
-
#birth_place ⇒ Mindee::Parsing::Standard::StringField
readonly
The location where the document holder was born.
-
#country_of_issue ⇒ Mindee::Parsing::Standard::StringField
readonly
The country that issued the identification document.
-
#document_number ⇒ Mindee::Parsing::Standard::StringField
readonly
The unique identifier assigned to the identification document.
-
#document_type ⇒ Mindee::Parsing::Standard::ClassificationField
readonly
The type of identification document being used.
-
#expiry_date ⇒ Mindee::Parsing::Standard::DateField
readonly
The date when the document will no longer be valid for use.
-
#given_names ⇒ Array<Mindee::Parsing::Standard::StringField>
readonly
The first names or given names of the document holder.
-
#issue_date ⇒ Mindee::Parsing::Standard::DateField
readonly
The date when the document was issued.
-
#mrz1 ⇒ Mindee::Parsing::Standard::StringField
readonly
First line of information in a standardized format for easy machine reading and processing.
-
#mrz2 ⇒ Mindee::Parsing::Standard::StringField
readonly
Second line of information in a standardized format for easy machine reading and processing.
-
#mrz3 ⇒ Mindee::Parsing::Standard::StringField
readonly
Third line of information in a standardized format for easy machine reading and processing.
-
#nationality ⇒ Mindee::Parsing::Standard::StringField
readonly
Indicates the country of citizenship or nationality of the document holder.
-
#sex ⇒ Mindee::Parsing::Standard::StringField
readonly
The document holder's biological sex, such as male or female.
-
#surnames ⇒ Array<Mindee::Parsing::Standard::StringField>
readonly
The surnames of the document holder.
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ InternationalIdV1Document
constructor
A new instance of InternationalIdV1Document.
- #to_s ⇒ String
Constructor Details
#initialize(prediction, page_id) ⇒ InternationalIdV1Document
Returns a new instance of InternationalIdV1Document.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 59 def initialize(prediction, page_id) super() @address = StringField.new(prediction['address'], page_id) @birth_date = DateField.new(prediction['birth_date'], page_id) @birth_place = StringField.new(prediction['birth_place'], page_id) @country_of_issue = StringField.new(prediction['country_of_issue'], page_id) @document_number = StringField.new(prediction['document_number'], page_id) @document_type = ClassificationField.new(prediction['document_type'], page_id) @expiry_date = DateField.new(prediction['expiry_date'], page_id) @given_names = [] prediction['given_names'].each do |item| @given_names.push(StringField.new(item, page_id)) end @issue_date = DateField.new(prediction['issue_date'], page_id) @mrz1 = StringField.new(prediction['mrz1'], page_id) @mrz2 = StringField.new(prediction['mrz2'], page_id) @mrz3 = StringField.new(prediction['mrz3'], page_id) @nationality = StringField.new(prediction['nationality'], page_id) @sex = StringField.new(prediction['sex'], page_id) @surnames = [] prediction['surnames'].each do |item| @surnames.push(StringField.new(item, page_id)) end end |
Instance Attribute Details
#address ⇒ Mindee::Parsing::Standard::StringField (readonly)
The physical location of the document holder's residence.
13 14 15 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 13 def address @address end |
#birth_date ⇒ Mindee::Parsing::Standard::DateField (readonly)
The date of birth of the document holder.
16 17 18 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 16 def birth_date @birth_date end |
#birth_place ⇒ Mindee::Parsing::Standard::StringField (readonly)
The location where the document holder was born.
19 20 21 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 19 def birth_place @birth_place end |
#country_of_issue ⇒ Mindee::Parsing::Standard::StringField (readonly)
The country that issued the identification document.
22 23 24 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 22 def country_of_issue @country_of_issue end |
#document_number ⇒ Mindee::Parsing::Standard::StringField (readonly)
The unique identifier assigned to the identification document.
25 26 27 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 25 def document_number @document_number end |
#document_type ⇒ Mindee::Parsing::Standard::ClassificationField (readonly)
The type of identification document being used.
28 29 30 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 28 def document_type @document_type end |
#expiry_date ⇒ Mindee::Parsing::Standard::DateField (readonly)
The date when the document will no longer be valid for use.
31 32 33 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 31 def expiry_date @expiry_date end |
#given_names ⇒ Array<Mindee::Parsing::Standard::StringField> (readonly)
The first names or given names of the document holder.
34 35 36 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 34 def given_names @given_names end |
#issue_date ⇒ Mindee::Parsing::Standard::DateField (readonly)
The date when the document was issued.
37 38 39 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 37 def issue_date @issue_date end |
#mrz1 ⇒ Mindee::Parsing::Standard::StringField (readonly)
First line of information in a standardized format for easy machine reading and processing.
40 41 42 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 40 def mrz1 @mrz1 end |
#mrz2 ⇒ Mindee::Parsing::Standard::StringField (readonly)
Second line of information in a standardized format for easy machine reading and processing.
43 44 45 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 43 def mrz2 @mrz2 end |
#mrz3 ⇒ Mindee::Parsing::Standard::StringField (readonly)
Third line of information in a standardized format for easy machine reading and processing.
46 47 48 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 46 def mrz3 @mrz3 end |
#nationality ⇒ Mindee::Parsing::Standard::StringField (readonly)
Indicates the country of citizenship or nationality of the document holder.
49 50 51 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 49 def nationality @nationality end |
#sex ⇒ Mindee::Parsing::Standard::StringField (readonly)
The document holder's biological sex, such as male or female.
52 53 54 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 52 def sex @sex end |
#surnames ⇒ Array<Mindee::Parsing::Standard::StringField> (readonly)
The surnames of the document holder.
55 56 57 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 55 def surnames @surnames end |
Instance Method Details
#to_s ⇒ String
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/mindee/product/international_id/international_id_v1_document.rb', line 85 def to_s surnames = @surnames.join("\n #{' ' * 10}") given_names = @given_names.join("\n #{' ' * 13}") out_str = String.new out_str << "\n:Document Type: #{@document_type}".rstrip out_str << "\n:Document Number: #{@document_number}".rstrip out_str << "\n:Country of Issue: #{@country_of_issue}".rstrip out_str << "\n:Surnames: #{surnames}".rstrip out_str << "\n:Given Names: #{given_names}".rstrip out_str << "\n:Gender: #{@sex}".rstrip out_str << "\n:Birth date: #{@birth_date}".rstrip out_str << "\n:Birth Place: #{@birth_place}".rstrip out_str << "\n:Nationality: #{@nationality}".rstrip out_str << "\n:Issue Date: #{@issue_date}".rstrip out_str << "\n:Expiry Date: #{@expiry_date}".rstrip out_str << "\n:Address: #{@address}".rstrip out_str << "\n:Machine Readable Zone Line 1: #{@mrz1}".rstrip out_str << "\n:Machine Readable Zone Line 2: #{@mrz2}".rstrip out_str << "\n:Machine Readable Zone Line 3: #{@mrz3}".rstrip out_str[1..].to_s end |