Passport fields
General fields structure
Each Passport object contains a set of different fields.
To acces an passport object, you need to create a mindee.Client
and call the Client.parse_passport
method:
from mindee import Client
# Instantiate your client
mindee_client = Client(passport_token="your_token_here")
# Call the Mindee passport endpoint and parse the result
passport_data = mindee_client.parse_passport("/path/to/my/file")
Whatever the field type, each of them contains the four following attributes:
- Value: (Str or Float depending on the field type), corresponds to the field value. Set to None if the field was not extracted.
- Probability: (Float), confidence score of the field prediction.
- bbox:(Array[Float]), contains the relative vertices coordinates of the bounding box containing the field in the image. If the field is not written, the bbox is an empty array.
- reconstructed: (Bool), True if the field was reconstructed using other fields.
Depending on the Field type, there can be extra attributes.
Passport's owner data
passport.given_names: List of passport's owner given names
# To get the list of names
given_names = passport_data.passport.given_names
# Loop on each given name
for given_name in given_names:
# To get the name string
name = given_name.value
passport.surname: Passport's owner surname
# To get the passport's owner surname (string)
surname = passport_data.passport.surname.value
passport.gender: Passport's owner gender (M / F)
# To get the passport's owner gender (string among {"M", "F"}
gender = passport_data.passport.gender.value
passport.full_name: Reconstructed Passport's owner full name from surname and given_names
# To get the passport's owner full name (string)
full_name = passport_data.passport.full_name.value
passport.birth_place: Passport's owner birth place
# To get the passport's owner birth place (string)
birth_place = passport_data.passport.birth_place.value
Dates
Each date field comes with an extra attribute:
- date_object: (Datetime), datetime object from python datetime.date library
passport.birth_date: Passport's owner date of birth
# To get the passport's owner date of birth (string)
birth_date = passport_data.passport.birth_date.value
passport.expiry_date: Passport expiry date
# To get the passport expiry date (string)
expiry_date = passport_data.passport.expiry_date.value
passport.issuance_date: Passport date of issuance
# To get the passport date of issuance (string)
issuance_date = passport_data.passport.issuance_date.value
Passports metadata
passport.mrz1: Passport first line of machine readable zone
# To get the passport first line of machine readable zone (string)
mrz1 = passport_data.passport.mrz1.value
passport.mrz2: Passport second line of machine readable zone
# To get the passport second line of machine readable zone (string)
mrz2 = passport_data.passport.mrz2.value
passport.mrz: Reconstructed passport full machine readable zone from mrz1 and mrz2
# To get the passport full machine readable zone (string)
mrz = passport_data.passport.mrz.value
passport.id_number: Passport identification number
# To get the passport id number (string)
id_number = passport_data.passport.id_number.value
passport.country: Passport country code
# To get the passport country code (string)
country_code = passport_data.passport.country_code.value