Ejemplo n.º 1
0
 def test_chart_data_all_locations(self):
     data = get_newborn_with_low_birth_weight_chart('icds-cas',
                                                    config={
                                                        'month':
                                                        (2017, 5, 1),
                                                        'aggregation_level':
                                                        1
                                                    },
                                                    loc_level='state')
     self.assertListEqual(data['all_locations'], [{
         'loc_name': 'st2',
         'percent': 0.0
     }, {
         'loc_name': 'st3',
         'percent': 0.0
     }, {
         'loc_name': 'st4',
         'percent': 0.0
     }, {
         'loc_name': 'st5',
         'percent': 0.0
     }, {
         'loc_name': 'st6',
         'percent': 0.0
     }, {
         'loc_name': 'st7',
         'percent': 0.0
     }, {
         'loc_name': 'st1',
         'percent': 50.0
     }])
Ejemplo n.º 2
0
 def test_chart_data_elements_length(self):
     data = get_newborn_with_low_birth_weight_chart('icds-cas',
                                                    config={
                                                        'month':
                                                        (2017, 5, 1),
                                                        'aggregation_level':
                                                        1
                                                    },
                                                    loc_level='state')
     self.assertEquals(len(data['chart_data']), 1)
Ejemplo n.º 3
0
 def test_chart_data_elements_length(self):
     data = get_newborn_with_low_birth_weight_chart(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertEquals(len(data['chart_data']), 1)
Ejemplo n.º 4
0
 def test_chart_data_location_type(self):
     data = get_newborn_with_low_birth_weight_chart('icds-cas',
                                                    config={
                                                        'month':
                                                        (2017, 5, 1),
                                                        'aggregation_level':
                                                        1
                                                    },
                                                    loc_level='state')
     self.assertEquals(data['location_type'], 'State')
Ejemplo n.º 5
0
 def test_chart_data_location_type(self):
     data = get_newborn_with_low_birth_weight_chart(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertEquals(data['location_type'], 'State')
Ejemplo n.º 6
0
 def test_chart_data_top_five(self):
     data = get_newborn_with_low_birth_weight_chart('icds-cas',
                                                    config={
                                                        'month':
                                                        (2017, 5, 1),
                                                        'aggregation_level':
                                                        1
                                                    },
                                                    loc_level='state')
     self.assertListEqual(data['top_five'], [{
         "loc_name": "st2",
         "percent": 0.0
     }, {
         "loc_name": "st1",
         "percent": 66.66666666666667
     }])
Ejemplo n.º 7
0
 def test_chart_data(self):
     data = get_newborn_with_low_birth_weight_chart('icds-cas',
                                                    config={
                                                        'month':
                                                        (2017, 5, 1),
                                                        'aggregation_level':
                                                        1
                                                    },
                                                    loc_level='state')
     self.assertDictEqual(
         data['chart_data'][0], {
             "color":
             ChartColors.BLUE,
             "classed":
             "dashed",
             "strokeWidth":
             2,
             "values": [{
                 "y": 0,
                 "x": 1485907200000,
                 "in_month": 0,
                 "low_birth": 0,
                 "all": 0
             }, {
                 "y": 0,
                 "x": 1488326400000,
                 "in_month": 0,
                 "low_birth": 0,
                 "all": 0
             }, {
                 "y": 0.0,
                 "x": 1491004800000,
                 "in_month": 3,
                 "low_birth": 0,
                 "all": 6
             }, {
                 "y": 0.3333333333333333,
                 "x": 1493596800000,
                 "in_month": 3,
                 "low_birth": 1,
                 "all": 5
             }],
             "key":
             "% Newborns with Low Birth Weight"
         })
Ejemplo n.º 8
0
 def test_chart_data(self):
     data = get_newborn_with_low_birth_weight_chart(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertDictEqual(
         data['chart_data'][0],
         {
             "color": ChartColors.BLUE,
             "classed": "dashed",
             "strokeWidth": 2,
             "values": [
                 {
                     "y": 0,
                     "x": 1485907200000,
                     "in_month": 0,
                     "low_birth": 0,
                     "all": 0},
                 {
                     "y": 0,
                     "x": 1488326400000,
                     "in_month": 0,
                     "low_birth": 0,
                     "all": 0},
                 {
                     "y": 0.0,
                     "x": 1491004800000,
                     "in_month": 3,
                     "low_birth": 0,
                     "all": 6},
                 {
                     "y": 0.3333333333333333,
                     "x": 1493596800000,
                     "in_month": 3,
                     "low_birth": 1,
                     "all": 5
                 }
             ],
             "key": "% Newborns with Low Birth Weight"
         }
     )
Ejemplo n.º 9
0
 def test_chart_data_top_five(self):
     data = get_newborn_with_low_birth_weight_chart(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'aggregation_level': 1
         },
         loc_level='state'
     )
     self.assertListEqual(
         data['top_five'],
         [
             {'loc_name': 'st2', 'percent': 0.0},
             {'loc_name': 'st3', 'percent': 0.0},
             {'loc_name': 'st4', 'percent': 0.0},
             {'loc_name': 'st5', 'percent': 0.0},
             {'loc_name': 'st6', 'percent': 0.0},
         ]
     )
Ejemplo n.º 10
0
 def test_chart_data(self):
     self.assertDictEqual(
         get_newborn_with_low_birth_weight_chart('icds-cas',
                                                 config={
                                                     'month': (2017, 5, 1),
                                                     'aggregation_level': 1
                                                 },
                                                 loc_level='state'),
         {
             "location_type":
             "State",
             "bottom_five": [{
                 "loc_name": "st2",
                 "percent": 0.0
             }, {
                 "loc_name": "st1",
                 "percent": 50.0
             }],
             "top_five": [{
                 "loc_name": "st2",
                 "percent": 0.0
             }, {
                 "loc_name": "st1",
                 "percent": 50.0
             }],
             "chart_data": [{
                 "color":
                 "#006fdf",
                 "classed":
                 "dashed",
                 "strokeWidth":
                 2,
                 "values": [{
                     "y": 0,
                     "x": 1485907200000,
                     "all": 0,
                     "low_birth": 0
                 }, {
                     "y": 0,
                     "x": 1488326400000,
                     "all": 0,
                     "low_birth": 0
                 }, {
                     "y": 0.0,
                     "x": 1491004800000,
                     "all": 8,
                     "low_birth": 0
                 }, {
                     "y": 0.2857142857142857,
                     "x": 1493596800000,
                     "all": 7,
                     "low_birth": 2
                 }],
                 "key":
                 "% Newborns with Low Birth Weight"
             }],
             "all_locations": [{
                 "loc_name": "st2",
                 "percent": 0.0
             }, {
                 "loc_name": "st1",
                 "percent": 50.0
             }]
         })