chellow 1713275535.0.0__py3-none-any.whl → 1713290435.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.

@@ -180,7 +180,7 @@ def val_to_slots(val):
180
180
  return slots
181
181
 
182
182
 
183
- def col_match(row, pattern, repeats=1):
183
+ def col_find(row, pattern, repeats=1):
184
184
  for i, cell in enumerate(row):
185
185
  txt = cell.value
186
186
  if txt is not None:
@@ -191,10 +191,15 @@ def col_match(row, pattern, repeats=1):
191
191
  else:
192
192
  repeats -= 1
193
193
 
194
- raise BadRequest(
195
- f"Pattern '{pattern}' not found in row "
196
- + ", ".join(str(cell.value) for cell in row)
197
- )
194
+
195
+ def col_match(row, pattern, repeats=1):
196
+ result = col_find(row, pattern, repeats=repeats)
197
+ if result is None:
198
+ raise BadRequest(
199
+ f"Pattern '{pattern}' not found in row "
200
+ + ", ".join(str(cell.value) for cell in row)
201
+ )
202
+ return result
198
203
 
199
204
 
200
205
  def tab_lv_hv(sheet, gsp_rates):
@@ -308,6 +313,8 @@ def tab_ehv(sheet, gsp_rates):
308
313
  llfc_val = get_value(row, col_match(title_row, "llfc", repeats=repeats))
309
314
  llfc = None if llfc_val is None else str(llfc_val).strip()
310
315
  if llfc not in (None, ""):
316
+ band_col = col_find(title_row, "residual")
317
+ band = "" if band_col is None else int(get_decimal(row, band_col))
311
318
  tariffs[llfc] = {
312
319
  "gbp-per-kwh": get_rate(
313
320
  row, col_match(title_row, polarity + " super red")
@@ -321,6 +328,7 @@ def tab_ehv(sheet, gsp_rates):
321
328
  "excess-gbp-per-kva-per-day": get_zero_rate(
322
329
  row, col_match(title_row, polarity + " exce")
323
330
  ),
331
+ "description": f"Designated EHV{band}",
324
332
  }
325
333
 
326
334
  elif state == EHV_BANDS:
chellow/e/system_price.py CHANGED
@@ -11,7 +11,7 @@ import xlrd
11
11
  from zish import loads
12
12
 
13
13
  from chellow.models import Contract, RateScript
14
- from chellow.utils import HH, hh_format, to_ct, to_utc
14
+ from chellow.utils import HH, ct_datetime, hh_format, to_ct, to_utc
15
15
 
16
16
 
17
17
  def key_format(dt):
@@ -61,7 +61,20 @@ def hh(data_source):
61
61
 
62
62
 
63
63
  def elexon_import(sess, log, set_progress, s, scripting_key):
64
- contract = Contract.get_non_core_by_name(sess, "system_price")
64
+ log("Starting to check System Prices.")
65
+ contract_name = "system_price"
66
+ contract = Contract.find_non_core_by_name(sess, contract_name)
67
+ if contract is None:
68
+ contract = Contract.insert_non_core(
69
+ sess,
70
+ contract_name,
71
+ "",
72
+ {"enabled": True},
73
+ to_utc(ct_datetime(1996, 4, 1)),
74
+ None,
75
+ {},
76
+ )
77
+ sess.commit()
65
78
  contract_props = contract.make_properties()
66
79
 
67
80
  if not contract_props.get("enabled", False):
@@ -71,15 +84,13 @@ def elexon_import(sess, log, set_progress, s, scripting_key):
71
84
  )
72
85
  return
73
86
 
74
- log("Starting to check System Prices.")
75
-
76
87
  for rscript in sess.scalars(
77
88
  select(RateScript)
78
89
  .where(RateScript.contract == contract)
79
90
  .order_by(RateScript.start_date.desc())
80
91
  ):
81
92
  ns = loads(rscript.script)
