Ejemplo n.º 1
0
 def test_sector_data(self):
     self.assertDictEqual(
         get_newborn_with_low_birth_weight_data('icds-cas',
                                                config={
                                                    'month': (2017, 5, 1),
                                                    'state_id': 'st1',
                                                    'district_id': 'd1',
                                                    'block_id': 'b1',
                                                    'aggregation_level': 4
                                                },
                                                loc_level='supervisor'),
         {
             "info":
             "Percentage of newborns with born with birth weight less than 2500 grams."
             "<br/><br/>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",
             "tooltips_data": {
                 "s2": {
                     "in_month": 0,
                     "low_birth": 0
                 },
                 "s1": {
                     "in_month": 1,
                     "low_birth": 1
                 }
             },
             "chart_data": [{
                 "color": "#006fdf",
                 "classed": "dashed",
                 "strokeWidth": 2,
                 "values": [["s1", 1.0], ["s2", 0.0]],
                 "key": ""
             }]
         })
Ejemplo n.º 2
0
 def test_sector_data_tooltips_data(self):
     data = get_newborn_with_low_birth_weight_data('icds-cas',
                                                   config={
                                                       'month':
                                                       (2017, 5, 1),
                                                       'state_id': 'st1',
                                                       'district_id': 'd1',
                                                       'block_id': 'b1',
                                                       'aggregation_level':
                                                       4
                                                   },
                                                   location_id='b1',
                                                   loc_level='supervisor')
     self.assertDictEqual(
         data['tooltips_data'], {
             "s2": {
                 "in_month": 0,
                 "low_birth": 0,
                 "all": 0
             },
             "s1": {
                 "in_month": 1,
                 "low_birth": 1,
                 "all": 1
             }
         })
 def test_sector_data_chart_data(self):
     data = get_newborn_with_low_birth_weight_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
             'aggregation_level': 4
         },
         location_id='b1',
         loc_level='supervisor'
     )
     self.assertListEqual(
         data['chart_data'],
         [
             {
                 "color": MapColors.BLUE,
                 "classed": "dashed",
                 "strokeWidth": 2,
                 "values": [
                     [
                         "s1",
                         1.0
                     ],
                     [
                         "s2",
                         0.0
                     ]
                 ],
                 "key": ""
             }
         ]
     )
Ejemplo n.º 4
0
 def test_sector_data_chart_data(self):
     data = get_newborn_with_low_birth_weight_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
             'aggregation_level': 4
         },
         location_id='b1',
         loc_level='supervisor'
     )
     self.assertListEqual(
         data['chart_data'],
         [
             {
                 "color": MapColors.BLUE,
                 "classed": "dashed",
                 "strokeWidth": 2,
                 "values": [
                     [
                         "s1",
                         1.0
                     ],
                     [
                         "s2",
                         0.0
                     ]
                 ],
                 "key": ""
             }
         ]
     )
Ejemplo n.º 5
0
 def test_sector_data_tooltips_data(self):
     data = get_newborn_with_low_birth_weight_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
             'aggregation_level': 4
         },
         location_id='b1',
         loc_level='supervisor'
     )
     self.assertDictEqual(
         data['tooltips_data'],
         {
             "s2": {
                 "in_month": 0,
                 "low_birth": 0,
                 "all": 0
             },
             "s1": {
                 "in_month": 1,
                 "low_birth": 1,
                 "all": 1
             }
         }
     )
Ejemplo n.º 6
0
 def test_sector_data_keys_length(self):
     data = get_newborn_with_low_birth_weight_data('icds-cas',
                                                   config={
                                                       'month':
                                                       (2017, 5, 1),
                                                       'state_id': 'st1',
                                                       'district_id': 'd1',
                                                       'block_id': 'b1',
                                                       'aggregation_level':
                                                       4
                                                   },
                                                   location_id='b1',
                                                   loc_level='supervisor')
     self.assertEquals(len(data), 3)
Ejemplo n.º 7
0
 def test_sector_data_keys_length(self):
     data = get_newborn_with_low_birth_weight_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
             'aggregation_level': 4
         },
         location_id='b1',
         loc_level='supervisor'
     )
     self.assertEquals(len(data), 3)
Ejemplo n.º 8
0
 def test_sector_data_info(self):
     data = get_newborn_with_low_birth_weight_data('icds-cas',
                                                   config={
                                                       'month':
                                                       (2017, 5, 1),
                                                       'state_id': 'st1',
                                                       'district_id': 'd1',
                                                       'block_id': 'b1',
                                                       'aggregation_level':
                                                       4
                                                   },
                                                   location_id='b1',
                                                   loc_level='supervisor')
     self.assertEquals(data['info'],
                       new_born_with_low_weight_help_text(html=True))
Ejemplo n.º 9
0
 def test_sector_data_info(self):
     data = get_newborn_with_low_birth_weight_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
             'aggregation_level': 4
         },
         location_id='b1',
         loc_level='supervisor'
     )
     self.assertEquals(
         data['info'],
         new_born_with_low_weight_help_text(html=True)
     )
 def test_sector_data_info(self):
     data = get_newborn_with_low_birth_weight_data('icds-cas',
                                                   config={
                                                       'month':
                                                       (2017, 5, 1),
                                                       'state_id': 'st1',
                                                       'district_id': 'd1',
                                                       'block_id': 'b1',
                                                       'aggregation_level':
                                                       4
                                                   },
                                                   location_id='b1',
                                                   loc_level='supervisor')
     self.assertEquals(
         data['info'],
         "Percentage of newborns with born with birth weight less than 2500 grams."
         "<br/><br/>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",
     )
Ejemplo n.º 11
0
 def test_sector_data_info(self):
     data = get_newborn_with_low_birth_weight_data('icds-cas',
                                                   config={
                                                       'month':
                                                       (2017, 5, 1),
                                                       'state_id': 'st1',
                                                       'district_id': 'd1',
                                                       'block_id': 'b1',
                                                       'aggregation_level':
                                                       4
                                                   },
                                                   location_id='b1',
                                                   loc_level='supervisor')
     self.assertEquals(
         data['info'],
         "Of all the children born in the current month and enrolled for Anganwadi services, the percentage "
         "that had a birth weight less than 2500 grams. "
         "<br/><br/>"
         "Newborns with Low Birth Weight are closely associated wtih foetal and neonatal mortality "
         "and morbidity, inhibited growth and cognitive development, and chronic diseases later in life. ",
     )