def test_map_data(self):
     self.assertDictEqual(
         get_immunization_coverage_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state'),
         {
             "rightLegend": {
                 "info":
                 "Percentage of children 1 year+ who have received complete immunization as per "
                 "National Immunization Schedule of India required by age 1."
                 "<br/><br/>"
                 "This includes the following immunizations:<br/>"
                 "If Pentavalent path: Penta1/2/3, OPV1/2/3, BCG, Measles, VitA1<br/>"
                 "If DPT/HepB path: DPT1/2/3, HepB1/2/3, OPV1/2/3, BCG, Measles, VitA1",
                 "average":
                 11.046135224905703,
                 'extended_info': [{
                     'indicator':
                     'Total number of ICDS Child beneficiaries older than 1 year:',
                     'value': "1,193"
                 }, {
                     'indicator':
                     ('Total number of children who have recieved '
                      'complete immunizations required by age 1:'),
                     'value':
                     "130"
                 }, {
                     'indicator':
                     ('% of children who have recieved complete immunizations required by age 1:'
                      ),
                     'value':
                     '10.90%'
                 }]
             },
             "fills": {
                 "0%-20%": MapColors.RED,
                 "20%-60%": MapColors.ORANGE,
                 "60%-100%": MapColors.PINK,
                 "defaultFill": MapColors.GREY
             },
             "data": {
                 "st1": {
                     "all": 573,
                     "children": 85,
                     'original_name': ["st1"],
                     "fillKey": "0%-20%"
                 },
                 "st2": {
                     "all": 620,
                     "children": 45,
                     'original_name': ["st2"],
                     "fillKey": "0%-20%"
                 }
             },
             "slug": "institutional_deliveries",
             "label": "Percent Immunization Coverage at 1 year"
         })
Пример #2
0
 def test_map_data_right_legend_extended_info(self):
     data = get_immunization_coverage_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 ICDS Child beneficiaries between 1-2 years old:',
         'value':
         "101"
     }, {
         'indicator':
         ('Total number of children between 1-2 years old who have received '
          'complete immunizations required by age 1:'),
         'value':
         "10"
     }, {
         'indicator':
         ('% of children between 1-2 years old who have received complete immunizations'
          ' required by age 1:'),
         'value':
         '9.90%'
     }])
Пример #3
0
 def test_map_data_right_legend_extended_info(self):
     data = get_immunization_coverage_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 ICDS Child beneficiaries older than 1 year:',
                 'value': "1,191"
             },
             {
                 'indicator': (
                     'Total number of children who have recieved '
                     'complete immunizations required by age 1:'
                 ),
                 'value': "128"
             },
             {
                 'indicator': (
                     '% of children who have recieved complete immunizations required by age 1:'
                 ),
                 'value': '10.75%'
             }
         ]
     )
 def test_map_data_slug(self):
     data = get_immunization_coverage_data_map('icds-cas',
                                               config={
                                                   'month': (2017, 5, 1),
                                                   'aggregation_level': 1
                                               },
                                               loc_level='state')
     self.assertEquals(data['slug'], 'institutional_deliveries')
 def test_map_data_right_legend_average(self):
     data = get_immunization_coverage_data_map('icds-cas',
                                               config={
                                                   'month': (2017, 5, 1),
                                                   'aggregation_level': 1
                                               },
                                               loc_level='state')
     self.assertEquals(data['rightLegend']['average'], 11.046135224905703)
 def test_map_data_label(self):
     data = get_immunization_coverage_data_map('icds-cas',
                                               config={
                                                   'month': (2017, 5, 1),
                                                   'aggregation_level': 1
                                               },
                                               loc_level='state')
     self.assertEquals(data['label'],
                       'Percent Immunization Coverage at 1 year')
 def test_map_name_is_different_data(self):
     self.assertDictEqual(
         get_immunization_coverage_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 1 year+ who have received complete immunization as per "
                 "National Immunization Schedule of India required by age 1."
                 "<br/><br/>"
                 "This includes the following immunizations:<br/>"
                 "If Pentavalent path: Penta1/2/3, OPV1/2/3, BCG, Measles, VitA1<br/>"
                 "If DPT/HepB path: DPT1/2/3, HepB1/2/3, OPV1/2/3, BCG, Measles, VitA1",
                 "average":
                 14.834205933682373,
                 'extended_info': [{
                     'indicator':
                     'Total number of ICDS Child beneficiaries older than 1 year:',
                     'value': "573"
                 }, {
                     'indicator':
                     ('Total number of children who have recieved '
                      'complete immunizations required by age 1:'),
                     'value':
                     "85"
                 }, {
                     'indicator':
                     ('% of children who have recieved complete immunizations required by age 1:'
                      ),
                     'value':
                     '14.83%'
                 }]
             },
             "fills": {
                 "0%-20%": MapColors.RED,
                 "20%-60%": MapColors.ORANGE,
                 "60%-100%": MapColors.PINK,
                 "defaultFill": MapColors.GREY
             },
             "data": {
                 'block_map': {
                     'all': 573,
                     'original_name': ['b1', 'b2'],
                     'children': 85,
                     'fillKey': '0%-20%'
                 }
             },
             "slug": "institutional_deliveries",
             "label": "Percent Immunization Coverage at 1 year"
         })
