Beispiel #1
0
 def test_data_institutional_deliveries(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }
         )['records'][3][1],
         {
             "redirect": "maternal_and_child/institutional_deliveries",
             "color": "green",
             "all": 14,
             "frequency": "month",
             "format": "percent_and_div",
             "help_text": "Of the total number of women enrolled for Anganwadi services who gave birth in "
                          "the last month, the percentage who delivered in a public or private medical "
                          "facility. Delivery in medical instituitions is associated with a decrease in "
                          "maternal mortality rate",
             "percent": 80.0,
             "value": 14,
             "label": "Institutional Deliveries"
         }
     )
Beispiel #2
0
 def test_data_stunting_height_for_age(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             },
             False,
             True
         )['records'][1][0],
         {
             "redirect": "maternal_and_child/stunting",
             "color": "green",
             "all": 32,
             "frequency": "month",
             "format": "percent_and_div",
             "help_text": "Of the children whose height was measured, the percentage of children between "
                          "0 - 5 years who were moderately/severely stunted in the current month."
                          "<br/><br/>"
                          "Stunting is a sign of chronic undernutrition and has long lasting harmful "
                          "consequences on the growth of a child",
             "percent": -14.236111111111107,
             "value": 19,
             "label": "Stunting (Height-for-Age)"
         }
     )
Beispiel #3
0
 def test_data_wasting_weight_for_height(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             },
             False,
             True
         )['records'][0][1],
         {
             "redirect": "maternal_and_child/wasting",
             "color": "green",
             "all": 27,
             "frequency": "month",
             "format": "percent_and_div",
             "help_text": "Of the children enrolled for Anganwadi services, whose weight and height was "
                          "measured, the percentage of children between 0 - 5 years who were "
                          "moderately/severely wasted in the current month. "
                          "<br/><br/>"
                          "Severe Acute Malnutrition (SAM) or wasting in children is a symptom of acute "
                          "undernutrition usually as a consequence of insufficient food intake or a high "
                          "incidence of infectious diseases.",
             "percent": -11.111111111111109,
             "value": 8,
             "label": "Wasting (Weight-for-Height)"
         }
     )
 def test_data_records_length(self):
     self.assertEqual(
         len(
             get_maternal_child_data(
                 'icds-cas', {
                     'month': (2017, 5, 1),
                     'prev_month': (2017, 4, 1),
                     'aggregation_level': 1
                 })['records']), 4)
Beispiel #5
0
def get_program_summary_data(step, domain, config, now, include_test, pre_release_features):
    data = {}
    if step == 'maternal_child':
        data = get_maternal_child_data(domain, config, include_test, pre_release_features)
    elif step == 'icds_cas_reach':
        data = get_cas_reach_data(domain, now, config, include_test)
    elif step == 'demographics':
        data = get_demographics_data(domain, now, config, include_test, beta=pre_release_features)
    elif step == 'awc_infrastructure':
        data = get_awc_infrastructure_data(domain, config, include_test)
    return data
Beispiel #6
0
 def test_data_keys(self):
     self.assertEqual(
         list(get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }
         ).keys()),
         ['records']
     )
Beispiel #7
0
 def test_data_records_length(self):
     self.assertEqual(
         len(get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }
         )['records']),
         4
     )
Beispiel #8
0
 def test_data_keys(self):
     self.assertEqual(
         list(get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }
         ).keys()),
         ['records']
     )
Beispiel #9
0
    def test_data_records_total_length(self):
        data = get_maternal_child_data(
            'icds-cas',
            {
                'month': (2017, 5, 1),
                'prev_month': (2017, 4, 1),
                'aggregation_level': 1
            }
        )['records']

        self.assertEqual(
            sum([len(record_row) for record_row in data]),
            8
        )
Beispiel #10
0
    def test_data_records_total_length(self):
        data = get_maternal_child_data(
            'icds-cas',
            {
                'month': (2017, 5, 1),
                'prev_month': (2017, 4, 1),
                'aggregation_level': 1
            }
        )['records']

        self.assertEqual(
            sum([len(record_row) for record_row in data]),
            8
        )
Beispiel #11
0
 def test_data_exclusive_breastfeeding(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas', {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             })['records'][2][1], {
                 "redirect": "maternal_and_child/exclusive_breastfeeding",
                 "color": "green",
                 "all": 50,
                 "frequency": "month",
                 "format": "percent_and_div",
                 "help_text": exclusive_breastfeeding_help_text(),
                 "percent": 149.84615384615384,
                 "value": 28,
                 "label": "Exclusive Breastfeeding"
             })
