diff --git a/docs/extras/guide/energy_bill_fra_v1.md b/docs/extras/guide/energy_bill_fra_v1.md index cfc7d236..e4535683 100644 --- a/docs/extras/guide/energy_bill_fra_v1.md +++ b/docs/extras/guide/energy_bill_fra_v1.md @@ -147,11 +147,19 @@ Details of energy consumption. A `EnergyBillV1EnergyUsage` implements the following attributes: +* **consumption** (`float`): The price per unit of energy consumed. * **description** (`str`): Description or details of the energy usage. * **end_date** (`str`): The end date of the energy usage. * **start_date** (`str`): The start date of the energy usage. * **tax_rate** (`float`): The rate of tax applied to the total cost. * **total** (`float`): The total cost of energy consumed. +* **unit** (`str`): The unit of measurement for energy consumption. + +#### Possible values include: + - kWh + - m3 + - L + * **unit_price** (`float`): The price per unit of energy consumed. Fields which are specific to this product; they are not used in any other product. @@ -169,7 +177,7 @@ A `EnergyBillV1MeterDetail` implements the following attributes: - water - None -* **unit** (`str`): The unit of measurement for energy consumption, which can be kW, m³, or L. +* **unit** (`str`): The unit of power for energy consumption. Fields which are specific to this product; they are not used in any other product. ### Subscription Field diff --git a/mindee/product/fr/energy_bill/energy_bill_v1_document.py b/mindee/product/fr/energy_bill/energy_bill_v1_document.py index 1fcff58e..a663b3fa 100644 --- a/mindee/product/fr/energy_bill/energy_bill_v1_document.py +++ b/mindee/product/fr/energy_bill/energy_bill_v1_document.py @@ -27,7 +27,7 @@ class EnergyBillV1Document(Prediction): - """Energy Bill API version 1.0 document data.""" + """Energy Bill API version 1.2 document data.""" contract_id: StringField """The unique identifier associated with a specific contract.""" @@ -164,11 +164,13 @@ def _subscription_to_str(self) -> str: @staticmethod def _energy_usage_separator(char: str) -> str: out_str = " " + out_str += f"+{char * 13}" out_str += f"+{char * 38}" out_str += f"+{char * 12}" out_str += f"+{char * 12}" out_str += f"+{char * 10}" out_str += f"+{char * 11}" + out_str += f"+{char * 17}" out_str += f"+{char * 12}" return out_str + "+" @@ -181,11 +183,13 @@ def _energy_usage_to_str(self) -> str: ) out_str = "" out_str += f"\n{self._energy_usage_separator('-')}\n " + out_str += " | Consumption" out_str += " | Description " out_str += " | End Date " out_str += " | Start Date" out_str += " | Tax Rate" out_str += " | Total " + out_str += " | Unit of Measure" out_str += " | Unit Price" out_str += f" |\n{self._energy_usage_separator('=')}" out_str += f"\n {lines}" diff --git a/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.py b/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.py index 0c9472d1..e218d41f 100644 --- a/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.py +++ b/mindee/product/fr/energy_bill/energy_bill_v1_energy_usage.py @@ -13,6 +13,8 @@ class EnergyBillV1EnergyUsage(FieldPositionMixin, FieldConfidenceMixin): """Details of energy consumption.""" + consumption: Optional[float] + """The price per unit of energy consumed.""" description: Optional[str] """Description or details of the energy usage.""" end_date: Optional[str] @@ -23,6 +25,8 @@ class EnergyBillV1EnergyUsage(FieldPositionMixin, FieldConfidenceMixin): """The rate of tax applied to the total cost.""" total: Optional[float] """The total cost of energy consumed.""" + unit: Optional[str] + """The unit of measurement for energy consumption.""" unit_price: Optional[float] """The price per unit of energy consumed.""" page_n: int @@ -44,53 +48,63 @@ def __init__( else: self.page_n = page_id + self.consumption = to_opt_float(raw_prediction, "consumption") self.description = raw_prediction["description"] self.end_date = raw_prediction["end_date"] self.start_date = raw_prediction["start_date"] self.tax_rate = to_opt_float(raw_prediction, "tax_rate") self.total = to_opt_float(raw_prediction, "total") + self.unit = raw_prediction["unit"] self.unit_price = to_opt_float(raw_prediction, "unit_price") def _printable_values(self) -> Dict[str, str]: """Return values for printing.""" out_dict: Dict[str, str] = {} + out_dict["consumption"] = float_to_string(self.consumption) out_dict["description"] = format_for_display(self.description) out_dict["end_date"] = format_for_display(self.end_date) out_dict["start_date"] = format_for_display(self.start_date) out_dict["tax_rate"] = float_to_string(self.tax_rate) out_dict["total"] = float_to_string(self.total) + out_dict["unit"] = format_for_display(self.unit) out_dict["unit_price"] = float_to_string(self.unit_price) return out_dict def _table_printable_values(self) -> Dict[str, str]: """Return values for printing inside an RST table.""" out_dict: Dict[str, str] = {} + out_dict["consumption"] = float_to_string(self.consumption) out_dict["description"] = format_for_display(self.description, 36) out_dict["end_date"] = format_for_display(self.end_date, 10) out_dict["start_date"] = format_for_display(self.start_date, None) out_dict["tax_rate"] = float_to_string(self.tax_rate) out_dict["total"] = float_to_string(self.total) + out_dict["unit"] = format_for_display(self.unit, None) out_dict["unit_price"] = float_to_string(self.unit_price) return out_dict def to_table_line(self) -> str: """Output in a format suitable for inclusion in an rST table.""" printable = self._table_printable_values() - out_str: str = f"| {printable['description']:<36} | " + out_str: str = f"| {printable['consumption']:<11} | " + out_str += f"{printable['description']:<36} | " out_str += f"{printable['end_date']:<10} | " out_str += f"{printable['start_date']:<10} | " out_str += f"{printable['tax_rate']:<8} | " out_str += f"{printable['total']:<9} | " + out_str += f"{printable['unit']:<15} | " out_str += f"{printable['unit_price']:<10} | " return clean_out_string(out_str) def __str__(self) -> str: """Default string representation.""" printable = self._printable_values() - out_str: str = f"Description: {printable['description']}, \n" + out_str: str = f"Consumption: {printable['consumption']}, \n" + out_str += f"Description: {printable['description']}, \n" out_str += f"End Date: {printable['end_date']}, \n" out_str += f"Start Date: {printable['start_date']}, \n" out_str += f"Tax Rate: {printable['tax_rate']}, \n" out_str += f"Total: {printable['total']}, \n" + out_str += f"Unit of Measure: {printable['unit']}, \n" out_str += f"Unit Price: {printable['unit_price']}, \n" return clean_out_string(out_str) diff --git a/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.py b/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.py index c1273c11..4d4c160b 100644 --- a/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.py +++ b/mindee/product/fr/energy_bill/energy_bill_v1_meter_detail.py @@ -13,7 +13,7 @@ class EnergyBillV1MeterDetail(FieldPositionMixin, FieldConfidenceMixin): meter_type: Optional[str] """The type of energy meter.""" unit: Optional[str] - """The unit of measurement for energy consumption, which can be kW, m³, or L.""" + """The unit of power for energy consumption.""" page_n: int """The document page on which the information was found.""" @@ -50,7 +50,7 @@ def to_field_list(self) -> str: printable = self._printable_values() out_str: str = f" :Meter Number: {printable['meter_number']}\n" out_str += f" :Meter Type: {printable['meter_type']}\n" - out_str += f" :Unit of Measure: {printable['unit']}\n" + out_str += f" :Unit of Power: {printable['unit']}\n" return out_str.rstrip() def __str__(self) -> str: @@ -58,5 +58,5 @@ def __str__(self) -> str: printable = self._printable_values() out_str: str = f"Meter Number: {printable['meter_number']}, \n" out_str += f"Meter Type: {printable['meter_type']}, \n" - out_str += f"Unit of Measure: {printable['unit']}, \n" + out_str += f"Unit of Power: {printable['unit']}, \n" return clean_out_string(out_str) diff --git a/mindee/product/us/healthcare_card/healthcare_card_v1_document.py b/mindee/product/us/healthcare_card/healthcare_card_v1_document.py index 25e51f19..9e73e3d9 100644 --- a/mindee/product/us/healthcare_card/healthcare_card_v1_document.py +++ b/mindee/product/us/healthcare_card/healthcare_card_v1_document.py @@ -11,7 +11,7 @@ class HealthcareCardV1Document(Prediction): - """Healthcare Card API version 1.0 document data.""" + """Healthcare Card API version 1.1 document data.""" company_name: StringField """The name of the company that provides the healthcare plan.""" diff --git a/tests/data b/tests/data index 415f6bf4..01336a09 160000 --- a/tests/data +++ b/tests/data @@ -1 +1 @@ -Subproject commit 415f6bf4a13f38af2776cbe2222fdfab92f41ee5 +Subproject commit 01336a096b6e31d30668afdb86b3f677d8ed93d0