chellow 1713268896.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.
- chellow/e/dno_rate_parser.py +13 -5
- chellow/e/system_price.py +22 -10
- chellow/e/tlms.py +14 -2
- chellow/e/tnuos.py +5 -0
- chellow/general_import.py +7 -3
- chellow/models.py +10 -56
- {chellow-1713268896.0.0.dist-info → chellow-1713290435.0.0.dist-info}/METADATA +1 -1
- {chellow-1713268896.0.0.dist-info → chellow-1713290435.0.0.dist-info}/RECORD +9 -9
- {chellow-1713268896.0.0.dist-info → chellow-1713290435.0.0.dist-info}/WHEEL +0 -0
chellow/e/dno_rate_parser.py
CHANGED
|
@@ -180,7 +180,7 @@ def val_to_slots(val):
|
|
|
180
180
|
return slots
|
|
181
181
|
|
|
182
182
|
|
|
183
|
-
def
|
|
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
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
-
|
|
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
|
|
chellow/general_import.py
CHANGED
|
@@ -1255,8 +1255,12 @@ def general_import_supply(sess, action, vals, args):
|
|
|
1255
1255
|
cop = Cop.get_by_code(sess, cop_code)
|
|
1256
1256
|
comm_code = add_arg(args, "Comms Type", vals, 16)
|
|
1257
1257
|
comm = Comm.get_by_code(sess, comm_code)
|
|
1258
|
-
|
|
1259
|
-
|
|
1258
|
+
ssc_code_str = add_arg(args, "Standard Settlement Configuration", vals, 17)
|
|
1259
|
+
if len(ssc_code_str) > 0:
|
|
1260
|
+
ssc = Ssc.get_by_code(sess, ssc_code_str, start_date)
|
|
1261
|
+
ssc_code = ssc.code
|
|
1262
|
+
else:
|
|
1263
|
+
ssc_code = None
|
|
1260
1264
|
energisation_status_code = add_arg(args, "Energisation Status", vals, 18)
|
|
1261
1265
|
energisation_status = EnergisationStatus.get_by_code(
|
|
1262
1266
|
sess, energisation_status_code
|
|
@@ -1340,7 +1344,7 @@ def general_import_supply(sess, action, vals, args):
|
|
|
1340
1344
|
mtc_code,
|
|
1341
1345
|
cop,
|
|
1342
1346
|
comm,
|
|
1343
|
-
|
|
1347
|
+
ssc_code,
|
|
1344
1348
|
energisation_status,
|
|
1345
1349
|
properties,
|
|
1346
1350
|
imp_mpan_core,
|
chellow/models.py
CHANGED
|
@@ -2845,44 +2845,21 @@ class MtcSsc(Base, PersistentClass):
|
|
|
2845
2845
|
mtc_llfc_sscs = relationship("MtcLlfcSsc", backref="mtc_ssc")
|
|
2846
2846
|
__table_args__ = (UniqueConstraint("mtc_participant_id", "ssc_id", "valid_from"),)
|
|
2847
2847
|
|
|
2848
|
-
def __init__(
|
|
2849
|
-
self,
|
|
2850
|
-
mtc_participant,
|
|
2851
|
-
ssc,
|
|
2852
|
-
valid_from,
|
|
2853
|
-
valid_to,
|
|
2854
|
-
):
|
|
2848
|
+
def __init__(self, mtc_participant, ssc, valid_from, valid_to):
|
|
2855
2849
|
self.mtc_participant = mtc_participant
|
|
2856
2850
|
self.ssc = ssc
|
|
2857
2851
|
self.valid_from = valid_from
|
|
2858
|
-
self.update(
|
|
2859
|
-
valid_to,
|
|
2860
|
-
)
|
|
2852
|
+
self.update(valid_to)
|
|
2861
2853
|
|
|
2862
|
-
def update(
|
|
2863
|
-
self,
|
|
2864
|
-
valid_to,
|
|
2865
|
-
):
|
|
2854
|
+
def update(self, valid_to):
|
|
2866
2855
|
self.valid_to = valid_to
|
|
2867
2856
|
|
|
2868
2857
|
if hh_after(self.valid_from, valid_to):
|
|
2869
2858
|
raise BadRequest("The valid_from date can't be after the valid_to date.")
|
|
2870
2859
|
|
|
2871
2860
|
@classmethod
|
|
2872
|
-
def insert(
|
|
2873
|
-
cls,
|
|
2874
|
-
sess,
|
|
2875
|
-
mtc_participant,
|
|
2876
|
-
ssc,
|
|
2877
|
-
valid_from,
|
|
2878
|
-
valid_to,
|
|
2879
|
-
):
|
|
2880
|
-
mtc_ssc = cls(
|
|
2881
|
-
mtc_participant,
|
|
2882
|
-
ssc,
|
|
2883
|
-
valid_from,
|
|
2884
|
-
valid_to,
|
|
2885
|
-
)
|
|
2861
|
+
def insert(cls, sess, mtc_participant, ssc, valid_from, valid_to):
|
|
2862
|
+
mtc_ssc = cls(mtc_participant, ssc, valid_from, valid_to)
|
|
2886
2863
|
sess.add(mtc_ssc)
|
|
2887
2864
|
sess.flush()
|
|
2888
2865
|
return mtc_ssc
|
|
@@ -2924,44 +2901,21 @@ class MtcLlfcSsc(Base, PersistentClass):
|
|
|
2924
2901
|
mtc_llfc_ssc_pcs = relationship("MtcLlfcSscPc", backref="mtc_llfc_ssc")
|
|
2925
2902
|
__table_args__ = (UniqueConstraint("mtc_ssc_id", "llfc_id", "valid_from"),)
|
|
2926
2903
|
|
|
2927
|
-
def __init__(
|
|
2928
|
-
self,
|
|
2929
|
-
mtc_ssc,
|
|
2930
|
-
llfc,
|
|
2931
|
-
valid_from,
|
|
2932
|
-
valid_to,
|
|
2933
|
-
):
|
|
2904
|
+
def __init__(self, mtc_ssc, llfc, valid_from, valid_to):
|
|
2934
2905
|
self.mtc_ssc = mtc_ssc
|
|
2935
2906
|
self.llfc = llfc
|
|
2936
2907
|
self.valid_from = valid_from
|
|
2937
|
-
self.update(
|
|
2938
|
-
valid_to,
|
|
2939
|
-
)
|
|
2908
|
+
self.update(valid_to)
|
|
2940
2909
|
|
|
2941
|
-
def update(
|
|
2942
|
-
self,
|
|
2943
|
-
valid_to,
|
|
2944
|
-
):
|
|
2910
|
+
def update(self, valid_to):
|
|
2945
2911
|
self.valid_to = valid_to
|
|
2946
2912
|
|
|
2947
2913
|
if hh_after(self.valid_from, valid_to):
|
|
2948
2914
|
raise BadRequest("The valid_from date can't be after the valid_to date.")
|
|
2949
2915
|
|
|
2950
2916
|
@classmethod
|
|
2951
|
-
def insert(
|
|
2952
|
-
cls,
|
|
2953
|
-
sess,
|
|
2954
|
-
mtc_ssc,
|
|
2955
|
-
llfc,
|
|
2956
|
-
valid_from,
|
|
2957
|
-
valid_to,
|
|
2958
|
-
):
|
|
2959
|
-
mtc_llfc_ssc = cls(
|
|
2960
|
-
mtc_ssc,
|
|
2961
|
-
llfc,
|
|
2962
|
-
valid_from,
|
|
2963
|
-
valid_to,
|
|
2964
|
-
)
|
|
2917
|
+
def insert(cls, sess, mtc_ssc, llfc, valid_from, valid_to):
|
|
2918
|
+
mtc_llfc_ssc = cls(mtc_ssc, llfc, valid_from, valid_to)
|
|
2965
2919
|
sess.add(mtc_llfc_ssc)
|
|
2966
2920
|
sess.flush()
|
|
2967
2921
|
return mtc_llfc_ssc
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: chellow
|
|
3
|
-
Version:
|
|
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)
|
|
@@ -4,8 +4,8 @@ chellow/bank_holidays.py,sha256=T_utYMwe_g1dz5X-aOTdIPryg49SvB7QsWM1yphlqG8,4423
|
|
|
4
4
|
chellow/commands.py,sha256=ESBe9ZWj1c3vdZgqMZ9gFvYAB3hRag2R1PzOwuw9yFo,1302
|
|
5
5
|
chellow/dloads.py,sha256=5SmP-0QPK6xCkd_wjIWh_8FAzN5OxNHCzyEQ1Xb-Y-M,5256
|
|
6
6
|
chellow/edi_lib.py,sha256=het3R0DBGtXEo-Sy1zvXQuX9EWQ1X6Y33G4l1hYYuds,51859
|
|
7
|
-
chellow/general_import.py,sha256=
|
|
8
|
-
chellow/models.py,sha256=
|
|
7
|
+
chellow/general_import.py,sha256=Su_JW28Wb2fG3x8fAbNmvB_YAEPieO_arhlhp31DHD8,65369
|
|
8
|
+
chellow/models.py,sha256=POIL0dfwZFuqht7xHZaE6KJ7fk4kxMZC2aXzgg5kEFY,236921
|
|
9
9
|
chellow/national_grid.py,sha256=uxcv0qisHPyzw9AVIYPzsRqwt2XPAcZL-SBR12qcrS0,4364
|
|
10
10
|
chellow/proxy.py,sha256=cVXIktPlX3tQ1BYcwxq0nJXKE6r3DtFTtfFHPq55HaM,1351
|
|
11
11
|
chellow/rate_server.py,sha256=vNuKzlr0lkAzZ4zG7zboStoo92_6iLKAxbw1yZ-ucII,5626
|
|
@@ -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=
|
|
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=
|
|
38
|
-
chellow/e/tlms.py,sha256=
|
|
39
|
-
chellow/e/tnuos.py,sha256=
|
|
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-
|
|
367
|
-
chellow-
|
|
368
|
-
chellow-
|
|
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,,
|
|
File without changes
|