Builder-Neekhil commited on
Commit
ad8b7e7
Β·
verified Β·
1 Parent(s): 761a114

Upload 5 files

Browse files
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ model_clean_inference.cbm filter=lfs diff=lfs merge=lfs -text
feature_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"female population age 6 years and above who ever attended school": "Female_population_age_6_years_and_above_who_ever_attended_school", "population below age 15 years": "Population_below_age_15_years", "sex ratio of the total population females per 1 000 males": "Sex_ratio_of_the_total_population_females_per_1_000_males", "sex ratio at birth for children born in the last five years females per 1 000 males": "Sex_ratio_at_birth_for_children_born_in_the_last_five_years_females_per_1_000_males", "children under age 5 years whose birth was registered with the civil authority": "Children_under_age_5_years_whose_birth_was_registered_with_the_civil_authority", "deaths in the last 3 years registered with the civil authority": "Deaths_in_the_last_3_years_registered_with_the_civil_authority", "population living in households with electricity": "Population_living_in_households_with_electricity", "population living in households with an improved drinking water source1": "Population_living_in_households_with_an_improved_drinking_water_source1", "population living in households that use an improved sanitation facility2": "Population_living_in_households_that_use_an_improved_sanitation_facility2", "households using clean fuel for cooking3": "Households_using_clean_fuel_for_cooking3", "households using iodized salt": "Households_using_iodized_salt", "households with any usual member covered under a health insurance financing scheme": "Households_with_any_usual_member_covered_under_a_health_insurance_financing_scheme", "children age 5 years who attended pre primary school during the school year 2019 20": "Children_age_5_years_who_attended_pre_primary_school_during_the_school_year_2019_20", "women who are literate4": "Women_who_are_literate4", "women with 10 or more years of schooling": "Women_with_10_or_more_years_of_schooling", "women age 20 24 years married before age 18 years": "Women_age_20_24_years_married_before_age_18_years", "births in the 5 years preceding the survey that are third or higher order": "Births_in_the_5_years_preceding_the_survey_that_are_third_or_higher_order", "women age 15 19 years who were already mothers or pregnant at the time of the survey": "Women_age_15_19_years_who_were_already_mothers_or_pregnant_at_the_time_of_the_survey", "women age 15 24 years who use hygienic methods of protection during their menstrual period5": "Women_age_15_24_years_who_use_hygienic_methods_of_protection_during_their_menstrual_period5", "any method6": "Any_method6", "any modern method6": "Any_modern_method6", "female sterilization": "Female_sterilization", "male sterilization": "Male_sterilization", "iud ppiud": "IUD_PPIUD", "injectables": "Injectables", "total unmet need7": "Total_unmet_need7", "unmet need for spacing7": "Unmet_need_for_spacing7", "health worker ever talked to female non users about family planning": "Health_worker_ever_talked_to_female_non_users_about_family_planning", "current users ever told about side effects of current method8": "Current_users_ever_told_about_side_effects_of_current_method8", "mothers who had an antenatal check up in the first trimester": "Mothers_who_had_an_antenatal_check_up_in_the_first_trimester", "mothers who had at least 4 antenatal care visits": "Mothers_who_had_at_least_4_antenatal_care_visits", "mothers whose last birth was protected against neonatal tetanus9": "Mothers_whose_last_birth_was_protected_against_neonatal_tetanus9", "mothers who consumed iron folic acid for 100 days or more when they were pregnant": "Mothers_who_consumed_iron_folic_acid_for_100_days_or_more_when_they_were_pregnant", "mothers who consumed iron folic acid for 180 days or more when they were pregnant": "Mothers_who_consumed_iron_folic_acid_for_180_days_or_more_when_they_were_pregnant", "registered pregnancies for which the mother received a mother and child protection mcp card": "Registered_pregnancies_for_which_the_mother_received_a_Mother_and_Child_Protection_MCP_card", "mothers who received postnatal care from a doctor nurse lhv anm midwife other health personnel within 2 days of delivery": "Mothers_who_received_postnatal_care_from_a_doctor_nurse_LHV_ANM_midwife_other_health_personnel_within_2_days_of_delivery", "average out of pocket expenditure per delivery in a public health facility rs": "Average_out_of_pocket_expenditure_per_delivery_in_a_public_health_facility_Rs", "children who received postnatal care from a doctor nurse lhv anm midwife other health personnel within 2 days of delivery": "Children_who_received_postnatal_care_from_a_doctor_nurse_LHV_ANM_midwife_other_health_personnel_within_2_days_of_delivery", "institutional births": "Institutional_births", "institutional births in public facility": "Institutional_births_in_public_facility", "home births that were conducted by skilled health personnel10": "Home_births_that_were_conducted_by_skilled_health_personnel10", "births attended by skilled health personnel10": "Births_attended_by_skilled_health_personnel10", "children age 12 23 months fully vaccinated based on information from either vaccination card or mother s recall11": "Children_age_12_23_months_fully_vaccinated_based_on_information_from_either_vaccination_card_or_mother_s_recall11", "children age 12 23 months fully vaccinated based on information from vaccination card only12": "Children_age_12_23_months_fully_vaccinated_based_on_information_from_vaccination_card_only12", "children age 12 23 months who have received bcg": "Children_age_12_23_months_who_have_received_BCG", "children age 12 23 months who have received 3 doses of polio vaccine13": "Children_age_12_23_months_who_have_received_3_doses_of_polio_vaccine13", "children age 12 23 months who have received 3 doses of penta or dpt vaccine": "Children_age_12_23_months_who_have_received_3_doses_of_penta_or_DPT_vaccine", "children age 12 23 months who have received the first dose of measles containing vaccine mcv": "Children_age_12_23_months_who_have_received_the_first_dose_of_measles_containing_vaccine_MCV", "children age 24 35 months who have received a second dose of measles containing vaccine mcv": "Children_age_24_35_months_who_have_received_a_second_dose_of_measles_containing_vaccine_MCV", "children age 12 23 months who have received 3 doses of rotavirus vaccine14": "Children_age_12_23_months_who_have_received_3_doses_of_rotavirus_vaccine14", "children age 12 23 months who have received 3 doses of penta or hepatitis b vaccine": "Children_age_12_23_months_who_have_received_3_doses_of_penta_or_hepatitis_B_vaccine", "children age 9 35 months who received a vitamin a dose in the last 6 months": "Children_age_9_35_months_who_received_a_vitamin_A_dose_in_the_last_6_months", "children age 12 23 months who received most of their vaccinations in a public health facility": "Children_age_12_23_months_who_received_most_of_their_vaccinations_in_a_public_health_facility", "children age 12 23 months who received most of their vaccinations in a private health facility": "Children_age_12_23_months_who_received_most_of_their_vaccinations_in_a_private_health_facility", "prevalence of diarrhoea in the 2 weeks preceding the survey": "Prevalence_of_diarrhoea_in_the_2_weeks_preceding_the_survey", "prevalence of symptoms of acute respiratory infection ari in the 2 weeks preceding the survey": "Prevalence_of_symptoms_of_acute_respiratory_infection_ARI_in_the_2_weeks_preceding_the_survey", "children with fever or symptoms of ari in the 2 weeks preceding the survey taken to a health facility or health provider": "Children_with_fever_or_symptoms_of_ARI_in_the_2_weeks_preceding_the_survey_taken_to_a_health_facility_or_health_provider", "children under age 3 years breastfed within one hour of birth15": "Children_under_age_3_years_breastfed_within_one_hour_of_birth15", "children under age 6 months exclusively breastfed16": "Children_under_age_6_months_exclusively_breastfed16", "children under 5 years who are stunted height for age 18": "Children_under_5_years_who_are_stunted_height_for_age_18", "children under 5 years who are wasted weight for height 18": "Children_under_5_years_who_are_wasted_weight_for_height_18", "children under 5 years who are severely wasted weight for height 19": "Children_under_5_years_who_are_severely_wasted_weight_for_height_19", "children under 5 years who are underweight weight for age 18": "Children_under_5_years_who_are_underweight_weight_for_age_18", "children under 5 years who are overweight weight for height 20": "Children_under_5_years_who_are_overweight_weight_for_height_20", "women whose body mass index bmi is below normal bmi 18 5 kg m2 21": "Women_whose_Body_Mass_Index_BMI_is_below_normal_BMI_18_5_kg_m2_21", "women who are overweight or obese bmi 25 0 kg m2 21": "Women_who_are_overweight_or_obese_BMI_25_0_kg_m2_21", "women who have high risk waist to hip ratio 0 85": "Women_who_have_high_risk_waist_to_hip_ratio_0_85", "children age 6 59 months who are anaemic 11 0 g dl 22": "Children_age_6_59_months_who_are_anaemic_11_0_g_dl_22", "non pregnant women age 15 49 years who are anaemic 12 0 g dl 22": "Non_pregnant_women_age_15_49_years_who_are_anaemic_12_0_g_dl_22", "pregnant women age 15 49 years who are anaemic 11 0 g dl 22": "Pregnant_women_age_15_49_years_who_are_anaemic_11_0_g_dl_22", "all women age 15 49 years who are anaemic22": "All_women_age_15_49_years_who_are_anaemic22", "all women age 15 19 years who are anaemic22": "All_women_age_15_19_years_who_are_anaemic22", "mildly elevated blood pressure systolic 140 159 mm of hg and or diastolic 90 99 mm of hg": "Mildly_elevated_blood_pressure_Systolic_140_159_mm_of_Hg_and_or_Diastolic_90_99_mm_of_Hg", "elevated blood pressure systolic 140 mm of hg and or diastolic 90 mm of hg or taking medicine to control blood pressure": "Elevated_blood_pressure_Systolic_140_mm_of_Hg_and_or_Diastolic_90_mm_of_Hg_or_taking_medicine_to_control_blood_pressure", "ever undergone a breast examination for breast cancer": "Ever_undergone_a_breast_examination_for_breast_cancer", "ever undergone an oral cavity examination for oral cancer": "Ever_undergone_an_oral_cavity_examination_for_oral_cancer", "women age 15 years and above who use any kind of tobacco": "Women_age_15_years_and_above_who_use_any_kind_of_tobacco", "men age 15 years and above who use any kind of tobacco": "Men_age_15_years_and_above_who_use_any_kind_of_tobacco", "women age 15 years and above who consume alcohol": "Women_age_15_years_and_above_who_consume_alcohol", "men age 15 years and above who consume alcohol": "Men_age_15_years_and_above_who_consume_alcohol", "obesity rate": "Women_who_are_overweight_or_obese_BMI_25_0_kg_m2_21", "overweight": "Women_who_are_overweight_or_obese_BMI_25_0_kg_m2_21", "bmi": "Women_who_are_overweight_or_obese_BMI_25_0_kg_m2_21", "tobacco": "Men_age_15_years_and_above_who_use_any_kind_of_tobacco", "smoking": "Men_age_15_years_and_above_who_use_any_kind_of_tobacco", "education": "Female_population_age_6_years_and_above_who_ever_attended_school", "literacy": "Female_population_age_6_years_and_above_who_ever_attended_school", "insurance": "Households_with_any_usual_member_covered_under_a_health_insurance_financing_scheme", "health insurance": "Households_with_any_usual_member_covered_under_a_health_insurance_financing_scheme", "anaemia": "All_women_age_15_49_years_who_are_anaemic_22", "anemia": "All_women_age_15_49_years_who_are_anaemic_22", "sanitation": "Population_living_in_households_that_use_an_improved_sanitation_facility2", "teen pregnancy": "Women_age_15_19_years_who_were_already_mothers_or_pregnant_at_the_time_of_the_survey", "children overweight": "Children_under_5_years_who_are_overweight_weight_for_height_20"}
feature_medians.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"Female_population_age_6_years_and_above_who_ever_attended_school": 71.6, "Population_below_age_15_years": 25.3, "Sex_ratio_of_the_total_population_females_per_1_000_males": 1012.0, "Sex_ratio_at_birth_for_children_born_in_the_last_five_years_females_per_1_000_males": 938.0, "Children_under_age_5_years_whose_birth_was_registered_with_the_civil_authority": 94.6, "Deaths_in_the_last_3_years_registered_with_the_civil_authority": 75.2, "Population_living_in_households_with_electricity": 98.6, "Population_living_in_households_with_an_improved_drinking_water_source1": 97.3, "Population_living_in_households_that_use_an_improved_sanitation_facility2": 73.3, "Households_using_clean_fuel_for_cooking3": 50.4, "Households_using_iodized_salt": 96.9, "Households_with_any_usual_member_covered_under_a_health_insurance_financing_scheme": 35.1, "Children_age_5_years_who_attended_pre_primary_school_during_the_school_year_2019_20": 9.6, "Women_who_are_literate4": 74.0, "Women_with_10_or_more_years_of_schooling": 38.7, "Women_age_20_24_years_married_before_age_18_years": 18.1, "Births_in_the_5_years_preceding_the_survey_that_are_third_or_higher_order": 1.7, "Women_age_15_19_years_who_were_already_mothers_or_pregnant_at_the_time_of_the_survey": 4.7, "Women_age_15_24_years_who_use_hygienic_methods_of_protection_during_their_menstrual_period5": 79.6, "Any_method6": 67.9, "Any_modern_method6": 54.9, "Female_sterilization": 33.4, "Male_sterilization": 0.1, "IUD_PPIUD": 2.0, "Injectables": 0.3, "Total_unmet_need7": 8.5, "Unmet_need_for_spacing7": 3.7, "Health_worker_ever_talked_to_female_non_users_about_family_planning": 23.1, "Current_users_ever_told_about_side_effects_of_current_method8": 66.1, "Mothers_who_had_an_antenatal_check_up_in_the_first_trimester": 72.9, "Mothers_who_had_at_least_4_antenatal_care_visits": 61.0, "Mothers_whose_last_birth_was_protected_against_neonatal_tetanus9": 92.4, "Mothers_who_consumed_iron_folic_acid_for_100_days_or_more_when_they_were_pregnant": 46.9, "Mothers_who_consumed_iron_folic_acid_for_180_days_or_more_when_they_were_pregnant": 23.7, "Registered_pregnancies_for_which_the_mother_received_a_Mother_and_Child_Protection_MCP_card": 97.6, "Mothers_who_received_postnatal_care_from_a_doctor_nurse_LHV_ANM_midwife_other_health_personnel_within_2_days_of_delivery": 82.3, "Average_out_of_pocket_expenditure_per_delivery_in_a_public_health_facility_Rs": 2832.0, "Children_who_received_postnatal_care_from_a_doctor_nurse_LHV_ANM_midwife_other_health_personnel_within_2_days_of_delivery": 82.3, "Institutional_births": 91.8, "Institutional_births_in_public_facility": 66.2, "Home_births_that_were_conducted_by_skilled_health_personnel10": 2.2, "Births_attended_by_skilled_health_personnel10": 92.0, "Children_age_12_23_months_fully_vaccinated_based_on_information_from_either_vaccination_card_or_mother_s_recall11": 77.7, "Children_age_12_23_months_fully_vaccinated_based_on_information_from_vaccination_card_only12": 84.9, "Children_age_12_23_months_who_have_received_BCG": 96.0, "Children_age_12_23_months_who_have_received_3_doses_of_polio_vaccine13": 82.0, "Children_age_12_23_months_who_have_received_3_doses_of_penta_or_DPT_vaccine": 88.8, "Children_age_12_23_months_who_have_received_the_first_dose_of_measles_containing_vaccine_MCV": 89.4, "Children_age_24_35_months_who_have_received_a_second_dose_of_measles_containing_vaccine_MCV": 31.4, "Children_age_12_23_months_who_have_received_3_doses_of_rotavirus_vaccine14": 38.9, "Children_age_12_23_months_who_have_received_3_doses_of_penta_or_hepatitis_B_vaccine": 86.2, "Children_age_9_35_months_who_received_a_vitamin_A_dose_in_the_last_6_months": 73.7, "Children_age_12_23_months_who_received_most_of_their_vaccinations_in_a_public_health_facility": 97.3, "Children_age_12_23_months_who_received_most_of_their_vaccinations_in_a_private_health_facility": 1.6, "Prevalence_of_diarrhoea_in_the_2_weeks_preceding_the_survey": 5.6, "Prevalence_of_symptoms_of_acute_respiratory_infection_ARI_in_the_2_weeks_preceding_the_survey": 2.1, "Children_with_fever_or_symptoms_of_ARI_in_the_2_weeks_preceding_the_survey_taken_to_a_health_facility_or_health_provider": 67.8, "Children_under_age_3_years_breastfed_within_one_hour_of_birth15": 44.6, "Children_under_age_6_months_exclusively_breastfed16": 66.4, "Children_under_5_years_who_are_stunted_height_for_age_18": 33.0, "Children_under_5_years_who_are_wasted_weight_for_height_18": 18.2, "Children_under_5_years_who_are_severely_wasted_weight_for_height_19": 6.9, "Children_under_5_years_who_are_underweight_weight_for_age_18": 29.9, "Children_under_5_years_who_are_overweight_weight_for_height_20": 3.5, "Women_whose_Body_Mass_Index_BMI_is_below_normal_BMI_18_5_kg_m2_21": 18.1, "Women_who_are_overweight_or_obese_BMI_25_0_kg_m2_21": 20.9, "Women_who_have_high_risk_waist_to_hip_ratio_0_85": 58.3, "Children_age_6_59_months_who_are_anaemic_11_0_g_dl_22": 67.7, "Non_pregnant_women_age_15_49_years_who_are_anaemic_12_0_g_dl_22": 57.3, "Pregnant_women_age_15_49_years_who_are_anaemic_11_0_g_dl_22": 52.3, "All_women_age_15_49_years_who_are_anaemic22": 57.0, "All_women_age_15_19_years_who_are_anaemic22": 59.6, "Mildly_elevated_blood_pressure_Systolic_140_159_mm_of_Hg_and_or_Diastolic_90_99_mm_of_Hg": 16.2, "Elevated_blood_pressure_Systolic_140_mm_of_Hg_and_or_Diastolic_90_mm_of_Hg_or_taking_medicine_to_control_blood_pressure": 24.3, "Ever_undergone_a_breast_examination_for_breast_cancer": 0.2, "Ever_undergone_an_oral_cavity_examination_for_oral_cancer": 0.3, "Women_age_15_years_and_above_who_use_any_kind_of_tobacco": 7.8, "Men_age_15_years_and_above_who_use_any_kind_of_tobacco": 43.0, "Women_age_15_years_and_above_who_consume_alcohol": 0.5, "Men_age_15_years_and_above_who_consume_alcohol": 19.5}
feature_names.json ADDED
@@ -0,0 +1 @@
 
 
1
+ ["Female_population_age_6_years_and_above_who_ever_attended_school", "Population_below_age_15_years", "Sex_ratio_of_the_total_population_females_per_1_000_males", "Sex_ratio_at_birth_for_children_born_in_the_last_five_years_females_per_1_000_males", "Children_under_age_5_years_whose_birth_was_registered_with_the_civil_authority", "Deaths_in_the_last_3_years_registered_with_the_civil_authority", "Population_living_in_households_with_electricity", "Population_living_in_households_with_an_improved_drinking_water_source1", "Population_living_in_households_that_use_an_improved_sanitation_facility2", "Households_using_clean_fuel_for_cooking3", "Households_using_iodized_salt", "Households_with_any_usual_member_covered_under_a_health_insurance_financing_scheme", "Children_age_5_years_who_attended_pre_primary_school_during_the_school_year_2019_20", "Women_who_are_literate4", "Women_with_10_or_more_years_of_schooling", "Women_age_20_24_years_married_before_age_18_years", "Births_in_the_5_years_preceding_the_survey_that_are_third_or_higher_order", "Women_age_15_19_years_who_were_already_mothers_or_pregnant_at_the_time_of_the_survey", "Women_age_15_24_years_who_use_hygienic_methods_of_protection_during_their_menstrual_period5", "Any_method6", "Any_modern_method6", "Female_sterilization", "Male_sterilization", "IUD_PPIUD", "Injectables", "Total_unmet_need7", "Unmet_need_for_spacing7", "Health_worker_ever_talked_to_female_non_users_about_family_planning", "Current_users_ever_told_about_side_effects_of_current_method8", "Mothers_who_had_an_antenatal_check_up_in_the_first_trimester", "Mothers_who_had_at_least_4_antenatal_care_visits", "Mothers_whose_last_birth_was_protected_against_neonatal_tetanus9", "Mothers_who_consumed_iron_folic_acid_for_100_days_or_more_when_they_were_pregnant", "Mothers_who_consumed_iron_folic_acid_for_180_days_or_more_when_they_were_pregnant", "Registered_pregnancies_for_which_the_mother_received_a_Mother_and_Child_Protection_MCP_card", "Mothers_who_received_postnatal_care_from_a_doctor_nurse_LHV_ANM_midwife_other_health_personnel_within_2_days_of_delivery", "Average_out_of_pocket_expenditure_per_delivery_in_a_public_health_facility_Rs", "Children_who_received_postnatal_care_from_a_doctor_nurse_LHV_ANM_midwife_other_health_personnel_within_2_days_of_delivery", "Institutional_births", "Institutional_births_in_public_facility", "Home_births_that_were_conducted_by_skilled_health_personnel10", "Births_attended_by_skilled_health_personnel10", "Children_age_12_23_months_fully_vaccinated_based_on_information_from_either_vaccination_card_or_mother_s_recall11", "Children_age_12_23_months_fully_vaccinated_based_on_information_from_vaccination_card_only12", "Children_age_12_23_months_who_have_received_BCG", "Children_age_12_23_months_who_have_received_3_doses_of_polio_vaccine13", "Children_age_12_23_months_who_have_received_3_doses_of_penta_or_DPT_vaccine", "Children_age_12_23_months_who_have_received_the_first_dose_of_measles_containing_vaccine_MCV", "Children_age_24_35_months_who_have_received_a_second_dose_of_measles_containing_vaccine_MCV", "Children_age_12_23_months_who_have_received_3_doses_of_rotavirus_vaccine14", "Children_age_12_23_months_who_have_received_3_doses_of_penta_or_hepatitis_B_vaccine", "Children_age_9_35_months_who_received_a_vitamin_A_dose_in_the_last_6_months", "Children_age_12_23_months_who_received_most_of_their_vaccinations_in_a_public_health_facility", "Children_age_12_23_months_who_received_most_of_their_vaccinations_in_a_private_health_facility", "Prevalence_of_diarrhoea_in_the_2_weeks_preceding_the_survey", "Prevalence_of_symptoms_of_acute_respiratory_infection_ARI_in_the_2_weeks_preceding_the_survey", "Children_with_fever_or_symptoms_of_ARI_in_the_2_weeks_preceding_the_survey_taken_to_a_health_facility_or_health_provider", "Children_under_age_3_years_breastfed_within_one_hour_of_birth15", "Children_under_age_6_months_exclusively_breastfed16", "Children_under_5_years_who_are_stunted_height_for_age_18", "Children_under_5_years_who_are_wasted_weight_for_height_18", "Children_under_5_years_who_are_severely_wasted_weight_for_height_19", "Children_under_5_years_who_are_underweight_weight_for_age_18", "Children_under_5_years_who_are_overweight_weight_for_height_20", "Women_whose_Body_Mass_Index_BMI_is_below_normal_BMI_18_5_kg_m2_21", "Women_who_are_overweight_or_obese_BMI_25_0_kg_m2_21", "Women_who_have_high_risk_waist_to_hip_ratio_0_85", "Children_age_6_59_months_who_are_anaemic_11_0_g_dl_22", "Non_pregnant_women_age_15_49_years_who_are_anaemic_12_0_g_dl_22", "Pregnant_women_age_15_49_years_who_are_anaemic_11_0_g_dl_22", "All_women_age_15_49_years_who_are_anaemic22", "All_women_age_15_19_years_who_are_anaemic22", "Mildly_elevated_blood_pressure_Systolic_140_159_mm_of_Hg_and_or_Diastolic_90_99_mm_of_Hg", "Elevated_blood_pressure_Systolic_140_mm_of_Hg_and_or_Diastolic_90_mm_of_Hg_or_taking_medicine_to_control_blood_pressure", "Ever_undergone_a_breast_examination_for_breast_cancer", "Ever_undergone_an_oral_cavity_examination_for_oral_cancer", "Women_age_15_years_and_above_who_use_any_kind_of_tobacco", "Men_age_15_years_and_above_who_use_any_kind_of_tobacco", "Women_age_15_years_and_above_who_consume_alcohol", "Men_age_15_years_and_above_who_consume_alcohol"]
main (1).py ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI, HTTPException
2
+ from fastapi.middleware.cors import CORSMiddleware
3
+ from pydantic import BaseModel
4
+ from typing import Optional, Dict, Any
5
+ import pandas as pd
6
+ import numpy as np
7
+ import os
8
+ import json
9
+ from catboost import CatBoostRegressor
10
+ from difflib import SequenceMatcher
11
+
12
+ app = FastAPI(
13
+ title="Districtmaps.ai API",
14
+ description="District-level NCD risk intelligence for India. Pre-computed scores + live inference.",
15
+ version="2.0.0"
16
+ )
17
+
18
+ app.add_middleware(
19
+ CORSMiddleware,
20
+ allow_origins=["*"],
21
+ allow_methods=["*"],
22
+ allow_headers=["*"],
23
+ )
24
+
25
+ # ── GLOBALS ───────────────────────────────────────────────────────────────────
26
+ df = None
27
+ model = None
28
+ feature_names = None
29
+ feature_medians = None
30
+ feature_map = None
31
+
32
+ # ── STARTUP ───────────────────────────────────────────────────────────────────
33
+ @app.on_event("startup")
34
+ def load_all():
35
+ global df, model, feature_names, feature_medians, feature_map
36
+
37
+ # Pre-computed CSV
38
+ DATA_PATH = os.getenv("DATA_PATH", "india_all_districts_risk.csv")
39
+ df = pd.read_csv(DATA_PATH)
40
+ df.columns = [c.strip().lower().replace(" ", "_") for c in df.columns]
41
+ df["district_lower"] = df["district"].str.lower().str.strip()
42
+ df["state_lower"] = df["state"].str.lower().str.strip()
43
+ print(f"βœ… Loaded {len(df)} districts")
44
+
45
+ # Live inference model
46
+ model = CatBoostRegressor()
47
+ model.load_model("model_clean_inference.cbm")
48
+ print("βœ… Model loaded")
49
+
50
+ with open("feature_names.json") as f: feature_names = json.load(f)
51
+ with open("feature_medians.json") as f: feature_medians = json.load(f)
52
+ with open("feature_map.json") as f: feature_map = json.load(f)
53
+ print(f"βœ… Feature map loaded: {len(feature_map)} mappings")
54
+
55
+ # ── HELPERS ───────────────────────────────────────────────────────────────────
56
+ def safe_float(val):
57
+ try:
58
+ f = float(val)
59
+ return round(f, 4) if not np.isnan(f) else None
60
+ except:
61
+ return None
62
+
63
+ def format_district(row):
64
+ return {
65
+ "district": row.get("district", ""),
66
+ "state": row.get("state", ""),
67
+ "risk_scores": {
68
+ "diabetes": safe_float(row.get("diabetes_risk")),
69
+ "blood_pressure": safe_float(row.get("blood_pressure_risk")),
70
+ "obesity": safe_float(row.get("obesity_risk")),
71
+ "anaemia": safe_float(row.get("anaemia_risk")),
72
+ },
73
+ "composite_risk": safe_float(row.get("composite_risk")),
74
+ "risk_percentile": safe_float(row.get("diabetes_risk_norm")),
75
+ }
76
+
77
+ def fuzzy_match_feature(input_key: str, threshold: float = 0.6):
78
+ """Match an input column name to a model feature name."""
79
+ input_clean = input_key.lower().strip().replace("_", " ").replace("-", " ")
80
+
81
+ # Direct match in feature map
82
+ if input_clean in feature_map:
83
+ return feature_map[input_clean], 1.0
84
+
85
+ # Partial match in feature map keys
86
+ best_score, best_match = 0, None
87
+ for map_key, feat_name in feature_map.items():
88
+ score = SequenceMatcher(None, input_clean, map_key).ratio()
89
+ if score > best_score:
90
+ best_score = score
91
+ best_match = feat_name
92
+
93
+ if best_score >= threshold:
94
+ return best_match, best_score
95
+
96
+ # Direct match against raw feature names
97
+ for feat in feature_names:
98
+ feat_clean = feat.lower().replace("_", " ")
99
+ score = SequenceMatcher(None, input_clean, feat_clean).ratio()
100
+ if score > best_score:
101
+ best_score = score
102
+ best_match = feat
103
+
104
+ if best_score >= threshold:
105
+ return best_match, best_score
106
+
107
+ return None, best_score
108
+
109
+ # ── ROUTES ────────────────────────────────────────────────────────────────────
110
+
111
+ @app.get("/", tags=["Info"])
112
+ def root():
113
+ return {
114
+ "product": "Districtmaps.ai",
115
+ "version": "2.0.0",
116
+ "description": "District-level NCD risk intelligence for India",
117
+ "districts": len(df) if df is not None else 0,
118
+ "conditions": ["diabetes", "blood_pressure", "obesity", "anaemia"],
119
+ "validation": {
120
+ "cross_sectional_r2": 0.7132,
121
+ "temporal_r2": 0.6279,
122
+ "temporal_gap": "4 years (NFHS-4 2015-16 β†’ NFHS-5 2019-21)",
123
+ "features": len(feature_names) if feature_names else 0,
124
+ },
125
+ "endpoints": {
126
+ "GET /risk": "Pre-computed risk scores for a named district",
127
+ "GET /top": "Top N highest risk districts",
128
+ "GET /state/{state}": "All districts within a state",
129
+ "GET /districts": "Full ranked list",
130
+ "POST /predict": "Live inference β€” send your own district data",
131
+ "GET /features": "List all supported input features",
132
+ }
133
+ }
134
+
135
+ # ── PRE-COMPUTED ENDPOINTS ────────────────────────────────────────────────────
136
+
137
+ @app.get("/risk", tags=["Pre-computed"])
138
+ def get_district_risk(district: str, state: str = None):
139
+ mask = df["district_lower"] == district.lower().strip()
140
+ if state:
141
+ mask &= df["state_lower"] == state.lower().strip()
142
+ results = df[mask]
143
+ if results.empty:
144
+ mask2 = df["district_lower"].str.contains(district.lower().strip(), na=False)
145
+ if state:
146
+ mask2 &= df["state_lower"].str.contains(state.lower().strip(), na=False)
147
+ results = df[mask2]
148
+ if results.empty:
149
+ raise HTTPException(status_code=404, detail=f"District '{district}' not found.")
150
+ return {"query": district, "matches": [format_district(row) for _, row in results.iterrows()]}
151
+
152
+ @app.get("/districts", tags=["Pre-computed"])
153
+ def get_all_districts(sort_by: str = "composite_risk", order: str = "desc", limit: int = 708):
154
+ col = sort_by if sort_by in df.columns else "composite_risk"
155
+ sorted_df = df.sort_values(col, ascending=(order == "asc")).head(limit)
156
+ return {"total": len(sorted_df), "sorted_by": col,
157
+ "districts": [format_district(row) for _, row in sorted_df.iterrows()]}
158
+
159
+ @app.get("/top", tags=["Pre-computed"])
160
+ def get_top_districts(n: int = 10, condition: str = "composite_risk"):
161
+ col = condition if condition in df.columns else "composite_risk"
162
+ top = df.nlargest(n, col)
163
+ return {"condition": col, "top_n": n,
164
+ "districts": [format_district(row) for _, row in top.iterrows()]}
165
+
166
+ @app.get("/state/{state}", tags=["Pre-computed"])
167
+ def get_state_districts(state: str):
168
+ mask = df["state_lower"].str.contains(state.lower().strip(), na=False)
169
+ results = df[mask].sort_values("composite_risk", ascending=False)
170
+ if results.empty:
171
+ raise HTTPException(status_code=404, detail=f"State '{state}' not found.")
172
+ return {"state": state, "districts": len(results),
173
+ "ranked": [format_district(row) for _, row in results.iterrows()]}
174
+
175
+ # ── LIVE INFERENCE ────────────────────────────────────────────────────────────
176
+
177
+ class PredictRequest(BaseModel):
178
+ data: Dict[str, Any]
179
+ district_name: Optional[str] = "Unknown"
180
+ fill_missing: Optional[bool] = True
181
+
182
+ @app.post("/predict", tags=["Live Inference"])
183
+ def predict(request: PredictRequest):
184
+ """
185
+ Live inference endpoint. Send any district-level health indicators
186
+ in your own column naming convention. We fuzzy-match to our 78 features,
187
+ fill missing values with national medians, and return a live prediction.
188
+
189
+ Example:
190
+ {
191
+ "district_name": "My District",
192
+ "data": {
193
+ "obesity": 32.1,
194
+ "tobacco": 18.4,
195
+ "literacy": 89.2,
196
+ "insurance": 45.0,
197
+ "anaemia": 52.3
198
+ }
199
+ }
200
+ """
201
+ input_data = request.data
202
+ matched = {}
203
+ unmatched = []
204
+ match_report = []
205
+
206
+ # Fuzzy match each input column to a model feature
207
+ for input_key, input_val in input_data.items():
208
+ feat_name, score = fuzzy_match_feature(str(input_key))
209
+ if feat_name:
210
+ matched[feat_name] = float(input_val)
211
+ match_report.append({
212
+ "input_column": input_key,
213
+ "mapped_to": feat_name,
214
+ "confidence": round(score, 3),
215
+ "value": float(input_val)
216
+ })
217
+ else:
218
+ unmatched.append(input_key)
219
+
220
+ if len(matched) == 0:
221
+ raise HTTPException(
222
+ status_code=422,
223
+ detail=f"None of your columns could be matched to model features. "
224
+ f"Call GET /features to see supported inputs."
225
+ )
226
+
227
+ # Build full feature vector
228
+ feature_vector = {}
229
+ filled_with_median = []
230
+
231
+ for feat in feature_names:
232
+ if feat in matched:
233
+ feature_vector[feat] = matched[feat]
234
+ elif request.fill_missing:
235
+ feature_vector[feat] = feature_medians.get(feat, 0)
236
+ filled_with_median.append(feat)
237
+ else:
238
+ feature_vector[feat] = 0
239
+
240
+ # Run prediction
241
+ X_input = pd.DataFrame([feature_vector])[feature_names]
242
+ prediction = float(model.predict(X_input)[0])
243
+ prediction = round(max(0, min(100, prediction)), 4)
244
+
245
+ # Risk band
246
+ if prediction > 15: risk_band = "VERY HIGH"
247
+ elif prediction > 10: risk_band = "HIGH"
248
+ elif prediction > 7: risk_band = "MODERATE"
249
+ elif prediction > 4: risk_band = "LOW"
250
+ else: risk_band = "VERY LOW"
251
+
252
+ return {
253
+ "district": request.district_name,
254
+ "prediction": {
255
+ "diabetes_risk_pct": prediction,
256
+ "risk_band": risk_band,
257
+ "model": "CatBoost Β· RΒ²=0.7132 Β· MAE=2.06%",
258
+ },
259
+ "input_summary": {
260
+ "columns_received": len(input_data),
261
+ "columns_matched": len(matched),
262
+ "columns_unmatched": len(unmatched),
263
+ "features_filled_median": len(filled_with_median),
264
+ "coverage_pct": round(len(matched) / len(feature_names) * 100, 1),
265
+ },
266
+ "match_report": match_report,
267
+ "unmatched_cols": unmatched,
268
+ "note": f"Prediction based on {len(matched)} matched features out of {len(feature_names)} total. "
269
+ f"{len(filled_with_median)} features filled with national district medians."
270
+ }
271
+
272
+ @app.get("/features", tags=["Live Inference"])
273
+ def list_features():
274
+ """Returns all supported feature names and common aliases for /predict."""
275
+ return {
276
+ "total_features": len(feature_names),
277
+ "model_feature_names": feature_names,
278
+ "common_aliases": {
279
+ "obesity / overweight / bmi": "Women overweight or obese (BMI β‰₯25)",
280
+ "tobacco / smoking": "Men age 15+ who use tobacco",
281
+ "literacy / education": "Female population who attended school",
282
+ "insurance / health insurance": "Households with health insurance",
283
+ "anaemia / anemia": "Women age 15-49 who are anaemic",
284
+ "sanitation": "Households with improved sanitation",
285
+ "teen pregnancy": "Women 15-19 already mothers or pregnant",
286
+ "children overweight": "Children under 5 who are overweight",
287
+ },
288
+ "tip": "Column names are fuzzy-matched β€” send whatever naming convention you use."
289
+ }
model_clean_inference.cbm ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e6e352bf11fe0b4774c494aacacacb56b3d5345ee3dee71bd7a550cac2747245
3
+ size 575232