« Ruby on Rails - Sharing Session for Singapore PHP User Group | Main | "Go away or I will replace you with a very small shell script" v2 »

April 16, 2008

Poor Man's Trends

I've just released my Poorman's Trends Rails plugin as an excuse to do something with my GitHub account. Much like its distant cousin, Poor Man's CRM, this software aims to be plug-and-play, self-sufficient and useful enough to make sense of existing data.

3 Steps to get it:

  1. Install into vendor/plugins with
    ./script/plugin install git://github.com/choonkeat/poormans-trends.git
  2. Add 1 line into your existing controller, e.g. admin_controller.rb
    include Poormans::Trends
  3. Point your browser to http://yourserver/admin/poormans_trends and Viola!

You should see a simple page greeting you, like in this screenshot:

Poorman's Trends Homepage

Pick a Model class, and you should see some pretty graphs making their AJAXy entrance:

Poorman's Trends Example3
Poorman's Trends Example1

What's happening is that a few interesting columns are picked up from the Model's table and a few popular values are picked up from those columns. A count is done for all of them, divided up by weeks and spitted out as HTML tables. These tables are then turned into pretty charts using the nice HTML-table-to-canvas javascript library from Filament Group.

Without configuration nor knowledge of what your application does, is there any hope that it can make sense?

That's where the "picking of interesting columns" come in. Assuming zero domain knowledge of your application, I'd say the foreign keys are most interesting (in Rails convention, any column ending with "_id"), together with sub-classes ("type" and any columns ending with "_type"). The time aspect relies on the Rails convention of using "created_at".

The end result actually looks pretty good for something requiring no configuration! :-)

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00e398212d6f883300e551ede9a78834

Listed below are links to weblogs that reference Poor Man's Trends:

Comments

Cool. I am going to try this. I think this comes really close to what I was looking for. I would like to make the "trends" panel of my site myself, so this could very well be a good starting point. Thank you.

@s2 lemme know how it works out for ya! :-D

Dude, I've been wanting something like this for ages! I have a half assed version implemented, but this looks really great. Can't wait to try it out.

Okay, got it all setup and it rocks. Great starting point, going to start tweaking the graphs and whatnot to suit my app. Thanks!

@chris fork it! ;-)

Nice work!
Cool to see our charts get some use. Do you have a link to a working implementation?

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment

Blog powered by TypePad