chellow 1716564585.0.0__py3-none-any.whl → 1716903746.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of chellow might be problematic. Click here for more details.

@@ -179,7 +179,7 @@ def _process_batch_file(sess, batch_file, log_f):
179
179
  raise BadRequest(f"Can't find a parser with the name '{parser_name}'.")
180
180
 
181
181
  parser = imp_mod.Parser(BytesIO(data))
182
- log_f(f"Starting to parse the file with '{parser_name}'.")
182
+ log_f(f"Starting to parse the file {batch_file.filename} with '{parser_name}'.")
183
183
 
184
184
  return parser
185
185
 
@@ -58,29 +58,53 @@ def _handle_0101(headers, pre_record, record):
58
58
  headers["finish_date"] = to_utc(to_ct(parse_date_naive(parts["finish_date"]) - HH))
59
59
 
60
60
 
61
- CHARGE_LOOKUP = {
61
+ CHARGE_UNITS_LOOKUP = {
62
62
  "STDG": "days",
63
63
  "UNIT": "kwh",
64
+ "AVAL": "kva",
65
+ "EXAVAL": "kva",
66
+ "MD": "kw",
67
+ "LOADU": "kw",
68
+ "SAG": "days",
69
+ "TNUOS": "days",
70
+ "REAP": "kvarh",
64
71
  }
65
72
 
66
- ELEMENT_LOOKUP = {"10ANNUAL": "standing", "20RS0108": "0001", "9WANNUAL": "site_fee"}
73
+ ELEMENT_LOOKUP = {
74
+ "10ANNUAL": "standing",
75
+ "20RS0108": "unrestricted",
76
+ "9WANNUAL": "site_fee",
77
+ "20RS0123": "day",
78
+ "30RS0123": "night",
79
+ "90ANNUAL": "duos-fixed",
80
+ "9QANNUAL": "duos-availability",
81
+ "9UANNUAL": "duos-excess-availability",
82
+ "40ANNUAL": "maximum-demand",
83
+ "20ANNUAL": "triad",
84
+ "70ANNUAL": "elexon",
85
+ "10RS0050": "duos-red",
86
+ "20RS0050": "duos-amber",
87
+ "30RS0050": "duos-red",
88
+ "9CANNUAL": "duos-reactive",
89
+ }
67
90
 
68
91
 
69
92
  def _handle_0460(headers, pre_record, record):
70
93
  parts = _chop_record(
71
94
  record,
72
95
  unknown_1=12,
73
- gbp=12,
96
+ unknown_2=12,
74
97
  code=8,
75
98
  quantity=12,
76
- charge=4,
77
- unknown_2=18,
99
+ units=22,
78
100
  rate=16,
79
101
  unknown_date=DATE_LENGTH,
80
- another_gbp=12,
102
+ gbp=12,
81
103
  charge_description=35,
104
+ unknown_3=51,
105
+ days=2,
82
106
  )
83
- units = CHARGE_LOOKUP[parts["charge"]]
107
+ units = CHARGE_UNITS_LOOKUP[parts["units"].strip()]
84
108
  gbp = Decimal(parts["gbp"]) / 100
85
109
  quantity = Decimal(parts["quantity"])
86
110
  rate = Decimal(parts["rate"])
@@ -95,11 +119,13 @@ def _handle_0460(headers, pre_record, record):
95
119
 
96
120
  rates.add(rate)
97
121
  breakdown[f"{element_name}-gbp"] += gbp
122
+ if element_name in ("duos-availability", "duos-excess-availability"):
123
+ breakdown[f"{element_name}-days"] += Decimal(parts["days"])
98
124
 
99
125
 
100
- UNITS_LOOKUP = {"KWH": "kwh"}
126
+ CONSUMPTION_UNITS_LOOKUP = {"KWH": "kwh", "KVA": "kva", "KVARH": "kvarh", "KW": "kw"}
101
127
 
102
- REGISTER_CODE_LOOKUP = {"000001": "0001"}
128
+ REGISTER_CODE_LOOKUP = {"DAY": "00040", "NIGHT": "00206", "SINGLE": "00001"}
103
129
 
104
130
 
105
131
  def _handle_0461(headers, pre_record, record):
@@ -109,7 +135,7 @@ def _handle_0461(headers, pre_record, record):
109
135
  unknown_1=2,
110
136
  prev_read_value=12,
111
137
  pres_read_value=12,
112
- register_code=6,
138
+ coefficient=6,
113
139
  units=6,
114
140
  quantity=12,
115
141
  charge=6,
@@ -117,40 +143,56 @@ def _handle_0461(headers, pre_record, record):
117
143
  pres_read_type=1,
118
144
  mpan_core=13,
119
145
  mpan_top=8,
120
- tariff_code=19,
146
+ register_code=19,
121
147
  pres_read_date=DATE_LENGTH,
122
148
  prev_read_date=DATE_LENGTH,
123
149
  )
