Code to Grab your Maritime Electric Transactions

Peter Rukavina

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:

wget http://data.maritimeelectric.com/transactions.xml

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:

  1. Grab a ZIP file of the latest pei-energy code.
  2. Unzip the resulting file, which will be named something like reinvented-pei-energy-2bec180.zip.
  3. From the command line, move to the maritime-electric/transactions folder inside the code you just unzipped.
  4. 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:

Working with Electricity Bill Data in Numbers

Comments

Submitted by Todd on

Permalink

Pulled my transaction data into Excel last night from the Maritime Electric site [the old fashioned copy/paste way, I’m afraid :-) ] and played around with the sorts and filtering. Then tried some trending graphs. Very interesting to visualize this history.

Thanks for the tip, Peter!

Submitted by Peter Rukavina on

Permalink

I fixed a bug in the PHP&#160code that was causing only every second transaction to be exported into the CSV file.


Note, was well, that the line-item “PEN Charge” is what appears on printed bills as “Interest charge on unpaid balance”.

Submitted by Peter Rukavina on

Permalink

Some insights from Martin Spindler on customer reading of our own digital electricity meters:


<object width=”100%” height=”81”>
<param name=”movie” value=”http://player.soundcloud.com/p…”/>
<param name=”allowscriptaccess” value=”always”/> <embed width=”100%” height=”81” allowscriptaccess=”always” src=”http://player.soundcloud.com/p…” type=”application/x-shockwave-flash”></embed> </object>

Add new comment

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

Photo of Peter RukavinaI am . I am a writer, letterpress printer, and a curious person.

To learn more about me, read my /nowlook at my bio, listen to audio I’ve posted, read presentations and speeches I’ve written, or get in touch (peter@rukavina.net is the quickest way). 

You can subscribe to an RSS feed of posts, an RSS feed of comments, or a podcast RSS feed that just contains audio posts. You can also receive a daily digests of posts by email.

Search