Skip to content

✨ add support for full address fields #325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions docs/extras/guide/expense_receipts_v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ The following fields are extracted for Receipt V5:
- 'gasoline'
- 'telecom'
- 'miscellaneous'
- 'software'
- 'shopping'
- 'energy'

```py
print(result.document.inference.prediction.category.value)
Expand Down Expand Up @@ -291,6 +294,15 @@ print(result.document.inference.prediction.receipt_number.value)
- 'train'
- 'restaurant'
- 'shopping'
- 'other'
- 'groceries'
- 'cultural'
- 'electronics'
- 'office_supplies'
- 'micromobility'
- 'car_rental'
- 'public'
- 'delivery'
- None

```py
Expand Down
43 changes: 35 additions & 8 deletions docs/extras/guide/financial_document_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ print(result.document)
########
Document
########
:Mindee ID: f52333ab-811e-4647-993e-ad79e072afa3
:Mindee ID: 6dd26385-719b-4527-bf6f-87d9da619de5
:Filename: default_sample.jpg

Inference
#########
:Product: mindee/financial_document v1.12
:Product: mindee/financial_document v1.14
:Rotation applied: Yes

Prediction
Expand Down Expand Up @@ -203,6 +203,21 @@ A typical `BaseField` object will have the following attributes:
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.


### AddressField
Aside from the basic `BaseField` attributes, the address field `AddressField` also implements the following:

* **street_number** (`str`): String representation of the string number. Can be `None`.
* **street_name** (`str`): Name of the street. Can be `None`.
* **po_box** (`str`): String representation of the PO Box number. Can be `None`.
* **address_complement** (`str`): Address complement. Can be `None`.
* **city** (`str`): City name. Can be `None`.
* **postal_code** (`str`): String representation of the postal code. Can be `None`.
* **state** (`str`): State name. Can be `None`.
* **country** (`str`): Country name. Can be `None`.

Note: The `value` field of an AddressField should be a concatenation of the rest of the values.


### AmountField
The amount field `AmountField` only has one constraint: its **value** is an `Optional[float]`.

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

