def test_map_data(self):
     self.assertDictEqual(
         get_clean_water_data_map('icds-cas',
                                  config={
                                      'month': (2017, 5, 1),
                                      'aggregation_level': 1
                                  },
                                  loc_level='state')[0],
         {
             "rightLegend": {
                 "info":
                 "Percentage of AWCs with a source of clean drinking water",
                 "average": 58.0
             },
             "fills": {
                 "0%-25%": "#de2d26",
                 "25%-75%": "#fc9272",
                 "75%-100%": "#fee0d2",
                 "defaultFill": "#9D9D9D"
             },
             "data": {
                 "st1": {
                     "in_month": 17,
                     "all": 26,
                     "fillKey": "25%-75%"
                 },
                 "st2": {
                     "in_month": 12,
                     "all": 24,
                     "fillKey": "25%-75%"
                 }
             },
             "slug": "clean_water",
             "label": "Percent AWCs with Clean Drinking Water"
         })
Beispiel #2
0
 def test_map_data(self):
     self.assertDictEqual(
         get_clean_water_data_map('icds-cas',
                                  config={
                                      'month': (2017, 5, 1),
                                      'aggregation_level': 1
                                  },
                                  loc_level='state'),
         {
             "rightLegend": {
                 "info":
                 "Of the AWCs that have submitted an Infrastructure Details form, the percentage "
                 "of AWCs that reported having a source of clean drinking water. ",
                 "average":
                 96.15384615384616,
                 'extended_info': [{
                     'indicator':
                     'Total number of AWCs with a source of clean drinking water:',
                     'value': "29"
                 }, {
                     'indicator':
                     '% of AWCs with a source of clean drinking water:',
                     'value': '96.67%'
                 }]
             },
             "label":
             "Percentage of AWCs that reported having a source of clean drinking water",
             "data": {
                 "st1": {
                     "in_month": 17,
                     "original_name": ["st1"],
                     "all": 17,
                     "fillKey": "75%-100%"
                 },
                 "st2": {
                     "in_month": 12,
                     "original_name": ["st2"],
                     "all": 13,
                     "fillKey": "75%-100%"
                 }
             },
             "slug": "clean_water",
             "fills": {
                 "0%-25%": MapColors.RED,
                 "25%-75%": MapColors.ORANGE,
                 "75%-100%": MapColors.PINK,
                 "defaultFill": MapColors.GREY
             }
         })
