Skip to content

Commit 980fe9a

Browse files
✨ bump FR EnergyBillV1 to V1.2 & US HealthcareCardV1 to V1.1 (#338)
1 parent 5e2d6c9 commit 980fe9a

File tree

7 files changed

+48
-11
lines changed

7 files changed

+48
-11
lines changed

docs/energy_bill_fra_v1.md

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

152152
A `EnergyBillV1EnergyUsage` implements the following attributes:
153153

154+
* `consumption` (number): The price per unit of energy consumed.
154155
* `description` (string): Description or details of the energy usage.
155156
* `endDate` (string): The end date of the energy usage.
156157
* `startDate` (string): The start date of the energy usage.
157158
* `taxRate` (number): The rate of tax applied to the total cost.
158159
* `total` (number): The total cost of energy consumed.
160+
* `unit` (string): The unit of measurement for energy consumption.
161+
162+
#### Possible values include:
163+
- kWh
164+
- m3
165+
- L
166+
159167
* `unitPrice` (number): The price per unit of energy consumed.
160168
Fields which are specific to this product; they are not used in any other product.
161169

@@ -173,7 +181,7 @@ A `EnergyBillV1MeterDetail` implements the following attributes:
173181
- water
174182
- `null`
175183

176-
* `unit` (string): The unit of measurement for energy consumption, which can be kW, m³, or L.
184+
* `unit` (string): The unit of power for energy consumption.
177185
Fields which are specific to this product; they are not used in any other product.
178186

179187
### Subscription Field

src/cliProducts.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,5 +310,3 @@ export const CLI_COMMAND_CONFIG = new Map<string, ProductConfig>([
310310
},
311311
],
312312
]);
313-
314-

src/product/fr/energyBill/energyBillV1Document.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
} from "../../../parsing/standard";
1717

