def get_awc_covered_data(step, domain, config, loc_level, location, include_test): if step == "map": if loc_level in [LocationTypes.SUPERVISOR, LocationTypes.AWC]: data = get_awcs_covered_sector_data(domain, config, loc_level, location, include_test) else: data = get_awcs_covered_data_map(domain, config.copy(), loc_level, include_test) if loc_level == LocationTypes.BLOCK: sector = get_awcs_covered_sector_data( domain, config, loc_level, location, include_test ) data.update(sector) elif step == "chart": data = get_awcs_covered_data_chart(domain, config, loc_level, include_test) return data
def test_sector_data(self): self.assertDictEqual( get_awcs_covered_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": ( "Total AWCs that have launched ICDS-CAS. " "AWCs are considered launched after submitting at least " "one Household Registration form. <br /><br />" "Number of AWCs launched: 3 <br />" "Number of Supervisors launched: 2" ), "tooltips_data": { "s2": { "districts": 1, "states": 1, "supervisors": 1, "blocks": 1, "awcs": 1 }, "s1": { "districts": 1, "states": 1, "supervisors": 1, "blocks": 1, "awcs": 2 } }, "chart_data": [ { "color": MapColors.BLUE, "classed": "dashed", "strokeWidth": 2, "values": [ [ "s1", 2 ], [ "s2", 1 ] ], "key": "" } ], "format": "number" } )
def test_sector_data(self): self.assertDictEqual( get_awcs_covered_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": ( "{}<br /><br />" "Number of AWCs launched: 4 <br />" "Number of Supervisors launched: 2".format(awcs_launched_help_text()) ), "tooltips_data": { "s2": { "districts": 1, "states": 1, "supervisors": 1, "blocks": 1, "awcs": 2 }, "s1": { "districts": 1, "states": 1, "supervisors": 1, "blocks": 1, "awcs": 2 } }, "chart_data": [ { "color": MapColors.BLUE, "classed": "dashed", "strokeWidth": 2, "values": [ [ "s1", 2 ], [ "s2", 2 ] ], "key": "" } ], "format": "number" } )
def test_sector_data(self): self.assertDictEqual( get_awcs_covered_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": ( "{}<br /><br />" "Number of AWCs launched: 4 <br />" "Number of Supervisors launched: 2".format(awcs_launched_help_text()) ), "tooltips_data": { "s2": { "districts": 1, "states": 1, "supervisors": 1, "blocks": 1, "awcs": 2 }, "s1": { "districts": 1, "states": 1, "supervisors": 1, "blocks": 1, "awcs": 2 } }, "chart_data": [ { "color": MapColors.BLUE, "classed": "dashed", "strokeWidth": 2, "values": [ [ "s1", 2 ], [ "s2", 2 ] ], "key": "" } ], "format": "number" } )