bwigianto / powertochoose Goto Github PK
View Code? Open in Web Editor NEWA crowd sourced way to find the cheapest electricity plans in Texas
License: MIT License
A crowd sourced way to find the cheapest electricity plans in Texas
License: MIT License
I'm thinking that we could save the tariff and a link and separate out different charges and such with a JSON dictionary. We could seed it with classes of TDU.
For example (made up data):
class rate(object):
def __init__(self, lim, func):
self.lim = lim,
self.func = func
tier = rate(500, '(.05)*(x-500)') # example to show is object
print(tier)
class TDU(object):
def __init__(self, name, tariff, base, tier1, tier2, tier3):
self.name = name
self.tariff = tariff,
self.base = base,
self.tier1 = tier1,
self.tier2 = tier2,
self.tier3 = tier3
infuse = TDU('infuse_3', 'abc123-10abcd-ef', '10',
rate(500, '(.05)*(x-500)'),
rate(1500, '(.05)*(x-1500)'),
rate(2500, '(.10)*(x-2500)'))
print(infuse) # example to show nesting rate in TDU
def jdefault(o):
return o.__dict__
print(json.dumps(infuse, default=jdefault))
# prints json representation (which is what we would store)
These are the print outputs FYI
<__main__.rate object at 0x015CA930>
<__main__.TDU object at 0x015CAB90>
{"base": ["10"], "tier2": [{"lim": [1500], "func": "(.05)*(x-1500)"}], "tier1": [{"lim": [500], "func": "(.05)*(x-500)"}], "tier3": {"lim": [2500], "func": "(.10)*(x-2500)"}, "tariff": ["abc123-10abcd-ef"], "name": "infuse_3"}
On the backend, then, we create a function that reads the json files and evals the rates?
Make houston.py call all functions inside and return the sum of total bills
The houston.py file is all hard coded with my example usage pattern over a 12 month period and so it's not generally useful yet.
When I run the script with 12 numbers
python houston.py 100 200 300 400 500 600 700 800 900 1000 1100 1200
we get a dictionary of plan names (function names) to total price over the 12 month period:
{'keep it simple savings': 210.34, 'wise buy complete': 120.54 ... }
Pull out the hard coded TDU charges in each plan calculation function in houston.py
Create or update electricity usage plan functions
These will help determine and sort which plans to use. We'll need a lot of help implementing and updating each of these functions correctly.
This association will make it more immediately obvious which plan corresponds to which calculation and will hopefully make it easier to maintain this as the terms of the plans change/plans stop being offered.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.