Пример #8
0
 def test_map_data_right_legend_average(self):
     data = get_immunization_coverage_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertEquals(data['rightLegend']['average'], 10.747271200671705)
Пример #9
0
 def test_map_data_label(self):
     data = get_immunization_coverage_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertEquals(data['label'], 'Percent Immunization Coverage at 1 year')
Пример #10
0
 def test_map_data_slug(self):
     data = get_immunization_coverage_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertEquals(data['slug'], 'institutional_deliveries')
 def test_average_with_two_locations_represent_by_one_topojson(self):
     data = get_immunization_coverage_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'], 14.909190638712824)
Пример #12
0
 def test_average_with_two_locations_represent_by_one_topojson(self):
     data = get_immunization_coverage_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'], 14.56140350877193)
 def test_map_data_right_legend_keys(self):
     data = get_immunization_coverage_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)
 def test_map_data(self):
     data = get_immunization_coverage_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': 1,
                 'original_name': ['st7'],
                 'children': 0,
                 'fillKey': '0%-20%'
             },
             'st1': {
                 'all': 568,
                 'original_name': ['st1'],
                 'children': 83,
                 'fillKey': '0%-20%'
             },
             'st2': {
                 'all': 617,
                 'original_name': ['st2'],
                 'children': 45,
                 'fillKey': '0%-20%'
             },
             'st3': {
                 'all': 0,
                 'original_name': ['st3'],
                 'children': 0,
                 'fillKey': '0%-20%'
             }
         })
Пример #15
0
 def test_map_data_right_legend_keys(self):
     data = get_immunization_coverage_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)
 def test_map_data_keys(self):
     data = get_immunization_coverage_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)
 def test_map_data_fills(self):
     data = get_immunization_coverage_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
         })
Пример #18
0
 def test_map_data_keys(self):
     data = get_immunization_coverage_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)
Пример #19
0
 def test_map_data_right_legend_info(self):
     data = get_immunization_coverage_data_map('icds-cas',
                                               config={
                                                   'month': (2017, 5, 1),
                                                   'aggregation_level': 1
                                               },
                                               loc_level='state')
     expected = (
         "Of the total number of children enrolled for Anganwadi Services who are between 1-2 years old,"
         " the percentage of children who have received the complete immunization as per the National"
         " Immunization Schedule of India that is required by age 1.<br/><br/>This includes the following"
         " immunizations:<br/>If Pentavalent path: Penta1/2/3, OPV1/2/3, BCG, Measles, VitA1<br/>If"
         " DPT/HepB path: DPT1/2/3, HepB1/2/3, OPV1/2/3, BCG, Measles, VitA1"
     )
     self.assertEqual(data['rightLegend']['info'], expected)
 def test_map_data_with_age_1_2_ff(self):
     data = get_immunization_coverage_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state',
     )
     self.assertDictEqual(
         data['data'],
         {
             'st1': {'all': 44, 'original_name': ['st1'], 'children': 4, 'fillKey': '0%-20%'},
             'st2': {'all': 57, 'original_name': ['st2'], 'children': 6, 'fillKey': '0%-20%'}
         }
     )
 def test_map_data_right_legend_info(self):
     data = get_immunization_coverage_data_map('icds-cas',
                                               config={
                                                   'month': (2017, 5, 1),
                                                   'aggregation_level': 1
                                               },
                                               loc_level='state')
     expected = (
         "Percentage of children 1 year+ who have received complete immunization as per "
         "National Immunization Schedule of India required by age 1."
         "<br/><br/>"
         "This includes the following immunizations:<br/>"
         "If Pentavalent path: Penta1/2/3, OPV1/2/3, BCG, Measles, VitA1<br/>"
         "If DPT/HepB path: DPT1/2/3, HepB1/2/3, OPV1/2/3, BCG, Measles, VitA1"
     )
     self.assertEquals(data['rightLegend']['info'], expected)
