Ejemplo n.º 1
0
 def columns(self):
     self.config['mother_ids'] = tuple(DeliveryMothersIds(config=self.config).data.keys()) + ('',)
     return [
         DatabaseColumn("Total births",
                        CountUniqueColumn('doc_id',
                                          filters=[AND([IN('mother_id', get_INFilter_bindparams('mother_ids', self.config['mother_ids'])),
                                                        OR([EQ('gender', 'female'), EQ('gender', 'male')])])],
                                          alias='total_births')),
         DatabaseColumn("Newborn deaths (< 1 m)",
                        CountUniqueColumn('doc_id', filters=self.filters + [AND(
                            [EQ('reason_for_child_closure', 'death'),
                             EQ('type_of_child_death', 'newborn_death')])], alias='newborn_death')),
         DatabaseColumn("Infant deaths (< 1 y)",
                        CountUniqueColumn('doc_id', filters=self.filters + [AND(
                            [EQ('reason_for_child_closure', 'death'),
                             EQ('type_of_child_death', 'infant_death')])], alias='infant_death')),
         DatabaseColumn("Child deaths (2-5y)",
                        CountUniqueColumn('doc_id', filters=self.filters + [AND(
                            [EQ('reason_for_child_closure', 'death'),
                             EQ('type_of_child_death', 'child_death')])], alias='child_death')),
         DatabaseColumn("Total deaths",
                        CountUniqueColumn('doc_id', filters=self.filters + [EQ('reason_for_child_closure',
                                                                               'death')], alias='total_deaths'))
     ]
Ejemplo n.º 2
0
 def filters(self):
     return [
         IN('awc_id', get_INFilter_bindparams('awc_id', self.awcs)),
         EQ('month', 'month')
     ]
Ejemplo n.º 3
0
 def filters(self):
     self.config['mother_ids'] = tuple(
         DeliveryMothersIds(config=self.config).data.keys()) + ('', )
     return [IN('mother_id', 'mother_ids')]
Ejemplo n.º 4
0
def _locations_filter(archived_locations):
    return NOT(
        IN('location_id',
           get_INFilter_bindparams('archived_locations', archived_locations)))
Ejemplo n.º 5
0
 def filters(self):
     for column_name in ['awc', 'gp', 'block']:
         if self.config.get(column_name):
             return [IN(column_name, get_INFilter_bindparams(column_name, self.config[column_name]))]
     return []
Ejemplo n.º 6
0
 def filters(self):
     self.config['mother_ids'] = tuple(DeliveryMothersIds(config=self.config).data.keys()) + ('',)
     return [IN('mother_id', get_INFilter_bindparams('mother_ids', self.config['mother_ids']))]
Ejemplo n.º 7
0
    def filters(self):
        if not self.group_by_district:
            users = tuple([user.user_id for user in self.users])
            return [IN("user_id", get_INFilter_bindparams("users", users))]

        return []
Ejemplo n.º 8
0
 def filters(self):
     filters = super(NombreData, self).filters
     if 'archived_locations' in self.config:
         filters.append(NOT(IN('location_id', 'archived_locations')))
     return filters
Ejemplo n.º 9
0
 def filters(self):
     filter = super(TauxDeRuptures, self).filters
     filter.append("total_stock_total = 0")
     if 'archived_locations' in self.config:
         filter.append(NOT(IN('location_id', 'archived_locations')))
     return filter