Beispiel #12
0
 def test_data_underweight_weight_for_age(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas', {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             })['records'][0][0], {
                 "redirect": "maternal_and_child/underweight_children",
                 "color": "green",
                 "all": 696,
                 "frequency": "month",
                 "format": "percent_and_div",
                 "help_text": underweight_children_help_text(),
                 "percent": -14.901477832512326,
                 "value": 150,
                 "label": "Underweight (Weight-for-Age)"
             })
Beispiel #13
0
 def test_data_early_initiation_of_breastfeeding(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas', {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             })['records'][2][0], {
                 "redirect": "maternal_and_child/early_initiation",
                 "color": "green",
                 "all": 7,
                 "frequency": "month",
                 "format": "percent_and_div",
                 "help_text": early_initiation_breastfeeding_help_text(),
                 "percent": 128.57142857142856,
                 "value": 4,
                 "label": "Early Initiation of Breastfeeding"
             })
Beispiel #14
0
 def test_data_newborns_with_low_birth_weight(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas', {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             })['records'][1][1],
         {
             "redirect": "maternal_and_child/low_birth",
             "color": "red",
             "all": 4,
             "frequency": "month",
             "format": "percent_and_div",
             "help_text": new_born_with_low_weight_help_text(html=False),
             "percent": "Data in the previous reporting period was 0",
             "value": 2,
             "label": "Newborns with Low Birth Weight"
         })
 def test_data_children_initiated_appropriate_complementary_feeding(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }
         )['records'][3][0],
         {
             "redirect": "maternal_and_child/children_initiated",
             "color": "green",
             "all": 40,
             "frequency": "month",
             "format": "percent_and_div",
             "help_text": children_initiated_appropriate_complementary_feeding_help_text(),
             "percent": 147.27272727272728,
             "value": 34,
             "label": "Children initiated appropriate Complementary Feeding"
         }
     )
Beispiel #16
0
 def test_data_children_initiated_appropriate_complementary_feeding(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }
         )['records'][3][0],
         {
             "redirect": "maternal_and_child/children_initiated",
             "color": "green",
             "all": 40,
             "frequency": "month",
             "format": "percent_and_div",
             "help_text": children_initiated_appropriate_complementary_feeding_help_text(),
             "percent": 147.27272727272728,
             "value": 34,
             "label": "Children initiated appropriate Complementary Feeding"
         }
     )
Beispiel #17
0
 def test_data_early_initiation_of_breastfeeding(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }
         )['records'][2][0],
         {
             "redirect": "maternal_and_child/early_initiation",
             "color": "green",
             "all": 5,
             "frequency": "month",
             "format": "percent_and_div",
             "help_text": early_initiation_breastfeeding_help_text(),
             "percent": 20.000000000000018,
             "value": 2,
             "label": "Early Initiation of Breastfeeding"
         }
     )
Beispiel #18
0
 def test_data_underweight_weight_for_age(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }
         )['records'][0][0],
         {
             "redirect": "maternal_and_child/underweight_children",
             "color": "green",
             "all": 696,
             "frequency": "month",
             "format": "percent_and_div",
             "help_text": underweight_children_help_text(),
             "percent": -14.901477832512326,
             "value": 150,
             "label": "Underweight (Weight-for-Age)"
         }
     )
Beispiel #19
0
 def test_data_newborns_with_low_birth_weight(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }
         )['records'][1][1],
         {
             "redirect": "maternal_and_child/low_birth",
             "color": "red",
             "all": 3,
             "frequency": "month",
             "format": "percent_and_div",
             "help_text": new_born_with_low_weight_help_text(html=False),
             "percent": "Data in the previous reporting period was 0",
             "value": 1,
             "label": "Newborns with Low Birth Weight"
         }
     )
