Skip to content

Commit 3f26e41

Browse files
committed
✨ add french_healthcard, driver_license, payslip_fra v3
1 parent 928dbc1 commit 3f26e41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1815
-857
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from mindee import Client, product, AsyncPredictResponse
2+
3+
# Init a new client
4+
mindee_client = Client(api_key="my-api-key")
5+
6+
# Load a file from disk
7+
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")
8+
9+
# Load a file from disk and enqueue it.
10+
result: AsyncPredictResponse = mindee_client.enqueue_and_parse(
11+
product.DriverLicenseV1,
12+
input_doc,
13+
)
14+
15+
# Print a brief summary of the parsed data
16+
print(result.document)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from mindee import Client, product, AsyncPredictResponse
2+
3+
# Init a new client
4+
mindee_client = Client(api_key="my-api-key")
5+
6+
# Load a file from disk
7+
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")
8+
9+
# Load a file from disk and enqueue it.
10+
result: AsyncPredictResponse = mindee_client.enqueue_and_parse(
11+
product.fr.HealthCardV1,
12+
input_doc,
13+
)
14+
15+
# Print a brief summary of the parsed data
16+
print(result.document)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from mindee import Client, product, AsyncPredictResponse
2+
3+
# Init a new client
4+
mindee_client = Client(api_key="my-api-key")
5+
6+
# Load a file from disk
7+
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")
8+
9+
# Load a file from disk and enqueue it.
10+
result: AsyncPredictResponse = mindee_client.enqueue_and_parse(
11+
product.fr.PayslipV3,
12+
input_doc,
13+
)
14+
15+
# Print a brief summary of the parsed data
16+
print(result.document)
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
title: Driver License OCR Python
3+
category: 622b805aaec68102ea7fcbc2
4+
slug: python-driver-license-ocr
5+
parentDoc: 609808f773b0b90051d839de
6+
---
7+
The Python OCR SDK supports the [Driver License API](https://platform.mindee.com/mindee/driver_license).
8+
9+
The [sample below](https://github.com/mindee/client-lib-test-data/blob/main/products/driver_license/default_sample.jpg) can be used for testing purposes.
10+
![Driver License sample](https://github.com/mindee/client-lib-test-data/blob/main/products/driver_license/default_sample.jpg?raw=true)
11+
12+
# Quick-Start
13+
```py
14+
from mindee import Client, product, AsyncPredictResponse
15+
16+
# Init a new client
17+
mindee_client = Client(api_key="my-api-key")
18+
19+
# Load a file from disk
20+
input_doc = mindee_client.source_from_path("/path/to/the/file.ext")
21+
22+
# Load a file from disk and enqueue it.
23+
result: AsyncPredictResponse = mindee_client.enqueue_and_parse(
24+
product.DriverLicenseV1,
25+
input_doc,
26+
)
27+
28+
# Print a brief summary of the parsed data
29+
print(result.document)
30+
31+
```
32+
# Field Types
33+
## Standard Fields
34+
These fields are generic and used in several products.
35+
36+
### BaseField
37+
Each prediction object contains a set of fields that inherit from the generic `BaseField` class.
38+
A typical `BaseField` object will have the following attributes:
39+
40+
* **value** (`Union[float, str]`): corresponds to the field value. Can be `None` if no value was extracted.
41+
* **confidence** (`float`): the confidence score of the field prediction.
42+
* **bounding_box** (`[Point, Point, Point, Point]`): contains exactly 4 relative vertices (points) coordinates of a right rectangle containing the field in the document.
43+
* **polygon** (`List[Point]`): contains the relative vertices coordinates (`Point`) of a polygon containing the field in the image.
44+
* **page_id** (`int`): the ID of the page, always `None` when at document-level.
45+
* **reconstructed** (`bool`): indicates whether an object was reconstructed (not extracted as the API gave it).
46+
47+
> **Note:** A `Point` simply refers to a List of two numbers (`[float, float]`).
48+
49+
50+
Aside from the previous attributes, all basic fields have access to a custom `__str__` method that can be used to print their value as a string.
51+
52+
### DateField
53+
Aside from the basic `BaseField` attributes, the date field `DateField` also implements the following:
54+
55+
* **date_object** (`Date`): an accessible representation of the value as a python object. Can be `None`.
56+
57+
### StringField
58+
The text field `StringField` only has one constraint: its **value** is an `Optional[str]`.
59+
60+
# Attributes
61+
The following fields are extracted for Driver License V1:
62+
63+
## Category
64+
**category** ([StringField](#stringfield)): The category or class of the driver license.
65+
66+
```py
67+
print(result.document.inference.prediction.category.value)
68+
```
69+
70+
## Country Code
71+
**country_code** ([StringField](#stringfield)): The alpha-3 ISO 3166 code of the country where the driver license was issued.
72+
73+
```py
74+
print(result.document.inference.prediction.country_code.value)
75+
```
76+
77+
## Date of Birth
78+
**date_of_birth** ([DateField](#datefield)): The date of birth of the driver license holder.
79+
80+
```py
81+
print(result.document.inference.prediction.date_of_birth.value)
82+
```
83+
84+
## DD Number
85+
**dd_number** ([StringField](#stringfield)): The DD number of the driver license.
86+
87+
```py
88+
print(result.document.inference.prediction.dd_number.value)
89+
```
90+
91+
## Expiry Date
92+
**expiry_date** ([DateField](#datefield)): The expiry date of the driver license.
93+
94+
```py
95+
print(result.document.inference.prediction.expiry_date.value)
96+
```
97+
98+
## First Name
99+
**first_name** ([StringField](#stringfield)): The first name of the driver license holder.
100+
101+
```py
102+
print(result.document.inference.prediction.first_name.value)
103+
```
104+
105+
## ID
106+
**id** ([StringField](#stringfield)): The unique identifier of the driver license.
107+
108+
```py
109+
print(result.document.inference.prediction.id.value)
110+
```
111+
112+
## Issued Date
113+
**issued_date** ([DateField](#datefield)): The date when the driver license was issued.
114+
115+
```py
116+
print(result.document.inference.prediction.issued_date.value)
117+
```
118+
119+
## Issuing Authority
120+
**issuing_authority** ([StringField](#stringfield)): The authority that issued the driver license.
121+
122+
```py
123+
print(result.document.inference.prediction.issuing_authority.value)
124+
```
125+
126+
## Last Name
127+
**last_name** ([StringField](#stringfield)): The last name of the driver license holder.
128+
129+
```py
130+
print(result.document.inference.prediction.last_name.value)
131+
```
132+
133+
## MRZ
134+
**mrz** ([StringField](#stringfield)): The Machine Readable Zone (MRZ) of the driver license.
135+
136+
```py
137+
print(result.document.inference.prediction.mrz.value)
138+
```
139+
140+
## Place of Birth
141+
**place_of_birth** ([StringField](#stringfield)): The place of birth of the driver license holder.
142+
143+
```py
144+
print(result.document.inference.prediction.place_of_birth.value)
145+
```
146+
147+
## State
148+
**state** ([StringField](#stringfield)): Second part of the ISO 3166-2 code, consisting of two letters indicating the US State.
149+
150+
```py
151+
print(result.document.inference.prediction.state.value)
152+
```
153+
154+
# Questions?
155+
[Join our Slack](https://join.slack.com/t/mindee-community/shared_invite/zt-2d0ds7dtz-DPAF81ZqTy20chsYpQBW5g)

0 commit comments

Comments
 (0)