chellow 1759823276.0.0__py3-none-any.whl → 1760028799.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/lcc.py
CHANGED
|
@@ -46,7 +46,7 @@ def run_import(sess, log, set_progress):
|
|
|
46
46
|
s = requests.Session()
|
|
47
47
|
s.verify = False
|
|
48
48
|
|
|
49
|
-
for mod_name in ("chellow.e.cfd",):
|
|
49
|
+
for mod_name in ("chellow.e.cfd", "chellow.e.rab"):
|
|
50
50
|
mod = import_module(mod_name)
|
|
51
51
|
mod.lcc_import(sess, log, set_progress, s)
|
|
52
52
|
|
chellow/e/rab.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
from datetime import datetime as Datetime
|
|
2
|
+
from decimal import Decimal
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
from sqlalchemy import select
|
|
6
|
+
|
|
7
|
+
from chellow.e.lcc import api_records
|
|
8
|
+
from chellow.models import Contract, RateScript
|
|
9
|
+
from chellow.utils import ct_datetime, to_ct, to_utc
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def hh(data_source):
|
|
13
|
+
try:
|
|
14
|
+
rab_cache = data_source.caches["rab"]
|
|
15
|
+
except KeyError:
|
|
16
|
+
rab_cache = data_source.caches["rab"] = {}
|
|
17
|
+
|
|
18
|
+
for h in data_source.hh_data:
|
|
19
|
+
try:
|
|
20
|
+
h["rab"] = rab_cache[h["start-date"]]
|
|
21
|
+
except KeyError:
|
|
22
|
+
h_start = h["start-date"]
|
|
23
|
+
rate_str = data_source.non_core_rate("rab_forecast_ilr_tra", h_start)[
|
|
24
|
+
"record"
|
|
25
|
+
]["Interim_Levy_Rate_GBP_MWh"]
|
|
26
|
+
if rate_str == "":
|
|
27
|
+
base_rate_dec = Decimal("0")
|
|
28
|
+
else:
|
|
29
|
+
base_rate_dec = Decimal(rate_str) / Decimal(1000)
|
|
30
|
+
|
|
31
|
+
base_rate = float(base_rate_dec)
|
|
32
|
+
|
|
33
|
+
h["rab"] = rab_cache[h_start] = {
|
|
34
|
+
"interim": base_rate,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def lcc_import(sess, log, set_progress, s):
|
|
39
|
+
import_forecast_ilr_tra(sess, log, set_progress, s)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _parse_date(date_str):
|
|
43
|
+
return to_utc(to_ct(Datetime.strptime(date_str[:10], "%Y-%m-%d")))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def import_forecast_ilr_tra(sess, log, set_progress, s):
|
|
47
|
+
log("Starting to check for new LCC RAB Forecast ILR TRA")
|
|
48
|
+
|
|
49
|
+
contract_name = "rab_forecast_ilr_tra"
|
|
50
|
+
contract = Contract.find_non_core_by_name(sess, contract_name)
|
|
51
|
+
if contract is None:
|
|
52
|
+
contract = Contract.insert_non_core(
|
|
53
|
+
sess, contract_name, "", {}, to_utc(ct_datetime(1996, 4, 1)), None, {}
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
for record in api_records(log, s, "1231fbb3-93ee-4a33-87a9-f15bb377346d"):
|
|
57
|
+
period_start_str = record["Month"]
|
|
58
|
+
if len(period_start_str) == 0:
|
|
59
|
+
continue
|
|
60
|
+
period_start = _parse_date(period_start_str)
|
|
61
|
+
|
|
62
|
+
rs = sess.execute(
|
|
63
|
+
select(RateScript).where(
|
|
64
|
+
RateScript.contract == contract,
|
|
65
|
+
RateScript.start_date == period_start,
|
|
66
|
+
)
|
|
67
|
+
).scalar_one_or_none()
|
|
68
|
+
if rs is None:
|
|
69
|
+
rs = contract.insert_rate_script(sess, period_start, {})
|
|
70
|
+
|
|
71
|
+
rs_script = rs.make_script()
|
|
72
|
+
rs_script["record"] = record
|
|
73
|
+
rs.update(rs_script)
|
|
74
|
+
sess.commit()
|
|
75
|
+
log("Finished LCC RAB Forecast ILR TRA")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: chellow
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1760028799.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)
|
|
@@ -35,8 +35,9 @@ chellow/e/hh_parser_schneider_xlsx.py,sha256=Vtq0TNz-oojoKJm4PeH4ZwBp2I-mjArB9-F
|
|
|
35
35
|
chellow/e/hh_parser_simple_csv.py,sha256=lJx9tw9BWFSoBmns1Cws_vY-OIn90LPt2yvIN_CFcTE,2177
|
|
36
36
|
chellow/e/hh_parser_vital_xlsx.py,sha256=g9-CElfH1PPfwpuUcVvD6WQpBlNxCo8j9pq_0Yza0ZM,4125
|
|
37
37
|
chellow/e/lafs.py,sha256=SUUFtvn_IQQTrZue1zefCYgzuscA0FVX2ySZ9u8BDPw,7776
|
|
38
|
-
chellow/e/lcc.py,sha256=
|
|
38
|
+
chellow/e/lcc.py,sha256=VqwKBE6N6wXv_xu0o-1CRtJripoFGCZ8Q8e1hvce_34,4686
|
|
39
39
|
chellow/e/mdd_importer.py,sha256=NugJr2JhuzkPTsEMl_5UdQuw5K2p8lVJ-hyz4MK6Hfg,35762
|
|
40
|
+
chellow/e/rab.py,sha256=8buWWqo7CPzAqenI8zEnKDMVxzXZzQZUFAWY9sdGH3s,2320
|
|
40
41
|
chellow/e/rcrc.py,sha256=92CA1uIotIHd1epQ_jEPdJKzXqDFV-AoJOJeRO6MEyA,4274
|
|
41
42
|
chellow/e/ro.py,sha256=cpeJQMY_6SpVxL1nySSj9we58A6E2KwJEAb6fK7cZKY,626
|
|
42
43
|
chellow/e/scenario.py,sha256=FLgh03r_SgXx0hMWFbAvwsz2ScDL8LUwYWSWVv2rQlg,24973
|
|
@@ -399,6 +400,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
|
|
|
399
400
|
chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
|
|
400
401
|
chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
|
|
401
402
|
chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
|
|
402
|
-
chellow-
|
|
403
|
-
chellow-
|
|
404
|
-
chellow-
|
|
403
|
+
chellow-1760028799.0.0.dist-info/METADATA,sha256=zm1x1B_QH5ZI_HiJ4vFBX0RbyndLd_v2iw77jNS4QqU,12500
|
|
404
|
+
chellow-1760028799.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
405
|
+
chellow-1760028799.0.0.dist-info/RECORD,,
|
|
File without changes
|