Beispiel #3
0
 def test_map_name_is_different_data(self):
     self.assertDictEqual(
         get_clean_water_data_map(
             'icds-cas',
             config={
                 'month': (2017, 5, 1),
                 'state_id': 'st1',
                 'district_id': 'd1',
                 'aggregation_level': 3
             },
             loc_level='block',
         ), {
             "rightLegend": {
                 "info":
                 "Of the AWCs that have submitted an Infrastructure Details form, the percentage "
                 "of AWCs that reported having a source of clean drinking water. ",
                 "average":
                 100.0,
                 'extended_info': [{
                     'indicator':
                     'Total number of AWCs with a source of clean drinking water:',
                     'value': "17"
                 }, {
                     'indicator':
                     '% of AWCs with a source of clean drinking water:',
                     'value': '100.00%'
                 }]
             },
             "label":
             "Percentage of AWCs that reported having a source of clean drinking water",
             "data": {
                 "block_map": {
                     "in_month": 17,
                     "original_name": ["b1", "b2"],
                     "all": 17,
                     "fillKey": "75%-100%"
                 }
             },
             "slug": "clean_water",
             "fills": {
                 "0%-25%": MapColors.RED,
                 "25%-75%": MapColors.ORANGE,
                 "75%-100%": MapColors.PINK,
                 "defaultFill": MapColors.GREY
             }
         })
 def test_map_name_is_different_data(self):
     self.assertDictEqual(
         get_clean_water_data_map(
             'icds-cas',
             config={
                 'month': (2017, 5, 1),
                 'state_id': 'st1',
                 'district_id': 'd1',
                 'aggregation_level': 3
             },
             loc_level='block',
         ),
         {
             "rightLegend": {
                 "info": awcs_reported_clean_drinking_water_help_text(),
                 "average": 100.0,
                 'extended_info': [
                     {
                         'indicator': 'Total number of AWCs with a source of clean drinking water:',
                         'value': "17"
                     },
                     {'indicator': '% of AWCs with a source of clean drinking water:', 'value': '100.00%'}
                 ]
             },
             "label": "Percentage of AWCs that reported having a source of clean drinking water",
             "data": {
                 "block_map": {
                     "in_month": 17,
                     "original_name": [
                         "b1",
                         "b2"
                     ],
                     "all": 17,
                     "fillKey": "75%-100%"
                 }
             },
             "slug": "clean_water",
             "fills": {
                 "0%-25%": MapColors.RED,
                 "25%-75%": MapColors.ORANGE,
                 "75%-100%": MapColors.PINK,
                 "defaultFill": MapColors.GREY
             }
         }
     )
 def test_map_data(self):
     self.assertDictEqual(
         get_clean_water_data_map(
             'icds-cas',
             config={
                 'month': (2017, 5, 1),
                 'aggregation_level': 1
             },
             loc_level='state'
         ),
         {
             "rightLegend": {
                 "info": awcs_reported_clean_drinking_water_help_text(),
                 "average": 96.66666666666667,
                 'extended_info': [
                     {
                         'indicator': 'Total number of AWCs with a source of clean drinking water:',
                         'value': "29"
                     },
                     {'indicator': '% of AWCs with a source of clean drinking water:', 'value': '96.67%'}
                 ]
             },
             "label": "Percentage of AWCs that reported having a source of clean drinking water",
             "data": {
                 'st4': {'in_month': 0, 'original_name': ['st4'], 'all': 0, 'fillKey': '0%-25%'},
                 'st5': {'in_month': 0, 'original_name': ['st5'], 'all': 0, 'fillKey': '0%-25%'},
                 'st6': {'in_month': 0, 'original_name': ['st6'], 'all': 0, 'fillKey': '0%-25%'},
                 'st7': {'in_month': 0, 'original_name': ['st7'], 'all': 0, 'fillKey': '0%-25%'},
                 'st1': {'in_month': 17, 'original_name': ['st1'], 'all': 17, 'fillKey': '75%-100%'},
                 'st2': {'in_month': 12, 'original_name': ['st2'], 'all': 13, 'fillKey': '75%-100%'},
                 'st3': {'in_month': 0, 'original_name': ['st3'], 'all': 0, 'fillKey': '0%-25%'}
             },
             "slug": "clean_water",
             "fills": {
                 "0%-25%": MapColors.RED,
                 "25%-75%": MapColors.ORANGE,
                 "75%-100%": MapColors.PINK,
                 "defaultFill": MapColors.GREY
             }
         }
     )
Beispiel #6
0
 def test_map_data(self):
     self.assertDictEqual(
         get_clean_water_data_map(
             'icds-cas',
             config={
                 'month': (2017, 5, 1),
                 'aggregation_level': 1
             },
             loc_level='state'
         ),
         {
             "rightLegend": {
                 "info": awcs_reported_clean_drinking_water_help_text(),
                 "average": 96.66666666666667,
                 'extended_info': [
                     {
                         'indicator': 'Total number of AWCs with a source of clean drinking water:',
                         'value': "29"
                     },
                     {'indicator': '% of AWCs with a source of clean drinking water:', 'value': '96.67%'}
                 ]
             },
             "label": "Percentage of AWCs that reported having a source of clean drinking water",
             "data": {
                 'st4': {'in_month': 0, 'original_name': ['st4'], 'all': 0, 'fillKey': '0%-25%'},
                 'st5': {'in_month': 0, 'original_name': ['st5'], 'all': 0, 'fillKey': '0%-25%'},
                 'st6': {'in_month': 0, 'original_name': ['st6'], 'all': 0, 'fillKey': '0%-25%'},
                 'st7': {'in_month': 0, 'original_name': ['st7'], 'all': 0, 'fillKey': '0%-25%'},
                 'st1': {'in_month': 17, 'original_name': ['st1'], 'all': 17, 'fillKey': '75%-100%'},
                 'st2': {'in_month': 12, 'original_name': ['st2'], 'all': 13, 'fillKey': '75%-100%'},
                 'st3': {'in_month': 0, 'original_name': ['st3'], 'all': 0, 'fillKey': '0%-25%'}
             },
             "slug": "clean_water",
             "fills": {
                 "0%-25%": MapColors.RED,
                 "25%-75%": MapColors.ORANGE,
                 "75%-100%": MapColors.PINK,
                 "defaultFill": MapColors.GREY
             }
         }
     )