82
- rates = ns["gbp_per_nbp_mwh"]
93
+ rates = ns.get("gbp_per_nbp_mwh", {})
83
94
  if len(rates) == 0:
84
95
  fill_start = rscript.start_date
85
96
  break
@@ -121,11 +132,12 @@ def elexon_import(sess, log, set_progress, s, scripting_key):
121
132
  sp_month = {}
122
133
  sp_months.append(sp_month)
123
134
  ssp_val = ssp_row[col_idx].value
124
- sp_month[hh_date] = {
125
- "run": run_code,
126
- "sbp": sbp_val,
127
- "ssp": ssp_val,
128
- }
135
+ if sp_month is not None:
136
+ sp_month[hh_date] = {
137
+ "run": run_code,
138
+ "sbp": sbp_val,
139
+ "ssp": ssp_val,
140
+ }
129
141
  hh_date += HH
130
142
  log("Successfully extracted data.")
131
143
  last_date = sorted(sp_months[-1].keys())[-1]
chellow/e/tlms.py CHANGED
@@ -12,7 +12,7 @@ from werkzeug.exceptions import BadRequest
12
12
  from zish import dumps, loads
13
13
 
14
14
  from chellow.models import Contract, RateScript
15
- from chellow.utils import HH, hh_format, hh_range, to_ct, to_utc
15
+ from chellow.utils import HH, ct_datetime, hh_format, hh_range, to_ct, to_utc
16
16
 
17
17
 
18
18
  RUNS = ["DF", "RF", "R3", "R2", "R1", "SF", "II"]
@@ -106,7 +106,19 @@ def elexon_import(sess, log, set_progress, s, scripting_key):
106
106
  cache = {"rate_scripts": [], "timestamps": {}}
107
107
  caches = {}
108
108
  log("Starting to check TLMs.")
109
- contract = Contract.get_non_core_by_name(sess, "tlms")
109
+ contract_name = "tlms"
110
+ contract = Contract.find_non_core_by_name(sess, contract_name)
111
+ if contract is None:
112
+ contract = Contract.insert_non_core(
113
+ sess,
114
+ contract_name,
115
+ "",
116
+ {"enabled": True},
117
+ to_utc(ct_datetime(1997, 1, 1)),
118
+ to_utc(ct_datetime(1997, 1, 31, 23, 30)),
119
+ {"tlms": {}},
120
+ )
121
+ sess.commit()
110
122
  contract_props = contract.make_properties()
111
123
  if contract_props.get("enabled", False):
112
124
 
chellow/e/tnuos.py CHANGED
@@ -51,6 +51,11 @@ BAND_LOOKUP = {
51
51
  "Non-Domestic Aggregated Band 4": "LV_NoMIC_4",
52
52
  "Non-Domestic Aggregated No Residual": "LV_NoMIC_1",
53
53
  "Unmetered Supplies": "Unmetered",
54
+ "Designated EHV0": "EHV1",
55
+ "Designated EHV1": "EHV1",
56
+ "Designated EHV2": "EHV2",
57
+ "Designated EHV3": "EHV3",
58
+ "Designated EHV4": "EHV4",
54
59
  }
55
60
 
56
61
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chellow
3
- Version: 1713275535.0.0
3
+ Version: 1713290435.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)
@@ -20,7 +20,7 @@ chellow/e/bsuos.py,sha256=hdP9vnOJSuZl46OAkJeUg1XJYvYIBj4J6Sqce1Hy9Vs,15542
20
20
  chellow/e/ccl.py,sha256=CYeFrg0TNF7Av49nqxa0guA8CMcJhdMpBRmOq8PH6G0,564
21
21
  chellow/e/cfd.py,sha256=V1DTT5XBQbt8hO1gae1u3315fZ4iuYk3XC7J2sUbhKQ,14352
22
22
  chellow/e/computer.py,sha256=YL1JFUYfFW-i9DODfvSnp6gTL_MwIfwoWj1TWtOsxPg,67105