## Billing Address
**billing_address** ([StringField](#stringfield)): The customer's address used for billing.
**billing_address** ([AddressField](#addressfield)): The customer's address used for billing.

```py
print(result.document.inference.prediction.billing_address.value)
```

## Purchase Category
**category** ([ClassificationField](#classificationfield)): The purchase category, only for receipts.
**category** ([ClassificationField](#classificationfield)): The purchase category.

#### Possible values include:
- 'toll'
Expand All @@ -294,13 +309,16 @@ print(result.document.inference.prediction.billing_address.value)
- 'gasoline'
- 'telecom'
- 'miscellaneous'
- 'software'
- 'shopping'
- 'energy'

```py
print(result.document.inference.prediction.category.value)
```

## Customer Address
**customer_address** ([StringField](#stringfield)): The address of the customer.
**customer_address** ([AddressField](#addressfield)): The address of the customer.

```py
print(result.document.inference.prediction.customer_address.value)
Expand Down Expand Up @@ -432,29 +450,38 @@ for reference_numbers_elem in result.document.inference.prediction.reference_num
```

## Shipping Address
**shipping_address** ([StringField](#stringfield)): The customer's address used for shipping.
**shipping_address** ([AddressField](#addressfield)): The customer's address used for shipping.

```py
print(result.document.inference.prediction.shipping_address.value)
```

## Purchase Subcategory
**subcategory** ([ClassificationField](#classificationfield)): The purchase subcategory for transport and food, only for receipts.
**subcategory** ([ClassificationField](#classificationfield)): The purchase subcategory for transport, food and shooping.

#### Possible values include:
- 'plane'
- 'taxi'
- 'train'
- 'restaurant'
- 'shopping'
- 'other'
- 'groceries'
- 'cultural'
- 'electronics'
- 'office_supplies'
- 'micromobility'
- 'car_rental'
- 'public'
- 'delivery'
- None

```py
print(result.document.inference.prediction.subcategory.value)
```

## Supplier Address
**supplier_address** ([StringField](#stringfield)): The address of the supplier or merchant.
**supplier_address** ([AddressField](#addressfield)): The address of the supplier or merchant.

```py
print(result.document.inference.prediction.supplier_address.value)
Expand Down
4 changes: 2 additions & 2 deletions docs/extras/guide/ind_passport_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Document

Inference
#########
:Product: mindee/ind_passport v1.0
:Product: mindee/ind_passport v1.2
:Rotation applied: Yes

Prediction
Expand All @@ -68,10 +68,10 @@ Prediction
:Name of Mother:
:Old Passport Date of Issue:
:Old Passport Number:
:Old Passport Place of Issue:
:Address Line 1:
:Address Line 2:
:Address Line 3:
:Old Passport Place of Issue:
:File Number:
```

Expand Down
74 changes: 68 additions & 6 deletions docs/extras/guide/invoices_v4.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ print(result.document)
########
Document
########
:Mindee ID: 3e524d26-f7dc-4852-9bbf-833a127a9570
:Mindee ID: 744748d5-9051-461c-b70c-bbf81f5ff943
:Filename: default_sample.jpg

Inference
#########
:Product: mindee/invoices v4.10
:Product: mindee/invoices v4.11
:Rotation applied: Yes

Prediction
Expand Down Expand Up @@ -111,6 +111,8 @@ Prediction
:Billing Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
:Document Type: INVOICE
:Document Type Extended: INVOICE
:Purchase Subcategory:
:Purchase Category: miscellaneous
:Line Items:
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
| Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price |
Expand Down Expand Up @@ -158,6 +160,8 @@ Page 0
:Billing Address: 1954 Bloor Street West Toronto, ON, M6P 3K9 Canada
:Document Type: INVOICE
:Document Type Extended: INVOICE
:Purchase Subcategory:
:Purchase Category: miscellaneous
:Line Items:
+--------------------------------------+--------------+----------+------------+--------------+--------------+-----------------+------------+
| Description | Product code | Quantity | Tax Amount | Tax Rate (%) | Total Amount | Unit of measure | Unit Price |
Expand Down Expand Up @@ -191,6 +195,21 @@ A typical `BaseField` object will have the following attributes:
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.


### AddressField
Aside from the basic `BaseField` attributes, the address field `AddressField` also implements the following:

* **street_number** (`str`): String representation of the string number. Can be `None`.
* **street_name** (`str`): Name of the street. Can be `None`.
* **po_box** (`str`): String representation of the PO Box number. Can be `None`.
* **address_complement** (`str`): Address complement. Can be `None`.
* **city** (`str`): City name. Can be `None`.
* **postal_code** (`str`): String representation of the postal code. Can be `None`.
* **state** (`str`): State name. Can be `None`.
* **country** (`str`): Country name. Can be `None`.

Note: The `value` field of an AddressField should be a concatenation of the rest of the values.


### AmountField
The amount field `AmountField` only has one constraint: its **value** is an `Optional[float]`.

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

## Billing Address
**billing_address** ([StringField](#stringfield)): The customer billing address.
**billing_address** ([AddressField](#addressfield)): The customer billing address.

```py
print(result.document.inference.prediction.billing_address.value)
```

## Purchase Category
**category** ([ClassificationField](#classificationfield)): The purchase category.

#### Possible values include:
- 'toll'
- 'food'
- 'parking'
- 'transport'
- 'accommodation'
- 'telecom'
- 'miscellaneous'
- 'software'
- 'shopping'
- 'energy'

```py
print(result.document.inference.prediction.category.value)
```

## Customer Address
**customer_address** ([StringField](#stringfield)): The address of the customer.
**customer_address** ([AddressField](#addressfield)): The address of the customer.

```py
print(result.document.inference.prediction.customer_address.value)
Expand Down Expand Up @@ -387,14 +425,38 @@ for reference_numbers_elem in result.document.inference.prediction.reference_num
```

## Shipping Address
**shipping_address** ([StringField](#stringfield)): Customer's delivery address.
**shipping_address** ([AddressField](#addressfield)): Customer's delivery address.

```py
print(result.document.inference.prediction.shipping_address.value)
```

## Purchase Subcategory
**subcategory** ([ClassificationField](#classificationfield)): The purchase subcategory for transport, food and shopping.

#### Possible values include:
- 'plane'
- 'taxi'
- 'train'
- 'restaurant'
- 'shopping'
- 'other'
- 'groceries'
- 'cultural'
- 'electronics'
- 'office_supplies'
- 'micromobility'
- 'car_rental'
- 'public'
- 'delivery'
- None

```py
print(result.document.inference.prediction.subcategory.value)
```

## Supplier Address
**supplier_address** ([StringField](#stringfield)): The address of the supplier or merchant.
**supplier_address** ([AddressField](#addressfield)): The address of the supplier or merchant.

```py
print(result.document.inference.prediction.supplier_address.value)
Expand Down
30 changes: 19 additions & 11 deletions docs/extras/guide/us_healthcare_cards_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,18 @@ print(result.document)
########
Document
########
:Mindee ID: 1e71d5f0-dedb-4070-9d94-9207cd9570b5
:Mindee ID: 5e917fc8-5c13-42b2-967f-954f4eed9959
:Filename: default_sample.jpg

Inference
#########
:Product: mindee/us_healthcare_cards v1.2
:Product: mindee/us_healthcare_cards v1.3
:Rotation applied: Yes

Prediction
==========
:Company Name: UnitedHealthcare
:Plan Name: Choice Plus
:Member Name: SUBSCRIBER SMITH
:Member ID: 123456789
:Issuer 80840:
Expand All @@ -64,14 +65,14 @@ Prediction
:RX ID:
:RX GRP: UHEALTH
:RX PCN: 9999
:copays:
:Copays:
+--------------+----------------------+
| Service Fees | Service Name |
+==============+======================+
| 300.00 | emergency_room |
+--------------+----------------------+
| 20.00 | office_visit |
+--------------+----------------------+
| 300.00 | emergency_room |
+--------------+----------------------+
| 75.00 | urgent_care |
+--------------+----------------------+
| 30.00 | specialist |
Expand Down Expand Up @@ -110,13 +111,13 @@ The text field `StringField` only has one constraint: its **value** is an `Optio
## Specific Fields
Fields which are specific to this product; they are not used in any other product.

### copays Field
Is a fixed amount for a covered service.
### Copays Field
Copayments for covered services.

A `HealthcareCardV1Copay` implements the following attributes:

* **service_fees** (`float`): The price of service.
* **service_name** (`str`): The name of service of the copay.
* **service_fees** (`float`): The price of the service.
* **service_name** (`str`): The name of the service.

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

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

```py
for copays_elem in result.document.inference.prediction.copays:
Expand Down Expand Up @@ -195,6 +196,13 @@ print(result.document.inference.prediction.member_name.value)
print(result.document.inference.prediction.payer_id.value)
```

## Plan Name
**plan_name** ([StringField](#stringfield)): The name of the healthcare plan.

```py
print(result.document.inference.prediction.plan_name.value)
```

## RX BIN
**rx_bin** ([StringField](#stringfield)): The BIN number for prescription drug coverage.

Expand Down
Loading