incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luke Driscoll <luke.drisc...@gmail.com>
Subject Re: Reporting in CouchDB
Date Tue, 27 Jul 2010 14:22:30 GMT
If I understand what you're saying, I think you could make your key:
[siteid, year, month, day]

Then when you call reduce you could set the group_level to 1, 2, 3 or 4, to
granulate by siteid, year, month and day respectively

Luke

On Tue, Jul 27, 2010 at 10:19, Cory Zue <czue@dimagi.com> wrote:

> I need to write some reports on top of the data in my couch db
> application.  My use case is a central database monitoring the data
> coming in from a bunch of satellite sites, and they want to generate
> aggregate reports on the data by site and by date range.
>
> My current plan is to use a view with a complex key that includes the
> site id and date the data came in, with the value being a dictionary
> of contributions the data makes to each aggregate indicator in the
> report.  Then my reduce function can just sum up the individual keys.
>
> However, this will only generate reports with the granularity of a
> single day out-of-the-box, which means I will need to do further
> processing on the client side in order to aggregate the counts over
> the entire range specified.
>
> My question is -- is there any way to do this in one view via couchdb?
>  My understanding is that the best aggregation I can do is get it down
> to one value per key, so even though I am only using the keys to
> specify start and end ranges and always want to return a full
> aggregate with a single set of counts I still have to do the final
> aggregation on the client side.
>
> Sorry if this is unclear.  I'd be happy to clarify over mail or IRC if
> necessary.
>
> thanks,
> Cory
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message