chellow 1724831616.0.0__py3-none-any.whl → 1725527086.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/mdd_importer.py +101 -7
- chellow/e/views.py +36 -23
- chellow/models.py +3 -5
- chellow/reports/report_59.py +56 -114
- chellow/templates/e/dno.html +4 -4
- chellow/templates/e/site_add_e_supply_form.html +8 -7
- chellow/templates/site.html +0 -2
- {chellow-1724831616.0.0.dist-info → chellow-1725527086.0.0.dist-info}/METADATA +1 -1
- {chellow-1724831616.0.0.dist-info → chellow-1725527086.0.0.dist-info}/RECORD +10 -10
- {chellow-1724831616.0.0.dist-info → chellow-1725527086.0.0.dist-info}/WHEEL +0 -0
chellow/e/mdd_importer.py
CHANGED
|
@@ -247,8 +247,6 @@ def _import_Market_Participant_Role(sess, rows, ctx):
|
|
|
247
247
|
name = values[4]
|
|
248
248
|
dno_code_str = values[14]
|
|
249
249
|
dno_code = None if len(dno_code_str) == 0 else dno_code_str
|
|
250
|
-
if dno_code == "99":
|
|
251
|
-
continue
|
|
252
250
|
|
|
253
251
|
if party is None:
|
|
254
252
|
participant.insert_party(
|
|
@@ -324,7 +322,7 @@ def _import_Meter_Timeswitch_Class(sess, rows, ctx):
|
|
|
324
322
|
has_comms_str = values[8] # MTC Communication Indicator
|
|
325
323
|
has_comms = parse_bool(has_comms_str)
|
|
326
324
|
is_hh_str = values[9] # MTC Type Indicator
|
|
327
|
-
is_hh =
|
|
325
|
+
is_hh = is_hh_str == "H"
|
|
328
326
|
tpr_count_str = values[10] # TPR Count
|
|
329
327
|
tpr_count = None if tpr_count_str == "" else int(tpr_count_str)
|
|
330
328
|
|
|
@@ -837,7 +835,101 @@ def _import_Valid_MTC_LLFC_SSC_PC_Combination(sess, rows, ctx):
|
|
|
837
835
|
)
|
|
838
836
|
|
|
839
837
|
|
|
840
|
-
def
|
|
838
|
+
def add_88_99(sess, ctx):
|
|
839
|
+
rows = [
|
|
840
|
+
[
|
|
841
|
+
"CIDC",
|
|
842
|
+
"R",
|
|
843
|
+
"01/01/2000",
|
|
844
|
+
"",
|
|
845
|
+
"Virtual",
|
|
846
|
+
"",
|
|
847
|
+
"",
|
|
848
|
+
"",
|
|
849
|
+
"",
|
|
850
|
+
"",
|
|
851
|
+
"",
|
|
852
|
+
"",
|
|
853
|
+
"",
|
|
854
|
+
"",
|
|
855
|
+
"88",
|
|
856
|
+
],
|
|
857
|
+
[
|
|
858
|
+
"CROW",
|
|
859
|
+
"R",
|
|
860
|
+
"01/04/1996",
|
|
861
|
+
"",
|
|
862
|
+
"Non-settlement",
|
|
863
|
+
"",
|
|
864
|
+
"",
|
|
865
|
+
"",
|
|
866
|
+
"",
|
|
867
|
+
"",
|
|
868
|
+
"",
|
|
869
|
+
"",
|
|
870
|
+
"",
|
|
871
|
+
"",
|
|
872
|
+
"99",
|
|
873
|
+
],
|
|
874
|
+
]
|
|
875
|
+
_import_Market_Participant_Role(sess, rows, ctx)
|
|
876
|
+
rows = [
|
|
877
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", ""],
|
|
878
|
+
["845", "01/04/1996", "CROW", "01/04/1996", ""],
|
|
879
|
+
]
|
|
880
|
+
_import_MTC_in_PES_Area(sess, rows, ctx)
|
|
881
|
+
rows = [
|
|
882
|
+
["CIDC", "", "", "005", "01/04/2010", "EG_HV_Intermittent", "C", ""],
|
|
883
|
+
["CIDC", "", "", "006", "01/04/2010", "EG_HV_Non_Intermittent", "C", ""],
|
|
884
|
+
["CIDC", "", "", "110", "01/01/2000", "Profile 3 Unrestricted", "A", ""],
|
|
885
|
+
["CIDC", "", "", "210", "01/01/2000", "Profile 4 Economy 7", "A", ""],
|
|
886
|
+
["CIDC", "", "", "510", "01/01/2000", "PC 5-8 & HH HV", "A", ""],
|
|
887
|
+
["CIDC", "", "", "521", "01/01/2000", "Export (HV)", "C", ""],
|
|
888
|
+
[
|
|
889
|
+
"CIDC",
|
|
890
|
+
"",
|
|
891
|
+
"",
|
|
892
|
+
"524",
|
|
893
|
+
"01/04/2010",
|
|
894
|
+
"HV Generation Non intermittent",
|
|
895
|
+
"C",
|
|
896
|
+
"",
|
|
897
|
+
],
|
|
898
|
+
["CIDC", "", "", "570", "01/01/2000", "PC 5-8 & HH LV", "A", ""],
|
|
899
|
+
["CIDC", "", "", "581", "01/01/2000", "Export (LV)", "C", ""],
|
|
900
|
+
["CIDC", "", "", "658", "01/04/1996", "HV HH metered", "A", ""],
|
|
901
|
+
["CROW", "", "", "510", "01/04/1996", "PC 5-8 & HH HV", "A", ""],
|
|
902
|
+
["CROW", "", "", "521", "01/04/1996", "Export (HV)", "C", ""],
|
|
903
|
+
["CROW", "", "", "570", "01/04/1996", "PC 5-8 & HH LV", "A", ""],
|
|
904
|
+
["CROW", "", "", "581", "01/04/1996", "Export (LV)", "C", ""],
|
|
905
|
+
]
|
|
906
|
+
|
|
907
|
+
_import_Line_Loss_Factor_Class(sess, rows, ctx)
|
|
908
|
+
rows = [
|
|
909
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", "005", "01/04/2010", ""],
|
|
910
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", "006", "01/04/2010", ""],
|
|
911
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", "110", "01/01/2000", ""],
|
|
912
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", "210", "01/01/2000", ""],
|
|
913
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", "510", "01/01/2000", ""],
|
|
914
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", "521", "01/01/2000", ""],
|
|
915
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", "524", "01/04/2010", ""],
|
|
916
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", "570", "01/01/2000", ""],
|
|
917
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", "581", "01/01/2000", ""],
|
|
918
|
+
["845", "01/04/1996", "CIDC", "01/04/1996", "658", "01/01/2000", ""],
|
|
919
|
+
["845", "01/04/1996", "CROW", "01/04/1996", "510", "01/04/1996", ""],
|
|
920
|
+
["845", "01/04/1996", "CROW", "01/04/1996", "521", "01/04/1996", ""],
|
|
921
|
+
["845", "01/04/1996", "CROW", "01/04/1996", "570", "01/04/1996", ""],
|
|
922
|
+
["845", "01/04/1996", "CROW", "01/04/1996", "581", "01/04/1996", ""],
|
|
923
|
+
]
|
|
924
|
+
_import_Valid_MTC_LLFC_Combination(sess, rows, ctx)
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
def _get_csv_reader(s, url):
|
|
928
|
+
csv_file = StringIO(download(s, url).decode("utf8"))
|
|
929
|
+
return csv.reader(csv_file)
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
def rate_server_import(sess, log, set_progress, s, paths, with_88_99=True):
|
|
841
933
|
log("Starting to check for a new MDD version")
|
|
842
934
|
mdd_entries = {}
|
|
843
935
|
for path, url in paths:
|
|
@@ -872,8 +964,7 @@ def rate_server_import(sess, log, set_progress, s, paths):
|
|
|
872
964
|
version = None
|
|
873
965
|
|
|
874
966
|
for file_name, url in fl_entries.items():
|
|
875
|
-
|
|
876
|
-
csv_reader = iter(csv.reader(csv_file))
|
|
967
|
+
csv_reader = iter(_get_csv_reader(s, url))
|
|
877
968
|
next(csv_reader) # Skip titles
|
|
878
969
|
|
|
879
970
|
table_name_elements = file_name.split("_")
|
|
@@ -929,7 +1020,10 @@ def rate_server_import(sess, log, set_progress, s, paths):
|
|
|
929
1020
|
func(sess, gnames[tname], ctx)
|
|
930
1021
|
else:
|
|
931
1022
|
raise BadRequest(f"Can't find {tname} on the rate server.")
|
|
932
|
-
|
|
1023
|
+
if with_88_99:
|
|
1024
|
+
log("Starting to add MDD data for 88 and 99 DNOs")
|
|
1025
|
+
add_88_99(sess, ctx)
|
|
1026
|
+
log("Finished adding MDD data for 88 and 99 DNOs")
|
|
933
1027
|
config = Contract.get_non_core_by_name(sess, "configuration")
|
|
934
1028
|
state = config.make_state()
|
|
935
1029
|
state["mdd_version"] = version
|
chellow/e/views.py
CHANGED
|
@@ -4354,29 +4354,15 @@ def site_add_e_supply_form_get(site_id):
|
|
|
4354
4354
|
EnergisationStatus.code
|
|
4355
4355
|
)
|
|
4356
4356
|
default_energisation_status = EnergisationStatus.get_by_code(g.sess, "E")
|
|
4357
|
-
|
|
4357
|
+
gsp_groups_q = select(GspGroup).order_by(GspGroup.code)
|
|
4358
|
+
gsp_groups = g.sess.scalars(gsp_groups_q)
|
|
4359
|
+
RateScriptAliasStart = aliased(RateScript)
|
|
4360
|
+
RateScriptAliasFinish = aliased(RateScript)
|
|
4358
4361
|
if "start_year" in request.values:
|
|
4359
4362
|
start_date = req_date("start")
|
|
4360
4363
|
else:
|
|
4361
4364
|
start_date = to_utc(ct_datetime(ct_now.year, ct_now.month, ct_now.day))
|
|
4362
4365
|
|
|
4363
|
-
site = Site.get_by_id(g.sess, site_id)
|
|
4364
|
-
sources = g.sess.scalars(select(Source).order_by(Source.code))
|
|
4365
|
-
source_id = req_int_none("source_id")
|
|
4366
|
-
if source_id is None:
|
|
4367
|
-
source = Source.get_by_code(g.sess, "grid")
|
|
4368
|
-
else:
|
|
4369
|
-
source = Source.get_by_id(g.sess, source_id)
|
|
4370
|
-
generator_types = g.sess.query(GeneratorType).order_by(GeneratorType.code)
|
|
4371
|
-
gsp_groups = g.sess.query(GspGroup).order_by(GspGroup.code)
|
|
4372
|
-
eras = (
|
|
4373
|
-
g.sess.query(Era)
|
|
4374
|
-
.join(SiteEra)
|
|
4375
|
-
.filter(SiteEra.site == site)
|
|
4376
|
-
.order_by(Era.start_date.desc())
|
|
4377
|
-
)
|
|
4378
|
-
RateScriptAliasStart = aliased(RateScript)
|
|
4379
|
-
RateScriptAliasFinish = aliased(RateScript)
|
|
4380
4366
|
mop_contracts = g.sess.scalars(
|
|
4381
4367
|
select(Contract)
|
|
4382
4368
|
.join(MarketRole)
|
|
@@ -4431,12 +4417,15 @@ def site_add_e_supply_form_get(site_id):
|
|
|
4431
4417
|
)
|
|
4432
4418
|
.order_by(Contract.name)
|
|
4433
4419
|
).all()
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4420
|
+
|
|
4421
|
+
site = Site.get_by_id(g.sess, site_id)
|
|
4422
|
+
sources = g.sess.scalars(select(Source).order_by(Source.code))
|
|
4423
|
+
source_id = req_int_none("source_id")
|
|
4424
|
+
if source_id is None:
|
|
4425
|
+
source = Source.get_by_code(g.sess, "grid")
|
|
4438
4426
|
else:
|
|
4439
|
-
|
|
4427
|
+
source = Source.get_by_id(g.sess, source_id)
|
|
4428
|
+
generator_types = g.sess.query(GeneratorType).order_by(GeneratorType.code)
|
|
4440
4429
|
|
|
4441
4430
|
dnos = g.sess.scalars(
|
|
4442
4431
|
select(Party)
|
|
@@ -4444,12 +4433,36 @@ def site_add_e_supply_form_get(site_id):
|
|
|
4444
4433
|
.where(MarketRole.code == "R")
|
|
4445
4434
|
.order_by(Party.dno_code)
|
|
4446
4435
|
).all()
|
|
4436
|
+
pcs = g.sess.query(Pc).order_by(Pc.code)
|
|
4447
4437
|
dno_id = req_int_none("dno_id")
|
|
4448
4438
|
if dno_id is None:
|
|
4449
4439
|
dno = dnos[0]
|
|
4450
4440
|
else:
|
|
4451
4441
|
dno = Party.get_by_id(g.sess, dno_id)
|
|
4452
4442
|
|
|
4443
|
+
dno_contract = Contract.get_dno_by_name(g.sess, dno.dno_code)
|
|
4444
|
+
dno_rate_script = dno_contract.find_rate_script_at(g.sess, start_date)
|
|
4445
|
+
dno_props = dno_rate_script.make_script()
|
|
4446
|
+
allowed_gsp_group_codes = list(dno_props.keys())
|
|
4447
|
+
|
|
4448
|
+
gsp_groups = g.sess.scalars(
|
|
4449
|
+
select(GspGroup)
|
|
4450
|
+
.where(GspGroup.code.in_(allowed_gsp_group_codes))
|
|
4451
|
+
.order_by(GspGroup.code)
|
|
4452
|
+
)
|
|
4453
|
+
|
|
4454
|
+
eras = (
|
|
4455
|
+
g.sess.query(Era)
|
|
4456
|
+
.join(SiteEra)
|
|
4457
|
+
.filter(SiteEra.site == site)
|
|
4458
|
+
.order_by(Era.start_date.desc())
|
|
4459
|
+
)
|
|
4460
|
+
pc_id = req_int_none("pc_id")
|
|
4461
|
+
if pc_id is None:
|
|
4462
|
+
pc = Pc.get_by_code(g.sess, "00")
|
|
4463
|
+
else:
|
|
4464
|
+
pc = Pc.get_by_id(g.sess, pc_id)
|
|
4465
|
+
|
|
4453
4466
|
participant = dno.participant
|
|
4454
4467
|
|
|
4455
4468
|
if pc.code == "00":
|
chellow/models.py
CHANGED
|
@@ -1598,15 +1598,13 @@ class Contract(Base, PersistentClass):
|
|
|
1598
1598
|
sess.delete(self)
|
|
1599
1599
|
|
|
1600
1600
|
def find_rate_script_at(self, sess, date):
|
|
1601
|
-
return (
|
|
1602
|
-
|
|
1603
|
-
.filter(
|
|
1601
|
+
return sess.scalars(
|
|
1602
|
+
select(RateScript).where(
|
|
1604
1603
|
RateScript.contract == self,
|
|
1605
1604
|
RateScript.start_date <= date,
|
|
1606
1605
|
or_(RateScript.finish_date == null(), RateScript.finish_date >= date),
|
|
1607
1606
|
)
|
|
1608
|
-
|
|
1609
|
-
)
|
|
1607
|
+
).first()
|
|
1610
1608
|
|
|
1611
1609
|
def start_date(self):
|
|
1612
1610
|
return self.start_rate_script.start_date
|
chellow/reports/report_59.py
CHANGED
|
@@ -57,17 +57,7 @@ from chellow.views import chellow_redirect
|
|
|
57
57
|
CATEGORY_ORDER = {None: 0, "unmetered": 1, "nhh": 2, "amr": 3, "hh": 4}
|
|
58
58
|
|
|
59
59
|
|
|
60
|
-
def write_spreadsheet(
|
|
61
|
-
fl,
|
|
62
|
-
compressed,
|
|
63
|
-
site_rows,
|
|
64
|
-
supply_rows,
|
|
65
|
-
era_rows,
|
|
66
|
-
read_rows,
|
|
67
|
-
bill_check_site_rows,
|
|
68
|
-
bill_check_era_rows,
|
|
69
|
-
is_bill_check,
|
|
70
|
-
):
|
|
60
|
+
def write_spreadsheet(fl, compressed, site_rows, supply_rows, era_rows, read_rows):
|
|
71
61
|
fl.seek(0)
|
|
72
62
|
fl.truncate()
|
|
73
63
|
with odio.create_spreadsheet(fl, "1.2", compressed=compressed) as f:
|
|
@@ -75,9 +65,6 @@ def write_spreadsheet(
|
|
|
75
65
|
f.append_table("Supply Level", supply_rows)
|
|
76
66
|
f.append_table("Era Level", era_rows)
|
|
77
67
|
f.append_table("Normal Reads", read_rows)
|
|
78
|
-
if is_bill_check:
|
|
79
|
-
f.append_table("Bill Check Site", bill_check_site_rows)
|
|
80
|
-
f.append_table("Bill Check Era", bill_check_era_rows)
|
|
81
68
|
|
|
82
69
|
|
|
83
70
|
def make_bill_row(titles, bill):
|
|
@@ -627,8 +614,41 @@ def _process_site(
|
|
|
627
614
|
.scalars()
|
|
628
615
|
.all()
|
|
629
616
|
)
|
|
617
|
+
imp_supplier_contract = first_era.imp_supplier_contract
|
|
618
|
+
exp_supplier_contract = first_era.exp_supplier_contract
|
|
630
619
|
if len(bills) > 0:
|
|
631
|
-
|
|
620
|
+
era_vals = {
|
|
621
|
+
"creation-date": now,
|
|
622
|
+
"start-date": start_date,
|
|
623
|
+
"finish-date": finish_date,
|
|
624
|
+
"imp-mpan-core": last_era.imp_mpan_core,
|
|
625
|
+
"exp-mpan-core": last_era.exp_mpan_core,
|
|
626
|
+
"site-code": site.code,
|
|
627
|
+
"site-name": site.name,
|
|
628
|
+
"associated-site-codes": None,
|
|
629
|
+
"era-start-date": None,
|
|
630
|
+
"era-finish-date": None,
|
|
631
|
+
"imp-supplier-contract": (
|
|
632
|
+
None
|
|
633
|
+
if imp_supplier_contract is None
|
|
634
|
+
else imp_supplier_contract.name
|
|
635
|
+
),
|
|
636
|
+
"imp-non-actual-hhs": None,
|
|
637
|
+
"imp-non-actual-kwh": None,
|
|
638
|
+
"exp-supplier-contract": (
|
|
639
|
+
None
|
|
640
|
+
if exp_supplier_contract is None
|
|
641
|
+
else exp_supplier_contract.name
|
|
642
|
+
),
|
|
643
|
+
"exp-non-actual-hhs": None,
|
|
644
|
+
"exp-non-actual-kwh": None,
|
|
645
|
+
"metering-type": last_era.meter_category,
|
|
646
|
+
"source": last_era.supply.source.code,
|
|
647
|
+
"generator-type": None,
|
|
648
|
+
"supply-name": last_era.supply.name,
|
|
649
|
+
"msn": last_era.msn,
|
|
650
|
+
"pc": last_era.pc.code,
|
|
651
|
+
}
|
|
632
652
|
for name in (
|
|
633
653
|
"import-grid",
|
|
634
654
|
"export-grid",
|
|
@@ -641,48 +661,18 @@ def _process_site(
|
|
|
641
661
|
"used-3rd-party",
|
|
642
662
|
):
|
|
643
663
|
for sname in ("kwh", "net-gbp"):
|
|
644
|
-
|
|
664
|
+
era_vals[f"{name}-{sname}"] = 0
|
|
645
665
|
for suf in ("kwh", "net-gbp", "vat-gbp", "gross-gbp"):
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
_add_bills(
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
exp_supplier_contract = first_era.exp_supplier_contract
|
|
655
|
-
out = [
|
|
656
|
-
now,
|
|
657
|
-
last_era.imp_mpan_core,
|
|
658
|
-
(
|
|
659
|
-
None
|
|
660
|
-
if imp_supplier_contract is None
|
|
661
|
-
else imp_supplier_contract.name
|
|
662
|
-
),
|
|
663
|
-
last_era.exp_mpan_core,
|
|
664
|
-
(
|
|
665
|
-
None
|
|
666
|
-
if exp_supplier_contract is None
|
|
667
|
-
else exp_supplier_contract.name
|
|
668
|
-
),
|
|
669
|
-
None,
|
|
670
|
-
last_era.meter_category,
|
|
671
|
-
last_era.supply.source.code,
|
|
672
|
-
None,
|
|
673
|
-
last_era.supply.name,
|
|
674
|
-
last_era.msn,
|
|
675
|
-
last_era.pc.code,
|
|
676
|
-
site.code,
|
|
677
|
-
site.name,
|
|
678
|
-
None,
|
|
679
|
-
start_date,
|
|
680
|
-
finish_date,
|
|
681
|
-
] + [month_data[t] for t in summary_titles]
|
|
682
|
-
|
|
683
|
-
era_rows.append([make_val(v) for v in out])
|
|
666
|
+
era_vals[f"billed-import-{suf}"] = 0
|
|
667
|
+
era_vals[f"billed-import-supplier-{suf}"] = 0
|
|
668
|
+
era_vals[f"billed-import-dc-{suf}"] = 0
|
|
669
|
+
era_vals[f"billed-import-mop-{suf}"] = 0
|
|
670
|
+
|
|
671
|
+
_add_bills(era_vals, bills, chunk_start, chunk_finish)
|
|
672
|
+
|
|
673
|
+
era_rows.append([make_val(vals.get(t)) for t in era_titles])
|
|
684
674
|
for t in summary_titles:
|
|
685
|
-
v =
|
|
675
|
+
v = era_vals.get(t)
|
|
686
676
|
if v is not None:
|
|
687
677
|
site_data[t] += v
|
|
688
678
|
|
|
@@ -746,9 +736,6 @@ def content(
|
|
|
746
736
|
supply_rows = []
|
|
747
737
|
era_rows = []
|
|
748
738
|
normal_read_rows = []
|
|
749
|
-
bill_check_site_rows = []
|
|
750
|
-
bill_check_supply_rows = []
|
|
751
|
-
bill_check_era_rows = []
|
|
752
739
|
|
|
753
740
|
try:
|
|
754
741
|
with RSession() as rsess:
|
|
@@ -850,6 +837,7 @@ def content(
|
|
|
850
837
|
)
|
|
851
838
|
|
|
852
839
|
by_hh = scenario_props.get("by_hh", False)
|
|
840
|
+
is_bill_check = scenario_props.get("is_bill_check", False)
|
|
853
841
|
|
|
854
842
|
era_header_titles = [
|
|
855
843
|
"creation-date",
|
|
@@ -1009,14 +997,15 @@ def content(
|
|
|
1009
997
|
supply_titles = supply_header_titles + summary_titles
|
|
1010
998
|
supply_rows.append(supply_titles)
|
|
1011
999
|
era_rows.append(era_titles)
|
|
1012
|
-
bill_check_site_rows.append(site_header_titles + summary_titles)
|
|
1013
|
-
bill_check_era_rows.append(era_titles)
|
|
1014
1000
|
|
|
1015
1001
|
normal_reads = set()
|
|
1016
1002
|
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1003
|
+
if is_bill_check:
|
|
1004
|
+
data_source_bill = Object()
|
|
1005
|
+
data_source_bill.start_date = start_date
|
|
1006
|
+
data_source_bill.finish_date = finish_date
|
|
1007
|
+
else:
|
|
1008
|
+
data_source_bill = None
|
|
1020
1009
|
|
|
1021
1010
|
for site in rsess.scalars(sites):
|
|
1022
1011
|
if by_hh:
|
|
@@ -1046,28 +1035,8 @@ def content(
|
|
|
1046
1035
|
supply_titles,
|
|
1047
1036
|
supply_rows,
|
|
1048
1037
|
site_rows,
|
|
1049
|
-
|
|
1038
|
+
data_source_bill,
|
|
1050
1039
|
)
|
|
1051
|
-
if is_bill_check:
|
|
1052
|
-
_process_site(
|
|
1053
|
-
rsess,
|
|
1054
|
-
report_context,
|
|
1055
|
-
forecast_from,
|
|
1056
|
-
start,
|
|
1057
|
-
finish,
|
|
1058
|
-
site,
|
|
1059
|
-
scenario_props,
|
|
1060
|
-
supply_ids,
|
|
1061
|
-
now,
|
|
1062
|
-
summary_titles,
|
|
1063
|
-
title_dict,
|
|
1064
|
-
era_titles,
|
|
1065
|
-
bill_check_era_rows,
|
|
1066
|
-
supply_titles,
|
|
1067
|
-
bill_check_supply_rows,
|
|
1068
|
-
bill_check_site_rows,
|
|
1069
|
-
data_source_bill,
|
|
1070
|
-
)
|
|
1071
1040
|
except BadRequest as e:
|
|
1072
1041
|
raise BadRequest(f"Site Code {site.code}: {e.description}")
|
|
1073
1042
|
|
|
@@ -1078,31 +1047,14 @@ def content(
|
|
|
1078
1047
|
|
|
1079
1048
|
rsess.rollback() # Evict from cache
|
|
1080
1049
|
write_spreadsheet(
|
|
1081
|
-
rf,
|
|
1082
|
-
compression,
|
|
1083
|
-
site_rows,
|
|
1084
|
-
supply_rows,
|
|
1085
|
-
era_rows,
|
|
1086
|
-
normal_read_rows,
|
|
1087
|
-
bill_check_site_rows,
|
|
1088
|
-
bill_check_era_rows,
|
|
1089
|
-
is_bill_check,
|
|
1050
|
+
rf, compression, site_rows, supply_rows, era_rows, normal_read_rows
|
|
1090
1051
|
)
|
|
1091
1052
|
except BadRequest as e:
|
|
1092
1053
|
msg = e.description + traceback.format_exc()
|
|
1093
1054
|
sys.stderr.write(msg + "\n")
|
|
1094
1055
|
site_rows.append(["Problem " + msg])
|
|
1095
1056
|
write_spreadsheet(
|
|
1096
|
-
rf,
|
|
1097
|
-
compression,
|
|
1098
|
-
site_rows,
|
|
1099
|
-
supply_rows,
|
|
1100
|
-
era_rows,
|
|
1101
|
-
normal_read_rows,
|
|
1102
|
-
bill_check_site_rows,
|
|
1103
|
-
bill_check_supply_rows,
|
|
1104
|
-
bill_check_era_rows,
|
|
1105
|
-
is_bill_check,
|
|
1057
|
+
rf, compression, site_rows, supply_rows, era_rows, normal_read_rows
|
|
1106
1058
|
)
|
|
1107
1059
|
except BaseException:
|
|
1108
1060
|
msg = traceback.format_exc()
|
|
@@ -1114,17 +1066,7 @@ def content(
|
|
|
1114
1066
|
ef.write(msg + "\n")
|
|
1115
1067
|
ef.close()
|
|
1116
1068
|
else:
|
|
1117
|
-
write_spreadsheet(
|
|
1118
|
-
rf,
|
|
1119
|
-
compression,
|
|
1120
|
-
site_rows,
|
|
1121
|
-
era_rows,
|
|
1122
|
-
normal_read_rows,
|
|
1123
|
-
bill_check_site_rows,
|
|
1124
|
-
bill_check_supply_rows,
|
|
1125
|
-
bill_check_era_rows,
|
|
1126
|
-
is_bill_check,
|
|
1127
|
-
)
|
|
1069
|
+
write_spreadsheet(rf, compression, site_rows, era_rows, normal_read_rows)
|
|
1128
1070
|
finally:
|
|
1129
1071
|
if rf is not None:
|
|
1130
1072
|
rf.close()
|
chellow/templates/e/dno.html
CHANGED
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
</td>
|
|
29
29
|
</tr>
|
|
30
30
|
<tr>
|
|
31
|
-
<td>
|
|
32
|
-
<td>{{
|
|
31
|
+
<td>Valid From</td>
|
|
32
|
+
<td>{{dno.valid_from|hh_format }}</td>
|
|
33
33
|
</tr>
|
|
34
34
|
<tr>
|
|
35
|
-
<td>
|
|
36
|
-
<td>{{
|
|
35
|
+
<td>Valid To</td>
|
|
36
|
+
<td>{{dno.valid_to|hh_format }}</td>
|
|
37
37
|
</tr>
|
|
38
38
|
<tr>
|
|
39
39
|
<td>Custom Reports</td>
|
|
@@ -32,6 +32,14 @@
|
|
|
32
32
|
</select>
|
|
33
33
|
{% endif %}
|
|
34
34
|
<label>Meter Serial Number</label> {{input_text('msn')}}
|
|
35
|
+
|
|
36
|
+
<label>DNO</label>
|
|
37
|
+
<select name="dno_id">
|
|
38
|
+
{% for dno in dnos %}
|
|
39
|
+
{{input_option( 'dno_id', dno.id, dno.dno_code + ' ' + dno.name)}}
|
|
40
|
+
{% endfor %}
|
|
41
|
+
</select>
|
|
42
|
+
|
|
35
43
|
<label>GSP Group</label>
|
|
36
44
|
<select name="gsp_group_id">
|
|
37
45
|
{% for gsp_group in gsp_groups %}
|
|
@@ -90,13 +98,6 @@
|
|
|
90
98
|
{% endfor %}
|
|
91
99
|
</select>
|
|
92
100
|
|
|
93
|
-
<label>DNO</label>
|
|
94
|
-
<select name="dno_id">
|
|
95
|
-
{% for dno in dnos %}
|
|
96
|
-
{{input_option( 'dno_id', dno.id, dno.dno_code + ' ' + dno.name)}}
|
|
97
|
-
{% endfor %}
|
|
98
|
-
</select>
|
|
99
|
-
|
|
100
101
|
{% if pc.code == '00' %}
|
|
101
102
|
<input type="hidden" name="ssc_id" value="">
|
|
102
103
|
{% else %}
|
chellow/templates/site.html
CHANGED
|
@@ -181,8 +181,6 @@ Table of site level monthly kWh, MD kWh etc.</a>
|
|
|
181
181
|
{{ input_number('months', initial='1', size='2', maxlength='2', required=True) }}
|
|
182
182
|
<label>Final Month</label>
|
|
183
183
|
{{ input_date('finish', last_month_finish, resolution='month') }}
|
|
184
|
-
<label>Include bill check tabs?</label>
|
|
185
|
-
{{input_checkbox('is_bill_check')}}
|
|
186
184
|
<input type="submit" value="Download">
|
|
187
185
|
</fieldset>
|
|
188
186
|
</form>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: chellow
|
|
3
|
-
Version:
|
|
3
|
+
Version: 1725527086.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)
|
|
@@ -5,7 +5,7 @@ chellow/commands.py,sha256=ESBe9ZWj1c3vdZgqMZ9gFvYAB3hRag2R1PzOwuw9yFo,1302
|
|
|
5
5
|
chellow/dloads.py,sha256=dixp-O0MF2_mlwrnKx3D9DH09Qu05BjTo0rZfigTjR4,5534
|
|
6
6
|
chellow/edi_lib.py,sha256=alu20x9ZX06iPfnNI9dEJzuP6RIf4We3Y_M_bl7RrcY,51789
|
|
7
7
|
chellow/general_import.py,sha256=l3EHq9zG9Vfl5Ee6XTVrC1nusXo4YGGB4VBmZ_JaJR8,65798
|
|
8
|
-
chellow/models.py,sha256=
|
|
8
|
+
chellow/models.py,sha256=pBaFnTUIyThyg7iGIrbh4v8MW3LuEAwe1-4LAF4G7Q4,243491
|
|
9
9
|
chellow/national_grid.py,sha256=czwIZqzJndSGhEMQ5YzI6hRBhvjkM6VRVYXybf4_KXg,4377
|
|
10
10
|
chellow/proxy.py,sha256=cVXIktPlX3tQ1BYcwxq0nJXKE6r3DtFTtfFHPq55HaM,1351
|
|
11
11
|
chellow/rate_server.py,sha256=fg-Pf_9Hk3bXmC9riPQNGQxBvLvBa_WtNYdwDCjnCSg,5678
|
|
@@ -30,7 +30,7 @@ chellow/e/hh_parser_df2.py,sha256=7gaVidyIqeqprm3zYPtHvRLLn08nph04N0cKlveNTV0,42
|
|
|
30
30
|
chellow/e/hh_parser_simple_csv.py,sha256=RN4QOLvTQeoPrpvXvQ9hkOBZnR5piybLfjCiSJdjpjs,2112
|
|
31
31
|
chellow/e/laf_import.py,sha256=aqkcbjnvfBPszBLSNg6getP7iW1uWiTVHy6N5Z5x39U,5514
|
|
32
32
|
chellow/e/lcc.py,sha256=OkpynN8_iAdHRlu-yyU6BhRUqYYOZsUnl0HbHULYo_4,4670
|
|
33
|
-
chellow/e/mdd_importer.py,sha256=
|
|
33
|
+
chellow/e/mdd_importer.py,sha256=wq5Fw-MSe17WNuPzeWdCmJvX0NKV3Y501t6z2tqd92Q,35638
|
|
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=fBDZVOdrI1I3XQG-RdpB0-lDF9VYENBu_9bBXJxmvWk,23362
|
|
@@ -38,7 +38,7 @@ chellow/e/system_price.py,sha256=6w5J7bzwFAZubE2zdOFRiS8IIrVP8hkoIOaG2yCt-Ic,623
|
|
|
38
38
|
chellow/e/tlms.py,sha256=M33D6YpMixu2KkwSCzDRM3kThLgShg8exp63Obo75l8,8905
|
|
39
39
|
chellow/e/tnuos.py,sha256=XseYztPUsQXNKuBmystO2kzzwAG9ehCZgpGBTdgSk-A,4313
|
|
40
40
|
chellow/e/triad.py,sha256=lIQj7EdUrcFwEqleuHZXYU_bfzIwNOqUVVxB3NPQt4A,13710
|
|
41
|
-
chellow/e/views.py,sha256
|
|
41
|
+
chellow/e/views.py,sha256=Ue11tdJSjXni4sFobzlvnrTI5evSja_qUuTQ_JusPdU,216671
|
|
42
42
|
chellow/e/bill_parsers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
43
|
chellow/e/bill_parsers/activity_mop_stark_xlsx.py,sha256=UgWXDPzQkQghyj_lfgBqoSJpHB-t-qOdSaB8qY6GLog,4071
|
|
44
44
|
chellow/e/bill_parsers/annual_mop_stark_xlsx.py,sha256=-HMoIfa_utXYKA44RuC0Xqv3vd2HLeQU_4P0iBUd3WA,4219
|
|
@@ -85,7 +85,7 @@ chellow/reports/report_33.py,sha256=laVz-itDbJTdvC6LxLEeuY0eKpYx43Un4adiExPTEEE,
|
|
|
85
85
|
chellow/reports/report_387.py,sha256=kmBZopb0AOivcowO2nPjRj6LnV0_QjCDXLwqPL7IGVE,5672
|
|
86
86
|
chellow/reports/report_41.py,sha256=QQeTshA1Og7N3wPaoZ8ynJzwsvZ1mgSFc7DDkVqIZoM,7447
|
|
87
87
|
chellow/reports/report_429.py,sha256=8WlLqyfMyvIF5Kc6CE0MKwcT5xwmR_Ao99Ef72yAOVc,12668
|
|
88
|
-
chellow/reports/report_59.py,sha256=
|
|
88
|
+
chellow/reports/report_59.py,sha256=X3zWhc18AukwzhCZEj9ZnGA73I3nPBISWoms6Fc2s80,44630
|
|
89
89
|
chellow/reports/report_81.py,sha256=NkT6dZeMo7Z0AkJemD_Xv8Ut5PIZ9vn8Ia1Q_DS9v54,5611
|
|
90
90
|
chellow/reports/report_87.py,sha256=j2gdBOapaVY1ZnlNlw14RPx58_k8eUkc3oRSnKuCsNA,7057
|
|
91
91
|
chellow/reports/report_asset_comparison.py,sha256=UN298MHuzyUDUiiZr7F_Ua6SrdVOlFLjgKjnIbrA-14,6118
|
|
@@ -140,7 +140,7 @@ chellow/templates/report_run_row.html,sha256=bmtcdqJaS1CXpL0i8PuqvmeF98jKNYX5-mn
|
|
|
140
140
|
chellow/templates/report_run_row_bill_check.html,sha256=aC2LMu_6NvmTN3ZdxHJPPPczyxPN6hg0F-PPcqIWUws,4683
|
|
141
141
|
chellow/templates/report_run_supply_contacts.html,sha256=JNzwz9M6qbLRDMkCzFCxxANapUer5klxo7t5a48nAzg,2117
|
|
142
142
|
chellow/templates/report_runs.html,sha256=Xef2nilmHHSnyRNKUQJrU2qWsQfslFL_wWD5rR92SOo,667
|
|
143
|
-
chellow/templates/site.html,sha256=
|
|
143
|
+
chellow/templates/site.html,sha256=dj0VgcmjaKJHuTOZDESO2E2MOyluYJtx4YaSOaWOkwU,10024
|
|
144
144
|
chellow/templates/site_add.html,sha256=NxYmOIZQH6X8EBOuJUbhUJ8IYB3t0BukjR1yVRhnJhM,422
|
|
145
145
|
chellow/templates/site_edit.html,sha256=TJ_ZDDkodj-uDB3GPP9Cel3FGZY2oP42KCzHOydPWVc,2909
|
|
146
146
|
chellow/templates/site_gen_graph.html,sha256=LXkD4n_aC_sFm9JJTCmBRrczpyTn2UUEgBToFiM5RPo,3468
|
|
@@ -196,7 +196,7 @@ chellow/templates/e/dc_contracts_add.html,sha256=2lrGrNqAoKp16OiMoNDNlJxBMW3QdSP
|
|
|
196
196
|
chellow/templates/e/dc_rate_script.html,sha256=gfKUHV2IMsTQT-cYfjl4aiEBqGEWSj3uW22UZpoyGq4,1219
|
|
197
197
|
chellow/templates/e/dc_rate_script_add.html,sha256=5MlE4r5eLww3xI9qZRlu8hE8bU7RVwyDJcr20-0e4uY,644
|
|
198
198
|
chellow/templates/e/dc_rate_script_edit.html,sha256=RytAio6WbORye2iEETorC_80lyo7ZqY7qbulmRPo9m8,1955
|
|
199
|
-
chellow/templates/e/dno.html,sha256=
|
|
199
|
+
chellow/templates/e/dno.html,sha256=dex343gChjoB8HOM3h4rUm-Gn8_Q_fDeAQT1pNWe-H0,2454
|
|
200
200
|
chellow/templates/e/dno_rate_script.html,sha256=8wK2GqDyPAPxLsK3waEuGwqerGtWPCu-RQdg-XCJw2o,753
|
|
201
201
|
chellow/templates/e/dno_rate_script_add.html,sha256=LRHN86z1oBceQLtzVbLs9rrcav8DfcDrPYzyvvc7cQA,559
|
|
202
202
|
chellow/templates/e/dno_rate_script_edit.html,sha256=5hNwZWMdesZywOiUAS_OIAapT8jjebc9qp_U9pkXUgs,1275
|
|
@@ -278,7 +278,7 @@ chellow/templates/e/scenario_docs.html,sha256=hOg6hrrnOcvdk7jXRsMrk1wtwK7K0IpqcB
|
|
|
278
278
|
chellow/templates/e/scenario_edit.html,sha256=Uf64v_qsBP0BxaFEIz214CC_dZXlvro4zvQXH_towhA,1070
|
|
279
279
|
chellow/templates/e/scenarios.html,sha256=zlNhZvQEcuwLgHObVHS-4THur5Lz9Jf1G6xD98-jamI,847
|
|
280
280
|
chellow/templates/e/site_add_e_supply.html,sha256=_gi1ejI4TMTMX9vCW7z2kToR2XKR6qoVh67qp_VrDsM,2731
|
|
281
|
-
chellow/templates/e/site_add_e_supply_form.html,sha256=
|
|
281
|
+
chellow/templates/e/site_add_e_supply_form.html,sha256=q5LfSmp_eamph4FLKslMrxKGOtGCkSFRe9I5AVn-hgM,5553
|
|
282
282
|
chellow/templates/e/site_hh_data.html,sha256=1Ld5IIM3G84tVCAwtlJNGJTnrASS7d84AgaPwwHNEMI,1413
|
|
283
283
|
chellow/templates/e/site_site_snags.html,sha256=vWpsFyxZj7GOrMXQz2rKq9zOQdVsqeUVtdBzehp9J5w,847
|
|
284
284
|
chellow/templates/e/site_snag.html,sha256=eZt1H-t-hsoKZBteU9ILpKqKLD0Pf0Uybp8pPQYuTAc,924
|
|
@@ -365,6 +365,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
|
|
|
365
365
|
chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
|
|
366
366
|
chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
|
|
367
367
|
chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
|
|
368
|
-
chellow-
|
|
369
|
-
chellow-
|
|
370
|
-
chellow-
|
|
368
|
+
chellow-1725527086.0.0.dist-info/METADATA,sha256=oUR_vnJy2tF7UGGlfYWk61_NiBlhC64Qy7SuE-FbV38,12241
|
|
369
|
+
chellow-1725527086.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
370
|
+
chellow-1725527086.0.0.dist-info/RECORD,,
|
|
File without changes
|