dimagi/hsph-reports — pull request #38 by mwhite (2013-11-01 22:20:05+00:00)
Title: Fada observations updates

The approach I was using to minimize the number of queries was to emit a hash of values and then sum hashes together (although actually it should have been OR, and I've fixed that in the first commit). It turns out that adding a dozen or so more key-value pairs to this hash pushed it above a heuristic that CouchDB has for reduce_limit that has to do with something *other* than the rate at which the size of the reduce output increases relative to the size of the map input (something to do with the absolute size of the reduce output or the size of the reduce output relative to any given map value?).

In order to avoid having to emit every key separately, I introduce an abstraction in map.js and the python processing code that lets you split up your hash into only n sub-hashes, with their keys in emit() prefixed with "split_{n}".