Skip to content

Commit 682120d

Browse files
fix addresses in wrong products
1 parent ef68007 commit 682120d

4 files changed

Lines changed: 9 additions & 41 deletions

File tree

docs/extras/guide/delivery_notes_v1.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,6 @@ A typical `BaseField` object will have the following attributes:
8080
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.
8181

8282

83-
### AddressField
84-
Aside from the basic `BaseField` attributes, the address field `AddressField` also implements the following:
85-
86-
* **street_number** (`str`): String representation of the string number. Can be `None`.
87-
* **street_name** (`str`): Name of the street. Can be `None`.
88-
* **po_box** (`str`): String representation of the PO Box number. Can be `None`.
89-
* **address_complement** (`str`): Address complement. Can be `None`.
90-
* **city** (`str`): City name. Can be `None`.
91-
* **postal_code** (`str`): String representation of the postal code. Can be `None`.
92-
* **state** (`str`): State name. Can be `None`.
93-
* **country** (`str`): Country name. Can be `None`.
94-
95-
Note: The `value` field of an AddressField should be a concatenation of the rest of the values.
96-
97-
9883
### AmountField
9984
The amount field `AmountField` only has one constraint: its **value** is an `Optional[float]`.
10085

@@ -110,7 +95,7 @@ The text field `StringField` only has one constraint: its **value** is an `Optio
11095
The following fields are extracted for Delivery note V1:
11196

11297
## Customer Address
113-
**customer_address** ([AddressField](#addressfield)): The address of the customer receiving the goods.
98+
**customer_address** ([StringField](#stringfield)): The address of the customer receiving the goods.
11499

115100
```py
116101
print(result.document.inference.prediction.customer_address.value)
@@ -138,7 +123,7 @@ print(result.document.inference.prediction.delivery_number.value)
138123
```
139124

140125
## Supplier Address
141-
**supplier_address** ([AddressField](#addressfield)): The address of the supplier providing the goods.
126+
**supplier_address** ([StringField](#stringfield)): The address of the supplier providing the goods.
142127

143128
```py
144129
print(result.document.inference.prediction.supplier_address.value)

docs/extras/guide/expense_receipts_v5.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -165,21 +165,6 @@ A typical `BaseField` object will have the following attributes:
165165
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.
166166

167167

168-
### AddressField
169-
Aside from the basic `BaseField` attributes, the address field `AddressField` also implements the following:
170-
171-
* **street_number** (`str`): String representation of the string number. Can be `None`.
172-
* **street_name** (`str`): Name of the street. Can be `None`.
173-
* **po_box** (`str`): String representation of the PO Box number. Can be `None`.
174-
* **address_complement** (`str`): Address complement. Can be `None`.
175-
* **city** (`str`): City name. Can be `None`.
176-
* **postal_code** (`str`): String representation of the postal code. Can be `None`.
177-
* **state** (`str`): State name. Can be `None`.
178-
* **country** (`str`): Country name. Can be `None`.
179-
180-
Note: The `value` field of an AddressField should be a concatenation of the rest of the values.
181-
182-
183168
### AmountField
184169
The amount field `AmountField` only has one constraint: its **value** is an `Optional[float]`.
185170

@@ -325,7 +310,7 @@ print(result.document.inference.prediction.subcategory.value)
325310
```
326311

327312
## Supplier Address
328-
**supplier_address** ([AddressField](#addressfield)): The address of the supplier or merchant.
313+
**supplier_address** ([StringField](#stringfield)): The address of the supplier or merchant.
329314

330315
```py
331316
print(result.document.inference.prediction.supplier_address.value)

mindee/product/delivery_note/delivery_note_v1_document.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from mindee.parsing.common.prediction import Prediction
44
from mindee.parsing.common.string_dict import StringDict
55
from mindee.parsing.common.summary_helper import clean_out_string
6-
from mindee.parsing.standard.address import AddressField
76
from mindee.parsing.standard.amount import AmountField
87
from mindee.parsing.standard.date import DateField
98
from mindee.parsing.standard.text import StringField
@@ -12,15 +11,15 @@
1211
class DeliveryNoteV1Document(Prediction):
1312
"""Delivery note API version 1.2 document data."""
1413

15-
customer_address: AddressField
14+
customer_address: StringField
1615
"""The address of the customer receiving the goods."""
1716
customer_name: StringField
1817
"""The name of the customer receiving the goods."""
1918
delivery_date: DateField
2019
"""The date on which the delivery is scheduled to arrive."""
2120
delivery_number: StringField
2221
"""A unique identifier for the delivery note."""
23-
supplier_address: AddressField
22+
supplier_address: StringField
2423
"""The address of the supplier providing the goods."""
2524
supplier_name: StringField
2625
"""The name of the supplier providing the goods."""
@@ -39,7 +38,7 @@ def __init__(
3938
:param page_id: Page number for multi pages pdf input
4039
"""
4140
super().__init__(raw_prediction, page_id)
42-
self.customer_address = AddressField(
41+
self.customer_address = StringField(
4342
raw_prediction["customer_address"],
4443
page_id=page_id,
4544
)
@@ -55,7 +54,7 @@ def __init__(
5554
raw_prediction["delivery_number"],
5655
page_id=page_id,
5756
)
58-
self.supplier_address = AddressField(
57+
self.supplier_address = StringField(
5958
raw_prediction["supplier_address"],
6059
page_id=page_id,
6160
)

mindee/product/receipt/receipt_v5_document.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from mindee.parsing.common.prediction import Prediction
44
from mindee.parsing.common.string_dict import StringDict
55
from mindee.parsing.common.summary_helper import clean_out_string
6-
from mindee.parsing.standard.address import AddressField
76
from mindee.parsing.standard.amount import AmountField
87
from mindee.parsing.standard.classification import ClassificationField
98
from mindee.parsing.standard.company_registration import CompanyRegistrationField
@@ -31,7 +30,7 @@ class ReceiptV5Document(Prediction):
3130
"""The receipt number or identifier."""
3231
subcategory: ClassificationField
3332
"""The purchase subcategory of the receipt for transport and food."""
34-
supplier_address: AddressField
33+
supplier_address: StringField
3534
"""The address of the supplier or merchant."""
3635
supplier_company_registrations: List[CompanyRegistrationField]
3736
"""List of company registration numbers associated to the supplier."""
@@ -92,7 +91,7 @@ def __init__(
9291
raw_prediction["subcategory"],
9392
page_id=page_id,
9493
)
95-
self.supplier_address = AddressField(
94+
self.supplier_address = StringField(
9695
raw_prediction["supplier_address"],
9796
page_id=page_id,
9897
)

0 commit comments

Comments
 (0)