chellow 1759155233.0.0__py3-none-any.whl → 1759823276.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/general_import.py CHANGED
@@ -942,47 +942,70 @@ def general_import_bill(sess, action, vals, args):
942
942
  supply,
943
943
  )
944
944
 
945
- for i in range(15, len(vals), 11):
946
- msn = add_arg(args, "Meter Serial Number", vals, i)
947
- mpan_str = add_arg(args, "MPAN", vals, i + 1)
948
- coefficient_str = add_arg(args, "Coefficient", vals, i + 2)
949
- coefficient = Decimal(coefficient_str)
950
- units = add_arg(args, "Units", vals, i + 3)
951
- tpr_code = add_arg(args, "TPR", vals, i + 4)
952
- if len(tpr_code) > 0:
953
- tpr = Tpr.get_by_code(sess, tpr_code)
954
- else:
955
- tpr = None
956
-
957
- prev_date_str = add_arg(args, "Previous Date", vals, i + 5)
958
- prev_date = parse_hh_start(prev_date_str)
959
- prev_value_str = add_arg(args, "Previous Value", vals, i + 6)
960
- prev_value = Decimal(prev_value_str)
961
-
962
- prev_type_str = add_arg(args, "Previous Type", vals, i + 7)
963
- prev_type = ReadType.get_by_code(sess, prev_type_str)
964
-
965
- pres_date_str = add_arg(args, "Present Date", vals, i + 8)
966
- pres_date = parse_hh_start(pres_date_str)
967
- pres_value_str = add_arg(args, "Present Value", vals, i + 9)
968
- pres_value = Decimal(pres_value_str)
969
-
970
- pres_type_str = add_arg(args, "Present Type", vals, i + 10)
971
- pres_type = ReadType.get_by_code(sess, pres_type_str)
972
- bill.insert_read(
973
- sess,
974
- tpr,
975
- coefficient,
976
- units,
977
- msn,
978
- mpan_str,
979
- prev_date,
980
- prev_value,
981
- prev_type,
982
- pres_date,
983
- pres_value,
984
- pres_type,
985
- )
945
+ i = 15
946
+ while i < len(vals):
947
+ typ = add_arg(args, "read or element", vals, i)
948
+ if typ == "read":
949
+ msn = add_arg(args, "Meter Serial Number", vals, i + 1)
950
+ mpan_str = add_arg(args, "MPAN", vals, i + 2)
951
+ coefficient_str = add_arg(args, "Coefficient", vals, i + 3)
952
+ coefficient = Decimal(coefficient_str)
953
+ units = add_arg(args, "Units", vals, i + 4)
954
+ tpr_code = add_arg(args, "TPR", vals, i + 5)
955
+ if len(tpr_code) > 0:
956
+ tpr = Tpr.get_by_code(sess, tpr_code)
957
+ else:
958
+ tpr = None
959
+
960
+ prev_date_str = add_arg(args, "Previous Date", vals, i + 6)
961
+ prev_date = parse_hh_start(prev_date_str)
962
+ prev_value_str = add_arg(args, "Previous Value", vals, i + 7)
963
+ prev_value = Decimal(prev_value_str)
964
+
965
+ prev_type_str = add_arg(args, "Previous Type", vals, i + 8)
966
+ prev_type = ReadType.get_by_code(sess, prev_type_str)
967
+
968
+ pres_date_str = add_arg(args, "Present Date", vals, i + 9)
969
+ pres_date = parse_hh_start(pres_date_str)
970
+ pres_value_str = add_arg(args, "Present Value", vals, i + 10)
971
+ pres_value = Decimal(pres_value_str)
972
+
973
+ pres_type_str = add_arg(args, "Present Type", vals, i + 11)
974
+ pres_type = ReadType.get_by_code(sess, pres_type_str)
975
+ bill.insert_read(
976
+ sess,
977
+ tpr,
978
+ coefficient,
979
+ units,
980
+ msn,
981
+ mpan_str,
982
+ prev_date,
983
+ prev_value,
984
+ prev_type,
985
+ pres_date,
986
+ pres_value,
987
+ pres_type,
988
+ )
989
+ i += 12
990
+ elif typ == "element":
991
+ name = add_arg(args, "Name", vals, i + 1)
992
+ start_date_str = add_arg(args, "Start Date", vals, i + 2)
993
+ start_date = parse_hh_start(start_date_str)
994
+ finish_date_str = add_arg(args, "Finish Date", vals, i + 3)
995
+ finish_date = parse_hh_start(finish_date_str)
996
+ net_str = add_arg(args, "Net", vals, i + 4)
997
+ net = Decimal(net_str)
998
+ breakdown_str = add_arg(args, "Breakdown", vals, i + 5)
999
+ breakdown = _parse_breakdown(breakdown_str)
1000
+ bill.insert_element(
1001
+ sess,
1002
+ name,
1003
+ start_date,
1004
+ finish_date,
1005
+ net,
1006
+ breakdown,
1007
+ )
1008
+ i += 6
986
1009
 
