My next logical step after discovering the treasure-trove of data available to customers in Maritime Electric’s customer portal was to create a simpler way of pulling that information out of their website and into a format that’s easier to analyze and visualize.
In an ideal world there would be a Maritime Electric API that would allow me to do something like:
But there’s not. So some scripted login voodoo, followed by some screen-scraping voodoo, is required to pull the data off in a useful format.
And so that’s what I did. Over at GitHub you can grab the code and, assuming you’re on a suitably-equipped computer (a Mac works well for this with nothing additional to install), you can turn your complete Maritime Electric transaction history into a CSV file, suitable for import into a spreadsheet, in one easy step. Here’s a quick step-by-step:
- Grab a ZIP file of the latest pei-energy code.
- Unzip the resulting file, which will be named something like reinvented-pei-energy-2bec180.zip.
- From the command line, move to the maritime-electric/transactions folder inside the code you just unzipped.
- From the command line, issue the following command, substituting the email address and password you use to login to the Maritime Electric Customer Portal:
php maritime-electric-dump.php email password
The result will be a file, in your home directory, called maritime-electric-accounts.csv that lists the service addresses attached to your account, and one file, named [account-number].csv, for each service address containing the complete transaction history for that address.
You can then load those files into any old spreadsheet application to search, sort and visualize the data: