Skip to content

Commit 3d3b68a

Browse files
✨ bump FR EnergyBillV1 to V1.2 & US HealthcareCardV1 to V1.1 (#308)
1 parent 66271f1 commit 3d3b68a

File tree

6 files changed

+35
-9
lines changed

6 files changed

+35
-9
lines changed

docs/extras/guide/energy_bill_fra_v1.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,19 @@ Details of energy consumption.
147147

148148
A `EnergyBillV1EnergyUsage` implements the following attributes:
149149

150+
* **consumption** (`float`): The price per unit of energy consumed.
150151
* **description** (`str`): Description or details of the energy usage.
151152
* **end_date** (`str`): The end date of the energy usage.
152153
* **start_date** (`str`): The start date of the energy usage.
153154
* **tax_rate** (`float`): The rate of tax applied to the total cost.
154155
* **total** (`float`): The total cost of energy consumed.
156+
* **unit** (`str`): The unit of measurement for energy consumption.
157+
158+
#### Possible values include:
159+
- kWh
160+
- m3
161+
- L
162+
155163
* **unit_price** (`float`): The price per unit of energy consumed.
156164
Fields which are specific to this product; they are not used in any other product.
157165

@@ -169,7 +177,7 @@ A `EnergyBillV1MeterDetail` implements the following attributes:
169177
- water
170178
- None
171179

172-
* **unit** (`str`): The unit of measurement for energy consumption, which can be kW, m³, or L.
180+
* **unit** (`str`): The unit of power for energy consumption.
173181
Fields which are specific to this product; they are not used in any other product.
174182

175183
### Subscription Field

mindee/product/fr/energy_bill/energy_bill_v1_document.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828

2929
class EnergyBillV1Document(Prediction):
30-
"""Energy Bill API version 1.0 document data."""
30+
"""Energy Bill API version 1.2 document data."""
3131

3232
contract_id: StringField
3333
"""The unique identifier associated with a specific contract."""
@@ -164,11 +164,13 @@ def _subscription_to_str(self) -> str:
164164
@staticmethod
165165
def _energy_usage_separator(char: str) -> str:
166166
out_str = " "
167+
out_str += f"+{char * 13}"
167168
out_str += f"+{char * 38}"
168169
out_str += f"+{char * 12}"
169170
out_str += f"+{char * 12}"
170171
out_str += f"+{char * 10}"
171172
out_str += f"+{char * 11}"
173+
out_str += f"+{char * 17}"
172174
out_str += f"+{char * 12}"
173175
return out_str + "+"
174176

@@ -181,11 +183,13 @@ def _energy_usage_to_str(self) -> str:
181183
)
182184
out_str = ""
183185
out_str += f"\n{self._energy_usage_separator('-')}\n "
186+
out_str += " | Consumption"
184187
out_str += " | Description "
185188
out_str += " | End Date "
186189
out_str += " | Start Date"
187190
out_str += " | Tax Rate"
188191
out_str += " | Total "
192+
out_str += " | Unit of Measure"
189193
out_str += " | Unit Price"
190194
out_str += f" |\n{self._energy_usage_separator('=')}"
191195
out_str += f"\n {lines}"

mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
class EnergyBillV1EnergyUsage(FieldPositionMixin, FieldConfidenceMixin):
1414
"""Details of energy consumption."""
1515