Пример #22
0
 def test_map_data_fills(self):
     data = get_immunization_coverage_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
         }
     )
Пример #23
0
 def test_map_data_right_legend_info(self):
     data = get_immunization_coverage_data_map(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     expected = (
         "Of the total number of children enrolled for Anganwadi Services who are over a year old, "
         "the percentage of children who have received the complete immunization as per the National "
         "Immunization Schedule of India that is required by age 1."
         "<br/><br/>"
         "This includes the following immunizations:<br/>"
         "If Pentavalent path: Penta1/2/3, OPV1/2/3, BCG, Measles, VitA1<br/>"
         "If DPT/HepB path: DPT1/2/3, HepB1/2/3, OPV1/2/3, BCG, Measles, VitA1"
     )
     self.assertEquals(data['rightLegend']['info'], expected)
 def test_map_name_two_locations_represent_by_one_topojson(self):
     data = get_immunization_coverage_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': 573,
                 'original_name': ['b1', 'b2'],
                 'children': 85,
                 'fillKey': '0%-20%'
             }
         })
Пример #25
0
 def test_map_data(self):
     data = get_immunization_coverage_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': 1, 'original_name': ['st7'], 'children': 0, 'fillKey': '0%-20%'},
             'st1': {'all': 570, 'original_name': ['st1'], 'children': 83, 'fillKey': '0%-20%'},
             'st2': {'all': 620, 'original_name': ['st2'], 'children': 45, 'fillKey': '0%-20%'},
             'st3': {'all': 0, 'original_name': ['st3'], 'children': 0, 'fillKey': '0%-20%'}
         }
     )
 def test_map_data(self):
     data = get_immunization_coverage_data_map('icds-cas',
                                               config={
                                                   'month': (2017, 5, 1),
                                                   'aggregation_level': 1
                                               },
                                               loc_level='state')
     self.assertDictEqual(
         data['data'], {
             "st1": {
                 "all": 573,
                 "children": 85,
                 'original_name': ["st1"],
                 "fillKey": "0%-20%"
             },
             "st2": {
                 "all": 620,
                 "children": 45,
                 'original_name': ["st2"],
                 "fillKey": "0%-20%"
             }
         })
Пример #27
0
 def test_map_name_two_locations_represent_by_one_topojson(self):
     data = get_immunization_coverage_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': 570,
                 'original_name': ['b1', 'b2'],
                 'children': 83,
                 'fillKey': '0%-20%'
             }
         }
     )
 def test_map_data(self):
     self.assertDictEqual(
         get_immunization_coverage_data_map('icds-cas',
                                            config={
                                                'month': (2017, 5, 1),
                                                'aggregation_level': 1
                                            },
                                            loc_level='state')[0],
         {
             "rightLegend": {
                 "info":
                 "Percentage of children 1 year+ who have received complete immunization"
                 " as per National Immunization Schedule of India required by age 1.",
                 "average":
                 10.896898575020955
             },
             "fills": {
                 "0%-20%": "#de2d26",
                 "20%-60%": "#fc9272",
                 "60%-100%": "#fee0d2",
                 "defaultFill": "#9D9D9D"
             },
             "data": {
                 "st1": {
                     "all": 573,
                     "children": 85,
                     "fillKey": "0%-20%"
                 },
                 "st2": {
                     "all": 620,
                     "children": 45,
                     "fillKey": "0%-20%"
                 }
             },
             "slug": "institutional_deliveries",
             "label": "Percent Immunization Coverage at 1 year"
         })