def columns(self): columns = self.get_columns_by_loc_level agg_columns = [ DatabaseColumn( 'num_children_0_6mo_enrolled_for_services', SumWhen(whens=[[ "age_tranche = '0' OR age_tranche = '6'", 'valid_in_month' ]], alias='num_children_0_6mo_enrolled_for_services'), slug='num_children_0_6mo_enrolled_for_services'), DatabaseColumn( 'num_children_6mo3yr_enrolled_for_services', SumWhen(whens=[[ "age_tranche = '12' OR age_tranche = '24' OR age_tranche = '36'", 'valid_in_month' ]], alias='num_children_6mo3yr_enrolled_for_services'), slug='num_children_6mo3yr_enrolled_for_services'), DatabaseColumn( 'num_children_3yr6yr_enrolled_for_services', SumWhen(whens=[[ "age_tranche = '48' OR age_tranche = '60' OR age_tranche = '72'", 'valid_in_month' ]], alias='num_children_3yr6yr_enrolled_for_services'), slug='num_children_3yr6yr_enrolled_for_services'), ] return columns + agg_columns
def _get_form_duration_column(self, meta, slug_suffix, filters): slug = '%s%s' % (meta['slug'], slug_suffix) when = "xmlns = '%s'" % meta['xmlns'] dur_col = SumWhen(whens={when: 'duration'}, else_=0, filters=filters, alias='%s_sum' % slug) count_col = SumWhen(whens={when: 1}, else_=0, filters=filters, alias='%s_count' % slug) return AggregateColumn(slug, mean_seconds, [dur_col, count_col], sortable=False)
def _get_form_sum_column(self, meta, slug_suffix, filters): slug = '%s%s' % (meta['slug'], slug_suffix) agg_col = SumWhen(whens={"xmlns = '%s'" % meta['xmlns']: 1}, else_=0, filters=filters, alias=slug) return DatabaseColumn(slug, agg_col, sortable=False)
def get_columns(self, filters): return [ DatabaseColumn('month', SimpleColumn('month')), AggregateColumn( 'Percent of pregnant women who are anemic in given month', lambda x, y, z: ((x or 0) + (y or 0)) * 100 / float(z or 1), [ SumWhen( whens=[["ccs_status = 'pregnant'", 'anemic_moderate']], alias='anemic_moderate'), SumWhen( whens=[["ccs_status = 'pregnant'", 'anemic_severe']], alias='anemic_severe'), SumColumn('pregnant', alias='pregnant') ], slug='severe_anemic'), AggregateColumn( 'Percent tetanus complete', percent_num, [SumColumn('tetanus_complete'), AliasColumn('pregnant')], slug='tetanus_complete'), AggregateColumn( 'Percent women ANC 1 recieved by deliveryy', percent_num, [ SumColumn('anc1_received_at_delivery'), SumColumn('delivered_in_month', alias='delivered_in_month') ], slug='anc_1'), AggregateColumn('Percent women ANC 2 received by delivery', percent_num, [ SumColumn('anc2_received_at_delivery'), AliasColumn('delivered_in_month') ], slug='anc_2'), AggregateColumn('Percent women ANC 3 received by delivery', percent_num, [ SumColumn('anc3_received_at_delivery'), AliasColumn('delivered_in_month') ], slug='anc_3'), AggregateColumn('Percent women ANC 4 received by delivery', percent_num, [ SumColumn('anc4_received_at_delivery'), AliasColumn('delivered_in_month') ], slug='anc_4'), AggregateColumn('Percent women Resting during pregnancy', percent_num, [ SumColumn('resting_during_pregnancy'), AliasColumn('pregnant') ], slug='resting'), AggregateColumn('Percent eating extra meal during pregnancy', percent_num, [SumColumn('extra_meal'), AliasColumn('pregnant')], slug='extra_meal'), AggregateColumn( 'Percent trimester 3 women Counselled on immediate EBF during home visit', percent_num, [SumColumn('counsel_immediate_bf'), SumColumn('trimester_3')], slug='trimester') ]
def columns(self): columns = self.get_columns_by_loc_level agg_columns = [ AggregateColumn( 'Weighing efficiency (in month)', percent, [ SumWhen( whens={"age_tranche != :age_72": 'nutrition_status_weighed'}, else_=0, alias='nutrition_status_weighed' ), SumWhen( whens={"age_tranche != :age_72": 'wer_eligible'}, else_=0, alias='wer_eligible' ) ], slug='percent_weight_efficiency' ), AggregateColumn( 'Height measurement efficiency (in month)', percent, [ SumWhen( whens={"age_tranche != :age_72": 'height_measured_in_month'}, else_=0, alias='height_measured_in_month_efficiency' ), SumWhen( whens={"age_tranche != :age_72": 'height_eligible'}, else_=0, alias='height_eligible', ) ], slug='height_measurement' ), DatabaseColumn( 'Total number of unweighed children (0-5 Years)', SumWhen( whens={"age_tranche != :age_72": 'nutrition_status_unweighed'}, else_=0, alias='nutrition_status_unweighed' ), slug='total_number_unweighed' ), AggregateColumn( 'Percentage of severely underweight children', percent, [ SumWhen( whens={"age_tranche != :age_72": 'nutrition_status_severely_underweight'}, else_=0, alias='nutrition_status_severely_underweight' ), AliasColumn('nutrition_status_weighed'), ], slug='percent_severe_underweight' ), AggregateColumn( 'Percentage of moderately underweight children', percent, [ SumWhen( whens={"age_tranche != :age_72": 'nutrition_status_moderately_underweight'}, else_=0, alias='nutrition_status_moderately_underweight' ), AliasColumn('nutrition_status_weighed'), ], slug='percent_moderate_underweight' ), AggregateColumn( 'Percentage of normal weight-for-age children', percent, [ SumWhen( whens={"age_tranche != :age_72": 'nutrition_status_normal'}, else_=0, alias='nutrition_status_normal' ), AliasColumn('nutrition_status_weighed'), ], slug='percent_normal_weight' ), AggregateColumn( 'Percentage of children with severe wasting', percent, [ SumWhen( whens={get_age_condition(self.beta): wasting_severe_column(self.beta)}, alias='wasting_severe' ), SumWhen( whens={get_age_condition(self.beta): wfh_recorded_in_month_column(self.beta)}, alias='weighed_and_height_measured_in_month' ), ], slug='percent_severe_wasting' ), AggregateColumn( 'Percentage of children with moderate wasting', percent, [ SumWhen( whens={get_age_condition(self.beta): wasting_moderate_column(self.beta)}, alias='wasting_moderate' ), AliasColumn('weighed_and_height_measured_in_month') ], slug='percent_moderate_wasting' ), AggregateColumn( 'Percentage of children with normal weight-for-height', percent, [ SumWhen( whens={get_age_condition(self.beta): wasting_normal_column(self.beta)}, alias='wasting_normal' ), AliasColumn('weighed_and_height_measured_in_month') ], slug='percent_normal_wasting' ), AggregateColumn( 'Percentage of children with severe stunting', percent, [ SumWhen( whens={get_age_condition(self.beta): stunting_severe_column(self.beta)}, alias='stunting_severe' ), SumWhen( whens={get_age_condition(self.beta): hfa_recorded_in_month_column(self.beta)}, alias='height_measured_in_month' ), ], slug='percent_severe_stunting' ), AggregateColumn( 'Percentage of children with moderate stunting', percent, [ SumWhen( whens={get_age_condition(self.beta): stunting_moderate_column(self.beta)}, alias='stunting_moderate' ), AliasColumn('height_measured_in_month') ], slug='percent_moderate_stunting' ), AggregateColumn( 'Percentage of children with normal height-for-age', percent, [ SumWhen( whens={get_age_condition(self.beta): stunting_normal_column(self.beta)}, alias='stunting_normal' ), AliasColumn('height_measured_in_month') ], slug='percent_normal_stunting' ), AggregateColumn( 'Percent of newborns with low birth weight', percent, [ SumColumn('low_birth_weight_in_month'), SumColumn('weighed_and_born_in_month') ], slug='newborn_low_birth_weight' ), AggregateColumn( 'Percentage of children with completed 1 year immunizations', lambda x, y, z: '%.2f%%' % (((x or 0) + (y or 0)) * 100 / float(z or 1)), [ SumColumn('fully_immunized_on_time'), SumColumn('fully_immunized_late'), SumColumn('fully_immunized_eligible') ], slug='percent_completed_1year_immunizations' ), AggregateColumn( 'Percentage of children breastfed at birth', percent, [ SumColumn('bf_at_birth'), SumColumn('born_in_month') ], slug='percent_breastfed_at_birth' ), AggregateColumn( 'Percentage of children exclusively breastfeeding', percent, [ SumColumn('ebf_in_month'), SumColumn('ebf_eligible') ], slug='percent_ebf' ), AggregateColumn( 'Percentage of children initiated complementary feeding (in the past 30 days)', percent, [ SumColumn('cf_initiation_in_month'), SumColumn('cf_initiation_eligible') ], slug='percent_initiated_on_cf' ), AggregateColumn( 'Percentage of children initiated appropriate complementary feeding', percent, [ SumColumn('cf_in_month'), SumColumn('cf_eligible') ], slug='percent_appropriate_cf' ), AggregateColumn( 'Percentage of children receiving complementary feeding with adequate diet diversity', percent, [ SumColumn('cf_diet_diversity'), AliasColumn('cf_eligible') ], slug='percent_cf_diet_diversity' ), AggregateColumn( 'Percentage of children receiving complementary feeding with adequate diet quanity', percent, [ SumColumn('cf_diet_quantity'), AliasColumn('cf_eligible') ], slug='percent_cf_diet_quanity' ), AggregateColumn( "Percentage of children receiving complementary feeding " "with appropriate handwashing before feeding", percent, [ SumColumn('cf_handwashing'), AliasColumn('cf_eligible') ], slug='percent_cf_handwashing_before_feeding' ), ] return columns + agg_columns
def get_columns(self, filters): return [ DatabaseColumn('month', SimpleColumn('month')), AggregateColumn( '% Weighing efficiency (Children <5 weighed)', percent_num, [ SumWhen(whens={ "age_tranche != :age_72": 'nutrition_status_weighed' }, alias='nutrition_status_weighed'), SumWhen(whens={"age_tranche != :age_72": 'wer_eligible'}, alias='wer_eligible') ], slug='status_weighed'), AggregateColumn( '% Height measurement efficiency (Children <5 measured)', percent_num, [ SumWhen(whens={ "age_tranche != :age_72": 'height_measured_in_month' }, alias='height_measured_in_month_less_5'), SumWhen( whens={"age_tranche != :age_72": 'height_eligible'}, alias='height_eligible') ], slug='status_height_efficiency'), DatabaseColumn( 'Total number Unweighed', SumWhen(whens={ "age_tranche != :age_72": 'nutrition_status_unweighed' }, alias='nutrition_status_unweighed')), AggregateColumn( 'Percent Children severely underweight (weight for age)', percent_num, [ SumWhen(whens={ "age_tranche != :age_72": 'nutrition_status_severely_underweight' }, alias='nutrition_status_severely_underweight'), AliasColumn('nutrition_status_weighed') ], slug='severely_underweight'), AggregateColumn( 'Percent Children moderately underweight (weight for age)', percent_num, [ SumWhen(whens={ "age_tranche != :age_72": 'nutrition_status_moderately_underweight' }, alias='nutrition_status_moderately_underweight'), AliasColumn('nutrition_status_weighed') ], slug='moderately_underweight'), AggregateColumn( 'Percent Children normal (weight for age)', percent_num, [ SumWhen(whens={ "age_tranche != :age_72": 'nutrition_status_normal' }, alias='nutrition_status_normal'), AliasColumn('nutrition_status_weighed') ], slug='status_normal'), AggregateColumn( 'Percent children with severe acute malnutrition (weight-for-height)', percent_num, [ SumWhen(whens={ get_age_condition(self.beta): wasting_severe_column(self.beta) }, alias='wasting_severe'), SumWhen(whens={ get_age_condition(self.beta): wfh_recorded_in_month_column(self.beta) }, alias='weighed_and_height_measured_in_month') ], slug='wasting_severe'), AggregateColumn( 'Percent children with moderate acute malnutrition (weight-for-height)', percent_num, [ SumWhen(whens={ get_age_condition(self.beta): wasting_moderate_column(self.beta) }, alias='wasting_moderate'), AliasColumn('weighed_and_height_measured_in_month') ], slug='wasting_moderate'), AggregateColumn( 'Percent children normal (weight-for-height)', percent_num, [ SumWhen(whens={ get_age_condition(self.beta): wasting_normal_column(self.beta) }, alias='wasting_normal'), AliasColumn('weighed_and_height_measured_in_month') ], slug='wasting_normal'), AggregateColumn( 'Percent children with severe stunting (height for age)', percent_num, [ SumWhen(whens={ get_age_condition(self.beta): stunting_severe_column(self.beta) }, alias='zscore_grading_hfa_severe'), SumWhen(whens={ get_age_condition(self.beta): hfa_recorded_in_month_column(self.beta) }, alias='height_measured_in_month') ], slug='stunting_severe'), AggregateColumn( 'Percent children with moderate stunting (height for age)', percent_num, [ SumWhen(whens={ get_age_condition(self.beta): stunting_moderate_column(self.beta) }, alias='zscore_grading_hfa_moderate'), AliasColumn('height_measured_in_month') ], slug='stunting_moderate'), AggregateColumn('Percent children with normal (height for age)', percent_num, [ SumWhen(whens={ get_age_condition(self.beta): stunting_normal_column(self.beta) }, alias='zscore_grading_hfa_normal'), AliasColumn('height_measured_in_month') ], slug='stunting_normal'), AggregateColumn( 'Percent children immunized with 1st year immunizations', lambda x, y, z: ((x or 0) + (y or 0)) * 100 / float(z or 1), [ SumColumn('fully_immunized_on_time'), SumColumn('fully_immunized_late'), SumColumn('fully_immunized_eligible') ], slug='fully_immunized'), AggregateColumn( 'Percent Children breastfed at birth', percent_num, [SumColumn('bf_at_birth'), SumColumn('born_in_month')], slug='breastfed_at_birth'), AggregateColumn( 'Percent Children exclusively breastfed', percent_num, [SumColumn('ebf_in_month'), SumColumn('ebf_eligible')], slug='exclusively_breastfed'), AggregateColumn( 'Percent Children initiated appropriate complementary feeding', percent_num, [ SumColumn('cf_initiation_in_month'), SumColumn('cf_initiation_eligible') ], slug='cf_initiation'), AggregateColumn( 'Perecent children complementary feeding', percent_num, [SumColumn('cf_in_month'), SumColumn('cf_eligible')], slug='complementary_feeding'), AggregateColumn( 'Percentage of children consuming atleast 4 food groups', percent_num, [SumColumn('cf_diet_diversity'), AliasColumn('cf_eligible')], slug='diet_diversity'), AggregateColumn( 'Percentage of children consuming adequate food', percent_num, [SumColumn('cf_diet_quantity'), AliasColumn('cf_eligible')], slug='diet_quantity'), AggregateColumn( 'Percentage of children whose mothers handwash before feeding', percent_num, [SumColumn('cf_handwashing'), AliasColumn('cf_eligible')], slug='handwashing'), DatabaseColumn( 'Children (0 - 28 Days) Seeking Services', SumWhen(whens={'age_tranche = :age_0': 'valid_in_month'}, alias='zero'), slug='zero'), DatabaseColumn( 'Children (28 Days - 6 mo) Seeking Services', SumWhen(whens={'age_tranche = :age_6': 'valid_in_month'}, alias='one'), slug='one'), DatabaseColumn( 'Children (6 mo - 1 year) Seeking Services', SumWhen(whens={'age_tranche = :age_12': 'valid_in_month'}, alias='two'), slug='two'), DatabaseColumn( 'Children (1 year - 3 years) Seeking Services', SumWhen(whens={ 'age_tranche = :age_24 OR age_tranche = :age_36': 'valid_in_month' }, alias='three'), slug='three'), DatabaseColumn( 'Children (3 years - 6 years) Seeking Services', SumWhen(whens={ 'age_tranche = :age_48 OR age_tranche = :age_60 OR age_tranche = :age_72': 'valid_in_month' }, alias='four'), slug='four'), AggregateColumn( 'Percent of children born in month with low birth weight', percent_num, [ SumColumn('low_birth_weight_in_month'), SumColumn('weighed_and_born_in_month') ], slug='low_birth_weight') ]
def sql_column(self): return SumWhen(self.key, whens=self.whens, else_=0, alias=self.alias).sql_column
def columns(self): columns = self.get_columns_by_loc_level agg_columns = [ AggregateColumn( 'Weighing efficiency (in month)', percent, [ SumWhen(whens={ "age_tranche != :age_72": 'nutrition_status_weighed' }, else_=0, alias='nutrition_status_weighed'), SumWhen(whens={"age_tranche != :age_72": 'wer_eligible'}, else_=0, alias='wer_eligible') ], slug='percent_weight_efficiency'), AggregateColumn( 'Height measurement efficiency (in month)', percent, [ SumWhen(whens={ "age_tranche != :age_72": 'height_measured_in_month' }, else_=0, alias='height_measured_in_month_efficiency'), SumWhen( whens={"age_tranche != :age_72": 'height_eligible'}, else_=0, alias='height_eligible', ) ], slug='height_measurement'), DatabaseColumn('Total number of unweighed children (0-5 Years)', SumWhen(whens={ "age_tranche != :age_72": 'nutrition_status_unweighed' }, else_=0, alias='nutrition_status_unweighed'), slug='total_number_unweighed'), AggregateColumn( 'Percentage of severely underweight children', percent, [ SumWhen(whens={ "age_tranche != :age_72": 'nutrition_status_severely_underweight' }, else_=0, alias='nutrition_status_severely_underweight'), AliasColumn('nutrition_status_weighed'), ], slug='percent_severe_underweight'), AggregateColumn( 'Percentage of moderately underweight children', percent, [ SumWhen(whens={ "age_tranche != :age_72": 'nutrition_status_moderately_underweight' }, else_=0, alias='nutrition_status_moderately_underweight'), AliasColumn('nutrition_status_weighed'), ], slug='percent_moderate_underweight'), AggregateColumn( 'Percentage of normal weight-for-age children', percent, [ SumWhen(whens={ "age_tranche != :age_72": 'nutrition_status_normal' }, else_=0, alias='nutrition_status_normal'), AliasColumn('nutrition_status_weighed'), ], slug='percent_normal_weight'), AggregateColumn( 'Percentage of children with severe wasting', percent, [ SumWhen(whens={ get_age_condition(self.beta): wasting_severe_column(self.beta) }, alias='wasting_severe'), SumWhen(whens={ get_age_condition(self.beta): wfh_recorded_in_month_column(self.beta) }, alias='weighed_and_height_measured_in_month'), ], slug='percent_severe_wasting'), AggregateColumn( 'Percentage of children with moderate wasting', percent, [ SumWhen(whens={ get_age_condition(self.beta): wasting_moderate_column(self.beta) }, alias='wasting_moderate'), AliasColumn('weighed_and_height_measured_in_month') ], slug='percent_moderate_wasting'), AggregateColumn( 'Percentage of children with normal weight-for-height', percent, [ SumWhen(whens={ get_age_condition(self.beta): wasting_normal_column(self.beta) }, alias='wasting_normal'), AliasColumn('weighed_and_height_measured_in_month') ], slug='percent_normal_wasting'), AggregateColumn('Percentage of children with severe stunting', percent, [ SumWhen(whens={ get_age_condition(self.beta): stunting_severe_column(self.beta) }, alias='stunting_severe'), SumWhen(whens={ get_age_condition(self.beta): hfa_recorded_in_month_column(self.beta) }, alias='height_measured_in_month'), ], slug='percent_severe_stunting'), AggregateColumn('Percentage of children with moderate stunting', percent, [ SumWhen(whens={ get_age_condition(self.beta): stunting_moderate_column(self.beta) }, alias='stunting_moderate'), AliasColumn('height_measured_in_month') ], slug='percent_moderate_stunting'), AggregateColumn( 'Percentage of children with normal height-for-age', percent, [ SumWhen(whens={ get_age_condition(self.beta): stunting_normal_column(self.beta) }, alias='stunting_normal'), AliasColumn('height_measured_in_month') ], slug='percent_normal_stunting'), AggregateColumn('Percent of newborns with low birth weight', percent, [ SumColumn('low_birth_weight_in_month', alias='low_birth_weight_in_month'), SumColumn('weighed_and_born_in_month', alias='weighed_and_born_in_month') ], slug='newborn_low_birth_weight'), AggregateColumn( 'Percentage of children with completed 1 year immunizations', lambda x, y, z: '%.2f%%' % (( (x or 0) + (y or 0)) * 100 / float(z or 1)), [ SumColumn('fully_immunized_on_time', alias='fully_immunized_on_time'), SumColumn('fully_immunized_late', alias='fully_immunized_late'), SumColumn('fully_immunized_eligible', alias='fully_immunized_eligible') ], slug='percent_completed_1year_immunizations'), AggregateColumn( 'Percentage of children breastfed at birth', percent, [ SumColumn('bf_at_birth', alias='bf_at_birth'), SumColumn('born_in_month', alias='born_in_month') ], slug='percent_breastfed_at_birth'), AggregateColumn( 'Percentage of children exclusively breastfeeding', percent, [ SumColumn('ebf_in_month', alias='ebf_in_month'), SumColumn('ebf_eligible', alias='ebf_eligible') ], slug='percent_ebf'), AggregateColumn( 'Percentage of children initiated complementary feeding (in the past 30 days)', percent, [ SumColumn('cf_initiation_in_month', alias='cf_initiation_in_month'), SumColumn('cf_initiation_eligible', alias='cf_initiation_eligible') ], slug='percent_initiated_on_cf'), AggregateColumn( 'Percentage of children initiated appropriate complementary feeding', percent, [ SumColumn('cf_in_month', alias='cf_in_month'), SumColumn('cf_eligible', alias='cf_eligible') ], slug='percent_appropriate_cf'), AggregateColumn( 'Percentage of children receiving complementary feeding with adequate diet diversity', percent, [ SumColumn('cf_diet_diversity', alias='cf_diet_diversity'), AliasColumn('cf_eligible') ], slug='percent_cf_diet_diversity'), AggregateColumn( 'Percentage of children receiving complementary feeding with adequate diet quantity', percent, [ SumColumn('cf_diet_quantity', alias='cf_diet_quantity'), AliasColumn('cf_eligible') ], slug='percent_cf_diet_quanity'), AggregateColumn( "Percentage of children receiving complementary feeding " "with appropriate handwashing before feeding", percent, [ SumColumn('cf_handwashing', alias='cf_handwashing'), AliasColumn('cf_eligible') ], slug='percent_cf_handwashing_before_feeding'), ] agg_columns.insert( 0, DatabaseColumn('Total no. of children weighed', AliasColumn('nutrition_status_weighed'), slug='nutrition_status_weighed')) agg_columns.insert( 1, DatabaseColumn('Total no. of children eligible to be weighed', AliasColumn('wer_eligible'), slug='wer_eligible')) agg_columns.insert( 3, DatabaseColumn('Total no. of children whose height was measured', AliasColumn('height_measured_in_month_efficiency'), slug='height_measured_in_month_efficiency')) agg_columns.insert( 4, DatabaseColumn( 'Total no. of children eligible for measuring height', AliasColumn('height_eligible'), slug='height_eligible')) agg_columns.insert( 7, DatabaseColumn( 'No. of severely underweight children', AliasColumn('nutrition_status_severely_underweight'), slug='nutrition_status_severely_underweight')) agg_columns.insert( 8, DatabaseColumn('Total No. of children weighed', AliasColumn('nutrition_status_weighed'), slug='nutrition_status_weighed')) agg_columns.insert( 10, DatabaseColumn( 'No. of moderately underweight children ', AliasColumn('nutrition_status_moderately_underweight'), slug='nutrition_status_moderately_underweight')) agg_columns.insert( 11, DatabaseColumn('Total No. of children weighed', AliasColumn('nutrition_status_weighed'), slug='nutrition_status_weighed')) agg_columns.insert( 13, DatabaseColumn('No. of children with normal weight for age', AliasColumn('nutrition_status_normal'), slug='nutrition_status_normal')) agg_columns.insert( 14, DatabaseColumn('Total No. of children weighed', AliasColumn('nutrition_status_weighed'), slug='nutrition_status_weighed')) agg_columns.insert( 16, DatabaseColumn('No. of Children with severe wasting', AliasColumn('wasting_severe'), slug='wasting_severe')) agg_columns.insert( 17, DatabaseColumn( 'Total number of children whose height and weight is measured', AliasColumn('weighed_and_height_measured_in_month'), slug='weighed_and_height_measured_in_month')) agg_columns.insert( 19, DatabaseColumn('No. of moderately wasted children', AliasColumn('wasting_moderate'), slug='wasting_moderate')) agg_columns.insert( 20, DatabaseColumn( 'Total number of children whose height and weight is measured', AliasColumn('weighed_and_height_measured_in_month'), slug='weighed_and_height_measured_in_month')) agg_columns.insert( 22, DatabaseColumn('No. of children with normal weight-for-height', AliasColumn('wasting_normal'), slug='wasting_normal')) agg_columns.insert( 23, DatabaseColumn( 'Total no. of children whose height and weight is measured', AliasColumn('weighed_and_height_measured_in_month'), slug='weighed_and_height_measured_in_month')) agg_columns.insert( 25, DatabaseColumn('No. of severely stunted children', AliasColumn('stunting_severe'), slug='stunting_severe')) agg_columns.insert( 26, DatabaseColumn( 'Total no. of children whose height has been measured', AliasColumn('height_measured_in_month'), slug='height_measured_in_month')) agg_columns.insert( 28, DatabaseColumn('No. of moderately stunted children', AliasColumn('stunting_moderate'), slug='stunting_moderate')) agg_columns.insert( 29, DatabaseColumn( 'Total no. of children whose height has been measured', AliasColumn('height_measured_in_month'), slug='height_measured_in_month')) agg_columns.insert( 31, DatabaseColumn('No. of children with normal height for age', AliasColumn('stunting_normal'), slug='stunting_normal')) agg_columns.insert( 32, DatabaseColumn( 'Total no. of children whose height has been measured', AliasColumn('height_measured_in_month'), slug='height_measured_in_month')) agg_columns.insert( 34, DatabaseColumn('No. of newborns with low birth weight', AliasColumn('low_birth_weight_in_month'), slug='low_birth_weight_in_month')) agg_columns.insert( 35, DatabaseColumn( 'Total no. of children born and weighed in the current month', AliasColumn('weighed_and_born_in_month'), slug='weighed_and_born_in_month')) agg_columns.insert( 37, AggregateColumn('No. of children completed 1 year immunization', lambda x, y: ((x or 0) + (y or 0)), [ AliasColumn('fully_immunized_on_time'), AliasColumn('fully_immunized_late') ], slug='num_immun_children')) agg_columns.insert( 38, DatabaseColumn('Total no. of children from age >12 months', AliasColumn('fully_immunized_eligible'), slug='fully_immunized_eligible')) agg_columns.insert( 40, DatabaseColumn('No. of children breastfed at birth', AliasColumn('bf_at_birth'), slug='bf_at_birth')) agg_columns.insert( 41, DatabaseColumn( 'Total no. of children enrolled in ICDS-CAS system and born in last month', AliasColumn('born_in_month'), slug='born_in_month')) agg_columns.insert( 43, DatabaseColumn('No. of children exclusively breastfed', AliasColumn('ebf_in_month'), slug='ebf_in_month')) agg_columns.insert( 44, DatabaseColumn( 'Total number of children (0-6 months) of age enrolled in ICDS-CAS system', AliasColumn('ebf_eligible'), slug='ebf_eligible')) agg_columns.insert( 46, DatabaseColumn( 'No. of children initiated complementary feeding (in the past 30 days)', AliasColumn('cf_initiation_in_month'), slug='cf_initiation_in_month')) agg_columns.insert( 47, DatabaseColumn( 'Total no. of children (6-8 ) months of age enrolled with ICDS-CAS', AliasColumn('cf_initiation_eligible'), slug='cf_initiation_eligible')) agg_columns.insert( 49, DatabaseColumn( 'No. of children initiated appropriate complementary feeding', AliasColumn('cf_in_month'), slug='cf_in_month')) agg_columns.insert( 50, DatabaseColumn( 'No.of children (6-24) months of age enrolled with ICDS-CAS', AliasColumn('cf_eligible'), slug='cf_eligible')) agg_columns.insert( 52, DatabaseColumn( 'No.of children receiving complementary feeding with adequate diet diversity', AliasColumn('cf_diet_diversity'), slug='cf_diet_diversity')) agg_columns.insert( 53, DatabaseColumn( 'Total number of children (6 months - 2 yrs) of age enrolled with ICDS-CAS', AliasColumn('cf_eligible'), slug='cf_eligible')) agg_columns.insert( 55, DatabaseColumn( 'No. of children initiated complementary feeding with adequate diet quantity', AliasColumn('cf_diet_quantity'), slug='cf_diet_quantity')) agg_columns.insert( 56, DatabaseColumn( 'No.of children (6-24) months of age enrolled with ICDS-CAS', AliasColumn('cf_eligible'), slug='cf_eligible')) agg_columns.insert( 58, DatabaseColumn( 'Total Number of children receiving complementary feeding ' 'with appropriate handwashing before feeding', AliasColumn('cf_handwashing'), slug='cf_handwashing')) agg_columns.insert( 59, DatabaseColumn( 'No.of children (6-24) months of age enrolled with ICDS-CAS', AliasColumn('cf_eligible'), slug='cf_eligible')) return columns + agg_columns