16+
consumption: Optional[float]
17+
"""The price per unit of energy consumed."""
1618
description: Optional[str]
1719
"""Description or details of the energy usage."""
1820
end_date: Optional[str]
@@ -23,6 +25,8 @@ class EnergyBillV1EnergyUsage(FieldPositionMixin, FieldConfidenceMixin):
2325
"""The rate of tax applied to the total cost."""
2426
total: Optional[float]
2527
"""The total cost of energy consumed."""
28+
unit: Optional[str]
29+
"""The unit of measurement for energy consumption."""
2630
unit_price: Optional[float]
2731
"""The price per unit of energy consumed."""
2832
page_n: int
@@ -44,53 +48,63 @@ def __init__(
4448
else:
4549
self.page_n = page_id
4650

51+
self.consumption = to_opt_float(raw_prediction, "consumption")
4752
self.description = raw_prediction["description"]
4853
self.end_date = raw_prediction["end_date"]
4954
self.start_date = raw_prediction["start_date"]
5055
self.tax_rate = to_opt_float(raw_prediction, "tax_rate")
5156
self.total = to_opt_float(raw_prediction, "total")
57+
self.unit = raw_prediction["unit"]
5258
self.unit_price = to_opt_float(raw_prediction, "unit_price")
5359

5460
def _printable_values(self) -> Dict[str, str]:
5561
"""Return values for printing."""
5662
out_dict: Dict[str, str] = {}
63+
out_dict["consumption"] = float_to_string(self.consumption)
5764
out_dict["description"] = format_for_display(self.description)
5865
out_dict["end_date"] = format_for_display(self.end_date)
5966
out_dict["start_date"] = format_for_display(self.start_date)
6067
out_dict["tax_rate"] = float_to_string(self.tax_rate)
6168
out_dict["total"] = float_to_string(self.total)
69+
out_dict["unit"] = format_for_display(self.unit)
6270
out_dict["unit_price"] = float_to_string(self.unit_price)
6371
return out_dict
6472

6573
def _table_printable_values(self) -> Dict[str, str]:
6674
"""Return values for printing inside an RST table."""
6775
out_dict: Dict[str, str] = {}
76+
out_dict["consumption"] = float_to_string(self.consumption)
6877
out_dict["description"] = format_for_display(self.description, 36)
6978
out_dict["end_date"] = format_for_display(self.end_date, 10)
7079
out_dict["start_date"] = format_for_display(self.start_date, None)
7180
out_dict["tax_rate"] = float_to_string(self.tax_rate)
7281
out_dict["total"] = float_to_string(self.total)
82+
out_dict["unit"] = format_for_display(self.unit, None)
7383
out_dict["unit_price"] = float_to_string(self.unit_price)
7484
return out_dict
7585

7686
def to_table_line(self) -> str:
7787
"""Output in a format suitable for inclusion in an rST table."""
7888
printable = self._table_printable_values()
79-
out_str: str = f"| {printable['description']:<36} | "
89+
out_str: str = f"| {printable['consumption']:<11} | "
90+
out_str += f"{printable['description']:<36} | "
8091
out_str += f"{printable['end_date']:<10} | "
8192
out_str += f"{printable['start_date']:<10} | "
8293
out_str += f"{printable['tax_rate']:<8} | "
8394
out_str += f"{printable['total']:<9} | "
95+
out_str += f"{printable['unit']:<15} | "
8496
out_str += f"{printable['unit_price']:<10} | "
8597
return clean_out_string(out_str)
8698

8799
def __str__(self) -> str:
88100
"""Default string representation."""
89101
printable = self._printable_values()
90-
out_str: str = f"Description: {printable['description']}, \n"
102+
out_str: str = f"Consumption: {printable['consumption']}, \n"
103+
out_str += f"Description: {printable['description']}, \n"
91104
out_str += f"End Date: {printable['end_date']}, \n"
92105
out_str += f"Start Date: {printable['start_date']}, \n"
93106
out_str += f"Tax Rate: {printable['tax_rate']}, \n"
94107
out_str += f"Total: {printable['total']}, \n"
108+
out_str += f"Unit of Measure: {printable['unit']}, \n"
95109
out_str += f"Unit Price: {printable['unit_price']}, \n"
96110
return clean_out_string(out_str)

mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class EnergyBillV1MeterDetail(FieldPositionMixin, FieldConfidenceMixin):
1313
meter_type: Optional[str]
1414
"""The type of energy meter."""
1515
unit: Optional[str]
16-
"""The unit of measurement for energy consumption, which can be kW, m³, or L."""
16+
"""The unit of power for energy consumption."""
1717
page_n: int
1818
"""The document page on which the information was found."""
1919

@@ -50,13 +50,13 @@ def to_field_list(self) -> str:
5050
printable = self._printable_values()
5151
out_str: str = f" :Meter Number: {printable['meter_number']}\n"
5252
out_str += f" :Meter Type: {printable['meter_type']}\n"
53-
out_str += f" :Unit of Measure: {printable['unit']}\n"
53+
out_str += f" :Unit of Power: {printable['unit']}\n"
5454
return out_str.rstrip()
5555

5656
def __str__(self) -> str:
5757
"""Default string representation."""
5858
printable = self._printable_values()
5959
out_str: str = f"Meter Number: {printable['meter_number']}, \n"
6060
out_str += f"Meter Type: {printable['meter_type']}, \n"
61-
out_str += f"Unit of Measure: {printable['unit']}, \n"
61+
out_str += f"Unit of Power: {printable['unit']}, \n"
6262
return clean_out_string(out_str)

mindee/product/us/healthcare_card/healthcare_card_v1_document.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class HealthcareCardV1Document(Prediction):
14-
"""Healthcare Card API version 1.0 document data."""
14+
"""Healthcare Card API version 1.1 document data."""
1515

1616
company_name: StringField
1717
"""The name of the company that provides the healthcare plan."""

0 commit comments

Comments
 (0)