Skip to content

Commit 617de77

Browse files
✨ add support for full address fields (#325)
1 parent 77b8e49 commit 617de77

18 files changed

+266
-93
lines changed

docs/extras/guide/expense_receipts_v5.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,9 @@ The following fields are extracted for Receipt V5:
237237
- 'gasoline'
238238
- 'telecom'
239239
- 'miscellaneous'
240+
- 'software'
241+
- 'shopping'
242+
- 'energy'
240243

241244
```py
242245
print(result.document.inference.prediction.category.value)
@@ -291,6 +294,15 @@ print(result.document.inference.prediction.receipt_number.value)
291294
- 'train'
292295
- 'restaurant'
293296
- 'shopping'
297+
- 'other'
298+
- 'groceries'
299+
- 'cultural'
300+
- 'electronics'
301+
- 'office_supplies'
302+
- 'micromobility'
303+
- 'car_rental'
304+
- 'public'
305+
- 'delivery'
294306
- None
295307

296308
```py

docs/extras/guide/financial_document_v1.md

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ print(result.document)
7070
########
7171
Document
7272
########
73-
:Mindee ID: f52333ab-811e-4647-993e-ad79e072afa3
73+
:Mindee ID: 6dd26385-719b-4527-bf6f-87d9da619de5
7474
:Filename: default_sample.jpg
7575
7676
Inference
7777
#########
78-
:Product: mindee/financial_document v1.12
78+
:Product: mindee/financial_document v1.14
7979
:Rotation applied: Yes
8080
8181
Prediction
@@ -203,6 +203,21 @@ A typical `BaseField` object will have the following attributes:
203203
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.
204204

205205

206+
### AddressField
207+
Aside from the basic `BaseField` attributes, the address field `AddressField` also implements the following:
208+
209+
* **street_number** (`str`): String representation of the string number. Can be `None`.
210+
* **street_name** (`str`): Name of the street. Can be `None`.
211+
* **po_box** (`str`): String representation of the PO Box number. Can be `None`.
212+
* **address_complement** (`str`): Address complement. Can be `None`.
213+
* **city** (`str`): City name. Can be `None`.
214+
* **postal_code** (`str`): String representation of the postal code. Can be `None`.
215+
* **state** (`str`): State name. Can be `None`.
216+
* **country** (`str`): Country name. Can be `None`.
217+
218+
Note: The `value` field of an AddressField should be a concatenation of the rest of the values.
219+
220+
206221
### AmountField
207222
The amount field `AmountField` only has one constraint: its **value** is an `Optional[float]`.
208223

@@ -276,14 +291,14 @@ A `FinancialDocumentV1LineItem` implements the following attributes:
276291
The following fields are extracted for Financial Document V1:
277292

278293
## Billing Address
279-
**billing_address** ([StringField](#stringfield)): The customer's address used for billing.
294+
**billing_address** ([AddressField](#addressfield)): The customer's address used for billing.
280295

281296
```py
282297
print(result.document.inference.prediction.billing_address.value)
283298
```
284299

285300
## Purchase Category
286-
**category** ([ClassificationField](#classificationfield)): The purchase category, only for receipts.
301+
**category** ([ClassificationField](#classificationfield)): The purchase category.
287302

288303
#### Possible values include:
289304
- 'toll'
@@ -294,13 +309,16 @@ print(result.document.inference.prediction.billing_address.value)
294309
- 'gasoline'
295310
- 'telecom'
296311
- 'miscellaneous'
312+
- 'software'
313+
- 'shopping'
314+
- 'energy'
297315

298316
```py
299317
print(result.document.inference.prediction.category.value)
300318
```
301319

302320
## Customer Address
303-
**customer_address** ([StringField](#stringfield)): The address of the customer.
321+
**customer_address** ([AddressField](#addressfield)): The address of the customer.
304322

305323
```py
306324
print(result.document.inference.prediction.customer_address.value)
@@ -432,29 +450,38 @@ for reference_numbers_elem in result.document.inference.prediction.reference_num
432450
```
433451

434452
## Shipping Address
435-
**shipping_address** ([StringField](#stringfield)): The customer's address used for shipping.
453+
**shipping_address** ([AddressField](#addressfield)): The customer's address used for shipping.
436454

437455
```py
438456
print(result.document.inference.prediction.shipping_address.value)
439457
```
440458

441459
## Purchase Subcategory
442-
**subcategory** ([ClassificationField](#classificationfield)): The purchase subcategory for transport and food, only for receipts.
460+
**subcategory** ([ClassificationField](#classificationfield)): The purchase subcategory for transport, food and shooping.
443461

444462
#### Possible values include:
445463
- 'plane'
446464
- 'taxi'
447465
- 'train'
448466
- 'restaurant'
449467
- 'shopping'
468+
- 'other'
469+
- 'groceries'
470+
- 'cultural'
471+
- 'electronics'
472+
- 'office_supplies'
473+
- 'micromobility'
474+
- 'car_rental'
475+
- 'public'
476+
- 'delivery'
450477
- None
451478

452479
```py
453480
print(result.document.inference.prediction.subcategory.value)
454481
```
455482

456483
## Supplier Address
457-
**supplier_address** ([StringField](#stringfield)): The address of the supplier or merchant.
484+
**supplier_address** ([AddressField](#addressfield)): The address of the supplier or merchant.
458485

459486
```py
460487
print(result.document.inference.prediction.supplier_address.value)

docs/extras/guide/ind_passport_v1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Document
4545
4646
Inference
4747
#########
48-
:Product: mindee/ind_passport v1.0
48+
:Product: mindee/ind_passport v1.2
4949
:Rotation applied: Yes
5050
5151
Prediction
@@ -68,10 +68,10 @@ Prediction
6868
:Name of Mother:
6969
:Old Passport Date of Issue:
7070
:Old Passport Number:
71+
:Old Passport Place of Issue:
7172
:Address Line 1:
7273
:Address Line 2:
7374
:Address Line 3:
74-
:Old Passport Place of Issue:
7575
:File Number:
7676
```
7777

docs/extras/guide/invoices_v4.md

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ print(result.document)
7070
########
7171
Document
7272
########
73-
:Mindee ID: 3e524d26-f7dc-4852-9bbf-833a127a9570
73+
:Mindee ID: 744748d5-9051-461c-b70c-bbf81f5ff943
7474
:Filename: default_sample.jpg
7575
7676
Inference
7777
#########
78-
:Product: mindee/invoices v4.10
78+
:Product: mindee/invoices v4.11
7979
:Rotation applied: Yes
8080
8181
Prediction
@@ -111,6 +111,8 @@ Prediction
111111
:Billing Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
112112
:Document Type: INVOICE
113113
:Document Type Extended: INVOICE
114+
:Purchase Subcategory:
115+
:Purchase Category: miscellaneous
114116
:Line Items:
115117
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
116118
| Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price |
@@ -158,6 +160,8 @@ Page 0
158160
:Billing Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
159161
:Document Type: INVOICE
160162
:Document Type Extended: INVOICE
163+
:Purchase Subcategory:
164+
:Purchase Category: miscellaneous
161165
:Line Items:
162166
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
163167
| Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price |
@@ -191,6 +195,21 @@ A typical `BaseField` object will have the following attributes:
191195
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.
192196

193197

198+
### AddressField
199+
Aside from the basic `BaseField` attributes, the address field `AddressField` also implements the following:
200+
201+
* **street_number** (`str`): String representation of the string number. Can be `None`.
202+
* **street_name** (`str`): Name of the street. Can be `None`.
203+
* **po_box** (`str`): String representation of the PO Box number. Can be `None`.
204+
* **address_complement** (`str`): Address complement. Can be `None`.
205+
* **city** (`str`): City name. Can be `None`.
206+
* **postal_code** (`str`): String representation of the postal code. Can be `None`.
207+
* **state** (`str`): State name. Can be `None`.
208+
* **country** (`str`): Country name. Can be `None`.
209+
210+
Note: The `value` field of an AddressField should be a concatenation of the rest of the values.
211+
212+
194213
### AmountField
195214
The amount field `AmountField` only has one constraint: its **value** is an `Optional[float]`.
196215

@@ -264,14 +283,33 @@ A `InvoiceV4LineItem` implements the following attributes:
264283
The following fields are extracted for Invoice V4:
265284

266285
## Billing Address
267-
**billing_address** ([StringField](#stringfield)): The customer billing address.
286+
**billing_address** ([AddressField](#addressfield)): The customer billing address.
268287

269288
```py
270289
print(result.document.inference.prediction.billing_address.value)
271290
```
272291

292+
## Purchase Category
293+
**category** ([ClassificationField](#classificationfield)): The purchase category.
294+
295+
#### Possible values include:
296+
- 'toll'
297+
- 'food'
298+
- 'parking'
299+
- 'transport'
300+
- 'accommodation'
301+
- 'telecom'
302+
- 'miscellaneous'
303+
- 'software'
304+
- 'shopping'
305+
- 'energy'
306+
307+
```py
308+
print(result.document.inference.prediction.category.value)
309+
```
310+
273311
## Customer Address
274-
**customer_address** ([StringField](#stringfield)): The address of the customer.
312+
**customer_address** ([AddressField](#addressfield)): The address of the customer.
275313

276314
```py
277315
print(result.document.inference.prediction.customer_address.value)
@@ -387,14 +425,38 @@ for reference_numbers_elem in result.document.inference.prediction.reference_num
387425
```
388426

389427
## Shipping Address
390-
**shipping_address** ([StringField](#stringfield)): Customer's delivery address.
428+
**shipping_address** ([AddressField](#addressfield)): Customer's delivery address.
391429

392430
```py
393431
print(result.document.inference.prediction.shipping_address.value)
394432
```
395433

434+
## Purchase Subcategory
435+
**subcategory** ([ClassificationField](#classificationfield)): The purchase subcategory for transport, food and shopping.
436+
437+
#### Possible values include:
438+
- 'plane'
439+
- 'taxi'
440+
- 'train'
441+
- 'restaurant'
442+
- 'shopping'
443+
- 'other'
444+
- 'groceries'
445+
- 'cultural'
446+
- 'electronics'
447+
- 'office_supplies'
448+
- 'micromobility'
449+
- 'car_rental'
450+
- 'public'
451+
- 'delivery'
452+
- None
453+
454+
```py
455+
print(result.document.inference.prediction.subcategory.value)
456+
```
457+
396458
## Supplier Address
397-
**supplier_address** ([StringField](#stringfield)): The address of the supplier or merchant.
459+
**supplier_address** ([AddressField](#addressfield)): The address of the supplier or merchant.
398460

399461
```py
400462
print(result.document.inference.prediction.supplier_address.value)

docs/extras/guide/us_healthcare_cards_v1.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,18 @@ print(result.document)
4040
########
4141
Document
4242
########
43-
:Mindee ID: 1e71d5f0-dedb-4070-9d94-9207cd9570b5
43+
:Mindee ID: 5e917fc8-5c13-42b2-967f-954f4eed9959
4444
:Filename: default_sample.jpg
4545
4646
Inference
4747
#########
48-
:Product: mindee/us_healthcare_cards v1.2
48+
:Product: mindee/us_healthcare_cards v1.3
4949
:Rotation applied: Yes
5050
5151
Prediction
5252
==========
5353
:Company Name: UnitedHealthcare
54+
:Plan Name: Choice Plus
5455
:Member Name: SUBSCRIBER SMITH
5556
:Member ID: 123456789
5657
:Issuer 80840:
@@ -64,14 +65,14 @@ Prediction
6465
:RX ID:
6566
:RX GRP: UHEALTH
6667
:RX PCN: 9999
67-
:copays:
68+
:Copays:
6869
+--------------+----------------------+
6970
| Service Fees | Service Name |
7071
+==============+======================+
71-
| 300.00 | emergency_room |
72-
+--------------+----------------------+
7372
| 20.00 | office_visit |
7473
+--------------+----------------------+
74+
| 300.00 | emergency_room |
75+
+--------------+----------------------+
7576
| 75.00 | urgent_care |
7677
+--------------+----------------------+
7778
| 30.00 | specialist |
@@ -110,13 +111,13 @@ The text field `StringField` only has one constraint: its **value** is an `Optio
110111
## Specific Fields
111112
Fields which are specific to this product; they are not used in any other product.
112113

113-
### copays Field
114-
Is a fixed amount for a covered service.
114+
### Copays Field
115+
Copayments for covered services.
115116

116117
A `HealthcareCardV1Copay` implements the following attributes:
117118

118-
* **service_fees** (`float`): The price of service.
119-
* **service_name** (`str`): The name of service of the copay.
119+
* **service_fees** (`float`): The price of the service.
120+
* **service_name** (`str`): The name of the service.
120121

121122
#### Possible values include:
122123
- primary_care
@@ -137,8 +138,8 @@ The following fields are extracted for Healthcare Card V1:
137138
print(result.document.inference.prediction.company_name.value)
138139
```
139140

140-
## copays
141-
**copays** (List[[HealthcareCardV1Copay](#copays-field)]): Is a fixed amount for a covered service.
141+
## Copays
142+
**copays** (List[[HealthcareCardV1Copay](#copays-field)]): Copayments for covered services.
142143

143144
```py
144145
for copays_elem in result.document.inference.prediction.copays:
@@ -195,6 +196,13 @@ print(result.document.inference.prediction.member_name.value)
195196
print(result.document.inference.prediction.payer_id.value)
196197
```
197198

199+
## Plan Name
200+
**plan_name** ([StringField](#stringfield)): The name of the healthcare plan.
201+
202+
```py
203+
print(result.document.inference.prediction.plan_name.value)
204+
```
205+
198206
## RX BIN
199207
**rx_bin** ([StringField](#stringfield)): The BIN number for prescription drug coverage.
200208

0 commit comments

Comments
 (0)