124
150
  mpan_core = parts["mpan_core"]
125
151
  headers["mpan_core"] = mpan_core
126
- units = UNITS_LOOKUP[parts["units"].strip()]
152
+ units = CONSUMPTION_UNITS_LOOKUP[parts["units"].strip()]
127
153
  if units == "kwh":
128
154
  headers["kwh"] += Decimal(parts["quantity"])
129
- tpr_code = REGISTER_CODE_LOOKUP[parts["register_code"]]
130
-
131
- headers["reads"].append(
132
- {
133
- "msn": parts["msn"].strip(),
134
- "mpan": f"{parts['mpan_top']} {mpan_core}",
135
- "coefficient": 1,
136
- "units": units,
137
- "tpr_code": tpr_code,
138
- "prev_date": parse_date(parts["prev_read_date"]),
139
- "prev_value": Decimal(parts["prev_read_value"]),
140
- "prev_type_code": parts["prev_read_type"],
141
- "pres_date": parse_date(parts["pres_read_date"]),
142
- "pres_value": Decimal(parts["pres_read_value"]),
143
- "pres_type_code": parts["pres_read_type"],
144
- }
145
- )
155
+
156
+ prev_read_date_str = parts["prev_read_date"].strip()
157
+ if len(prev_read_date_str) > 0:
158
+ tpr_code = REGISTER_CODE_LOOKUP[parts["register_code"].strip()]
159
+
160
+ headers["reads"].append(
161
+ {
162
+ "msn": parts["msn"].strip(),
163
+ "mpan": f"{parts['mpan_top']} {mpan_core}",
164
+ "coefficient": Decimal(parts["coefficient"]),
165
+ "units": units,
166
+ "tpr_code": tpr_code,
167
+ "prev_date": parse_date(parts["prev_read_date"]),
168
+ "prev_value": Decimal(parts["prev_read_value"]),
169
+ "prev_type_code": parts["prev_read_type"],
170
+ "pres_date": parse_date(parts["pres_read_date"]),
171
+ "pres_value": Decimal(parts["pres_read_value"]),
172
+ "pres_type_code": parts["pres_read_type"],
173
+ }
174
+ )
146
175
 
147
176
 
148
177
  def _handle_0470(headers, pre_record, record):
149
178
  pass
150
179
 
151
180
 
181
+ def _handle_1455(headers, pre_record, record):
182
+ parts = _chop_record(record, ccl_kwh=13, unknown_1=8, ccl_rate=15, ccl_gbp=13)
183
+ bd = headers["breakdown"]
184
+ bd["ccl_kwh"] += Decimal(parts["ccl_kwh"])
185
+ if "ccl_rate" in bd:
186
+ ccl_rates = bd["ccl_rate"]
187
+ else:
188
+ ccl_rates = bd["ccl_rate"] = set()
189
+
190
+ ccl_rates.add(Decimal(parts["ccl_rate"]) / Decimal("100"))
191
+ bd["ccl_gbp"] += Decimal(parts["ccl_gbp"]) / Decimal("100")
192
+
193
+
152
194
  def _handle_1460(headers, pre_record, record):
153
- parts = _chop_record(record, unknown_1=1, net=12, vat_rate=5, vat=12)
195
+ parts = _chop_record(record, unknown_1=1, net=12, vat_rate=6, vat=12)
154
196
  net = Decimal(parts["net"]) / Decimal(100)
155
197
  vat_rate = int(Decimal(parts["vat_rate"]))
156
198
  vat = Decimal(parts["vat"]) / Decimal(100)
@@ -170,13 +212,15 @@ def _handle_1500(headers, pre_record, record):
170
212
  record,
171
213
  unknown_1=8,
172
214
  unknown_2=10,
173
- net=10,
174
215
  unknown_3=10,
175
- unknown_4=20,
176
- vat=10,
177
- unknown_5=10,
178
- unknown_6=20,
216
+ unknown_4=10,
217
+ unknown_5=20,
218
+ unknown_6=10,
219
+ unknown_7=10,
220
+ unknown_8=20,
179
221
  gross=12,
222
+ net=12,
223
+ vat=12,
180
224
  )
181
225
  return {
182
226
  "bill_type_code": "N",
@@ -187,9 +231,9 @@ def _handle_1500(headers, pre_record, record):
187
231
  "start_date": headers["start_date"],
188
232
  "finish_date": headers["finish_date"],
189
233
  "kwh": headers["kwh"],
190
- "net": Decimal(parts["net"]),
191
- "vat": Decimal(parts["vat"]),
192
- "gross": Decimal(parts["gross"]),
234
+ "net": Decimal("0.00") + Decimal(parts["net"]) / Decimal("100"),
235
+ "vat": Decimal("0.00") + Decimal(parts["vat"]) / Decimal("100"),
236
+ "gross": Decimal("0.00") + Decimal(parts["gross"]) / Decimal("100"),
193
237
  "breakdown": headers["breakdown"],
194
238
  "reads": headers["reads"],
195
239
  }