987
1010
  elif action == "update":
988
1011
  bill_id_str = add_arg(args, "Bill Id", vals, 0)
@@ -4,7 +4,7 @@ import threading
4
4
  import traceback
5
5
  from collections import defaultdict
6
6
  from datetime import datetime as Datetime
7
- from decimal import Decimal
7
+ from decimal import Decimal, ROUND_HALF_UP
8
8
  from itertools import combinations
9
9
  from numbers import Number
10
10
 
@@ -18,6 +18,8 @@ from sqlalchemy.sql.expression import null
18
18
 
19
19
  from werkzeug.exceptions import BadRequest
20
20
 
21
+ from zish import ZishException
22
+
21
23
 
22
24
  from chellow.dloads import open_file
23
25
  from chellow.e.computer import SupplySource, contract_func
@@ -456,6 +458,40 @@ def _process_period(
456
458
  f"the Net GBP ({bill.net}) + VAT GBP ({bill.vat}) of the bill."
457
459
  )
458
460
 
461
+ vat_net = Decimal("0.00")
462
+ vat_vat = Decimal("0.00")
463
+
464
+ try:
465
+ bd = bill.bd
466
+
467
+ if "vat" in bd:
468
+ for vat_percentage, vat_vals in bd["vat"].items():
469
+ calc_vat = Decimal(
470
+ float(vat_percentage) / 100 * float(vat_vals["net"])
471
+ ).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
472
+ if calc_vat != vat_vals["vat"]:
473
+ actual_bill["problem"] += (
474
+ f"The VAT at {vat_percentage}% on the net amount "
475
+ f"{vat_vals['net']} is calculated to be {calc_vat}, "
476
+ f"which is different from the value in the bill of "
477
+ f"{vat_vals['vat']}"
478
+ )
479
+ vat_net += vat_vals["net"]
480
+ vat_vat += vat_vals["vat"]
481
+ except ZishException as e:
482
+ actual_bill["problem"] += f"Problem parsing the breakdown: {e}"
483
+
484
+ if vat_net != bill.net:
485
+ actual_bill["problem"] += (
486
+ f"The total 'net' {vat_net} in the VAT breakdown doesn't "
487
+ f"match the 'net' {bill.net} of the bill."
488
+ )
489
+ if vat_vat != bill.vat:
490
+ actual_bill["problem"] += (
491
+ f"The total VAT {vat_vat} in the VAT breakdown doesn't "
492
+ f"match the VAT {bill.vat} of the bill."
493
+ )
494
+
459
495
  if len(actual_bill["problem"]) > 0:
460
496
  vals["problem"] += "Bills have problems. "
461
497
 
@@ -306,6 +306,7 @@
306
306
  <td>Type</td>
307
307
  <td>Breakdown</td>
308
308
  <td>Kwh</td>
309
+ <td>'read' or 'element'</td>
309
310
  <td>(Meter Serial Number</td>
310
311
  <td>Mpan</td>
311
312
  <td>Coefficient</td>
@@ -317,6 +318,12 @@
317
318
  <td>Present Date</td>
318
319
  <td>Present Value</td>
319
320
  <td>Present Type)*</td>
321
+ <td>'read' or 'element'</td>
322
+ <td>(Name</td>
323
+ <td>Start Date</td>
324
+ <td>Finish Date</td>
325
+ <td>Net</td>
326
+ <td>Breakdown)*</td>
320
327
  </tr>
321
328
  <tr>
322
329
  <td><em>update</em></td>
@@ -101,7 +101,7 @@
101
101
  {% for row in rows %}
102
102
  {% set data = row.data['data'] %}
103
103
  {% set properties = row.data.get('properties', {}) %}
