bitbckt edited this page Sep 12, 2010 · 4 revisions
Clone this wiki locally

Munger Ruby Reporting Library

Munger is basically a simple data munging and reporting library
for Ruby as an alternative to Ruport, which did not fill my needs
in ways that convinced me to start over rather than try to fork or
patch it. Apologies to the Ruport chaps, whom I am sure are
smashing blokes – it just didn’t wiggle my worm.

See the MungerData tutorial for lots of information.

3-Part Reporting

Munger creates reports in three stages, much like an Apollo rocket. My
main problem with Ruport was the coupling of different parts of these
stages in ways that didn’t make the data easily re-usable, cacheable or
didn’t give me enough control. I likes to have my data separate from my
report, which should be renderable however I want.

Stage 1 – Data Munging

The first stage is getting a dataset that has all the information you need.
I like to call this stage ‘munging’ (pronounced: ‘MON’-day + chan-‘GING’),
which is taking a simple set of data (from a SQL query, perhaps) and
transforming fields, adding derived data, pivoting, etc – and making it into
a table of all the actual data-points you need.

Stage 2 – Report Formatting

Then there is the Reporting. To me, this means taking your massaged dataset
and doing all the fun reporting to it. This includes grouping, subgrouping,
sorting, column ordering, multi-level aggregation (sums, avg, etc) and
highlighting important information (values that are too small, too high, etc).

It can be argued that pivoting should be at this level, rather than the first,
but I decided to put it there instead, mostly because I really think of the
pivoted data as a different data set and also for performance reasons – the
pivot data can be a bear to produce, and I plan on caching the first stage and
then running different reporting options on it.

Stage 3 – Output Rendering

Now that I have my super spiffy report, I want to be able to render it however
I want, possibly in multiple formats – HTML and XLS are the most important to
me, but PDF, text, csv, etc will also likely be produced eventually.

See Examples for examples.