1818
/**
19-
* Energy Bill API version 1.0 document data.
19+
* Energy Bill API version 1.2 document data.
2020
*/
2121
export class EnergyBillV1Document implements Prediction {
2222
/** The unique identifier associated with a specific contract. */
@@ -150,13 +150,15 @@ export class EnergyBillV1Document implements Prediction {
150150
}
151151
let energyUsageSummary:string = "";
152152
if (this.energyUsage && this.energyUsage.length > 0) {
153-
const energyUsageColSizes:number[] = [38, 12, 12, 10, 11, 12];
153+
const energyUsageColSizes:number[] = [13, 38, 12, 12, 10, 11, 17, 12];
154154
energyUsageSummary += "\n" + lineSeparator(energyUsageColSizes, "-") + "\n ";
155+
energyUsageSummary += "| Consumption ";
155156
energyUsageSummary += "| Description ";
156157
energyUsageSummary += "| End Date ";
157158
energyUsageSummary += "| Start Date ";
158159
energyUsageSummary += "| Tax Rate ";
159160
energyUsageSummary += "| Total ";
161+
energyUsageSummary += "| Unit of Measure ";
160162
energyUsageSummary += "| Unit Price ";
161163
energyUsageSummary += "|\n" + lineSeparator(energyUsageColSizes, "=");
162164
energyUsageSummary += this.energyUsage.map(

src/product/fr/energyBill/energyBillV1EnergyUsage.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { Polygon } from "../../../geometry";
66
* Details of energy consumption.
77
*/
88
export class EnergyBillV1EnergyUsage {
9+
/** The price per unit of energy consumed. */
10+
consumption: number | null;
911
/** Description or details of the energy usage. */
1012
description: string | null;
1113
/** The end date of the energy usage. */
@@ -16,6 +18,8 @@ export class EnergyBillV1EnergyUsage {
1618
taxRate: number | null;
1719
/** The total cost of energy consumed. */
1820
total: number | null;
21+
/** The unit of measurement for energy consumption. */
22+
unit: string | null;
1923
/** The price per unit of energy consumed. */
2024
unitPrice: number | null;
2125
/** Confidence score */
@@ -29,6 +33,15 @@ export class EnergyBillV1EnergyUsage {
2933
polygon: Polygon = [];
3034

3135
constructor({ prediction = {} }: StringDict) {
36+
if (
37+
prediction["consumption"] !== undefined &&
38+
prediction["consumption"] !== null &&
39+
!isNaN(prediction["consumption"])
40+
) {
41+
this.consumption = +parseFloat(prediction["consumption"]);
42+
} else {
43+
this.consumption = null;
44+
}
3245
this.description = prediction["description"];
3346
this.endDate = prediction["end_date"];
3447
this.startDate = prediction["start_date"];
@@ -50,6 +63,7 @@ export class EnergyBillV1EnergyUsage {
5063
} else {
5164
this.total = null;
5265
}
66+
this.unit = prediction["unit"];
5367
if (
5468
prediction["unit_price"] !== undefined &&
5569
prediction["unit_price"] !== null &&
@@ -71,6 +85,8 @@ export class EnergyBillV1EnergyUsage {
7185
*/
7286
#printableValues() {
7387
return {
88+
consumption:
89+
this.consumption !== undefined ? floatToString(this.consumption) : "",
7490
description: this.description ?
7591
this.description.length <= 36 ?
7692
cleanSpecialChars(this.description) :
@@ -88,6 +104,11 @@ export class EnergyBillV1EnergyUsage {
88104
"",
89105
taxRate: this.taxRate !== undefined ? floatToString(this.taxRate) : "",
90106
total: this.total !== undefined ? floatToString(this.total) : "",
107+
unit: this.unit ?
108+
this.unit.length <= 15 ?
109+
cleanSpecialChars(this.unit) :
110+
cleanSpecialChars(this.unit).slice(0, 12) + "..." :
111+
"",
91112
unitPrice: this.unitPrice !== undefined ? floatToString(this.unitPrice) : "",
92113
};
93114
}
@@ -98,7 +119,9 @@ export class EnergyBillV1EnergyUsage {
98119
toString(): string {
99120
const printable = this.#printableValues();
100121
return (
101-
"Description: " +
122+
"Consumption: " +
123+
printable.consumption +
124+
", Description: " +
102125
printable.description +
103126
", End Date: " +
104127
printable.endDate +
@@ -108,6 +131,8 @@ export class EnergyBillV1EnergyUsage {
108131
printable.taxRate +
109132
", Total: " +
110133
printable.total +
134+
", Unit of Measure: " +
135+
printable.unit +
111136
", Unit Price: " +
112137
printable.unitPrice
113138
);
@@ -120,6 +145,8 @@ export class EnergyBillV1EnergyUsage {
120145
const printable = this.#printableValues();
121146
return (
122147
"| " +
148+
printable.consumption.padEnd(11) +
149+
" | " +
123150
printable.description.padEnd(36) +
124151
" | " +
125152
printable.endDate.padEnd(10) +
@@ -130,6 +157,8 @@ export class EnergyBillV1EnergyUsage {
130157
" | " +
131158
printable.total.padEnd(9) +
132159
" | " +
160+
printable.unit.padEnd(15) +
161+
" | " +
133162
printable.unitPrice.padEnd(10) +
134163
" |"
135164
);

src/product/fr/energyBill/energyBillV1MeterDetail.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class EnergyBillV1MeterDetail {
99
meterNumber: string | null;
1010
/** The type of energy meter. */
1111
meterType: string | null;
12-
/** The unit of measurement for energy consumption, which can be kW, m³, or L. */
12+
/** The unit of power for energy consumption. */
1313
unit: string | null;
1414
/** Confidence score */
1515
confidence: number = 0.0;
@@ -53,7 +53,7 @@ export class EnergyBillV1MeterDetail {
5353
printable.meterNumber +
5454
", Meter Type: " +
5555
printable.meterType +
56-
", Unit of Measure: " +
56+
", Unit of Power: " +
5757
printable.unit
5858
);
5959
}
@@ -66,6 +66,6 @@ export class EnergyBillV1MeterDetail {
6666
return `
6767
:Meter Number: ${printable.meterNumber}
6868
:Meter Type: ${printable.meterType}
69-
:Unit of Measure: ${printable.unit}`.trimEnd();
69+
:Unit of Power: ${printable.unit}`.trimEnd();
7070
}
7171
}

src/product/us/healthcareCard/healthcareCardV1Document.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { HealthcareCardV1Copay } from "./healthcareCardV1Copay";
77
import { DateField, StringField } from "../../../parsing/standard";
88

99
/**
10-
* Healthcare Card API version 1.0 document data.
10+
* Healthcare Card API version 1.1 document data.
1111
*/
1212
export class HealthcareCardV1Document implements Prediction {
1313
/** The name of the company that provides the healthcare plan. */

0 commit comments

Comments
 (0)