diff --git a/dpr/api.py b/dpr/api.py index a3c9ffab..1db3032c 100644 --- a/dpr/api.py +++ b/dpr/api.py @@ -68,7 +68,7 @@ get_factory_data, get_mining_data, get_green_credit_data, - get_intersecting_village_ids, + get_intersecting_village_ids ) from .gen_tehsil_report import ( get_tehsil_data, @@ -85,6 +85,7 @@ get_agroforestry_transition_data, ) from .gen_village_report import ( + load_block_sheets, get_village_polygon_and_info, get_development_data, get_block_development_data, @@ -97,6 +98,9 @@ get_community_institutes, get_livelihood_diversification, get_livestock_management, + get_livestock_count, + get_land_cultivation, + get_all_villages_land_cultivation, get_irrigation_Infra, get_agri_support_service, get_ecological_climate_resiliance, @@ -169,7 +173,7 @@ def generate_dpr(request): try: plan_id = request.data.get("plan_id") email_id = request.data.get("email_id") - language = request.data.get("language") + # language = request.data.get("language") regenerate = request.data.get("regenerate", False) logger.info( @@ -193,9 +197,7 @@ def generate_dpr(request): {"error": "Plan not found"}, status=status.HTTP_404_NOT_FOUND ) - generate_dpr_task.apply_async( - args=[plan_id, email_id, language, regenerate], queue="dpr" - ) + generate_dpr_task.apply_async(args=[plan_id, email_id, regenerate], queue="dpr") return Response( { @@ -339,11 +341,11 @@ def generate_mws_report(request): village_ids = get_intersecting_village_ids(state, district, block, uid) context = { - "state": state, + "state" : state, "district": district, "block": block, "mws_id": uid, - "base_url": BASE_API_URL, + "base_url" : BASE_API_URL, "block_osm": parameter_block, "mws_osm": parameter_mws, "terrain_mws": terrain_mws, @@ -405,7 +407,7 @@ def generate_mws_report(request): "factory_desc": factory_desc, "mining_desc": mining_desc, "green_credit_desc": green_credits, - "village_ids": json.dumps(village_ids), + "village_ids" : json.dumps(village_ids) } # print("Api Processing End 1", datetime.now()) @@ -606,99 +608,103 @@ def generate_village_report(request): """ Generate comprehensive village report with all sections. """ - state = request.GET.get("state") - district = request.GET.get("district") - block = request.GET.get("block") - village_id = request.GET.get("villageId") - - if village_id == "0": - return render( - request, - "village-report-unavailable.html", - { - "state": state, - "district": district, - "block": block, - }, - ) + state = request.GET.get('state') + district = request.GET.get('district') + block = request.GET.get('block') + village_id = request.GET.get('villageId') + + if village_id == '0': + return render(request, 'village-report-unavailable.html', { + 'state': state, + 'district': district, + 'block': block, + }) + + # Load all Excel sheets once — shared by every data function below + df, df_facilities, df_nrega, df_livestock = load_block_sheets(state, district, block) # Get village polygon and info from GeoServer village_data = get_village_polygon_and_info(state, district, block, village_id) # Get Development Scores - development_score = get_development_data(state, district, block, village_id) - block_development_score = get_block_development_data(state, district, block) + development_score = get_development_data(state, district, block, village_id, df=df, df_facilities=df_facilities, df_nrega=df_nrega) + block_development_score = get_block_development_data(state, district, block, df=df, df_facilities=df_facilities, df_nrega=df_nrega) # Calculate demographic data with percentages - demographic_data = calculate_demographics(village_data["properties"]) + demographic_data = calculate_demographics(village_data['properties']) # Calculate Basic Infra - basic_infra_data = get_basic_infrastructure(state, district, block, village_id) + basic_infra_data = get_basic_infrastructure(state, district, block, village_id, df=df) # Convert scores to performance categories basic_infra_performance = [ - "Low" if score <= 0.33 else "High" if score > 0.66 else "Medium" + 'Low' if score <= 0.33 else 'High' if score > 0.66 else 'Medium' for score in basic_infra_data ] # Calculate Health and Wash - health_wash_data = get_health_and_wash(state, district, block, village_id) + health_wash_data = get_health_and_wash(state, district, block, village_id, df=df, df_facilities=df_facilities) health_wash_performance = [ # Maternal & Child Health (High / Low only) "High" if health_wash_data[0] > 0.66 else "Low", + # Water & Sanitation (High / Medium / Low) ( "Low" if health_wash_data[1] <= 0.33 - else "High" if health_wash_data[1] > 0.66 else "Medium" - ), + else "High" + if health_wash_data[1] > 0.66 + else "Medium" + ) ] - # Calculate Education Institutions - education_data = get_education_institutions(state, district, block, village_id) + #Calculate Education Institutions + education_data = get_education_institutions(state, district, block, village_id, df_facilities=df_facilities) # Calculate Financial Inclusion - finance_data = get_financial_inclusion(state, district, block, village_id) + finance_data = get_financial_inclusion(state, district, block, village_id, df_facilities=df_facilities) - # Calculate Welfare - welfare_data = get_welfare_inclusion(state, district, block, village_id) + #Calculate Welfare + welfare_data = get_welfare_inclusion(state, district, block, village_id, df=df, df_facilities=df_facilities) - # Calculate Community Institutions - community_data = get_community_institutes(state, district, block, village_id) + #Calculate Community Institutions + community_data = get_community_institutes(state, district, block, village_id, df=df) - # Livelihood Diversification - livelihood_data = get_livelihood_diversification(state, district, block, village_id) + #Livelihood Diversification + livelihood_data = get_livelihood_diversification(state, district, block, village_id, df=df) - # Livestock Management - livestock_data = get_livestock_management(state, district, block, village_id) + #Livestock Management + livestock_data = get_livestock_management(state, district, block, village_id, df=df, df_facilities=df_facilities) + livestock_count_data = get_livestock_count(state, district, block, village_id, df_livestock=df_livestock) - # Irrigation data - irrigation_data = get_irrigation_Infra(state, district, block, village_id) + #Land Cultivation + land_cultivation_data = get_land_cultivation(state, district, block, village_id, df=df) - # Agriculture Support - agri_support_data = get_agri_support_service(state, district, block, village_id) + #Irrigation data + irrigation_data = get_irrigation_Infra(state, district, block, village_id, df=df) - # Climate Resiliance - climate_resiliance_data = get_ecological_climate_resiliance( - state, district, block, village_id - ) + #Agriculture Support + agri_support_data = get_agri_support_service(state, district, block, village_id, df=df, df_facilities=df_facilities) + + #Climate Resiliance + climate_resiliance_data = get_ecological_climate_resiliance(state, district, block, village_id, df=df, df_nrega=df_nrega) - # Map Data - basic_infra_map = get_all_villages_basic_infrastructure(state, district, block) - health_wash_map = get_all_villages_health_and_wash(state, district, block) - education_map = get_all_villages_education_institutions(state, district, block) - financial_map = get_all_villages_financial_inclusion(state, district, block) - welfare_map = get_all_villages_welfare_inclusion(state, district, block) - community_map = get_all_villages_community_institutes(state, district, block) - livestock_map = get_all_villages_livestock_management(state, district, block) - irrigation_infra_map = get_all_villages_irrigation_infra(state, district, block) - agri_support_map = get_all_villages_agri_support_service(state, district, block) - climate_resiliance_map = get_all_villages_ecological_climate_resiliance( - state, district, block - ) + + #Map Data + basic_infra_map = get_all_villages_basic_infrastructure(state, district, block, df=df, df_nrega=df_nrega) + health_wash_map = get_all_villages_health_and_wash(state, district, block, df=df) + education_map = get_all_villages_education_institutions(state, district, block, df_facilities=df_facilities, df_nrega=df_nrega) + financial_map = get_all_villages_financial_inclusion(state, district, block, df_facilities=df_facilities, df_nrega=df_nrega) + welfare_map = get_all_villages_welfare_inclusion(state, district, block, df=df, df_facilities=df_facilities, df_nrega=df_nrega) + community_map = get_all_villages_community_institutes(state, district, block, df=df) + livestock_map = get_all_villages_livestock_management(state, district, block, df=df, df_facilities=df_facilities) + land_cultivation_map = get_all_villages_land_cultivation(state, district, block, df=df) + irrigation_infra_map = get_all_villages_irrigation_infra(state, district, block, df=df) + agri_support_map = get_all_villages_agri_support_service(state, district, block, df=df, df_facilities=df_facilities) + climate_resiliance_map = get_all_villages_ecological_climate_resiliance(state, district, block, df=df, df_nrega=df_nrega) mws_ids = get_mwses_ids(state, district, block, village_id) mws_pattern_intensity = get_pattern_intensity(state, district, block) - + # Build context for template context = { # Location info @@ -706,60 +712,79 @@ def generate_village_report(request): "district": district, "block": block, "village_id": village_id, - "base_url": BASE_API_URL, - "village_name": village_data["village_name"], - "gram_panchayat_name": village_data["gram_panchayat_name"], - "area_hectares": village_data["area_hectares"], - "village_polygon": json.dumps(village_data["village_polygon"]), + "base_url" : BASE_API_URL, + "village_name": village_data['village_name'], + "gram_panchayat_name": village_data['gram_panchayat_name'], + "area_hectares": village_data['area_hectares'], + "village_polygon": json.dumps(village_data['village_polygon']), + # RADAR CHART DATA "village_scores": json.dumps(development_score), "block_average_scores": json.dumps(block_development_score), + # DEMOGRAPHIC DATA "demographic_data": demographic_data, + # BASIC INFRASTRUCTURE DATA - "basic_infra_data": json.dumps(basic_infra_data), + "basic_infra_data" : json.dumps(basic_infra_data), "basic_infra_performance": basic_infra_performance, + # HEALTH AND WASH DATA - "health_wash_data": json.dumps(health_wash_data), - "health_wash_performance": health_wash_performance, - # Education Data - "education_data": json.dumps(education_data), - # Finance Data - "finance_data": json.dumps(finance_data), - # Welfare Inclusion - "welfare_data": json.dumps(welfare_data), - # Community Institutions - "community_data": json.dumps(community_data), - # Livelihood Diversification - "livelihood_data": json.dumps(livelihood_data), - # Livestock Management - "livestock_data": json.dumps(livestock_data), - # Irrigation Data - "irrigation_data": json.dumps(irrigation_data), - # Agri Support Data - "agri_support_data": json.dumps(agri_support_data), - # Climate Data - "climate_resiliance_data": json.dumps(climate_resiliance_data), - "village_polygon": json.dumps(village_data["village_polygon"]), - "basic_infra_map": json.dumps(basic_infra_map), - "health_wash_map": json.dumps(health_wash_map), - "education_map": json.dumps(education_map), - "financial_map": json.dumps(financial_map), - "welfare_map": json.dumps(welfare_map), - "community_map": json.dumps(community_map), - "livestock_map": json.dumps(livestock_map), - "irrigation_infra_map": json.dumps(irrigation_infra_map), - "agri_support_map": json.dumps(agri_support_map), - "climate_resiliance_map": json.dumps(climate_resiliance_map), - "mws_ids": json.dumps(mws_ids), - "pattern_intensity": json.dumps(mws_pattern_intensity["intensity"]), - "mws_active_patterns": json.dumps(mws_pattern_intensity["mws_active_patterns"]), - "pattern_display_mapping": json.dumps( - mws_pattern_intensity["pattern_display_mapping"] - ), - } + "health_wash_data" : json.dumps(health_wash_data), + "health_wash_performance" : health_wash_performance, + + #Education Data + "education_data" : json.dumps(education_data), + + #Finance Data + "finance_data" : json.dumps(finance_data), + + #Welfare Inclusion + "welfare_data" : json.dumps(welfare_data), + + #Community Institutions + "community_data" : json.dumps(community_data), + + #Livelihood Diversification + "livelihood_data" : json.dumps(livelihood_data), + + #Livestock Management + "livestock_data" : json.dumps(livestock_data), + "livestock_count_data" : json.dumps(livestock_count_data), - return render(request, "village-report.html", context) + #Land Cultivation + "land_cultivation_data" : json.dumps(land_cultivation_data), + + #Irrigation Data + "irrigation_data" : json.dumps(irrigation_data), + + #Agri Support Data + "agri_support_data" : json.dumps(agri_support_data), + + #Climate Data + "climate_resiliance_data" : json.dumps(climate_resiliance_data), + + "village_polygon": json.dumps(village_data['village_polygon']), + + "basic_infra_map" : json.dumps(basic_infra_map), + "health_wash_map" : json.dumps(health_wash_map), + "education_map" : json.dumps(education_map), + "financial_map" : json.dumps(financial_map), + "welfare_map" : json.dumps(welfare_map), + "community_map" : json.dumps(community_map), + "livestock_map" : json.dumps(livestock_map), + "land_cultivation_map" : json.dumps(land_cultivation_map), + "irrigation_infra_map" : json.dumps(irrigation_infra_map), + "agri_support_map" : json.dumps(agri_support_map), + "climate_resiliance_map" : json.dumps(climate_resiliance_map), + + "mws_ids" : json.dumps(mws_ids), + "pattern_intensity": json.dumps(mws_pattern_intensity['intensity']), + "mws_active_patterns": json.dumps(mws_pattern_intensity['mws_active_patterns']), + "pattern_display_mapping": json.dumps(mws_pattern_intensity['pattern_display_mapping']), + } + + return render(request, 'village-report.html', context) # --------------------------------------------------------------------------- diff --git a/dpr/gen_village_report.py b/dpr/gen_village_report.py index fafcb67c..6a17ecea 100644 --- a/dpr/gen_village_report.py +++ b/dpr/gen_village_report.py @@ -15,6 +15,35 @@ DATA_DIR_TEMP = EXCEL_DIR +def _build_file_path(state, district, block): + return ( + DATA_DIR_TEMP + + state.upper() + "/" + + district.upper() + "/" + + district.lower() + "_" + block.lower() + ".xlsx" + ) + + +def load_block_sheets(state, district, block): + """Load all Excel sheets for a block once. Returns (df, df_facilities, df_nrega, df_livestock).""" + try: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + df = pd.read_excel(excel_file, sheet_name="antyodaya") + df["village_id"] = df["village_id"].astype(str).str.strip() + df_facilities = pd.read_excel(excel_file, sheet_name="facilities_proximity") + df_facilities["censuscode2011"] = df_facilities["censuscode2011"].astype(str).str.strip() + df_nrega = pd.read_excel(excel_file, sheet_name="nrega_assets_village") + df_nrega["vill_id"] = df_nrega["vill_id"].astype(str).str.strip() + df_livestock = pd.read_excel(excel_file, sheet_name="livestock") + df_livestock["pc11_village_id"] = df_livestock["pc11_village_id"].astype(str).str.strip() + return df, df_facilities, df_nrega, df_livestock + except Exception as e: + logger.error( + "Failed to load block sheets for %s/%s/%s: %s", state, district, block, str(e) + ) + return None, None, None, None + + # ? MARK: HELPER FUNCTIONS def get_geojson(workspace, layer_name): """Construct the GeoServer WFS request URL for fetching GeoJSON data.""" @@ -230,7 +259,7 @@ def get_village_polygon_and_info(state, district, block, village_id): } -def get_development_data(state, district, block, village_id): +def get_development_data(state, district, block, village_id, df=None, df_facilities=None, df_nrega=None): def normalize_column(df, column): df[column] = df[column].astype(str).str.strip() @@ -281,25 +310,13 @@ def get_distance_logic(row, columns, logic="max"): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) + if df is None or df_facilities is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) - df = pd.read_excel(excel_file, sheet_name="antyodaya") - df_facilities = pd.read_excel( - excel_file, - sheet_name="facilities_proximity" - ) + if df is None: + df = pd.read_excel(excel_file, sheet_name="antyodaya") + if df_facilities is None: + df_facilities = pd.read_excel(excel_file, sheet_name="facilities_proximity") normalize_column(df, "village_id") normalize_column(df_facilities, "censuscode2011") @@ -363,8 +380,8 @@ def get_distance_logic(row, columns, logic="max"): essential_distance = get_distance_logic( facility_row, [ - "health_sub_cen_distance", - "health_phc_distance" + "health_sub_cen_distance_in_km", + "health_phc_distance_in_km" ], logic="max" ) @@ -378,9 +395,9 @@ def get_distance_logic(row, columns, logic="max"): advanced_distance = get_distance_logic( facility_row, [ - "health_chc_distance", - "health_dis_h_distance", - "health_s_t_h_distance" + "health_chc_distance_in_km", + "health_dis_h_distance_in_km", + "health_s_t_h_distance_in_km" ], logic="min" ) @@ -408,9 +425,9 @@ def get_distance_logic(row, columns, logic="max"): essential_education_distance = get_distance_logic( facility_row, [ - "school_primary_distance", - "school_upper_primary_distance", - "school_secondary_distance" + "school_primary_distance_in_km", + "school_upper_primary_distance_in_km", + "school_secondary_distance_in_km" ], logic="max" ) @@ -418,9 +435,9 @@ def get_distance_logic(row, columns, logic="max"): higher_education_distance = get_distance_logic( facility_row, [ - "school_higher_secondary_distance", - "college_distance", - "universities_distance" + "school_higher_secondary_distance_in_km", + "college_distance_in_km", + "universities_distance_in_km" ], logic="min" ) @@ -455,10 +472,10 @@ def get_distance_logic(row, columns, logic="max"): financial_distance = get_distance_logic( facility_row, [ - "csc_distance", - "bank_mitra_distance", - "bank_branch_distance", - "bank_atm_distance" + "csc_distance_in_km", + "bank_mitra_distance_in_km", + "bank_branch_distance_in_km", + "bank_atm_distance_in_km" ], logic="max" ) @@ -561,22 +578,22 @@ def get_distance_logic(row, columns, logic="max"): agri_facility_configs = [ { - "column": "agri_industry_agri_support_infrastructure_distance", + "column": "agri_industry_agri_support_infrastructure_distance_in_km", "high_limit": 10, "medium_limit": 50, }, { - "column": "agri_industry_agri_processing_distance", + "column": "agri_industry_agri_processing_distance_in_km", "high_limit": 5, "medium_limit": 20, }, { - "column": "agri_industry_co_operatives_societies_distance", + "column": "agri_industry_co_operatives_societies_distance_in_km", "high_limit": 10, "medium_limit": 30, }, { - "column": "agri_industry_markets_trading_distance", + "column": "agri_industry_markets_trading_distance_in_km", "high_limit": 3, "medium_limit": 10, }, @@ -598,10 +615,11 @@ def get_distance_logic(row, columns, logic="max"): #* Ecology and Climate Resilience organic_farm_score = safe_float(row.get("agriculture_organic_farming_cat_value", 0)) - df_nrega = pd.read_excel( - excel_file, - sheet_name="nrega_assets_village" - ) + if df_nrega is None: + df_nrega = pd.read_excel( + pd.ExcelFile(_build_file_path(state, district, block)), + sheet_name="nrega_assets_village" + ) normalize_column(df_nrega, "vill_id") @@ -663,7 +681,7 @@ def get_distance_logic(row, columns, logic="max"): return [] -def get_block_development_data(state, district, block): +def get_block_development_data(state, district, block, df=None, df_facilities=None, df_nrega=None): def normalize_column(df, column): df[column] = df[column].astype(str).str.strip() @@ -716,30 +734,15 @@ def get_distance_logic(row, columns, logic="max"): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df = pd.read_excel(excel_file, sheet_name="antyodaya") - df_facilities = pd.read_excel( - excel_file, - sheet_name="facilities_proximity" - ) + if df is None or df_facilities is None or df_nrega is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) - df_nrega = pd.read_excel( - excel_file, - sheet_name="nrega_assets_village" - ) + if df is None: + df = pd.read_excel(excel_file, sheet_name="antyodaya") + if df_facilities is None: + df_facilities = pd.read_excel(excel_file, sheet_name="facilities_proximity") + if df_nrega is None: + df_nrega = pd.read_excel(excel_file, sheet_name="nrega_assets_village") normalize_column(df, "village_id") normalize_column(df_facilities, "censuscode2011") @@ -790,8 +793,8 @@ def get_distance_logic(row, columns, logic="max"): essential_distance = get_distance_logic( facility_row, [ - "health_sub_cen_distance", - "health_phc_distance" + "health_sub_cen_distance_in_km", + "health_phc_distance_in_km" ], logic="max" ) @@ -807,9 +810,9 @@ def get_distance_logic(row, columns, logic="max"): advanced_distance = get_distance_logic( facility_row, [ - "health_chc_distance", - "health_dis_h_distance", - "health_s_t_h_distance" + "health_chc_distance_in_km", + "health_dis_h_distance_in_km", + "health_s_t_h_distance_in_km" ], logic="min" ) @@ -844,9 +847,9 @@ def get_distance_logic(row, columns, logic="max"): essential_education_distance = get_distance_logic( facility_row, [ - "school_primary_distance", - "school_upper_primary_distance", - "school_secondary_distance" + "school_primary_distance_in_km", + "school_upper_primary_distance_in_km", + "school_secondary_distance_in_km" ], logic="max" ) @@ -854,9 +857,9 @@ def get_distance_logic(row, columns, logic="max"): higher_education_distance = get_distance_logic( facility_row, [ - "school_higher_secondary_distance", - "college_distance", - "universities_distance" + "school_higher_secondary_distance_in_km", + "college_distance_in_km", + "universities_distance_in_km" ], logic="min" ) @@ -1068,22 +1071,22 @@ def get_distance_logic(row, columns, logic="max"): agri_facility_configs = [ { - "column": "agri_industry_agri_support_infrastructure_distance", + "column": "agri_industry_agri_support_infrastructure_distance_in_km", "high_limit": 10, "medium_limit": 50, }, { - "column": "agri_industry_agri_processing_distance", + "column": "agri_industry_agri_processing_distance_in_km", "high_limit": 5, "medium_limit": 20, }, { - "column": "agri_industry_co_operatives_societies_distance", + "column": "agri_industry_co_operatives_societies_distance_in_km", "high_limit": 10, "medium_limit": 30, }, { - "column": "agri_industry_markets_trading_distance", + "column": "agri_industry_markets_trading_distance_in_km", "high_limit": 3, "medium_limit": 10, }, @@ -1249,7 +1252,7 @@ def safe_float(value, default=0): return [] -def get_health_and_wash(state, district, block, village_id): +def get_health_and_wash(state, district, block, village_id, df=None, df_facilities=None): def safe_float(value, default=0): try: @@ -1276,29 +1279,13 @@ def get_distance_logic(row, columns, logic="max"): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) + if df is None or df_facilities is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) - df_facilities = pd.read_excel( - excel_file, - sheet_name="facilities_proximity" - ) + if df is None: + df = pd.read_excel(excel_file, sheet_name="antyodaya") + if df_facilities is None: + df_facilities = pd.read_excel(excel_file, sheet_name="facilities_proximity") df["village_id"] = ( df["village_id"] @@ -1352,8 +1339,8 @@ def get_distance_logic(row, columns, logic="max"): essential_distance = get_distance_logic( facility_row, [ - "health_sub_cen_distance", - "health_phc_distance" + "health_sub_cen_distance_in_km", + "health_phc_distance_in_km" ], logic="max" ) @@ -1361,9 +1348,9 @@ def get_distance_logic(row, columns, logic="max"): advanced_distance = get_distance_logic( facility_row, [ - "health_chc_distance", - "health_dis_h_distance", - "health_s_t_h_distance" + "health_chc_distance_in_km", + "health_dis_h_distance_in_km", + "health_s_t_h_distance_in_km" ], logic="min" ) @@ -1453,9 +1440,9 @@ def get_distance_logic(row, columns, logic="max"): essential_education_distance = get_distance_logic( facility_row, [ - "school_primary_distance", - "school_upper_primary_distance", - "school_secondary_distance" + "school_primary_distance_in_km", + "school_upper_primary_distance_in_km", + "school_secondary_distance_in_km" ], logic="max" ) @@ -1463,9 +1450,9 @@ def get_distance_logic(row, columns, logic="max"): higher_education_distance = get_distance_logic( facility_row, [ - "school_higher_secondary_distance", - "college_distance", - "universities_distance" + "school_higher_secondary_distance_in_km", + "college_distance_in_km", + "universities_distance_in_km" ], logic="min" ) @@ -1586,10 +1573,10 @@ def get_distance_logic(row, columns, logic="max"): financial_distance = get_distance_logic( facility_row, [ - "csc_distance", - "bank_mitra_distance", - "bank_branch_distance", - "bank_atm_distance" + "csc_distance_in_km", + "bank_mitra_distance_in_km", + "bank_branch_distance_in_km", + "bank_atm_distance_in_km" ], logic="max" ) @@ -1725,7 +1712,7 @@ def get_numeric(row, column): pds_distance = get_numeric( facility_row, - "pds_distance" + "pds_distance_in_km" ) if social_protection_score <= 0.33: @@ -1855,7 +1842,7 @@ def safe_float(value, default=0): return [] -def get_livelihood_diversification(state, district, block, village_id): +def get_livelihood_diversification(state, district, block, village_id, df=None): def safe_float(value, default=0): try: @@ -1865,24 +1852,9 @@ def safe_float(value, default=0): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) + if df is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + df = pd.read_excel(excel_file, sheet_name="antyodaya") df["village_id"] = ( df["village_id"] @@ -2017,7 +1989,7 @@ def get_numeric(row, column): husbandry_distance = get_numeric( facility_row, - "agri_industry_dairy_animal_husbandry_distance" + "agri_industry_dairy_animal_husbandry_distance_in_km" ) veterinary_color = ( @@ -2054,33 +2026,137 @@ def get_numeric(row, column): return [] -def get_land_cultivation(state, district, block, village_id): - +def get_livestock_count(state, district, block, village_id, df_livestock=None): + + def safe_int(value): + try: + if value is None or pd.isna(value): + return None + v = int(float(value)) + return v if v >= 0 else None + except: + return None + + try: + + if df_livestock is None: + + file_path = ( + DATA_DIR_TEMP + + state.upper() + + "/" + + district.upper() + + "/" + + district.lower() + + "_" + + block.lower() + + ".xlsx" + ) + + excel_file = pd.ExcelFile(file_path) + + df_livestock = pd.read_excel( + excel_file, + sheet_name="livestock" + ) + + df_livestock["pc11_village_id"] = ( + df_livestock["pc11_village_id"] + .astype(str) + .str.strip() + ) + + village_id = str(village_id).strip() + + matched_rows = df_livestock[ + df_livestock["pc11_village_id"] == village_id + ] + + if matched_rows.empty: + logger.info( + "No livestock count data found for village_id %s in %s district, %s block", + village_id, + district, + block, + ) + return {} + + row = matched_rows.iloc[0] + + return { + "cattle": { + "male": safe_int(row.get("cattle_male")), + "female": safe_int(row.get("cattle_female")), + "total": safe_int(row.get("cattle_total")), + }, + "buffalo": { + "male": safe_int(row.get("buffalo_male")), + "female": safe_int(row.get("buffalo_female")), + "total": safe_int(row.get("buffalo_total")), + }, + "sheep": { + "male": safe_int(row.get("sheep_male")), + "female": safe_int(row.get("sheep_female")), + "total": safe_int(row.get("sheep_total")), + }, + "goat": { + "male": safe_int(row.get("goat_male")), + "female": safe_int(row.get("goat_female")), + "total": safe_int(row.get("goat_total")), + }, + "pig": { + "male": safe_int(row.get("pig_male")), + "female": safe_int(row.get("pig_female")), + "total": safe_int(row.get("pig_total")), + }, + } + + except Exception as e: + + logger.info( + "Not able to access livestock count data for %s district, %s block. Error: %s", + district, + block, + str(e), + ) + + return {} + + +def get_land_cultivation(state, district, block, village_id, df=None): + def safe_float(value, default=0): try: return float(value) except: return default - + try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) + if df is None: + file_path = ( + DATA_DIR_TEMP + + state.upper() + + "/" + + district.upper() + + "/" + + district.lower() + + "_" + + block.lower() + + ".xlsx" + ) - excel_file = pd.ExcelFile(file_path) + excel_file = pd.ExcelFile(file_path) - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) + df = pd.read_excel( + excel_file, + sheet_name="antyodaya" + ) + + df["village_id"] = ( + df["village_id"] + .astype(str) + .str.strip() + ) village_id = str(village_id).strip() @@ -2097,10 +2173,50 @@ def safe_float(value, default=0): row = matched_rows.iloc[0] - land_utilization_score = safe_float(row.get("agriculture_land_cultivation_cat_value", 0)) + land_utilization_score = safe_float( + row.get("land_utilization_feat_value", 0) + ) + # Seasonal cultivation score: kharif sown / total cultivable, clamped to [0, 1] + kharif_ha = safe_float(row.get("net_sown_area_kharif_in_ha", 0)) + cultivable_ha = safe_float(row.get("total_cultivable_area_in_ha", 0)) + if cultivable_ha > 0: + seasonal_cultivation_score = min(kharif_ha / cultivable_ha, 1.0) + else: + seasonal_cultivation_score = 0.0 + + # Map color from land_utilization_feat_cluster + land_utilization_cluster = str( + row.get("land_utilization_feat_cluster", "Low") + ).strip() + if land_utilization_cluster == "High": + land_utilization_color = "green" + elif land_utilization_cluster == "Medium": + land_utilization_color = "yellow" + else: + land_utilization_color = "red" + + # Seasonal cultivation color (score-based, 3 levels) + if seasonal_cultivation_score <= 0.33: + seasonal_cultivation_color = "red" + elif seasonal_cultivation_score <= 0.66: + seasonal_cultivation_color = "yellow" + else: + seasonal_cultivation_color = "green" + + # Text cluster + cultivation_cluster = str( + row.get("agriculture_land_cultivation_cat_cluster", "Low") + ).strip() + + return [ + round(land_utilization_score, 4), # index 0 + round(seasonal_cultivation_score, 4), # index 1 + land_utilization_color, # index 2 + cultivation_cluster, # index 3 + seasonal_cultivation_color, # index 4 + ] - except Exception as e: logger.info( @@ -2113,6 +2229,64 @@ def safe_float(value, default=0): return [] +def get_all_villages_land_cultivation(state, district, block, df=None): + + try: + + if df is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + df = pd.read_excel(excel_file, sheet_name="antyodaya") + + df["village_id"] = ( + df["village_id"] + .astype(str) + .str.strip() + ) + + village_ids = [ + str(v).strip() + for v in df["village_id"].dropna().unique() + if str(v).strip() not in ("", "0") + ] + + village_data = {} + + for village_id in village_ids: + + cultivation_info = get_land_cultivation( + state, + district, + block, + village_id, + df=df + ) + + if not cultivation_info: + village_data[village_id] = { + "land_utilization_color": "black", + "seasonal_cultivation_color": "black" + } + continue + + village_data[village_id] = { + "land_utilization_color": cultivation_info[2], + "seasonal_cultivation_color": cultivation_info[4] + } + + return village_data + + except Exception as e: + + logger.info( + "Not able to access land cultivation map data for %s district, %s block. Error: %s", + district, + block, + str(e), + ) + + return {} + + def get_irrigation_Infra(state, district, block, village_id, df=None): def safe_float(value, default=0): @@ -2174,35 +2348,16 @@ def safe_float(value, default=0): ) ) - modern_irrigation_score = safe_float( - row.get( - "modern_irrigation_feat_value", - 0 - ) - ) - - # Irrigation Watershed Color - irrigation_watershed_color = ( - "green" - if irrigation_watershed_score > 0.66 - else "red" - ) - - # Modern Irrigation Color - if modern_irrigation_score <= 0.33: - modern_irrigation_color = "red" - - elif modern_irrigation_score <= 0.66: - modern_irrigation_color = "yellow" - + if irrigation_watershed_score <= 0.33: + irrigation_watershed_color = "red" + elif irrigation_watershed_score <= 0.66: + irrigation_watershed_color = "yellow" else: - modern_irrigation_color = "green" + irrigation_watershed_color = "green" return [ irrigation_watershed_score, - modern_irrigation_score, - irrigation_watershed_color, - modern_irrigation_color + irrigation_watershed_color ] except Exception as e: @@ -2335,16 +2490,19 @@ def get_distance_logic(row, columns, logic="max"): post_harvest_distance = None apmc_access_distance = None + agri_support_socities_distance = None + agri_support_infra_distance = None + agri_processing_distance = None if facility_row is not None: post_harvest_distance = get_distance_logic( facility_row, [ - "agri_industry_storage_warehousing_distance", - "agri_industry_distribution_utilities_distance", - "agri_industry_agri_processing_distance", - "agri_industry_industrial_manufacturing_distance" + "agri_industry_storage_warehousing_distance_in_km", + "agri_industry_distribution_utilities_distance_in_km", + "agri_industry_agri_processing_distance_in_km", + "agri_industry_industrial_manufacturing_distance_in_km" ], logic="min" ) @@ -2352,8 +2510,32 @@ def get_distance_logic(row, columns, logic="max"): apmc_access_distance = get_distance_logic( facility_row, [ - "apmc_distance", - "agri_industry_markets_trading_distance" + "apmc_distance_in_km", + "agri_industry_markets_trading_distance_in_km" + ], + logic="min" + ) + + agri_support_socities_distance = get_distance_logic( + facility_row, + [ + "agri_industry_co_operatives_societies_distance_in_km", + ], + logic="min" + ) + + agri_support_infra_distance = get_distance_logic( + facility_row, + [ + "agri_industry_agri_support_infrastructure_distance_in_km", + ], + logic="min" + ) + + agri_processing_distance = get_distance_logic( + facility_row, + [ + "agri_industry_agri_processing_distance_in_km", ], logic="min" ) @@ -2387,7 +2569,16 @@ def get_distance_logic(row, columns, logic="max"): if apmc_access_distance is not None else None, # index 3 agri_support_color, # index 4 - agri_market_color # index 5 + agri_market_color, # index 5 + round(agri_support_socities_distance, 2) + if agri_support_socities_distance is not None + else None, # index 6 + round(agri_support_infra_distance, 2) + if agri_support_infra_distance is not None + else None, # index 7 + round(agri_processing_distance, 2) + if agri_processing_distance is not None + else None, # index 8 ] except Exception as e: @@ -2578,27 +2769,14 @@ def safe_float(value, default=0): #? Get Tehsil Map Data -def get_all_villages_basic_infrastructure(state, district, block): +def get_all_villages_basic_infrastructure(state, district, block, df=None, df_nrega=None): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - # Read once - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) + if df is None or df_nrega is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + if df is None: + df = pd.read_excel(excel_file, sheet_name="antyodaya") + if df_nrega is None: + df_nrega = pd.read_excel(excel_file, sheet_name="nrega_assets_village") df["village_id"] = ( df["village_id"] @@ -2606,11 +2784,6 @@ def get_all_villages_basic_infrastructure(state, district, block): .str.strip() ) - df_nrega = pd.read_excel( - excel_file, - sheet_name="nrega_assets_village" - ) - village_ids = ( df_nrega["vill_id"] .dropna() @@ -2677,7 +2850,7 @@ def get_all_villages_basic_infrastructure(state, district, block): return {} -def get_all_villages_health_and_wash(state, district, block): +def get_all_villages_health_and_wash(state, district, block, df=None): def safe_float(value, default=0): try: @@ -2687,24 +2860,9 @@ def safe_float(value, default=0): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) + if df is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + df = pd.read_excel(excel_file, sheet_name="antyodaya") df["village_id"] = ( df["village_id"] @@ -2796,32 +2954,15 @@ def safe_float(value, default=0): return {} -def get_all_villages_education_institutions( state, district, block): +def get_all_villages_education_institutions(state, district, block, df_facilities=None, df_nrega=None): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df_nrega = pd.read_excel( - excel_file, - sheet_name="nrega_assets_village" - ) - - df_facilities = pd.read_excel( - excel_file, - sheet_name="facilities_proximity" - ) + if df_facilities is None or df_nrega is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + if df_nrega is None: + df_nrega = pd.read_excel(excel_file, sheet_name="nrega_assets_village") + if df_facilities is None: + df_facilities = pd.read_excel(excel_file, sheet_name="facilities_proximity") df_facilities["censuscode2011"] = ( df_facilities["censuscode2011"] @@ -2872,33 +3013,16 @@ def get_all_villages_education_institutions( state, district, block): return {} -def get_all_villages_financial_inclusion(state, district, block): +def get_all_villages_financial_inclusion(state, district, block, df_facilities=None, df_nrega=None): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df_nrega = pd.read_excel( - excel_file, - sheet_name="nrega_assets_village" - ) - - df_facilities = pd.read_excel( - excel_file, - sheet_name="facilities_proximity" - ) + if df_facilities is None or df_nrega is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + if df_nrega is None: + df_nrega = pd.read_excel(excel_file, sheet_name="nrega_assets_village") + if df_facilities is None: + df_facilities = pd.read_excel(excel_file, sheet_name="facilities_proximity") df_facilities["censuscode2011"] = ( df_facilities["censuscode2011"] @@ -2955,28 +3079,18 @@ def get_all_villages_financial_inclusion(state, district, block): return {} -def get_all_villages_welfare_inclusion(state, district, block): +def get_all_villages_welfare_inclusion(state, district, block, df=None, df_facilities=None, df_nrega=None): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) + if df is None or df_facilities is None or df_nrega is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + if df is None: + df = pd.read_excel(excel_file, sheet_name="antyodaya") + if df_facilities is None: + df_facilities = pd.read_excel(excel_file, sheet_name="facilities_proximity") + if df_nrega is None: + df_nrega = pd.read_excel(excel_file, sheet_name="nrega_assets_village") df["village_id"] = ( df["village_id"] @@ -2984,22 +3098,12 @@ def get_all_villages_welfare_inclusion(state, district, block): .str.strip() ) - df_facilities = pd.read_excel( - excel_file, - sheet_name="facilities_proximity" - ) - df_facilities["censuscode2011"] = ( df_facilities["censuscode2011"] .astype(str) .str.strip() ) - df_nrega = pd.read_excel( - excel_file, - sheet_name="nrega_assets_village" - ) - village_ids = [ str(v).strip() for v in df_nrega["vill_id"].dropna().unique() @@ -3043,28 +3147,13 @@ def get_all_villages_welfare_inclusion(state, district, block): return {} -def get_all_villages_community_institutes(state, district, block): +def get_all_villages_community_institutes(state, district, block, df=None): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) + if df is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + df = pd.read_excel(excel_file, sheet_name="antyodaya") df["village_id"] = ( df["village_id"] @@ -3118,33 +3207,16 @@ def get_all_villages_community_institutes(state, district, block): return {} -def get_all_villages_livestock_management(state, district, block): +def get_all_villages_livestock_management(state, district, block, df=None, df_facilities=None): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) - - df_facilities = pd.read_excel( - excel_file, - sheet_name="facilities_proximity" - ) + if df is None or df_facilities is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + if df is None: + df = pd.read_excel(excel_file, sheet_name="antyodaya") + if df_facilities is None: + df_facilities = pd.read_excel(excel_file, sheet_name="facilities_proximity") df["village_id"] = ( df["village_id"] @@ -3199,28 +3271,13 @@ def get_all_villages_livestock_management(state, district, block): return {} -def get_all_villages_irrigation_infra(state, district, block): +def get_all_villages_irrigation_infra(state, district, block, df=None): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) + if df is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + df = pd.read_excel(excel_file, sheet_name="antyodaya") df["village_id"] = ( df["village_id"] @@ -3249,15 +3306,13 @@ def get_all_villages_irrigation_infra(state, district, block): if not irrigation_info: village_data[village_id] = { - "irrigation_watershed_color": "black", - "modern_irrigation_color": "black" + "irrigation_watershed_color": "black" } continue village_data[village_id] = { - "irrigation_watershed_color": irrigation_info[2], - "modern_irrigation_color": irrigation_info[3] + "irrigation_watershed_color": irrigation_info[1] } return village_data @@ -3274,33 +3329,16 @@ def get_all_villages_irrigation_infra(state, district, block): return {} -def get_all_villages_agri_support_service(state, district, block): +def get_all_villages_agri_support_service(state, district, block, df=None, df_facilities=None): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) - - df_facilities = pd.read_excel( - excel_file, - sheet_name="facilities_proximity" - ) + if df is None or df_facilities is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + if df is None: + df = pd.read_excel(excel_file, sheet_name="antyodaya") + if df_facilities is None: + df_facilities = pd.read_excel(excel_file, sheet_name="facilities_proximity") df["village_id"] = ( df["village_id"] @@ -3355,33 +3393,16 @@ def get_all_villages_agri_support_service(state, district, block): return {} -def get_all_villages_ecological_climate_resiliance(state, district, block): +def get_all_villages_ecological_climate_resiliance(state, district, block, df=None, df_nrega=None): try: - file_path = ( - DATA_DIR_TEMP - + state.upper() - + "/" - + district.upper() - + "/" - + district.lower() - + "_" - + block.lower() - + ".xlsx" - ) - - excel_file = pd.ExcelFile(file_path) - - df = pd.read_excel( - excel_file, - sheet_name="antyodaya" - ) - - df_nrega = pd.read_excel( - excel_file, - sheet_name="nrega_assets_village" - ) + if df is None or df_nrega is None: + excel_file = pd.ExcelFile(_build_file_path(state, district, block)) + if df is None: + df = pd.read_excel(excel_file, sheet_name="antyodaya") + if df_nrega is None: + df_nrega = pd.read_excel(excel_file, sheet_name="nrega_assets_village") df["village_id"] = ( df["village_id"] diff --git a/templates/js/vertical_charts_fixes.js b/templates/js/vertical_charts_fixes.js new file mode 100644 index 00000000..a0752eb2 --- /dev/null +++ b/templates/js/vertical_charts_fixes.js @@ -0,0 +1,604 @@ +// ===== VERTICAL BAR CHART FIXES ===== +// Replace the chart initialization code with these updated versions + +// 1. BASIC INFRASTRUCTURE CHART - VERTICAL +function initBasicInfraChart(basicInfraScores, basicInfraLabels) { + const infraCtx = document.getElementById('basicInfraChart'); + if (!infraCtx) return; + + const ctx = infraCtx.getContext('2d'); + new Chart(ctx, { + type: 'bar', + data: { + labels: basicInfraLabels, + datasets: [{ + label: 'Infrastructure Score', + data: basicInfraScores, + backgroundColor: basicInfraScores.map(value => { + if (value <= 0.33) return '#ef4444'; + if (value <= 0.66) return '#eab308'; + return '#22c55e'; + }), + borderColor: basicInfraScores.map(value => { + if (value <= 0.33) return '#dc2626'; + if (value <= 0.66) return '#ca8a04'; + return '#16a34a'; + }), + borderWidth: 1.5, + borderRadius: 4, + minBarLength: 5 + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + layout: {padding: {top: 10, right: 20, bottom: 10, left: 10}}, + plugins: { + legend: {display: false}, + tooltip: { + backgroundColor: 'rgba(62, 39, 35, 0.9)', + titleFont: {family: "'Georgia', 'Garamond', serif", size: 12, weight: 'bold'}, + bodyFont: {family: "'Georgia', 'Garamond', serif", size: 12}, + padding: 12, + displayColors: true, + callbacks: { + label: function(context) { + const value = context.parsed.y.toFixed(2); + let performance = 'Low'; + if (value > 0.33 && value <= 0.66) performance = 'Medium'; + if (value > 0.66) performance = 'High'; + return 'Score: ' + value + ' (' + performance + ')'; + } + } + } + }, + scales: { + y: { + min: 0, + max: 1, + ticks: { + stepSize: 0.25, + font: {family: "'Georgia', 'Garamond', serif", size: 11}, + color: '#6b7280', + callback: function(value) { + if (value === 0) return 'Low'; + if (value === 0.5) return 'Medium'; + if (value === 1) return 'High'; + return ''; + } + }, + grid: {color: 'rgba(0, 0, 0, 0.1)', drawBorder: true, borderColor: '#000000'} + }, + x: { + ticks: { + font: {family: "'Georgia', 'Garamond', serif", size: 11, weight: '500'}, + color: '#3e2723' + }, + grid: {display: false, drawBorder: false} + } + } + } + }); +} + +// 2. COMMUNITY CHART - VERTICAL +function initCommunityChart(communityScores, communityLabels) { + const ctx = document.getElementById('communityChart'); + if (!ctx) return; + + const chartCtx = ctx.getContext('2d'); + new Chart(chartCtx, { + type: 'bar', + data: { + labels: communityLabels, + datasets: [{ + label: 'Community Score', + data: communityScores, + backgroundColor: communityScores.map(value => { + if (value <= 0.33) return '#ef4444'; + if (value <= 0.66) return '#eab308'; + return '#22c55e'; + }), + borderColor: communityScores.map(value => { + if (value <= 0.33) return '#dc2626'; + if (value <= 0.66) return '#ca8a04'; + return '#16a34a'; + }), + borderWidth: 1.5, + borderRadius: 4, + minBarLength: 5 + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: { + legend: {display: false}, + tooltip: { + backgroundColor: 'rgba(62, 39, 35, 0.9)', + titleFont: {family: "'Georgia', 'Garamond', serif", size: 12, weight: 'bold'}, + bodyFont: {family: "'Georgia', 'Garamond', serif", size: 12}, + padding: 12, + displayColors: true, + callbacks: { + label: function(context) { + const value = context.parsed.y.toFixed(2); + let performance = 'Low'; + if (value > 0.33 && value <= 0.66) performance = 'Medium'; + if (value > 0.66) performance = 'High'; + return 'Score: ' + value + ' (' + performance + ')'; + } + } + } + }, + scales: { + y: { + min: 0, + max: 1, + ticks: { + stepSize: 0.25, + font: {family: "'Georgia', 'Garamond', serif", size: 11}, + color: '#6b7280', + callback: function(value) { + if (value === 0) return 'Low'; + if (value === 0.5) return 'Medium'; + if (value === 1) return 'High'; + return ''; + } + }, + grid: {color: 'rgba(0, 0, 0, 0.1)', drawBorder: true, borderColor: '#000000'} + }, + x: { + ticks: { + font: {family: "'Georgia', 'Garamond', serif", size: 11, weight: '500'}, + color: '#3e2723' + }, + grid: {display: false, drawBorder: false} + } + } + } + }); +} + +// 3. LIVELIHOOD CHART - VERTICAL +function initLivelihoodChart(livelihoodScores, livelihoodLabels) { + const ctx = document.getElementById('livelihoodChart'); + if (!ctx) return; + + const chartCtx = ctx.getContext('2d'); + new Chart(chartCtx, { + type: 'bar', + data: { + labels: livelihoodLabels, + datasets: [{ + label: 'Livelihood Score', + data: livelihoodScores, + backgroundColor: livelihoodScores.map((value, index) => { + const isFarm = index === 0; + if (isFarm) { + if (value <= 0.33) return '#ef4444'; + if (value <= 0.66) return '#eab308'; + return '#22c55e'; + } else { + if (value < 0.5) return '#ef4444'; + return '#22c55e'; + } + }), + borderColor: livelihoodScores.map((value, index) => { + const isFarm = index === 0; + if (isFarm) { + if (value <= 0.33) return '#dc2626'; + if (value <= 0.66) return '#ca8a04'; + return '#16a34a'; + } else { + if (value < 0.5) return '#dc2626'; + return '#16a34a'; + } + }), + borderWidth: 1.5, + borderRadius: 4, + minBarLength: 5 + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: { + legend: {display: false}, + tooltip: { + backgroundColor: 'rgba(62, 39, 35, 0.9)', + titleFont: {family: "'Georgia', 'Garamond', serif", size: 12, weight: 'bold'}, + bodyFont: {family: "'Georgia', 'Garamond', serif", size: 12}, + padding: 12, + displayColors: true, + callbacks: { + label: function(context) { + const value = context.parsed.y.toFixed(2); + const isFarm = context.dataIndex === 0; + let performance = 'Low'; + if (isFarm) { + if (value > 0.33 && value <= 0.66) performance = 'Medium'; + if (value > 0.66) performance = 'High'; + } else { + if (value >= 0.5) performance = 'High'; + } + return 'Score: ' + value + ' (' + performance + ')'; + } + } + } + }, + scales: { + y: { + min: 0, + max: 1, + ticks: { + stepSize: 0.25, + font: {family: "'Georgia', 'Garamond', serif", size: 11}, + color: '#6b7280', + callback: function(value) { + if (value === 0) return 'Low'; + if (value === 0.5) return 'High'; + return ''; + } + }, + grid: {color: 'rgba(0, 0, 0, 0.1)', drawBorder: true, borderColor: '#000000'} + }, + x: { + ticks: { + font: {family: "'Georgia', 'Garamond', serif", size: 10, weight: '500'}, + color: '#3e2723' + }, + grid: {display: false, drawBorder: false} + } + } + } + }); +} + +// 4. LIVESTOCK CHART - VERTICAL +function initLivestockChart(livestockScores, livestockLabels) { + const ctx = document.getElementById('livestockChart'); + if (!ctx) return; + + const chartCtx = ctx.getContext('2d'); + new Chart(chartCtx, { + type: 'bar', + data: { + labels: livestockLabels, + datasets: [{ + label: 'Livestock Score', + data: livestockScores, + backgroundColor: livestockScores.map((value, index) => { + const isService = index === 0; + if (isService) { + if (value <= 0.33) return '#ef4444'; + if (value <= 0.66) return '#eab308'; + return '#22c55e'; + } else { + if (value < 0.5) return '#ef4444'; + return '#22c55e'; + } + }), + borderColor: livestockScores.map((value, index) => { + const isService = index === 0; + if (isService) { + if (value <= 0.33) return '#dc2626'; + if (value <= 0.66) return '#ca8a04'; + return '#16a34a'; + } else { + if (value < 0.5) return '#dc2626'; + return '#16a34a'; + } + }), + borderWidth: 1.5, + borderRadius: 4, + minBarLength: 5 + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: { + legend: {display: false}, + tooltip: { + backgroundColor: 'rgba(62, 39, 35, 0.9)', + titleFont: {family: "'Georgia', 'Garamond', serif", size: 12, weight: 'bold'}, + bodyFont: {family: "'Georgia', 'Garamond', serif", size: 12}, + padding: 12, + displayColors: true, + callbacks: { + label: function(context) { + const value = context.parsed.y.toFixed(2); + const isService = context.dataIndex === 0; + let performance = 'Low'; + if (isService) { + if (value > 0.33 && value <= 0.66) performance = 'Medium'; + if (value > 0.66) performance = 'High'; + } else { + if (value >= 0.5) performance = 'High'; + } + return 'Score: ' + value + ' (' + performance + ')'; + } + } + } + }, + scales: { + y: { + min: 0, + max: 1, + ticks: { + stepSize: 0.25, + font: {family: "'Georgia', 'Garamond', serif", size: 11}, + color: '#6b7280', + callback: function(value) { + if (value === 0) return 'Low'; + if (value === 0.5) return 'High'; + return ''; + } + }, + grid: {color: 'rgba(0, 0, 0, 0.1)', drawBorder: true, borderColor: '#000000'} + }, + x: { + ticks: { + font: {family: "'Georgia', 'Garamond', serif", size: 11, weight: '500'}, + color: '#3e2723' + }, + grid: {display: false, drawBorder: false} + } + } + } + }); +} + +// 5. IRRIGATION CHART - VERTICAL +// 5a. LAND CULTIVATION CHART - VERTICAL +function initLandCultivationChart(scores, labels) { + const ctx = document.getElementById('landCultivationChart'); + if (!ctx) return; + + const chartCtx = ctx.getContext('2d'); + new Chart(chartCtx, { + type: 'bar', + data: { + labels: labels, + datasets: [{ + label: 'Score', + data: scores, + backgroundColor: scores.map((value) => { + if (value <= 0.33) return '#ef4444'; + if (value <= 0.66) return '#eab308'; + return '#22c55e'; + }), + borderColor: scores.map((value) => { + if (value <= 0.33) return '#dc2626'; + if (value <= 0.66) return '#ca8a04'; + return '#16a34a'; + }), + borderWidth: 1.5, + borderRadius: 4, + minBarLength: 5 + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: { + legend: {display: false}, + tooltip: { + backgroundColor: 'rgba(62, 39, 35, 0.9)', + titleFont: {family: "'Georgia', 'Garamond', serif", size: 12, weight: 'bold'}, + bodyFont: {family: "'Georgia', 'Garamond', serif", size: 12}, + padding: 12, + displayColors: true, + callbacks: { + label: function(context) { + const value = context.parsed.y.toFixed(2); + let performance = 'Low'; + if (value > 0.66) performance = 'High'; + else if (value > 0.33) performance = 'Medium'; + return 'Score: ' + value + ' (' + performance + ')'; + } + } + } + }, + scales: { + y: { + min: 0, + max: 1, + ticks: { + stepSize: 0.33, + font: {family: "'Georgia', 'Garamond', serif", size: 11}, + color: '#6b7280', + callback: function(value) { + if (value === 0) return 'Low'; + if (value === 0.33) return 'Medium'; + if (value === 0.66) return 'High'; + return ''; + } + }, + grid: {color: 'rgba(0, 0, 0, 0.1)', drawBorder: true, borderColor: '#000000'} + }, + x: { + ticks: { + font: {family: "'Georgia', 'Garamond', serif", size: 11, weight: '500'}, + color: '#3e2723' + }, + grid: {display: false, drawBorder: false} + } + } + } + }); +} + +function initIrrigationChart(irrigationScores, irrigationLabels) { + const ctx = document.getElementById('irrigationChart'); + if (!ctx) return; + + const chartCtx = ctx.getContext('2d'); + new Chart(chartCtx, { + type: 'bar', + data: { + labels: irrigationLabels, + datasets: [{ + label: 'Irrigation Score', + data: irrigationScores, + backgroundColor: irrigationScores.map((value) => { + if (value <= 0.33) return '#ef4444'; + if (value <= 0.66) return '#eab308'; + return '#22c55e'; + }), + borderColor: irrigationScores.map((value) => { + if (value <= 0.33) return '#dc2626'; + if (value <= 0.66) return '#ca8a04'; + return '#16a34a'; + }), + borderWidth: 1.5, + borderRadius: 4, + minBarLength: 5 + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: { + legend: {display: false}, + tooltip: { + backgroundColor: 'rgba(62, 39, 35, 0.9)', + titleFont: {family: "'Georgia', 'Garamond', serif", size: 12, weight: 'bold'}, + bodyFont: {family: "'Georgia', 'Garamond', serif", size: 12}, + padding: 12, + displayColors: true, + callbacks: { + label: function(context) { + const value = context.parsed.y.toFixed(2); + let performance = 'Low'; + if (value > 0.66) performance = 'High'; + else if (value > 0.33) performance = 'Medium'; + return 'Score: ' + value + ' (' + performance + ')'; + } + } + } + }, + scales: { + y: { + min: 0, + max: 1, + ticks: { + stepSize: 0.33, + font: {family: "'Georgia', 'Garamond', serif", size: 11}, + color: '#6b7280', + callback: function(value) { + if (value === 0) return 'Low'; + if (value === 0.33) return 'Medium'; + if (value === 0.66) return 'High'; + return ''; + } + }, + grid: {color: 'rgba(0, 0, 0, 0.1)', drawBorder: true, borderColor: '#000000'} + }, + x: { + ticks: { + font: {family: "'Georgia', 'Garamond', serif", size: 11, weight: '500'}, + color: '#3e2723' + }, + grid: {display: false, drawBorder: false} + } + } + } + }); +} + +// 6. AGRICULTURAL SUPPORT CHART - VERTICAL +function initAgriSupportChart(agriScores, agriSupportLabels) { + const ctx = document.getElementById('agriSupportChart'); + if (!ctx) return; + + const chartCtx = ctx.getContext('2d'); + new Chart(chartCtx, { + type: 'bar', + data: { + labels: agriSupportLabels, + datasets: [{ + label: 'Agricultural Support Score', + data: agriScores, + backgroundColor: agriScores.map((value, index) => { + const isSupport = index === 0; + if (isSupport) { + if (value <= 0.33) return '#ef4444'; + if (value <= 0.66) return '#eab308'; + return '#22c55e'; + } else { + if (value < 0.5) return '#ef4444'; + return '#22c55e'; + } + }), + borderColor: agriScores.map((value, index) => { + const isSupport = index === 0; + if (isSupport) { + if (value <= 0.33) return '#dc2626'; + if (value <= 0.66) return '#ca8a04'; + return '#16a34a'; + } else { + if (value < 0.5) return '#dc2626'; + return '#16a34a'; + } + }), + borderWidth: 1.5, + borderRadius: 4, + minBarLength: 5 + }] + }, + options: { + responsive: true, + maintainAspectRatio: false, + plugins: { + legend: {display: false}, + tooltip: { + backgroundColor: 'rgba(62, 39, 35, 0.9)', + titleFont: {family: "'Georgia', 'Garamond', serif", size: 12, weight: 'bold'}, + bodyFont: {family: "'Georgia', 'Garamond', serif", size: 12}, + padding: 12, + displayColors: true, + callbacks: { + label: function(context) { + const value = context.parsed.y.toFixed(2); + const isSupport = context.dataIndex === 0; + let performance = 'Low'; + if (isSupport) { + if (value > 0.33 && value <= 0.66) performance = 'Medium'; + if (value > 0.66) performance = 'High'; + } else { + if (value >= 0.5) performance = 'High'; + } + return 'Score: ' + value + ' (' + performance + ')'; + } + } + } + }, + scales: { + y: { + min: 0, + max: 1, + ticks: { + stepSize: 0.25, + font: {family: "'Georgia', 'Garamond', serif", size: 11}, + color: '#6b7280', + callback: function(value) { + if (value === 0) return 'Low'; + if (value === 0.5) return 'High'; + return ''; + } + }, + grid: {color: 'rgba(0, 0, 0, 0.1)', drawBorder: true, borderColor: '#000000'} + }, + x: { + ticks: { + font: {family: "'Georgia', 'Garamond', serif", size: 11, weight: '500'}, + color: '#3e2723' + }, + grid: {display: false, drawBorder: false} + } + } + } + }); +} \ No newline at end of file diff --git a/templates/resource-report.html b/templates/resource-report.html index 09bb53e4..53f36660 100644 --- a/templates/resource-report.html +++ b/templates/resource-report.html @@ -1,1175 +1,1273 @@ - - - - - - - Resource Mapping Report - - - - - - - - - - - - - - - - - - - - -
-
-

Resource and Demand Map Report

-
-
Plan Name: {{plan_name}}
-
Plan ID: {{plan_id}}
-
- -
-
- -
- -
-

Village Overview over LULC

-
-
-
-
-
- Barren Lands -
-
-
- Single Kharif -
-
-
- Single Non-Kharif -
-
-
- Double Cropping -
-
-
- Tripple/Annual/Perennial Cropping -
-
-
- Shrubs and Scrubs -
-
-
- -
- -
-

Settlement Overview for Plan : {{plan_name}}

-
-
- -
- -
- -
-

Well Overview for Plan : {{plan_name}}

-
-
-

Note: Well Distribution on Stream Order Raster

-
-
-
- 1 -
-
-
- 2 -
-
-
- 3 -
-
-
- 4 -
-
-
- 5 -
-
-
- 6 -
-
-
- 7 -
-
-
- 8 -
-
-
- 9 -
-
-
- 10 -
-
-
- 11 -
-
-
- -
- -
-

Water Structures Overview for Plan : {{plan_name}}

-
-
-
-
-
- Good recharge -
-
-
- Moderate recharge -
-
-
- Regeneration -
-
-
- High runoff zone -
-
-
- Surface water harvesting -
-
-
- -
- -
-

Demands Overview for Plan : {{plan_name}}

-
-
-
-
-
- V-shape river valleys, Deep narrow canyons -
-
-
- Lateral midslope incised drainages, Local valleys in plains -
-
-
- Upland incised drainages, Stream headwaters -
-
-
- U-shape valleys -
-
-
- Broad Flat Areas -
-
-
- Broad open slopes -
-
-
- Mesa tops -
-
-
- Upper Slopes -
-
-
- Local ridge/hilltops within broad valleys -
-
-
- Lateral midslope drainage divides, Local ridges in plains -
-
-
- Mountain tops, high ridges -
-
-
- - - - - - - + + + + + + + Resource Mapping Report + + + + + + + + + + + + + + + + + + + + +
+
+

Resource and Demand Map Report

+
+
Plan Name: {{plan_name}}
+
Plan ID: {{plan_id}}
+
+ +
+
+ +
+ +
+

Village Overview over LULC

+
+
+
+
+
+ Barren Lands +
+
+
+ Single Kharif +
+
+
+ Single Non-Kharif +
+
+
+ Double Cropping +
+
+
+ Tripple/Annual/Perennial Cropping +
+
+
+ Shrubs and Scrubs +
+
+
+ +
+ +
+

Settlement Overview for Plan : {{plan_name}}

+
+
+ +
+ +
+ +
+

Well Overview for Plan : {{plan_name}}

+ +
+
+

Note: Well Distribution on Stream Order Raster

+
+
+
+ 1 +
+
+
+ 2 +
+
+
+ 3 +
+
+
+ 4 +
+
+
+ 5 +
+
+
+ 6 +
+
+
+ 7 +
+
+
+ 8 +
+
+
+ 9 +
+
+
+ 10 +
+
+
+ 11 +
+
+
+ +
+ +
+

Water Structures Overview for Plan : {{plan_name}}

+
+
+
+
+
+ Good recharge +
+
+
+ Moderate recharge +
+
+
+ Regeneration +
+
+
+ High runoff zone +
+
+
+ Surface water harvesting +
+
+
+ +
+ +
+

Demands Overview for Plan : {{plan_name}}

+
+
+
+
+
+ Irrigation Demand +
+
+
+ Groundwater Recharge +
+
+
+
+
+ V-shape river valleys, Deep narrow canyons +
+
+
+ Lateral midslope incised drainages, Local valleys in plains +
+
+
+ Upland incised drainages, Stream headwaters +
+
+
+ U-shape valleys +
+
+
+ Broad Flat Areas +
+
+
+ Broad open slopes +
+
+
+ Mesa tops +
+
+
+ Upper Slopes +
+
+
+ Local ridge/hilltops within broad valleys +
+
+
+ Lateral midslope drainage divides, Local ridges in plains +
+
+
+ Mountain tops, high ridges +
+
+
+ +
+ +
+

Livelihood Demand Overview for Plan : {{plan_name}}

+
+
+ +
+ + + + + + + \ No newline at end of file diff --git a/templates/village-report.html b/templates/village-report.html index 71067171..09578286 100644 --- a/templates/village-report.html +++ b/templates/village-report.html @@ -335,15 +335,7 @@

Literate Population - {{ demographic_data.P_LIT }} ({{ demographic_data.literacy_percentage }}%) - - - Male - {{ demographic_data.M_LIT }} - - - Female - {{ demographic_data.F_LIT }} + {{ demographic_data.literacy_percentage }} {% if demographic_data.ADI_2011 >= 6 and demographic_data.ADI_2011 <= 18 %} @@ -389,20 +381,13 @@

-
-
+
+
- -
-

Road Connectivity

-

The road connectivity indicator takes into account the availability of all weather roads, internal pucca roads, public transport system and access to railway stations.

-
-

Road Connectivity

@@ -410,9 +395,9 @@

Road {% if basic_infra_performance.0 == 'Low' %}

This village has issues with road connectivity such as potential absence of an all-weather road, pucca roads, and lack of public transport. The village likely faces significant mobility constraints affecting service delivery, employment access, and market participation.

{% elif basic_infra_performance.0 == 'High' %} -

This village has good public transport infrastructure such as availability of all-weather roads, internal pucca road networks, and railway connectivity.

+

This village has good public transport infrastructure such as availability of all-weather roads, and internal pucca road networks.

{% else %} -

This village has moderate road connectivity with some all-weather roads and basic public transport access, though there may be room for improvement in last-mile connectivity.

+

This village may have an external road connection but weaker internal roads, or they may have some transport availability but uneven road quality.

{% endif %}

@@ -421,11 +406,11 @@

Road

Electricity Supply

{% if basic_infra_performance.1 == 'Low' %} -

The village has poor access to electricity such as lower levels of electrification, limited energy supply for enterprises, and minimal usage of clean cooking fuel.

+

The village has poor access to electricity and clean energy such as lower levels of electrification, limited energy supply for enterprises, and minimal usage of clean cooking fuel.

{% elif basic_infra_performance.1 == 'High' %}

This village likely has good electrification, access to energy for enterprises, and high adoption of clean cooking solutions.

{% else %} -

This village has moderate electricity access and moderate adoption of clean energy, with opportunities for further expansion of electrification and clean cooking fuel adoption.

+

This village may have moderate domestic electricity but incomplete clean fuel coverage or limited productive electricity.

{% endif %}
@@ -434,7 +419,7 @@

Elect

Housing Quality

{% if basic_infra_performance.2 == 'Low' %} -

Many housing demands under PMAY seem to be unmet in this village along with limited coverage under PMAY and Ujjwala schemes.

+

Many housing demands under PMAY seem to be unmet in this village along with limited coverage under PMAY and Ujjwala schemes. As a result, there is a possibility that many households are living in kutcha houses.

{% elif basic_infra_performance.2 == 'Medium' %}

This village exhibits moderate housing permanence and scheme coverage. While pucca housing rates seem to be decent, gaps remain in PMAY saturation and clean cooking fuel adoption.

{% elif basic_infra_performance.2 == 'High' %} @@ -469,28 +454,16 @@

- -
-

Maternal and Child Health

-

Captures Anganwadi coverage, maternity service utilization, institutional deliveries, child registration and immunization coverage.

-

- Green: High | - Yellow: Moderate | - Red: Low -

-
-

Maternal and Child Health

{% if health_wash_performance.0 == 'Low' %} -

There are concerns with access to maternal and child health services, including weak Anganwadi coverage, low service utilization for pregnant and lactating mothers, and poor health outcomes like anemia and low birth weight. The village may be prioritized for strengthening ICDS services, Anganwadi functionality, nutrition programs, and maternal care outreach.

+

There are concerns with access to maternal and child health services, including weak Anganwadi coverage, low service utilization for pregnant and lactating mothers, and poor health outcomes like anemia and low birth weight.

{% elif health_wash_performance.0 == 'High' %}

This village likely has adequate Anganwadi availability, good coverage of maternity services, high institutional deliveries, high rates of child registration and enrollment, and effective immunization coverage.

{% else %} -

This village shows moderate maternal and child health service coverage. While some infrastructure exists, there is room for improvement in Anganwadi services, maternal care, and immunization programs.

+

This village likely has functioning maternal-child systems in terms of moderate service utilization for pregnant and lactating mothers and Anganwadi coverage. However, outcome translation in terms of newborn health and sustained utilization of health schemes might be weak in this village.

{% endif %}

Healthcare Infrastructure Access: Primary health centers / sub-centers in this village are accessible within -- kms. Community health centers, district hospitals and tertiary hospitals are accessible at a distance of -- kms and beyond. @@ -503,9 +476,9 @@

Mater

Water and Sanitation

{% if health_wash_performance.1 == 'Low' %} -

The village has weak infrastructure for piped water and sanitation facilities. Drainage and waste management systems might need strengthening.

+

The village has weak infrastructure for piped water and sanitation facilities. Drainage and waste management systems should be investigated.

{% elif health_wash_performance.1 == 'Medium' %} -

This village shows moderate piped water access and sanitation coverage. The drainage and waste management infrastructure should be checked for quality and accordingly prioritized for improvement.

+

This village shows moderate piped water access and sanitation coverage.

{% elif health_wash_performance.1 == 'High' %}

This village has good access to piped water, sanitation facilities, covered drainage systems and better adoption of waste recycling or biogas facilities, indicating advanced WASH outcomes.

{% endif %} @@ -523,7 +496,7 @@

-

This village has primary education institutions covered within the reach of -- kms. Higher educational institutions, including access to higher secondary schools, colleges, and universities are accessible at a distance of -- kms and beyond.

+

This village has primary education institutions covered within the reach of -- kms. Primary education comprises access to primary, upper primary, and secondary education. Higher educational institutions, including access to higher secondary schools, colleges, and universities are accessible at a distance of -- kms and beyond.

@@ -559,18 +532,6 @@

- - -
-

Financial Inclusion - Access Quality:

-

- Financial inclusion indicates presence of a bank branch, presence of ATM services, availability of business correspondent services, proportion of SHGs accessing bank loans, minority households receiving bank credit, proportion of households with PMJDY accounts. -

-

- Green: Strong access to financial services (High financial inclusion)
- Red: Limited access to formal banking services (Low financial inclusion) -

-

@@ -591,19 +552,6 @@

- - -
-

Social Protection - Scheme Coverage Quality:

-

- Social protection accounts for BPL, NFSA, and pension coverage along with PDS utilization. -

-

- Green: Good coverage of welfare schemes (High social protection)
- Yellow: Moderate coverage with scope for improvement (Medium social protection)
- Red: Weak coverage of welfare schemes (Low social protection) -

-

@@ -633,25 +581,13 @@

-
-
+
+
- -
-

Institutionalization Strength

-

Captured in terms of the proportion of households mobilized into Self-Help Groups, the share of SHGs federated into Village Organizations, household participation in producer groups, presence of a Farmer Producer Organization.

-

- Green: High | - Yellow: Moderate | - Red: Low -

-
-

SHG and FPO led Federation Networks

@@ -676,23 +612,6 @@

- -
-
-
- High -
-
-
- Medium -
-
-
- Low -
-
- @@ -762,24 +681,13 @@

-
-
+
+
- -
-

Livestock Service Quality

-

Availability of veterinary services, livestock development projects, and milk collection routes.

-

- Green: High | - Red: Low -

-
-

Livestock Management Service Quality

@@ -790,58 +698,86 @@

Commo

+ +
-

Note: Indicators describing the common pasture access of this village are taken from publicly available data from Mission Antyodaya, 2020. Indicator on distance from dairy processing and animal husbandry centers is fetched from the Pradhan Mantri Gram Sadak Yojana (PMGSY) project, released publicly in 2023.

+

Note: Indicators describing the common pasture access of this village are taken from publicly available data from Mission Antyodaya, 2020. Indicator on distance from dairy processing and animal husbandry centers is fetched from the Pradhan Mantri Gram Sadak Yojana (PMGSY) project, released publicly in 2023. The livestock count for the village is derived from the 20th Livestock Census held in 2019.

- -
-

Irrigation Infrastructure and Farming Techniques

+ +
+

Agricultural Land Cultivation Patterns

- -
-
+
-
-
- +
+
+
- -
-

Irrigation Watershed Access

-

Presence of irrigation canals, rainwater harvesting structures, and watershed projects supporting water management.

-

- Green: Good | - Red: Poor -

+
+

Agricultural Land Cultivation Patterns

+
-
-

Irrigation Watershed Access

-
+
+

Note: Source of these indicators is the publicly available data from Mission Antyodaya, 2020.

+
+
+ + +
+

Irrigation Infrastructure and Farming Techniques

+ + +
+
+
+
+
+
+ +
+
-

Modern Irrigation Adoption

-
+

Irrigation Watershed Access

+
@@ -870,25 +806,13 @@

-
-
+
+
- -
-

Agricultural Support Services

-

Agricultural support services are assessed in terms of proportion of farmers registered under farmer pension schemes, coverage of pension support for young farmers, and proportion of farmers who have undertaken soil testing.

-

- Green: High | - Yellow: Moderate | - Red: Low -

-
-

Agricultural Support Services

@@ -921,13 +845,6 @@

Natural
-
-

MGNREGA Work Uptake:

-

- Green: Good uptake (>100 assets)
- Red: Poor uptake (≤100 assets) -

-
@@ -984,14 +901,6 @@

Organic
-
-

Organic Farming Adoption:

-

- Green: High adoption - Yellow: Moderate adoption - Red: Low adoption -

-
@@ -1004,13 +913,6 @@

Organic

- {% comment %}
-

Climate Vulnerability

- -
- -
{% endcomment %} -
@@ -1020,6 +922,8 @@

+ +