def add_custom_form_data(self, indicator_name, range_name, xmlns, indicator_type, lower, upper):
        aggregation = Avg('duration') if indicator_type == TYPE_DURATION else Count('instance_id')

        def millis_to_secs(x):
            return round(x / 1000)

        transformer = millis_to_secs if indicator_type == TYPE_DURATION else None

        results = FormData.objects \
            .values('user_id') \
            .filter(
                xmlns=xmlns,
                domain=self.domain,
                user_id__in=self.users_needing_data) \
            .filter(**self._date_filters('time_end', lower, upper)) \
            .annotate(count=aggregation)

        self._add_data(
            results,
            '{}{}'.format(indicator_name, range_name.title()),
            transformer=transformer)
For each layer, save the number of filters and precompute
dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/callcenter/indicator_sets.py/CallCenterIndicators.add_custom_form_data--crossover with--dataset/ETHPy150Open yosinski/deep-visualization-toolbox/caffevis/app.py/CaffeVisApp._populate_net_layer_info