chellow-2827
2827
2826
2825
2824
2823
2822
2821
2820
2819
2818
2817
2816
2815
2814
2813
2812
2811
2810
2809
2808
2807
2805
2804
2803
2802
2801
2800
2799
2798
2797
2796
2795
2794
2793
2792
2791
2790
2789
2788
2784
2783
2782
2781
2780
2779
2778
2777
2776
2775
2774
2773
2772
2771
2770
2769
2768
2767
2764
2763
2760
2758
2757
2756
2755
2753
2752
2751
2750
2749
2747
2746
2745
2744
2743
2742
2741
2740
2739
2738
2737
2736
2735
2733
2732
2731
2730
2729
2728
2727
2726
2725
2723
2722
2720
2719
2718
2717
2716
2715
2714
2713
2712
2711
2710
2709
2708
2707
2706
2705
2704
2703
2702
2701
2700
2698
2696
2695
2694
2693
2692
2691
2690
2689
2688
2687
2686
2682
2681
2680
2679
2678
2677
2676
2675
2674
2673
2672
2671
2670
2669
2668
2667
2666
2665
2664
2663
2662
2661
2659
2657
2656
2655
2653
2651
2650
2649
2648
2647
2645
2644
2643
2642
2641
2638
2637
2636
2634
2631
2629
2628
2627
2626
2625
2624
2623
2622
2621
2620
2619
2618
2617
2616
2615
2614
2613
2611
2610
2608
2606
2605
2604
2603
2602
2601
2600
2599
2598
2597
2596
2595
2594
2593
2592
2591
2590
2589
2588
2587
2585
2583
2582
2581
2580
2579
2578
2577
2576
2575
2574
2573
2572
2571
2570
2569
2568
2567
2565
2564
2563
2562
2561
2560
2559
2558
2557
2556
2555
2553
2552
2551
2550
2549
2548
2547
2546
2544
2543
2542
2540
2539
2538
2537
2536
2535
2534
2533
2531
2529
2528
2527
2526
2525
2524
2523
2522
2520
2519
2518
2517
2516
2515
2514
2513
2510
2509
2508
2507
2506
2505
2504
2503
2502
2501
2500
2499
2498
2497
2496
2495
2494
2493
2492
2491
2490
2489
2488
2487
2485
2484
2483
2482
2481
2480
2479
2478
2477
2476
2475
2474
2473
2472
2471
2470
2469
2468
2467
2466
2465
2464
2463
2462
2460
2459
2458
2457
2456
2455
2454
2453
2452
2451
2450
2449
2447
2446
2445
2444
2442
2440
2439
2438
2437
2435
2434
2433
2432
2431
2430
2422
2420
2419
2418
2417
2416
2415
2414
2413
2412
2411
2410
2408
2405
2404
2403
2402
2401
2400
2399
2397
2396
2394
2393
2392
2391
2390
2389
2388
2387
2384
2383
2382
2381
2380
2379
2378
2377
2376
2375
2374
2373
2372
2371
2370
2369
2368
2367
2366
2365
2362
2361
2360
2358
2357
2356
2355
2354
2353
2351
2350
2349
2348
2347
2346
2345
2344
2343
2341
2340
2339
2338
2337
2336
2335
2334
2333
2332
2331
2328
2327
2326
2325
2324
2323
2322
2321
2320
2319
2318
2317
2316
2314
2312
2311
2310
2309
2308
2307
2303
2302
2301
2300
2299
2298
2294
2293
2292
2291
2290
2289
2288
2287
2286
2285
2284
2283
2282
2281
2280
2279
2278
2277
2276
2275
2274
2273
2272
2271
2270
2269
2268
2267
2266
2265
2264
2263
2261
2260
2259
2258
2257
2256
2254
2253
2252
2251
2250
2249
2248
2247
2246
2245
2244
2243
2241
2240
2239
2238
2237
2236
2235
2234
2233
2232
2231
2230
2229
2228
2227
2226
2225
2224
2223
2222
2221
2219
2218
2217
2216
2215
2214
2213
2212
2211
2210
2209
2208
2207
2206
2205
2204
2203
2202
2201
2200
2198
2197
2196
2195
2194
2193
2192
2191
2190
2189
2184
2183
2182
2181
2180
2179
2178
2177
2176
2174
2173
2172
2171
2170
2169
2168
2167
2165
2164
2163
2162
2161
2160
2159
2158
2157
2156
2155
2154
2153
2152
2151
2150
2149
2148
2147
2145
2144
2143
2142
2141
2140
2139
2138
2137
2136
2135
2134
2133
2132
2131
2130
2129
2128
2127
2126
2125
2124
2123
2122
2120
2117
2116
2115
2114
2113
2112
2111
2110
2109
2108
2107
2106
2105
2104
2103
2102
2101
2100
2099
2097
2096
2095
2094
2093
2092
2091
2090
2089
2088
2087
2086
2085
2084
2083
2082
2081
2080
2079
2078
2077
2076
2075
2074
2071
2070
2069
2068
2067
2066
2065
2064
2063
2062
2061
2060
2059
2058
2057
2056
2055
2054
2053
2052
2051
2050
2049
2048
2047
2046
2045
2044
2043
2042
2041
2040
2039
2038
2037
2036
2035
2034
2033
2032
2031
2030
2029
2028
2027
2026
2025
2024
2022
2021
2020
2019
2017
2016
2015
2014
2013
2012
2011
2010
2009
2008
2007
2006
2005
2004
2003
2002
2001
2000
1999
1998
1995
1994
1993
1992
1991
1990
1989
1988
1987
1986
1985
1984
1983
1982
1981
1980
1979
1978
1977
1976
1975
1974
1971
1970
1969
1968
1967
1966
1965
1964
1963
1962
1961
1960
1957
1956
1955
1954
1953
1952
1951
1949
1948
1947
1944
1943
1942
1941
1940
1939
1938
1937
1936
1935
1934
1933
1932
1931
1930
1929
1928
1927
1926
1925
1924
1923
1922
1921
1920
1919
1918
1917
1916
1915
1914
1912
1911
1910
1907
1906
1905
1904
1901
1899
1897
1896
1895
1894
1893
1892
1891
1890
1889
1888
1887
1683187792.0.0
1682692302.0.0
1682689432.0.0
1682682992.0.0
1682496543.0.0
1682345327.0.0
1681998363.0.0
1681996459.0.0
1681987257.0.0
1681899091.0.0
1681893421.0.0
1681890263.0.0
1681482204.0.0
1681477937.0.0
1681460579.0.0
1681398121.0.0
1681375983.0.0
1680630560.0.0
1680609693.0.0
1680512939.0.0
1680185003.0.0
1680180901.0.0
1680096270.0.0
1679675897.0.0
1679666417.0.0
1679494175.0.0
1679492799.0.0
1679477063.0.0
1679316064.0.0
1678964984.0.0
1678884840.0.0
1678873939.0.0
1678706572.0.0
1678381744.0.0
1678375085.0.0
1678360292.0.0
1677603109.0.0
1677580176.0.0
1677056335.0.0
1676653739.0.0
2827
2826
2825
2824
2823
2822
2821
2820
2819
2818
2817
2816
2815
2814
2813
2812
2811
2810
2809
2808
2807
2805
2804
2803
2802
2801
2800
2799
2798
2797
2796
2795
2794
2793
2792
2791
2790
2789
2788
2783
2782
2781
2780
2779
2778
2777
2776
2775
2774
2773
2772
2771
2770
2769
2768
2767
2764
2763
2758
2757
2756
2755
2753
2752
2751
2750
2749
2747
2746
2745
2744
2743
2742
2741
2740
2739
2738
2737
2736
2735
2733
2732
2731
2730
2729
2728
2727
2726
2725
2723
2722
2720
2719
2718
2717
2716
2715
2714
2713
2712
2711
2710
2709
2708
2707
2706
2705
2704
2703
2702
2701
2700
2698
2696
2695
2694
2693
2692
2691
2690
2689
2688
2687
2686
2682
2681
2680
2679
2678
2677
2676
2675
2674
2673
2672
2671
2670
2669
2668
2667
2666
2665
2664
2663
2662
2661
2659
2657
2656
2655
2653
2651
2650
2649
2648
2647
2645
2644
2643
2642
2641
2638
2637
2636
2634
2631
2629
2628
2627
2626
2625
2624
2623
2622
2621
2620
2619
2618
2617
2616
2615
2614
2613
2611
2610
2608
2606
2605
2604
2603
2602
2601
2599
2598
2597
2596
2595
2594
2593
2592
2591
2590
2589
2588
2587
2585
2583
2582
2581
2580
2579
2578
2576
2575
2574
2573
2572
2570
2569
2568
2567
2565
2564
2563
2562
2561
2560
2559
2558
2557
2556
2555
2553
2552
2551
2550
2549
2548
2547
2546
2544
2543
2542
2540
2539
2538
2537
2536
2535
2534
2533
2531
2529
2528
2527
2526
2525
2524
2523
2522
2520
2519
2518
2517
2516
2515
2514
2513
2510
2509
2508
2507
2506
2505
2504
2503
2502
2501
2500
2499
2498
2497
2496
2495
2494
2493
2492
2491
2490
2489
2488
2487
2485
2484
2483
2482
2481
2480
2479
2478
2477
2476
2475
2474
2473
2472
2471
2470
2469
2468
2467
2466
2465
2464
2463
2462
2460
2459
2458
2457
2456
2455
2454
2453
2452
2451
2450
2449
2447
2446
2445
2444
2442
2440
2439
2438
2437
2435
2434
2433
2432
2431
2430
2422
2420
2419
2418
2417
2416
2415
2414
2413
2412
2411
2410
2408
2405
2404
2403
2402
2401
2400
2399
2397
2396
2394
2393
2392
2391
2390
2389
2388
2387
2384
2383
2382
2381
2380
2379
2378
2377
2376
2375
2374
2373
2372
2371
2370
2369
2368
2367
2366
2365
1683187792.0.0
1682692302.0.0
1682689432.0.0
1682682992.0.0
1682496543.0.0
1682345327.0.0
1681998363.0.0
1681996459.0.0
1681987257.0.0
1681899091.0.0
1681893421.0.0
1681890263.0.0
1681482204.0.0
1681477937.0.0
1681460579.0.0
1681398121.0.0
1681375983.0.0
1680630560.0.0
1680609693.0.0
1680512939.0.0
1680185003.0.0
1680180901.0.0
1680096270.0.0
1679675897.0.0
1679666417.0.0
1679494175.0.0
1679492799.0.0
1679477063.0.0
1679316064.0.0
1678964984.0.0
1678884840.0.0
1678873939.0.0
1678706572.0.0
1678381744.0.0
1678375085.0.0
1678360292.0.0
1677603109.0.0
1677580176.0.0
1677056335.0.0
1676653739.0.0
توضیحات
Web Application for checking UK energy bills.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | chellow-2827 |
| نام | chellow |
| نسخه کتابخانه | 2827 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/chellow/ |
| مجوز | - |
# Chellow
A web application for checking UK electricity and gas bills for organizations with
a large number of supplies and / or high consumption.
Website: https://www.chellow.org/
## Licence
Chellow is released under the [GPL v3](http://www.gnu.org/licenses/gpl.html).
## Introduction
Chellow is a web application for checking UK electricity and gas bills. It's designed
for organizations with high electricity consumption. The software is hosted at
https://github.com/WessexWater/chellow.
[](https://github.com/WessexWater/chellow/workflows/chellow)
## Installation
Chellow is a Python web application that uses the PostgreSQL database. To install
Chellow, follow these steps:
* Install [PostgreSQL](http://www.postgresql.org/) 12
* Create a PostgreSQL database: `createdb --encoding=UTF8 chellow`
* Set up the following environment variables to configure Chellow:
| Name | Default | Description |
| ------------ | ----------- | ---------------------- |
| `PGUSER` | `postgres` | Postgres user name |
| `PGPASSWORD` | `postgres` | Postgres password |
| `PGHOST` | `localhost` | Postgres host name |
| `PGPORT` | `5432` | Postgres port |
| `PGDATABASE` | `chellow` | Postgres database name |
In bash an environment variable can be set by doing:
`export PGUSER=postgres`
in Windows an environment variable can be set by doing:
`set PGUSER=postgres`
* Install Python 3.9 (tested on the [CPython 3.9.8](http://www.python.org/) interpreter)
* Create a virtual environment: `python3 -m venv venv`
* Activate the virtual environment: `source venv/bin/activate`
* Install Chellow: `pip install chellow`
* Start Chellow:`waitress-serve --host=0.0.0.0 --port=8080 --call chellow:create_app`
* You should now be able to visit `http://localhost:8080/` in a browser. You should be
prompted to enter a username and password. Enter the admin user name
`admin@example.com` and the password `admin`, and then the home page should appear.
Change the admin password from the `users` page.
### Manually Upgrading Chellow
To upgrade to the latest version of Chellow do: `pip install --upgrade chellow`
### Automatically Upgrading Chellow
The bash script [chellow\_upgrader.sh](bin/chellow_upgrader.sh) will check for a new
version of Chellow and if one's there it will stop Chellow, then do the upgrade, then
start Chellow.
### Using with systemd
Copy the following files into the `/etc/systemd/system` directory:
* [chellow.service](systemd/chellow.service)
* [chellow\_upgrader.service](systemd/chellow_upgrader.service)
* [chellow\_upgrader.timer](systemd/chellow_upgrader.timer)
and modify them as appropriate. The `chellow_upgrader.service` uses the
`chellow_upgrader.sh` script above. The you should be able to use the following
commands:
* Start Chellow: `sudo systemctl start chellow`
* Make Chellow run on startup: `sudo systemctl enable chellow`
* Start the Chellow Upgrader: `sudo systemctl start chellow_upgrader.timer`
* Make Chellow Upgrader run on startup: `sudo systemctl enable chellow_upgrader.timer`
### Using A Different Webserver
Chellow comes bundled with the
[Waitress](http://docs.pylonsproject.org/projects/waitress/en/latest/) webserver, but
the is also a Python WSGI web application so Chellow can be used with any WSGI compliant
application server, eg Gunicorn. The WSGI app that should be specified is `chellow.app`.
## Getting Started
This is a brief guide to setting things up after you've installed Chellow. It
assumes that you have a basic knowledge of
[UK electricity billing](https://en.wikipedia.org/wiki/Electricity_billing_in_the_UK). It goes through the steps of adding a half-hourly (HH) metered supply,
and producing virtual bills for it, and then importing an actual bill and
running a bill check.
Chellow can handle non-half-hourly supplies as well as half-hourly, and it can
also deal with gas supplies, but we'll use a half-hourly electricity supply for
this example.
### View the Chellow home page
Assuming you've installed Chellow correctly, you should be able to open your
browser, type in the URL of the Chellow application, and see the Chellow home
page.
### Users
Before any users are added, if you access Chellow from `localhost` you'll have
read / write access. Once users are added, you have to log in as one of those
users. Users are added from the 'users' page.
### Importing Market Domain Data
Follow the instructions at `/e/mdd_imports` to import the Market Domain Data into
Chellow.
### Add HHDC Contracts
Every supply must a have a data collector. Add in a new HHDC by going to the
'HHDC Contracts' page and then clicking on the 'Add' link.
### Add MOP Contracts
Every supply must a have a meter operator. Add in a new MOP by going to the
'MOP Contracts' page and then clicking on the 'Add' link. For now just put in a
simple virtual bill for the MOP, so in the 'script' field enter:
```
from chellow.utils import reduce_bill_hhs
def virtual_bill_titles():
return ['net-gbp']
def virtual_bill(data_source):
for hh in data_source.hh_data:
bill_hh = data_source.mop_bill_hhs[hh['start-date']]
if hh['utc-is-month-end']:
bill_hh['net-gbp'] = 10
data_source.mop_bill = reduce_bills_hh(data_source.mop_bill_hhs)
```
### Add Supplier Contracts
Click on the 'supplier contracts' link and then fill out the 'Add a contract'
form. For the Charge Script field enter:
```
from chellow.utils import reduce_bill_hhs
def virtual_bill_titles():
return ['net-gbp', 'day-kwh', 'day-gbp', 'night-kwh', 'night-gbp']
def virtual_bill(data_source):
bill = data_source.supplier_bill
for hh in data_source.hh_data:
bill_hh = data_source.supplier_bill_hhs[hh['start-date']]
if 0 < hh['utc-decimal-hour'] < 8:
bill_hh['night-kwh'] = hh['msp-kwh']
bill_hh['night-gbp'] = hh['msp-kwh'] * 0.05
else:
bill_hh['day-kwh'] = hh['msp-kwh']
bill_hh['day-gbp'] = hh['msp-kwh'] * 0.1
bill_hh['net-gbp'] = sum(
v for k, v in bill_hh.items() if k[-4:] == '-gbp')
data_source.supplier_bill = reduce_bill_hhs(
data_source.supplier_bill_hhs)
```
This will generate a simple virtual bill based on a day / night tariff.
Supplier contract scripts can be much more sophisticated than this, including
DUoS, TNUoS, BSUoS, RO and many other standard charges. These will be addressed
later on in this guide.
Also, don't worry about the 'properties' field for now.
### Add a Site
Go to the 'sites' link on the home page, and click 'add'. Fill out the form
and create the site.
### Add a Supply
To add a supply to a site, go to the site's page and click on 'edit'. Half-way
down the page there's an 'Insert an electricity supply' form. For a standard
electricity supply the 'source' is 'net'. Make sure the profile class (PC) is
'00' to indicate to Chellow that it's a half-hourly metered supply. The SSC
field is left blank for a half-hourly as they don't have an SSC.
A supply is formed from a series of eras. Each era has different
characteristics to capture the history of a supply.
### Run a Virtual Bill
At this stage it should be possible to run a virtual bill for the supply you've
added. Go to the supply's page and click on the 'Supplier Virtual Bill' link.
That should return a page showing the virtual bill for the supply.
Of course, the consumption will be zero because we haven't added in any
half-hourly data yet.
### Add Some HH Data
On the page of the supply you've created, you'll see that there's a 'channels'
link, with an 'add' link next to it. Add an active import channel for the
half-hourly data to be attached to.
Back on the supply page a link to the channel you just created will have
appeared. Click on this and fill out the form for adding a half-hour of data.
If you then re-run the virtual bill for the period in which you added the
half-hour, it should show up in the virtual bill.
It's tedious to add HH data one by one, so if you go to the page of the HHDC
contract that you've created, you'll see a 'HH Data Imports' link. Click on
this and there's a form for uploading HH data in bulk in a variety of formats.
Chellow can also be set up to import files automatically from an FTP server.
### Virtual Bills For A Contract
To see the virtual bills for a supplier contract, go to the contract page and
follow the Virtual Bills link.
### Data Structure
* Site
* Supply
* Supply Era
* Site
* MOP Contract
* DC Contract
* Profile Class
* Imp / Exp Supplier Contract
* Imp / Exp Mpan Core
* Imp / Exp LLFC
* Imp / Exp Supply Capacity
* Imp / Exp Channels
* HH Data
* Supplier Contracts (Same for DC and MOP)
* Rate Scripts
* Batches
* Bills
* Supply
* Register Reads
* DNOs (Distribution Network Operators)
* LLFCs (Line Loss Factor Classes)
### General Imports
The menu has a link called 'General Import' which take you to a page for doing
bulk insert / update / delete operations on Chellow data (eg. Sites, Supplies,
LLFCs etc.) using a CSV file.
## Common Tasks
### Merging Two Supplies
Say there are two supplies A and B, and you want to end up with just A. The
steps are:
1. Back up the data by taking a snapshot of the database.
2. Check that A and B have the same header data (LLFC, MTC etc).
3. See if there are any overlapping channels, eg. do both A and B have import
kVArh? If there are, then decide which one is going to be kept.
4. Load the hh data for the required channels from the backup file. First
take a copy of the file, then edit out the data you don't want, then
further edit the file so that it loads into the new supply.
5. Delete supply B.
### Local Reports
Core reports come with Chellow, but it's possible for users to create custom
reports. Reports are written in Python, and often use a Jinja2 template. You
can display a link to a report of user reports by adding the `local_reports_id`
to the `configuration` non-core contract.
#### Default users
Default users can be automatically assigned to requests from certain IP
addresses. To associate an IP address to a user, go to the non-core contract
`configuration` and add a line to the 'properties' field similar to the
following:
```
{
'ips': {'127.0.0.1': 'implicit-user@localhost'}
}
```
Note that multiple IP addresses can be mapped to the same user.
It's also possible to use Microsoft Active Directory to authenticate users
with a reverse proxy server. Edit the `configuration` non-core contract and add
something like:
```
{
"ad_authentication": {
"default_user": "readonly@example.com",
"on": true
}
```
## Design Decisions
Why don't you use the +/- infinity values for timestamps? The problem is that it's not clear how this would translate into Python. So we currently use null for infinity, which naturally translates into None in Python.
نیازمندی
| مقدار | نام |
|---|---|
| - | flask-restx==1.0.3 |
| - | flask==2.3.2 |
| - | odio==0.0.22 |
| - | openpyxl==3.0.10 |
| - | pep3143daemon==0.0.6 |
| - | pg8000==1.29.3 |
| - | pip>=9.0.1 |
| - | psutil==5.9.4 |
| - | pympler==1.0.1 |
| - | pypdf==3.6.0 |
| - | pysftp==0.2.9 |
| - | python-dateutil==2.8.2 |
| - | pytz==2022.6 |
| - | requests==2.28.1 |
| - | sqlalchemy==1.4.44 |
| - | waitress==2.1.2 |
| - | xlrd==2.0.1 |
| - | zish==0.1.10 |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.9 | Python |
نحوه نصب
نصب پکیج whl chellow-2827:
pip install chellow-2827.whl
نصب پکیج tar.gz chellow-2827:
pip install chellow-2827.tar.gz