Agile Web Development

Build it. Launch it. Love it.

Active OLAP

This Rails plugin makes it easy to add an OLAP interface to your application, which is great for administration interfaces. Its main uses are collection information about the usage of your application and detecting inconsistencies and problems in your data. It does so by counting records in the table that conform the provided category definitions.



This plugin is developed for the Floorplanner.com website, but is usable for any ActiveRecord based model. Because named_scope is used for the implementation, Rails 2.1 is required for this to work.


An example to show how this plugin works:

class MyModel < ActiveRecord::Base
  # fields :published_at, :category_field, :price
  enable_active_olap do |olap|
    olap.dimension :category_field
    olap.dimension :published, :categories => [
      :published_recently => 'published_at > NOW() - INTERVAL 1 MONTHS',
      :published_earlier =>  'published_at <= NOW() - INTERVAL 1 MONTHS'
    ] # :other category (not published) added automatically
  end
end

# execute simple query
@result = MyModel.olap_query(:category_field)

# drilldown to records in published/other category
# (implemented as a named scope)
@my_models = MyModel.olap_drilldown(:published => :other).
      paginate(:page => 1)
@mymodels.each { |my_model| ... }

# multiple dimensions
@result = MyModel.olap_query(:category_field, :published)

Features:
- Multi-dimensional queries
- Drilling down to individual records
- Easily define your dimensions
- Easily perform trend queries
- Rails helpers in development to display graphs and tables
- BSD-licensed


For some information about this plugin, see the Floorplanner techblog:
http://techblog.floorplanner.com/tag/active_olap/

Vitals

Home http://techblog.floorplanner.com/tag/active_olap
Repository git://github.com/wvanbergen/active_olap.git
License BSD
Tags Tag_red activerecord drilldown named_scope OLAP query statistics
Rating (1 vote)
Owner Willem van Bergen
Created 29 July 2008

Comments

Add a comment