104
- {% set market_ROLE_Code = data['market_role_code'] %}
104
+ {% set market_role_code = data['market_role_code'] %}
105
105
  <tr>
106
106
  <td><a href="/report_run_rows/{{row.id}}">View</a></td>
107
107
  <td style="white-space: nowrap">
@@ -108,7 +108,12 @@
108
108
  <td>
109
109
  <strong style="color: red">{{bill.problem}}</strong>
110
110
  </td>
111
- <td>{{bill.breakdown}}</td>
111
+ <td>
112
+ <details>
113
+ <summary>Breakdown</summary>
114
+ <pre>{{bill.breakdown}}</pre>
115
+ </details>
116
+ </td>
112
117
  </tr>
113
118
  {% endfor %}
114
119
  </tbody>
chellow/views.py CHANGED
@@ -1389,14 +1389,17 @@ def report_run_get(run_id):
1389
1389
  )
1390
1390
  for n in element_names
1391
1391
  ]
1392
- sum_diffs = g.sess.execute(
1393
- select(*diff_selects).where(ReportRunRow.report_run == run)
1394
- ).one()
1392
+ if len(diff_selects) > 0:
1393
+ sum_diffs = g.sess.execute(
1394
+ select(*diff_selects).where(ReportRunRow.report_run == run)
1395
+ ).one()
1395
1396
 
1396
- for elem, sum_diff in zip(element_names, sum_diffs):
1397
- elements.append((elem, sum_diff))
1397
+ for elem, sum_diff in zip(element_names, sum_diffs):
1398
+ elements.append((elem, sum_diff))
1398
1399
 
1399
- elements.sort(key=lambda x: 0 if x[1] is None else abs(x[1]), reverse=True)
1400
+ elements.sort(
1401
+ key=lambda x: 0 if x[1] is None else abs(x[1]), reverse=True
1402
+ )
1400
1403
 
1401
1404
  if "element" in request.values:
1402
1405
  element = req_str("element")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chellow
3
- Version: 1759155233.0.0
3
+ Version: 1759823276.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)
@@ -14,7 +14,7 @@ Requires-Dist: odio==0.0.23
14
14
  Requires-Dist: openpyxl==3.1.5
15
15
  Requires-Dist: paramiko==3.4.1
16
16
  Requires-Dist: pep3143daemon==0.1.0
17
- Requires-Dist: pg8000==1.31.1
17
+ Requires-Dist: pg8000==1.31.5
18
18
  Requires-Dist: pip>=9.0.1
19
19
  Requires-Dist: psutil==5.9.5
20
20
  Requires-Dist: pympler==1.0.1
@@ -47,7 +47,7 @@ Chellow is a web application for checking UK electricity and gas bills. It's des
47
47
  for organizations with high electricity consumption. The software is hosted at
48
48
  https://github.com/WessexWater/chellow.
49
49
 