23
- chellow/e/dno_rate_parser.py,sha256=5MYEbcYngh7n6Szn2h9zLTwQKXH-WHKy6c80PYwNLLQ,20983
23
+ chellow/e/dno_rate_parser.py,sha256=OeD1flXsyTH6cdP4jlg2aG8yA46pRxQR3dpd8MvzMOA,21347
24
24
  chellow/e/duos.py,sha256=ISTcNqe9KNjVNM2Qs8IBoQxnmSXOt5W_G7tZxp4T78M,28870
25
25
  chellow/e/elexon.py,sha256=ALhXS9Es7PV0z9ukPbIramn3cf3iLyFi-PMWPSm5iOs,5487
26
26
  chellow/e/energy_management.py,sha256=aXC2qlGt3FAODlNl_frWzVYAQrJLP8FFOiNX3m-QE_Y,12388
@@ -34,9 +34,9 @@ chellow/e/mdd_importer.py,sha256=9GN-at0DC3vOjd-0N2U856O3hInnjkMWWcRfxzQ5DjA,320
34
34
  chellow/e/rcrc.py,sha256=92CA1uIotIHd1epQ_jEPdJKzXqDFV-AoJOJeRO6MEyA,4274
35
35
  chellow/e/ro.py,sha256=dZKZv_9wXSWuwcb3jiKavoD_9ot-PZseNVeEEe0siLo,596
36
36
  chellow/e/scenario.py,sha256=1tUxnvwTzr6cKqiw2wphdv5XDzV6JO6UVYkyQa67vHs,23263
37
- chellow/e/system_price.py,sha256=3cPWohHmmBI9v7fENLBzXQkpAeC3r0s5xV29Nmr6k_E,5839
38
- chellow/e/tlms.py,sha256=kHAy2A2d1Mma7x4GdNDyrzscJd5DpJtDBYiZEg241Dw,8538
39
- chellow/e/tnuos.py,sha256=KoMPJDIXfE4zwhSDuywGF1ooxjTYLVjtF7BkSFm6X24,4158
37
+ chellow/e/system_price.py,sha256=6w5J7bzwFAZubE2zdOFRiS8IIrVP8hkoIOaG2yCt-Ic,6232
38
+ chellow/e/tlms.py,sha256=M33D6YpMixu2KkwSCzDRM3kThLgShg8exp63Obo75l8,8905
39
+ chellow/e/tnuos.py,sha256=XseYztPUsQXNKuBmystO2kzzwAG9ehCZgpGBTdgSk-A,4313
40
40
  chellow/e/triad.py,sha256=S6LEMHvUKhAZe0-yfLIRciYDZ8IKMn1jh1TmmsbQD3s,13588
41
41
  chellow/e/views.py,sha256=ccA5ebQA8Oefwi9L71rbStvHenDMB4rhAu0iRMandLc,213977
42
42
  chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -363,6 +363,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
363
363
  chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
364
364
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
365
365
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
366
- chellow-1713275535.0.0.dist-info/METADATA,sha256=deT9VNOc5rczl9Wi1rWFkM5DP5iaUsrzz3zpqim0Je4,12205
367
- chellow-1713275535.0.0.dist-info/WHEEL,sha256=K0BPUNF1N3kQ9olb8aVEtkObePEjdr2JOLT1N83EVws,87
368
- chellow-1713275535.0.0.dist-info/RECORD,,
366
+ chellow-1713290435.0.0.dist-info/METADATA,sha256=yIG8sLzbptjjWt7VZHhuLjq-OJW23hR_UnDvLmfkE-M,12205
367
+ chellow-1713290435.0.0.dist-info/WHEEL,sha256=K0BPUNF1N3kQ9olb8aVEtkObePEjdr2JOLT1N83EVws,87
368
+ chellow-1713290435.0.0.dist-info/RECORD,,