Beispiel #20
0
 def test_data_exclusive_breastfeeding(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas',
             {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }
         )['records'][2][1],
         {
             "redirect": "maternal_and_child/exclusive_breastfeeding",
             "color": "green",
             "all": 50,
             "frequency": "month",
             "format": "percent_and_div",
             "help_text": exclusive_breastfeeding_help_text(),
             "percent": 149.84615384615384,
             "value": 28,
             "label": "Exclusive Breastfeeding"
         }
     )
 def test_data(self):
     self.assertDictEqual(
         get_maternal_child_data(
             'icds-cas', {
                 'month': (2017, 5, 1),
                 'prev_month': (2017, 4, 1),
                 'aggregation_level': 1
             }),
         {
             "records":
             [[{
                 "redirect":
                 "underweight_children",
                 "color":
                 "red",
                 "all":
                 989,
                 "frequency":
                 "month",
                 "format":
                 "percent_and_div",
                 "help_text":
                 "Percentage of children between 0-5 years enrolled for ICDS services"
                 " with weight-for-age less than -2 standard deviations"
                 " of the WHO Child Growth Standards median. "
                 "Children who are moderately or severely underweight"
                 " have a higher risk of mortality.",
                 "percent":
                 3.336703741152685,
                 "value":
                 196,
                 "label":
                 "Underweight (Weight-for-Age)"
             }, {
                 "redirect":
                 "wasting",
                 "color":
                 "red",
                 "all":
                 939,
                 "frequency":
                 "month",
                 "format":
                 "percent_and_div",
                 "help_text":
                 "Percentage of children (6-60 months) with weight-for-height below"
                 " -3 standard deviations of the WHO Child Growth Standards median. "
                 "Severe Acute Malnutrition (SAM) or wasting in children is a symptom of"
                 " acute undernutrition usually as a consequence of insufficient "
                 "food intake or a high incidence of infectious diseases.",
                 "percent":
                 242.20802271920482,
                 "value":
                 10,
                 "label":
                 "Wasting (Weight-for-Height)"
             }],
              [{
                  "redirect":
                  "stunting",
                  "color":
                  "red",
                  "all":
                  939,
                  "frequency":
                  "month",
                  "format":
                  "percent_and_div",
                  "help_text":
                  "Percentage of children (6-60 months) with height-for-age below -2Z"
                  " standard deviations of the WHO Child Growth Standards median. "
                  "Stunting is a sign of chronic undernutrition and has "
                  "long lasting harmful consequences on the growth of a child",
                  "percent":
                  122.43521476748312,
                  "value":
                  26,
                  "label":
                  "Stunting (Height-for-Age)"
              }, {
                  "redirect":
                  "low_birth",
                  "color":
                  "red",
                  "all":
                  7,
                  "frequency":
                  "month",
                  "format":
                  "percent_and_div",
                  "help_text":
                  "Percentage of newborns born with birth weight less than 2500 grams."
                  " Newborns with Low Birth Weight are closely associated "
                  "with foetal and neonatal mortality and morbidity,"
                  " inhibited growth and cognitive development,"
                  " and chronic diseases later in life",
                  "percent":
                  "Data in the previous reporting period was 0",
                  "value":
                  2,
                  "label":
                  "Newborns with Low Birth Weight"
              }],
              [{
                  "redirect":
                  "early_initiation",
                  "color":
                  "green",
                  "all":
                  7,
                  "frequency":
                  "month",
                  "format":
                  "percent_and_div",
                  "help_text":
                  "Percentage of children breastfed within an hour of birth. "
                  "Early initiation of breastfeeding ensure the newborn "
                  "recieves the 'first milk' rich in nutrients "
                  "and encourages exclusive breastfeeding practice",
                  "percent":
                  128.57142857142856,
                  "value":
                  4,
                  "label":
                  "Early Initiation of Breastfeeding"
              }, {
                  "redirect":
                  "exclusive_breastfeeding",
                  "color":
                  "green",
                  "all":
                  50,
                  "frequency":
                  "month",
                  "format":
                  "percent_and_div",
                  "help_text":
                  "Percentage of children between 0 - 6 months exclusively breastfed. "
                  "An infant is exclusively breastfed if they recieve only breastmilk "
                  "with no additional food, liquids (even water) ensuring "
                  "optimal nutrition and growth between 0 - 6 months",
                  "percent":
                  149.84615384615384,
                  "value":
                  28,
                  "label":
                  "Exclusive Breastfeeding"
              }],
              [{
                  "redirect":
                  "children_initiated",
                  "color":
                  "green",
                  "all":
                  40,
                  "frequency":
                  "month",
                  "format":
                  "percent_and_div",
                  "help_text":
                  "Percentage of children between 6 - 8 months given timely "
                  "introduction to solid or semi-solid food. Timely intiation"
                  " of complementary feeding in addition to breastmilk "
                  "at 6 months of age is a key feeding practice to reduce malnutrition",
                  "percent":
                  147.27272727272725,
                  "value":
                  34,
                  "label":
                  "Children initiated appropriate Complementary Feeding"
              }, {
                  "redirect":
                  "institutional_deliveries",
                  "color":
                  "green",
                  "all":
                  26,
                  "frequency":
                  "month",
                  "format":
                  "percent_and_div",
                  "help_text":
                  "Percentage of pregnant women who delivered in a public "
                  "or private medical facility in the last month. "
                  "Delivery in medical instituitions is associated "
                  "with a decrease in maternal mortality rate",
                  "percent":
                  156.41025641025647,
                  "value":
                  20,
                  "label":
                  "Institutional Deliveries"
              }]]
         })