50
- [![Build Status](https://github.com/WessexWater/chellow/workflows/chellow/badge.svg)](https://github.com/WessexWater/chellow/workflows/chellow)
50
+ [![Build Status](https://github.com/WessexWater/chellow/actions/workflows/chellow.yml/badge.svg)](https://github.com/WessexWater/chellow/actions/workflows/chellow.yml)
51
51
 
52
52
 
53
53
  ## Installation
@@ -55,8 +55,7 @@ https://github.com/WessexWater/chellow.
55
55
  Chellow is a Python web application that uses the PostgreSQL database. To install
56
56
  Chellow, follow these steps:
57
57
 
58
- * Install [PostgreSQL](http://www.postgresql.org/) 12
59
- * Set the PostgreSQL time zone to 'UTC'.
58
+ * Install [PostgreSQL](http://www.postgresql.org/) 15
60
59
  * Create a PostgreSQL database: `createdb --encoding=UTF8 chellow`
61
60
  * Set up the following environment variables to configure Chellow:
62
61
 
@@ -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=Lq70TUJuogoP5KGrphzUEUfyfgftEclg_iA3mpNAaDI,51324
7
7
  chellow/fake_batch_updater.py,sha256=khAmvSUn9qN04w8C92kRg1UeyQvfLztE7QXv9tUz6nE,11611
8
- chellow/general_import.py,sha256=bm8FoaC9xUajGvJYShuS5GEwPwcL5eCF9D9g6o_AkB0,68089
8
+ chellow/general_import.py,sha256=ghybbden66VT4q5J0vYwiNg-6G2vg71EgCN_x3fvhW0,69200
9
9
  chellow/models.py,sha256=Ws3-jP6x3bSrCmv1umbviaQ3SijpP4R_a6i2Go26gRM,247072
10
10
  chellow/national_grid.py,sha256=-c_vqNRtpNIQOcm0F1NDhS3_QUiOaLgEJYWzysSNc5Y,4369
11
11
  chellow/proxy.py,sha256=cVXIktPlX3tQ1BYcwxq0nJXKE6r3DtFTtfFHPq55HaM,1351
@@ -13,7 +13,7 @@ chellow/rate_server.py,sha256=RwJo-AzBIdzxx7PAtboZEUH1nUjAeJckw0bk06-9oyM,5672
13
13
  chellow/rrun.py,sha256=sWm_tuJ_6xH3T28TY1w63k1Q44N_S_p_pYF5YCeztqU,2226
14
14
  chellow/testing.py,sha256=Dj2c1NX8lVlygueOrh2eyYawLW6qKEHxNhXVVUaNRO0,3637
15
15
  chellow/utils.py,sha256=i3GQK9MIcweosZk2gi-nX_IFq2DxURAJDyNoLBg6YwM,19421
16
- chellow/views.py,sha256=sEWt-CcVl4YPe7raAGXforkoIdfM6ofiBt6aQdmKFV4,85978
16
+ chellow/views.py,sha256=9IUUbYjqEmQQzbYQB4w-ygCo25gecIxYVbxTXRF-YfY,86078
17
17
  chellow/e/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  chellow/e/aahedc.py,sha256=d2usudp7KYWpU6Pk3fal5EQ47EbvkvKeaFGylnb3NWw,606
19
19
  chellow/e/bill_importer.py,sha256=mEW4s_P5tp81uf1cYWCKcr5DW1EkeRi0JUHy9caz5mI,10353
@@ -78,7 +78,7 @@ chellow/gas/transportation.py,sha256=uWFh0v-ViA02nH9Vof9JG3PiyAPXwhYZ1SvPxuzsQ0I
78
78
  chellow/gas/views.py,sha256=GeCvi6BGTUN7bu7sVkypNckwG3Crl6AbUcRob9qMi0E,59733
79
79
  chellow/reports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
80
80
  chellow/reports/report_109.py,sha256=Exb-FQ5f70-ier_h15CgHGysQ7vJ7k3gFZ1001zM3iM,11171
81
- chellow/reports/report_111.py,sha256=mLU56iUir-YKpuYIA-LqEo2ipsoYtF_HlvRtGz1xD5s,24545
81
+ chellow/reports/report_111.py,sha256=LNrSqXb_oIShjWj5KewciAc2KCtOZiSIVr4lhZkif1I,26168
82
82
  chellow/reports/report_169.py,sha256=wortJyvgXTrnjjXhLzqwaksKKu63K5IgdzU5f4SkHMI,9246
83
83
  chellow/reports/report_181.py,sha256=ypfYWYVNC1X2fMlJyDzwNiNTTRrpPW49DirXE_xDKa0,4958
84
84
  chellow/reports/report_183.py,sha256=fGONpKEIXTqIT_3dE5jZKBIesWPgLq-chHO6X22dIv0,8768
@@ -128,7 +128,7 @@ chellow/templates/downloads.html,sha256=R9QPcFz-PLJOX7rDlmquIk-Hp9Iq-thzWCTfOexS
128
128
  chellow/templates/edi_viewer.html,sha256=szUthgHOdph6Of-7f_1LeC_zYlNJaMeS5ctn6xTAeiM,1437
129
129
  chellow/templates/fake_batch_updater.html,sha256=aRQbxtNUlIzxwgSUy2pr-Km5NbhZkse4WSBtlqFIJMg,1885
130
130
  chellow/templates/general_import.html,sha256=9ezzieDjaPBZ0nUJkMkzoDxWVzYtr4D-Dr2UCA5xV8U,1370
131
- chellow/templates/general_imports.html,sha256=-uQRJBtpwZHODcWM1JuECJ_H_AHsu8frtwEFQ6s_7Sk,13690
131
+ chellow/templates/general_imports.html,sha256=h7UC7AWJ3Qw9PH8UPq24PqZ5xQF5b3Ct7LfC_PK78BE,13866
132
132
  chellow/templates/home.html,sha256=7xiD6QLju3ugALzMlzTJosRyMUmQGWPK6jDF7oZbnAQ,5781
133
133
  chellow/templates/input_date.html,sha256=rpgB5n0LfN8Y5djN_ZiuSxqdskxzCoKrEqI7hyJkVQo,1248
134
134
  chellow/templates/local_report.html,sha256=pV7_0QwyQ-D3OS9LXrly5pq3qprZnwTCoq6vCnMTkS4,1332
@@ -146,13 +146,13 @@ chellow/templates/object_summary.html,sha256=VGCAAYcWTzgNfL0mxEef2Fa8dP3FcBhzj0f
146
146
  chellow/templates/rate_server.html,sha256=SezuwdKhHRZ00-R_S6ttKiZ-nvRpwozV9QcIMf9StG8,5360
147
147
  chellow/templates/report_run.html,sha256=O_wjIu43S-mKVyZyku3dJJdvyck3rAgEdhw59TsCcK0,4040
148
148
  chellow/templates/report_run_asset_comparison.html,sha256=VYCCUmIC7Mfe7uuaAHb6ihiK6zsqeTlQbzgtzLqR3zg,2305
149
- chellow/templates/report_run_bill_check.html,sha256=G2hGKD_Gh3_zo67EMirYAJ0iz8IXF9CaKwiZ49E7n6o,4505
149
+ chellow/templates/report_run_bill_check.html,sha256=gLeQbDb6AayGR-gvDq5v7M-XxEkNA6f0PO6-NP-UjPU,4505
150
150
  chellow/templates/report_run_ecoes_comparison.html,sha256=EYjmdiQ14lt_CW7e6mdyQYec1t-rg8g85wFb1757YpI,4812
151
151
  chellow/templates/report_run_g_bill_check.html,sha256=tOXl_mjR__foYKiOYflJbK-459actAtjzv8rfuL3TwM,4851
152
152
  chellow/templates/report_run_missing_e_bills.html,sha256=l5idQhfaNhMvvzIRv-iqCpeDnYl_wgs6-mZMBOmuyR8,2447
153
153
  chellow/templates/report_run_monthly_duration_org.html,sha256=gGNGJ4Q50q4BtIMi98rhO-7NqRHcsFUmbj2qzeOLejw,1713
154
154
  chellow/templates/report_run_row.html,sha256=bmtcdqJaS1CXpL0i8PuqvmeF98jKNYX5-mnQu-OuDKQ,3791
155
- chellow/templates/report_run_row_bill_check.html,sha256=olLzCvllJsPyXgs3f2V9G1N1w_KVmi_7tSqMF9TE9QM,8011
155
+ chellow/templates/report_run_row_bill_check.html,sha256=JzedUA9R4-0jnonnoluV7CYCnzGsSAPFQtEVgMt6GTc,8105
156
156
  chellow/templates/report_run_row_g_bill_check.html,sha256=2Ym9mkwvA_DGDrgktDDwXQXlUK7tR2aR3gp3KUqMLoI,7017
157
157
  chellow/templates/report_run_supply_contacts.html,sha256=JNzwz9M6qbLRDMkCzFCxxANapUer5klxo7t5a48nAzg,2117
158
158
  chellow/templates/report_runs.html,sha256=ecoIkl2WtfYtifiTxnslmpMGYYGVQW-CVSBpqhXyiE4,1131
@@ -399,6 +399,6 @@ chellow/templates/g/supply_note_edit.html,sha256=b8mB6_ucBwoljp03iy6AgVaZUhGw3-1
399
399
  chellow/templates/g/supply_notes.html,sha256=6epNmZ3NKdXZz27fvmRUGeffg_oc1kmwuBeyRzQe3Rg,854
400
400
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
401
401
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
402
- chellow-1759155233.0.0.dist-info/METADATA,sha256=qzWyoZ51hskEgNCLUswUI7miFb3QIbshyX4o37JeaXc,12519
403
- chellow-1759155233.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
404
- chellow-1759155233.0.0.dist-info/RECORD,,
402
+ chellow-1759823276.0.0.dist-info/METADATA,sha256=FByd2AG_PHGsgs27uxDhVTHa9U52X14rX8HGh4X7aVo,12500
403
+ chellow-1759823276.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
404
+ chellow-1759823276.0.0.dist-info/RECORD,,