Source code for utility_modules.check_mcaid_subsidy
#!/usr/bin/env python
import pandas as pd
import numpy as np
[docs]def mcaid_elig_check(long_table_path, hieu_path):
long_output_table = pd.read_csv(long_table_path)
hieu_table = pd.read_csv(hieu_path)
long_output_hieu_table = pd.merge(long_output_table, hieu_table, on = "hieu_id", how= "left")
mcaid_elig_choices = np.where((long_output_hieu_table.mcaid==0) & (long_output_hieu_table.choice==9))
print("Number people who are not eligible for mcaid but are on mcaid: " + str(len(mcaid_elig_choices[0])))
undoc_subsidy = np.where((long_output_hieu_table.doc_status==0) & (long_output_hieu_table.xc_sub==1))
print("Number people who are undocumented but have exchange subsidy eligiblity: " + str(len(undoc_subsidy[0])))
undoc_mcaid = np.where((long_output_hieu_table.doc_status==0) & (long_output_hieu_table.mcaid==1))
print("Number people who are undocumented but have mcaid eligiblity: " + str(len(undoc_mcaid[0])))
percent_mcaid_eligible = float(len(np.where(long_output_hieu_table.mcaid==1)[0]))/float(long_output_hieu_table.shape[0])*100
print("Percent of people who are eligible for mcaid: " + str(round(percent_mcaid_eligible,2)) + "%")
percent_xc_subsidy_eligible = float(len(np.where(long_output_hieu_table.xc_sub==1)[0]))/float(long_output_hieu_table.shape[0])*100
print("Percent of people who are eligible for exchange subsidy: " + str(round(percent_xc_subsidy_eligible,2)) + "%")
xc_sub_takeup = float(len((np.where((long_output_hieu_table.xc_sub==1) & \
((long_output_hieu_table.choice==6) | \
(long_output_hieu_table.choice==7) | \
(long_output_hieu_table.choice==8)))[0]))) \
/float(len(np.where(long_output_hieu_table.xc_sub==1)[0]))*100
print("Percent of people who are eligible for exchange subsidy and are on exchange_subsidy: " + str(round(xc_sub_takeup,2)) + "%")
mcaid_takeup = float(len(np.where((long_output_hieu_table.choice==9) & (long_output_hieu_table.mcaid==1))[0])) \
/float(len(np.where(long_output_hieu_table.mcaid==1)[0]))*100
print("Percent of people who are eligible for mcaid and are on mcaid: " + str(round(mcaid_takeup,2)) + "%")
#part 2
mcaid_elig_choices_weight = (long_output_hieu_table['p_weight'][mcaid_elig_choices[0]]).sum()
print("\nweight of non_elig mcaid patients on mcaid: " + str(mcaid_elig_choices_weight))
undoc_subsidy_weight = (long_output_hieu_table['p_weight'][undoc_subsidy[0]]).sum()
print("weight of nondoc patients who are exchange sub elig: " + str(undoc_subsidy_weight))
undoc_mcaid_weight = (long_output_hieu_table['p_weight'][undoc_mcaid[0]]).sum()
print("weight of undoc patients who are mcaid elig: " + str(undoc_mcaid_weight))
percent_mcaid_eligible_weight = float(long_output_hieu_table['p_weight'][np.where(long_output_hieu_table.mcaid==1)[0]].sum()) \
/ float(long_output_hieu_table['p_weight'].sum())*100
print("Percent of people who are eligible for mcaid weight: " + str(round(percent_mcaid_eligible_weight,2))+ "%")
percent_xc_subsidy_eligible_weight = float(long_output_hieu_table['p_weight'][np.where(long_output_hieu_table.xc_sub==1)[0]].sum()) \
/float(long_output_hieu_table['p_weight'].sum())*100
print("Percent of people who are eligible for exchange subsidy weight: " + str(round(percent_xc_subsidy_eligible_weight,2)) + "%")
xc_sub_takeup_weight = long_output_hieu_table['p_weight'][np.where((long_output_hieu_table.xc_sub==1) & \
((long_output_hieu_table.choice==6) | \
(long_output_hieu_table.choice==7) | \
(long_output_hieu_table.choice==8)))[0]].sum() \
/float(long_output_hieu_table['p_weight'][np.where(long_output_hieu_table.xc_sub==1)[0]].sum())*100
print("Percent elig for xc_sub and are on xc_sub weight: " + str(round(xc_sub_takeup_weight,2)) + "%")
mcaid_takeup_weight = float(long_output_hieu_table['p_weight'][np.where((long_output_hieu_table.choice==9) & (long_output_hieu_table.mcaid==1))[0]].sum())\
/float(long_output_hieu_table['p_weight'][np.where(long_output_hieu_table.mcaid==1)[0]].sum())*100
print("Percent of people who are mcaid_elig and are on mcaid weight: " + str(round(mcaid_takeup_weight,2)) + "%")
[docs]def main():
mcaid_elig_check('/home/bshea/new_calsim/input_tables/long_out_tables_2015.csv','/home/bshea/new_calsim/input_tables/hieu_table.csv')
if __name__ == '__main__':
main()