def test_map_data(self):
     data = get_children_initiated_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state')
     self.assertDictEqual(
         data['data'], {
             'st7': {
                 'all': 0,
                 'original_name': ['st7'],
                 'children': 0,
                 'fillKey': '0%-20%'
             },
             'st1': {
                 'all': 17,
                 'original_name': ['st1'],
                 'children': 14,
                 'fillKey': '60%-100%'
             },
             'st2': {
                 'all': 23,
                 'original_name': ['st2'],
                 'children': 20,
                 'fillKey': '60%-100%'
             },
         })
Esempio n. 2
0
 def test_map_data_right_legend_extended_info(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertListEqual(
         data['rightLegend']['extended_info'],
         [
             {'indicator': 'Total number of children between age 6 - 8 months:', 'value': "40"},
             {
                 'indicator': (
                     'Total number of children (6-8 months) given timely introduction '
                     'to sold or semi-solid food in the given month:'
                 ),
                 'value': "34"
             },
             {
                 'indicator': (
                     '% children (6-8 months) given timely introduction '
                     'to solid or semi-solid food in the given month:'
                 ),
                 'value': '85.00%'
             }
         ]
     )
Esempio n. 3
0
 def test_map_data_right_legend_extended_info(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertListEqual(
         data['rightLegend']['extended_info'],
         [
             {'indicator': 'Total number of children between age 6 - 8 months:', 'value': "40"},
             {
                 'indicator': (
                     'Total number of children (6-8 months) given timely introduction '
                     'to sold or semi-solid food in the given month:'
                 ),
                 'value': "34"
             },
             {
                 'indicator': (
                     '% children (6-8 months) given timely introduction '
                     'to solid or semi-solid food in the given month:'
                 ),
                 'value': '85.00%'
             }
         ]
     )
 def test_map_data_slug(self):
     data = get_children_initiated_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state')
     self.assertEqual(data['slug'], 'severe')
 def test_map_data_right_legend_average(self):
     data = get_children_initiated_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state')
     self.assertEqual(data['rightLegend']['average'], 85.0)
Esempio n. 6
0
 def test_map_data(self):
     self.assertDictEqual(
         get_children_initiated_data_map(
             'icds-cas',
             config={
                 'month': (2017, 5, 1),
                 'aggregation_level': 1
             },
             loc_level='state'
         ),
         {
             "rightLegend": {
                 "info": "Percentage of children between 6 - 8 months"
                         " given timely introduction to solid, semi-solid or soft food.",
                 "average": 84.65473145780052,
                 'extended_info': [
                     {'indicator': 'Total number of children between age 6 - 8 months:', 'value': "40"},
                     {
                         'indicator': (
                             'Total number of children (6-8 months) given timely introduction '
                             'to sold or semi-solid food in the given month:'
                         ),
                         'value': "34"
                     },
                     {
                         'indicator': (
                             '% children (6-8 months) given timely introduction '
                             'to solid or semi-solid food in the given month:'
                         ),
                         'value': '85.00%'
                     }
                 ]
             },
             "fills": {
                 "0%-20%": MapColors.RED,
                 "20%-60%": MapColors.ORANGE,
                 "60%-100%": MapColors.PINK,
                 "defaultFill": MapColors.GREY
             },
             "data": {
                 "st1": {
                     "all": 17,
                     "children": 14,
                     'original_name': ["st1"],
                     "fillKey": "60%-100%"
                 },
                 "st2": {
                     "all": 23,
                     "children": 20,
                     'original_name': ["st2"],
                     "fillKey": "60%-100%"
                 }
             },
             "slug": "severe",
             "label": "Percent Children (6-8 months) initiated Complementary Feeding"
         }
     )
Esempio n. 7
0
 def test_map_data_label(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertEquals(data['label'], 'Percent Children (6-8 months) initiated Complementary Feeding')
 def test_map_data_label(self):
     data = get_children_initiated_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state')
     self.assertEqual(
         data['label'],
         'Percent Children (6-8 months) initiated Complementary Feeding')
 def test_map_data_right_legend_info(self):
     data = get_children_initiated_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state')
     expected = children_initiated_appropriate_complementary_feeding_help_text(
         html=True)
     self.assertEqual(data['rightLegend']['info'], expected)
Esempio n. 10
0
 def test_map_data_slug(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertEquals(data['slug'], 'severe')
Esempio n. 11
0
 def test_map_data_right_legend_average(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertEquals(data['rightLegend']['average'], 85.0)
 def test_map_data_right_legend_info(self):
     data = get_children_initiated_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state')
     expected = (
         "Percentage of children between 6 - 8 months"
         " given timely introduction to solid, semi-solid or soft food.")
     self.assertEquals(data['rightLegend']['info'], expected)
Esempio n. 13
0
 def test_map_data_right_legend_info(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     expected = children_initiated_appropriate_complementary_feeding_help_text(html=True)
     self.assertEquals(data['rightLegend']['info'], expected)
 def test_average_with_two_locations_represent_by_one_topojson(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'aggregation_level': 3
         },
         loc_level='block',
     )
     self.assertEqual(data['rightLegend']['average'], 82.3529411764706)
Esempio n. 15
0
 def test_map_name_is_different_data(self):
     self.assertDictEqual(
         get_children_initiated_data_map(
             'icds-cas',
             config={
                 'month': (2017, 5, 1),
                 'state_id': 'st1',
                 'district_id': 'd1',
                 'aggregation_level': 3
             },
             loc_level='block',
         ),
         {
             "rightLegend": {
                 "info": "Percentage of children between 6 - 8 months"
                         " given timely introduction to solid, semi-solid or soft food.",
                 "average": 82.3529411764706,
                 'extended_info': [
                     {'indicator': 'Total number of children between age 6 - 8 months:', 'value': "17"},
                     {
                         'indicator': (
                             'Total number of children (6-8 months) given timely introduction '
                             'to sold or semi-solid food in the given month:'
                         ),
                         'value': "14"
                     },
                     {
                         'indicator': (
                             '% children (6-8 months) given timely introduction '
                             'to solid or semi-solid food in the given month:'
                         ),
                         'value': '82.35%'
                     }
                 ]
             },
             "fills": {
                 "0%-20%": MapColors.RED,
                 "20%-60%": MapColors.ORANGE,
                 "60%-100%": MapColors.PINK,
                 "defaultFill": MapColors.GREY
             },
             "data": {
                 'block_map': {
                     'all': 17,
                     'original_name': ['b1', 'b2'],
                     'children': 14,
                     'fillKey': '60%-100%'
                 }
             },
             "slug": "severe",
             "label": "Percent Children (6-8 months) initiated Complementary Feeding"
         }
     )
Esempio n. 16
0
 def test_average_with_two_locations_represent_by_one_topojson(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'aggregation_level': 3
         },
         loc_level='block',
     )
     self.assertEquals(data['rightLegend']['average'], 82.3529411764706)
 def test_map_data_right_legend_keys(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state')['rightLegend']
     self.assertEqual(len(data), 3)
     self.assertIn('info', data)
     self.assertIn('average', data)
     self.assertIn('extended_info', data)
 def test_map_data_keys(self):
     data = get_children_initiated_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state')
     self.assertEqual(len(data), 5)
     self.assertIn('rightLegend', data)
     self.assertIn('fills', data)
     self.assertIn('data', data)
     self.assertIn('slug', data)
     self.assertIn('label', data)
Esempio n. 19
0
 def test_map_data_right_legend_keys(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )['rightLegend']
     self.assertEquals(len(data), 3)
     self.assertIn('info', data)
     self.assertIn('average', data)
     self.assertIn('extended_info', data)
Esempio n. 20
0
 def test_map_data_fills(self):
     data = get_children_initiated_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state')
     self.assertDictEqual(
         data['fills'], {
             "0%-20%": MapColors.RED,
             "20%-60%": MapColors.ORANGE,
             "60%-100%": MapColors.PINK,
             "defaultFill": MapColors.GREY
         })
Esempio n. 21
0
 def test_map_data_keys(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertEquals(len(data), 5)
     self.assertIn('rightLegend', data)
     self.assertIn('fills', data)
     self.assertIn('data', data)
     self.assertIn('slug', data)
     self.assertIn('label', data)
Esempio n. 22
0
 def test_map_data_fills(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertDictEqual(
         data['fills'],
         {
             "0%-20%": MapColors.RED,
             "20%-60%": MapColors.ORANGE,
             "60%-100%": MapColors.PINK,
             "defaultFill": MapColors.GREY
         }
     )
 def test_map_name_two_locations_represent_by_one_topojson(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'aggregation_level': 3
         },
         loc_level='block',
     )
     self.assertDictEqual(
         data['data'], {
             'block_map': {
                 'all': 17,
                 'original_name': ['b1', 'b2'],
                 'children': 14,
                 'fillKey': '60%-100%'
             }
         })
Esempio n. 24
0
 def test_map_data(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertDictEqual(
         data['data'],
         {
             'st4': {'all': 0, 'original_name': ['st4'], 'children': 0, 'fillKey': '0%-20%'},
             'st5': {'all': 0, 'original_name': ['st5'], 'children': 0, 'fillKey': '0%-20%'},
             'st6': {'all': 0, 'original_name': ['st6'], 'children': 0, 'fillKey': '0%-20%'},
             'st7': {'all': 0, 'original_name': ['st7'], 'children': 0, 'fillKey': '0%-20%'},
             'st1': {'all': 17, 'original_name': ['st1'], 'children': 14, 'fillKey': '60%-100%'},
             'st2': {'all': 23, 'original_name': ['st2'], 'children': 20, 'fillKey': '60%-100%'},
             'st3': {'all': 0, 'original_name': ['st3'], 'children': 0, 'fillKey': '0%-20%'}
         }
     )
 def test_map_data(self):
     data = get_children_initiated_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state')
     self.assertDictEqual(
         data['data'], {
             "st1": {
                 "all": 17,
                 "children": 14,
                 'original_name': ["st1"],
                 "fillKey": "60%-100%"
             },
             "st2": {
                 "all": 23,
                 "children": 20,
                 'original_name': ["st2"],
                 "fillKey": "60%-100%"
             }
         })
Esempio n. 26
0
 def test_map_name_two_locations_represent_by_one_topojson(self):
     data = get_children_initiated_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'aggregation_level': 3
         },
         loc_level='block',
     )
     self.assertDictEqual(
         data['data'],
         {
             'block_map': {
                 'all': 17,
                 'original_name': ['b1', 'b2'],
                 'children': 14,
                 'fillKey': '60%-100%'
             }
         }
     )
 def test_map_data(self):
     self.assertDictEqual(
         get_children_initiated_data_map('icds-cas',
                                         config={
                                             'month': (2017, 5, 1),
                                             'aggregation_level': 1
                                         },
                                         loc_level='state')[0],
         {
             "rightLegend": {
                 "info": "Percentage of children between 6 - 8 months"
                 " given timely introduction to solid, semi-solid or soft food.",
                 "average": 85.0
             },
             "fills": {
                 "0%-20%": "#de2d26",
                 "20%-60%": "#fc9272",
                 "60%-100%": "#fee0d2",
                 "defaultFill": "#9D9D9D"
             },
             "data": {
                 "st1": {
                     "all": 17,
                     "children": 14,
                     "fillKey": "60%-100%"
                 },
                 "st2": {
                     "all": 23,
                     "children": 20,
                     "fillKey": "60%-100%"
                 }
             },
             "slug":
             "severe",
             "label":
             "Percent Children (6-8 months) initiated Complementary Feeding"
         })