def test_sector_data_tooltips_data(self):
     data = get_prevalence_of_undernutrition_sector_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
         },
         location_id='b1',
         loc_level='supervisor')
     self.assertDictEqual(
         data['tooltips_data'], {
             "s2": {
                 "weighed": 182,
                 "severely_underweight": 4,
                 "moderately_underweight": 54,
                 "normal": 124,
                 "total": 326
             },
             "s1": {
                 "weighed": 134,
                 "severely_underweight": 8,
                 "moderately_underweight": 36,
                 "normal": 90,
                 "total": 144
             },
             None: {
                 "weighed": 158,
                 "severely_underweight": 6,
                 "moderately_underweight": 45,
                 "normal": 107,
                 "total": 235
             }
         })
 def test_sector_data_tooltips_data(self):
     self.maxDiff = None
     data = get_prevalence_of_undernutrition_sector_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": {
                 "weighed": 91,
                 "severely_underweight": 2,
                 "moderately_underweight": 27,
                 "normal": 62,
                 "total": 163
             },
             "s1": {
                 "weighed": 67,
                 "severely_underweight": 4,
                 "moderately_underweight": 18,
                 "normal": 45,
                 "total": 72
             }
         })
 def test_sector_data_keys_length(self):
     data = get_prevalence_of_undernutrition_sector_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
         },
         location_id='b1',
         loc_level='supervisor')
     self.assertEquals(len(data), 3)
 def test_sector_data(self):
     self.assertDictEqual(
         get_prevalence_of_undernutrition_sector_data(
             'icds-cas',
             config={
                 'month': (2017, 5, 1),
                 'state_id': 'st1',
                 'district_id': 'd1',
                 'block_id': 'b1',
             },
             location_id='b1',
             loc_level='supervisor'),
         {
             "info":
             "Percentage of children between 0-5 years enrolled for ICDS services with weight-for-age"
             " less than -2 standard deviations of the WHO Child Growth Standards median."
             " <br/><br/>Children who are moderately "
             "or severely underweight have a higher risk of mortality",
             "tooltips_data": {
                 u"s2": {
                     "total": 326,
                     "severely_underweight": 4,
                     "moderately_underweight": 74,
                     "normal": 236
                 },
                 u"s1": {
                     "total": 144,
                     "severely_underweight": 8,
                     "moderately_underweight": 42,
                     "normal": 92
                 },
                 None: {
                     "total": 235,
                     "severely_underweight": 6,
                     "moderately_underweight": 58,
                     "normal": 164
                 }
             },
             "chart_data": [{
                 "color":
                 MapColors.BLUE,
                 "classed":
                 "dashed",
                 "strokeWidth":
                 2,
                 "values": [[None, 0.2723404255319149],
                            ["s1", 0.3472222222222222],
                            ["s2", 0.2392638036809816]],
                 "key":
                 ""
             }]
         })
 def test_sector_data_keys_length(self):
     data = get_prevalence_of_undernutrition_sector_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
         },
         location_id='b1',
         loc_level='supervisor'
     )
     self.assertEquals(len(data), 3)
예제 #6
0
 def test_sector_data_info(self):
     data = get_prevalence_of_undernutrition_sector_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
         },
         location_id='b1',
         loc_level='supervisor')
     self.assertEquals(
         data['info'],
         underweight_children_help_text(age_label="0-5 years", html=True))
 def test_sector_data_info(self):
     data = get_prevalence_of_undernutrition_sector_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
         },
         location_id='b1',
         loc_level='supervisor'
     )
     self.assertEquals(
         data['info'],
         underweight_children_help_text(age_label="0-5 years", html=True)
     )
 def test_sector_data_info(self):
     data = get_prevalence_of_undernutrition_sector_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
         },
         location_id='b1',
         loc_level='supervisor')
     self.assertEquals(
         data['info'],
         "Percentage of children between 0-5 years enrolled for Anganwadi Services with weight-for-age"
         " less than -2 standard deviations of the WHO Child Growth Standards median."
         " <br/><br/>Children who are moderately "
         "or severely underweight have a higher risk of mortality")
예제 #9
0
 def test_sector_data(self):
     self.assertDictEqual(
         get_prevalence_of_undernutrition_sector_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'),
         {
             "info":
             "Percentage of children between 0-5 years enrolled for ICDS services"
             " with weight-for-age less than -2 standard deviations"
             " of the WHO Child Growth Standards median. <br/><br/>"
             "Children who are moderately or severely underweight have a higher risk of mortality",
             "tooltips_data": {
                 "s2": {
                     "total": 163,
                     "severely_underweight": 2,
                     "moderately_underweight": 37,
                     "normal": 118
                 },
                 "s1": {
                     "total": 72,
                     "severely_underweight": 4,
                     "moderately_underweight": 21,
                     "normal": 46
                 }
             },
             "chart_data": [{
                 "color":
                 "#006fdf",
                 "classed":
                 "dashed",
                 "strokeWidth":
                 2,
                 "values": [["s1", 0.3472222222222222],
                            ["s2", 0.2392638036809816]],
                 "key":
                 ""
             }]
         })
예제 #10
0
 def test_sector_data_info(self):
     data = get_prevalence_of_undernutrition_sector_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
         },
         location_id='b1',
         loc_level='supervisor')
     self.assertEquals(
         data['info'],
         "Of the total children enrolled for Anganwadi services and weighed, the percentage of children "
         "between 0-5 years who were moderately/severely underweight in the current month. "
         "<br/><br/>"
         "Children who are moderately or severely underweight have a higher risk of mortality. "
     )
 def test_sector_data_tooltips_data(self):
     data = get_prevalence_of_undernutrition_sector_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
         },
         location_id='b1',
         loc_level='supervisor'
     )
     self.assertDictEqual(
         data['tooltips_data'],
         {
             "s2": {
                 "weighed": 182,
                 "severely_underweight": 4,
                 "moderately_underweight": 54,
                 "normal": 124,
                 "total": 326
             },
             "s1": {
                 "weighed": 134,
                 "severely_underweight": 8,
                 "moderately_underweight": 36,
                 "normal": 90,
                 "total": 144
             },
             None: {
                 "weighed": 158,
                 "severely_underweight": 6,
                 "moderately_underweight": 45,
                 "normal": 107,
                 "total": 235
             }
         }
     )
 def test_sector_data_chart_data(self):
     data = get_prevalence_of_undernutrition_sector_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
         },
         location_id='b1',
         loc_level='supervisor')
     self.assertListEqual(data['chart_data'], [{
         "color":
         MapColors.BLUE,
         "classed":
         "dashed",
         "strokeWidth":
         2,
         "values": [[None, 0.3227848101265823], ["s1", 0.3283582089552239],
                    ["s2", 0.31868131868131866]],
         "key":
         ""
     }])
 def test_sector_data_chart_data(self):
     data = get_prevalence_of_undernutrition_sector_data(
         'icds-cas',
         config={
             'month': (2017, 5, 1),
             'state_id': 'st1',
             'district_id': 'd1',
             'block_id': 'b1',
         },
         location_id='b1',
         loc_level='supervisor'
     )
     self.assertListEqual(
         data['chart_data'],
         [
             {
                 "color": MapColors.BLUE,
                 "classed": "dashed",
                 "strokeWidth": 2,
                 "values": [
                     [
                         None,
                         0.3227848101265823
                     ],
                     [
                         "s1",
                         0.3283582089552239
                     ],
                     [
                         "s2",
                         0.31868131868131866
                     ]
                 ],
                 "key": ""
             }
         ]
     )