@@ -212,6 +256,7 @@ LINE_HANDLERS = {
212
256
  "0460": _handle_0460,
213
257
  "0461": _handle_0461,
214
258
  "0470": _handle_0470,
259
+ "1455": _handle_1455,
215
260
  "1460": _handle_1460,
216
261
  "1500": _handle_1500,
217
262
  "2000": _handle_2000,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chellow
3
- Version: 1716564585.0.0
3
+ Version: 1716903746.0.0
4
4
  Summary: Web Application for checking UK energy bills.
5
5
  Project-URL: Homepage, https://github.com/WessexWater/chellow
6
6
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
@@ -14,7 +14,7 @@ chellow/utils.py,sha256=32qPWEGzCPKPhSM7ztpzcR6ZG74sVZanScDIdK50Rq4,19308
14
14
  chellow/views.py,sha256=eDvTQM_PUqRvrCQvBdlF5q7MEs7w2yJmRjcC8WDbHtE,79584
15
15
  chellow/e/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  chellow/e/aahedc.py,sha256=d2usudp7KYWpU6Pk3fal5EQ47EbvkvKeaFGylnb3NWw,606
17
- chellow/e/bill_importer.py,sha256=y1bpn49xDwltj0PRFowWsjAVamcD8eyxUbCTdGxEZiE,7389
17
+ chellow/e/bill_importer.py,sha256=7UcnqNlKbJc2GhW9gy8sDp9GuqambJVpZLvbafOZztA,7411
18
18
  chellow/e/bmarketidx.py,sha256=0JCBBnP3xfLq2eFjXO_u-gzHyTizab4Pp6PRK6OZLcw,7134
19
19
  chellow/e/bsuos.py,sha256=hdP9vnOJSuZl46OAkJeUg1XJYvYIBj4J6Sqce1Hy9Vs,15542
20
20
  chellow/e/ccl.py,sha256=30dh_SvlgzsTQPPAJNZWILaMvbeDsv9-P-S1JxS5_SQ,3184
@@ -51,7 +51,7 @@ chellow/e/bill_parsers/gdf_csv.py,sha256=ZfK3Oc6oP28p_P9DIevLNB_zW2WLcEJ3Lvb1gL3
51
51
  chellow/e/bill_parsers/haven_csv.py,sha256=0uENq8IgVNqdxfBQMBxLTSZWCOuDHXZC0xzk52SbfyE,13652
52
52
  chellow/e/bill_parsers/haven_edi.py,sha256=YGPHRxPOhje9s32jqPHHELni2tooOYj3cMC_qaZVPq4,16107
53
53
  chellow/e/bill_parsers/haven_edi_tprs.py,sha256=ZVX9CCqUybsot_Z0BEOJPvl9x5kSr7fEWyuJXvZDcz4,11841
54
- chellow/e/bill_parsers/mm.py,sha256=b4Tzil_iXyKGvJSSbmMtBwH-4oiwIZthnvueU7CxNwg,6875
54
+ chellow/e/bill_parsers/mm.py,sha256=DEy-W-Z03TdfUjtFUNk48h5nEAaXKV3etfrPZ-z001Q,8494
55
55
  chellow/e/bill_parsers/nonsettlement_dc_stark_xlsx.py,sha256=yogXTuQHGRL7IiqvRWr2C9V24ez1j9Yx0128UygPE_k,4723
56
56
  chellow/e/bill_parsers/settlement_dc_stark_xlsx.py,sha256=gKeYMdUO4bVycV8n1lWs5AIfF3bHZLkM6tkasD4rhHs,6239
57
57
  chellow/e/bill_parsers/sse_edi.py,sha256=L85DOfNkqexeEIEr8pCBn_2sHJI-zEaw6cogpE3YyYM,15204
@@ -364,6 +364,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
364
364
  chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
365
365
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
366
366
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
367
- chellow-1716564585.0.0.dist-info/METADATA,sha256=xaQbUGAclcjTkpSWGRS8X8pIe8pSo17WT6dFKZX4nwE,12205
368
- chellow-1716564585.0.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
369
- chellow-1716564585.0.0.dist-info/RECORD,,
367
+ chellow-1716903746.0.0.dist-info/METADATA,sha256=1b3az19NrZfzrNS1rPZPOjvDnuejOViqXe0ubM4A0-Q,12205
368
+ chellow-1716903746.0.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
369
+ chellow-1716903746.0.0.dist-info/RECORD,,