chellow 1724831616.0.0__py3-none-any.whl → 1724868336.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/reports/report_59.py +56 -114
- chellow/templates/site.html +0 -2
- {chellow-1724831616.0.0.dist-info → chellow-1724868336.0.0.dist-info}/METADATA +1 -1
- {chellow-1724831616.0.0.dist-info → chellow-1724868336.0.0.dist-info}/RECORD +5 -5
- {chellow-1724831616.0.0.dist-info → chellow-1724868336.0.0.dist-info}/WHEEL +0 -0
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/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: 1724868336.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)
|
|
@@ -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
|
|
@@ -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-1724868336.0.0.dist-info/METADATA,sha256=tSIH1BFEVhIB3kTzEPeIrYlTSVM5bdKcwDmURrsSKH4,12241
|
|
369
|
+
chellow-1724868336.0.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
370
|
+
chellow-1724868336.0.0.dist-info/RECORD,,
|
|
File without changes
|