chellow 1716928285.0.0__py3-none-any.whl → 1716978442.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.

@@ -9,8 +9,19 @@ from werkzeug.exceptions import BadRequest
9
9
  from chellow.edi_lib import parse_edi, to_date, to_decimal
10
10
  from chellow.utils import HH, to_ct, to_utc
11
11
 
12
-
13
- READ_TYPE_MAP = {"00": "A", "01": "E", "02": "E"}
12
+ # From Total 2024-05-29
13
+ # ReadType == "C" = "00"
14
+ # ReadType == "N" = "00"
15
+ # ReadType == "A" = "00"
16
+ # ReadType == "PA" = "00"
17
+ # ReadType == "S" = "00"
18
+ # ReadType == "I" = "00"
19
+ # ReadType == "E" = "02"
20
+ # ReadType == "AE" = "02"
21
+ # ReadType == "M" = "02"
22
+ # ReadType == "PE" = "02"
23
+
24
+ READ_TYPE_MAP = {"00": "A", "02": "E"}
14
25
 
15
26
 
16
27
  SUPPLIER_CODE_MAP = {
@@ -15,8 +15,8 @@ from chellow.models import (
15
15
  Bill,
16
16
  BillType,
17
17
  Era,
18
+ RSession,
18
19
  RegisterRead,
19
- Session,
20
20
  Supply,
21
21
  User,
22
22
  )
@@ -27,31 +27,33 @@ from chellow.views import chellow_redirect
27
27
  def content(year, month, months, supply_id, user_id):
28
28
  f = None
29
29
  try:
30
- with Session() as sess:
30
+ with RSession() as sess:
31
31
  user = User.get_by_id(sess, user_id)
32
32
 
33
33
  f = open_file("register_reads.csv", user, mode="w", newline="")
34
34
  w = csv.writer(f, lineterminator="\n")
35
35
  titles = (
36
- "Duration Start",
37
- "Duration Finish",
38
- "Supply Id",
39
- "Import MPAN Core",
40
- "Export MPAN Core",
41
- "Batch Reference",
42
- "Bill Id",
43
- "Bill Reference",
44
- "Bill Issue Date",
45
- "Bill Type",
46
- "Register Read Id",
47
- "TPR",
48
- "Coefficient",
49
- "Previous Read Date",
50
- "Previous Read Value",
51
- "Previous Read Type",
52
- "Present Read Date",
53
- "Present Read Value",
54
- "Present Read Type",
36
+ "duration_start",
37
+ "duration_finish",
38
+ "site_code",
39
+ "site_name",
40
+ "supply_id",
41
+ "imp_mpan_core",
42
+ "exp_mpan_core",
43
+ "batch_reference",
44
+ "bill_id",
45
+ "bill_reference",
46
+ "bill_issue_date",
47
+ "bill_type",
48
+ "register_read_id",
49
+ "tpr",
50
+ "coefficient",
51
+ "prev_read_date",
52
+ "prev_read_value",
53
+ "prev_read_type",
54
+ "pres_read_date",
55
+ "pres_read_value",
56
+ "pres_read_type",
55
57
  )
56
58
  w.writerow(titles)
57
59
 
@@ -118,6 +120,8 @@ def content(year, month, months, supply_id, user_id):
118
120
  else:
119
121
  era = eras[-1]
120
122
 
123
+ site = era.get_physical_site(sess)
124
+
121
125
  for read in (
122
126
  sess.query(RegisterRead)
123
127
  .filter(
@@ -139,28 +143,30 @@ def content(year, month, months, supply_id, user_id):
139
143
  joinedload(RegisterRead.present_type),
140
144
  )
141
145
  ):
142
- vals = [
143
- start_date,
144
- finish_date,
145
- supply_id,
146
- era.imp_mpan_core,
147
- era.exp_mpan_core,
148
- batch.reference,
149
- bill.id,
150
- bill.reference,
151
- bill.issue_date,
152
- bill_type.code,
153
- read.id,
154
- "md" if read.tpr is None else read.tpr.code,
155
- read.coefficient,
156
- read.previous_date,
157
- read.previous_value,
158
- read.previous_type.code,
159
- read.present_date,
160
- read.present_value,
161
- read.present_type.code,
162
- ]
163
- w.writerow(csv_make_val(v) for v in vals)
146
+ vals = {
147
+ "duration_start": start_date,
148
+ "duration_finish": finish_date,
149
+ "site_code": site.code,
150
+ "site_name": site.name,
151
+ "supply_id": supply_id,
152
+ "imp_mpan_core": era.imp_mpan_core,
153
+ "exp_mpan_core": era.exp_mpan_core,
154
+ "batch_reference": batch.reference,
155
+ "bill_id": bill.id,
156
+ "bill_reference": bill.reference,
157
+ "bill_issue_date": bill.issue_date,
158
+ "bill_type": bill_type.code,
159
+ "register_read_id": read.id,
160
+ "tpr": "md" if read.tpr is None else read.tpr.code,
161
+ "coefficient": read.coefficient,
162
+ "prev_read_date": read.previous_date,
163
+ "prev_read_value": read.previous_value,
164
+ "prev_read_type": read.previous_type.code,
165
+ "pres_read_date": read.present_date,
166
+ "pres_read_value": read.present_value,
167
+ "pres_read_type": read.present_type.code,
168
+ }
169
+ w.writerow(csv_make_val(vals.get(t)) for t in titles)
164
170
 
165
171
  # Avoid a long-running transaction
166
172
  sess.rollback()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: chellow
3
- Version: 1716928285.0.0
3
+ Version: 1716978442.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)
@@ -59,7 +59,7 @@ chellow/e/bill_parsers/sww_xls.py,sha256=QEjiuvwvr5FuWCfqqVw8LaA_vZyAKsvRAS5fw3x
59
59
  chellow/gas/bill_import.py,sha256=w0lPgK_Drzh8rtnEBQe3qFuxrgzZ6qQSgpaGrrGznMU,6549
60
60
  chellow/gas/bill_parser_csv.py,sha256=Ecdy-apFT-mWAxddAsM4k1s-9-FpIaOfjP0oFc0rdQg,5557
61
61
  chellow/gas/bill_parser_engie_edi.py,sha256=Ko0vZP-QdVQ1uuhS_5cdrii60_cM4b_LFJMoY0pZqnk,8950
62
- chellow/gas/bill_parser_total_edi.py,sha256=k5b9vadgLdEb8dk1E-mZpcKGyxXh1AWYsNiGSUK5CBA,7172
62
+ chellow/gas/bill_parser_total_edi.py,sha256=pnh8qCd9NfXCZSbVxto9QIXoV7ri7exhLrUoP17brG0,7444
63
63
  chellow/gas/ccl.py,sha256=DMlcPUELZi00CaDekVJINYk3GgH5apFrImVdmkbyba0,2913
64
64
  chellow/gas/cv.py,sha256=4cdYYQ8Qak6NeYdBCB4YaQ0jX8-UkaydIIdibCQuXxM,7344
65
65
  chellow/gas/dn_rate_parser.py,sha256=Mq8rAcUEUxIQOks59bsCKl8GrefvoHbrTCHqon9N0z0,11340
@@ -73,7 +73,7 @@ chellow/reports/report_169.py,sha256=tnTiHmhigcgZ7E8rUSfgzsVYUCW947xBZZq04-KqfK8
73
73
  chellow/reports/report_181.py,sha256=mCL6vXfrj8r0kL-LilDS0SnSu5tJOzCq7eMJVx9zpEw,4999
74
74
  chellow/reports/report_183.py,sha256=DZX-hHJPl_Tbgkt31C_cuLZg_5L2b6iCPQ5foOZizR0,8817
75
75
  chellow/reports/report_187.py,sha256=UvpaYHjyJFNV5puYq8_KxfzoBtVrwFgIGUOmC5oGA9A,9956
76
- chellow/reports/report_219.py,sha256=o2eEg3mX9_raP2b4gjc2Gu4vqnMqcvvJBYQ1oQjxvpE,6637
76
+ chellow/reports/report_219.py,sha256=cA0lfJKnJg41Zc4_gZB1KUXZ9JeJo0TiTlu5jm1bdDM,7158
77
77
  chellow/reports/report_231.py,sha256=gOb1AkXZQvwVpRg5cIenO7iR7Se1_zsWnJp9l2BlgpA,5008
78
78
  chellow/reports/report_233.py,sha256=cIatj-HHYW_GNIRsji-DlsmYjt8rUdm_5xujPLOYL8U,4537
79
79
  chellow/reports/report_241.py,sha256=AlFmSHnfG2HWv_ICmWX7fNpPwLHjq7mo1QtOTjSKO3k,5384
@@ -364,6 +364,6 @@ chellow/templates/g/supply_note_edit.html,sha256=6UQf_qbhFDys3cVsTp-c7ABWZpggW9R
364
364
  chellow/templates/g/supply_notes.html,sha256=WR3YwGh_qqTklSJ7JqWX6BKBc9rk_jMff4RiWZiF2CM,936
365
365
  chellow/templates/g/unit.html,sha256=KouNVU0-i84afANkLQ_heJ0uDfJ9H5A05PuLqb8iCN8,438
366
366
  chellow/templates/g/units.html,sha256=p5Nd-lAIboKPEOO6N451hx1bcKxMg4BDODnZ-43MmJc,441
367
- chellow-1716928285.0.0.dist-info/METADATA,sha256=lq5aS6s7xy1rEuw15YFDiVcv3oNv-OeA3IM1cyaKgqc,12205
368
- chellow-1716928285.0.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
369
- chellow-1716928285.0.0.dist-info/RECORD,,
367
+ chellow-1716978442.0.0.dist-info/METADATA,sha256=UeYVA1nfFGn3AMlHF_8OvShako15szmOhzVhzBlW47g,12205
368
+ chellow-1716978442.0.0.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
369
+ chellow-1716978442.0.0.dist-info/RECORD,,