Exemplo n.º 1
0
	def parse_5_x(self, row):

		#self.inputs will be used in the aggregation functions
		#note: sequence number did not exist prior to 2012 and HUD median income became FFIEC median income in 2012
		#instantiate classes to set loan variables
		MSA_index = MSA_info() #contains functions for census tract characteristics
		demo=demographics() #contains functions for borrower characteristics

		app_races = [row['applicantrace1'], row['applicantrace2'], row['applicantrace3'],row['applicantrace4'],row['applicantrace5']]
		co_app_races = [row['coapplicantrace1'], row['coapplicantrace2'], row['coapplicantrace3'],row['coapplicantrace4'],row['coapplicantrace5']]
		a_race = demo.make_race_list(app_races) #put applicant race codes in a list 0-5, 0 is blank field
		co_race = demo.make_race_list(co_app_races) #put co-applicant race codes in a list 0-5, 0 is blank field
		#add data elements to dictionary
		self.inputs['a_race'] = a_race
		self.inputs['co_race'] = co_race
		self.inputs['a ethn'] = row['applicantethnicity'] #ethnicity of the applicant
		self.inputs['co ethn'] = row['coapplicantethnicity'] #ethnicity of the co-applicant
		self.inputs['income'] = row['applicantincome'] #relied upon income rounded to the nearest thousand
		self.inputs['loan value'] = float(row['loanamount']) #loan value rounded to the nearest thousand
		self.inputs['year'] = row['asofdate'] #year or application or origination
		self.inputs['state code'] = row['statecode'] #two digit state code
		self.inputs['state name'] = row['statename'] #two character state abbreviation
		self.inputs['action taken'] = int(row['actiontype']) #disposition of the loan application
		self.inputs['MSA median income'] = row['ffiec_median_family_income'] #median income for the tract/msa
		self.inputs['sequence'] = row['sequencenumber'] #the sequence number of the loan, used for checking errors
		self.inputs['income bracket'] = MSA_index.app_income_to_MSA(self.inputs) #sets the applicant income as an index by an applicant's income as a percent of MSA median
		self.inputs['app non white flag'] = demo.set_non_white(a_race) #flags the applicant as non-white if true, used in setting minority status and race
		self.inputs['co non white flag'] = demo.set_non_white(co_race) #flags the co applicant as non-white if true, used in setting minority status and race
		self.inputs['minority count'] = demo.minority_count(a_race) #determines if the number of minority races claimed by the applicant is 2 or greater
		self.inputs['joint status'] = demo.set_joint(self.inputs) #requires non white status flags be set prior to running set_joint
		self.inputs['race'] = demo.set_race(self.inputs, a_race) #requires joint status be set prior to running set_race
		self.inputs['ethnicity'] = demo.set_ethnicity(self.inputs) #requires  ethnicity be parsed prior to running set_ethnicity
		self.inputs['minority status'] = demo.set_minority_status(self.inputs) #requires non white flags be set prior to running set_minority_status
Exemplo n.º 2
0
	def parse_5_x(self, row):

		#self.inputs will be used in the aggregation functions
		#note: sequence number did not exist prior to 2012 and HUD median income became FFIEC median income in 2012
		#instantiate classes to set loan variables
		MSA_index = MSA_info() #contains functions for census tract characteristics
		demo=demographics() #contains functions for borrower characteristics

		app_races = [row['applicantrace1'], row['applicantrace2'], row['applicantrace3'],row['applicantrace4'],row['applicantrace5']]
		co_app_races = [row['coapplicantrace1'], row['coapplicantrace2'], row['coapplicantrace3'],row['coapplicantrace4'],row['coapplicantrace5']]
		a_race = demo.make_race_list(app_races) #put applicant race codes in a list 0-5, 0 is blank field
		co_race = demo.make_race_list(co_app_races) #put co-applicant race codes in a list 0-5, 0 is blank field
		#add data elements to dictionary
		self.inputs['a_race'] = a_race
		self.inputs['co_race'] = co_race
		self.inputs['a ethn'] = row['applicantethnicity'] #ethnicity of the applicant
		self.inputs['co ethn'] = row['coapplicantethnicity'] #ethnicity of the co-applicant
		self.inputs['income'] = row['applicantincome'] #relied upon income rounded to the nearest thousand
		self.inputs['loan value'] = float(row['loanamount']) #loan value rounded to the nearest thousand
		self.inputs['year'] = row['asofdate'] #year or application or origination
		self.inputs['state code'] = row['statecode'] #two digit state code
		self.inputs['state name'] = row['statename'] #two character state abbreviation
		self.inputs['action taken'] = int(row['actiontype']) #disposition of the loan application
		self.inputs['MSA median income'] = row['ffiec_median_family_income'] #median income for the tract/msa
		self.inputs['sequence'] = row['sequencenumber'] #the sequence number of the loan, used for checking errors
		self.inputs['income bracket'] = MSA_index.app_income_to_MSA(self.inputs) #sets the applicant income as an index by an applicant's income as a percent of MSA median
		self.inputs['app non white flag'] = demo.set_non_white(a_race) #flags the applicant as non-white if true, used in setting minority status and race
		self.inputs['co non white flag'] = demo.set_non_white(co_race) #flags the co applicant as non-white if true, used in setting minority status and race
		self.inputs['minority count'] = demo.minority_count(a_race) #determines if the number of minority races claimed by the applicant is 2 or greater
		self.inputs['joint status'] = demo.set_joint(self.inputs) #requires non white status flags be set prior to running set_joint
		self.inputs['race'] = demo.set_race(self.inputs, a_race) #requires joint status be set prior to running set_race
		self.inputs['ethnicity'] = demo.set_ethnicity(self.inputs) #requires  ethnicity be parsed prior to running set_ethnicity
		self.inputs['minority status'] = demo.set_minority_status(self.inputs) #requires non white flags be set prior to running set_minority_status
def test_set_race(input_dict, race_list, expected_result):
	# Arrange
	demo = demographics()

	# Action
 	actual_result = demo.set_race(input_dict, race_list)

	# Assert
	assert_equals(actual_result, expected_result)
def test_gender(input_dict, expected_result): #testing set_gender
	# Arrange
	demo = demographics()

	# Action
	actual_result = demo.set_gender(input_dict)

	# Assert
	assert_equals(actual_result, expected_result)
def test_minority_count(race_list, expected_result):#testing minority_count
	# Arrange
	demo = demographics()

	# Action
	actual_result = demo.minority_count(race_list)

	# Assert
	assert_equals(actual_result, expected_result)
def test_rate_spread_index(rate, expected_result): # #test rate spread index (for 3.2)
	# Arrange
	demo = demographics()

	# Action
	actual_result = demo.rate_spread_index_3_2(rate)

	# Assert
	assert_equals(actual_result, expected_result)
def test_rate_spread_index_11_x(rate, expected_result):
	# Arrange
	demo = demographics()

	# Action
	actual_result = demo.rate_spread_index_11_x(rate)

	# Assert
	assert_equals(actual_result, expected_result)
def test_make_race_list(race_list, expected_result):
	# Arrange
	demo = demographics()

	# Action
 	actual_result = demo.make_race_list(race_list)

	# Assert
	assert_equals(actual_result, expected_result)
def test_set_ethnicity(input_dict, expected_result):
	# Arrange
	demo = demographics()

	# Action
	actual_result = demo.set_ethnicity(input_dict)

	# Assert
	assert_equals(actual_result, expected_result)
Exemplo n.º 10
0
	def parse_B_x(self, row):
		demo=demographics() #contains functions for borrower characteristics
		self.inputs['year'] = row['asofdate'] #year or application or origination
		#self.inputs['rate spread'] = row['ratespread'] # interest rate spread over APOR if spread is greater than 1.5%
		self.inputs['rate spread'] = row['ratespread']
		self.inputs['state code'] = row['statecode'] #two digit state code
		self.inputs['state name'] = row['statename'] #two character state abbreviation
		self.inputs['sequence'] = row['sequencenumber'] #the sequence number of the loan, used for checking errors
		self.inputs['loan purpose'] = self.purpose_index(row['loanpurpose'])
		self.inputs['lien status'] = int(row['lienstatus'])
		self.inputs['hoepa flag'] = int(row['hoepastatus']) #if the loan is subject to Home Ownership Equity Protection Act
		self.inputs['property type'] = int(row['propertytype'])
		self.inputs['rate spread index'] = demo.rate_spread_index_11_x(row['ratespread']) #index of the rate spread for use in the JSON structure
Exemplo n.º 11
0
	def parse_B_x(self, row):
		demo=demographics() #contains functions for borrower characteristics
		self.inputs['year'] = row['asofdate'] #year or application or origination
		#self.inputs['rate spread'] = row['ratespread'] # interest rate spread over APOR if spread is greater than 1.5%
		self.inputs['rate spread'] = row['ratespread']
		self.inputs['state code'] = row['statecode'] #two digit state code
		self.inputs['state name'] = row['statename'] #two character state abbreviation
		self.inputs['sequence'] = row['sequencenumber'] #the sequence number of the loan, used for checking errors
		self.inputs['loan purpose'] = self.purpose_index(row['loanpurpose'])
		self.inputs['lien status'] = int(row['lienstatus'])
		self.inputs['hoepa flag'] = int(row['hoepastatus']) #if the loan is subject to Home Ownership Equity Protection Act
		self.inputs['property type'] = int(row['propertytype'])
		self.inputs['rate spread index'] = demo.rate_spread_index_11_x(row['ratespread']) #index of the rate spread for use in the JSON structure
Exemplo n.º 12
0
	def parse_3_2(self, row): #takes a row of tuples from a table 3-1 query and parses it to the inputs dictionary
		#parsing inputs for report 3-1
		#self.inputs will be returned to for use in the aggregation function

		demo=demographics() #instantiate class to set loan variables

		#add data elements to dictionary
		self.inputs['rate spread'] = row['ratespread'] # interest rate spread over APOR if spread is greater than 1.5%
		self.inputs['lien status'] = row['lienstatus'] #first, junior, or not applicable
		self.inputs['loan value'] = float(row['loanamount']) #loan value rounded to the nearest thousand
		self.inputs['hoepa flag'] = int(row['hoepastatus']) #if the loan is subject to Home Ownership Equity Protection Act
		self.inputs['purchaser'] = int(row['purchasertype']) -1 #adjust purchaser index down 1 to match JSON
		self.inputs['year'] = row['asofdate'] #year of the loan
		self.inputs['state code'] = row['statecode'] #state abbreviation, 2 digits
		self.inputs['state name'] = row['statename'] #name of the state
		self.inputs['census tract'] = row['censustractnumber'] # this is currently the 7 digit tract used by the FFIEC, it includes a decimal prior to the last two digits
		self.inputs['county code'] = row['countycode'] #3 digit county code
		self.inputs['county name'] = row['countyname'] #full county name
		self.inputs['rate spread index'] = demo.rate_spread_index_3_2(self.inputs['rate spread']) #index of the rate spread for use in the JSON structure
Exemplo n.º 13
0
	def parse_3_2(self, row): #takes a row of tuples from a table 3-1 query and parses it to the inputs dictionary
		#parsing inputs for report 3-1
		#self.inputs will be returned to for use in the aggregation function

		demo=demographics() #instantiate class to set loan variables

		#add data elements to dictionary
		self.inputs['rate spread'] = row['ratespread'] # interest rate spread over APOR if spread is greater than 1.5%
		self.inputs['lien status'] = row['lienstatus'] #first, junior, or not applicable
		self.inputs['loan value'] = float(row['loanamount']) #loan value rounded to the nearest thousand
		self.inputs['hoepa flag'] = int(row['hoepastatus']) #if the loan is subject to Home Ownership Equity Protection Act
		self.inputs['purchaser'] = int(row['purchasertype']) -1 #adjust purchaser index down 1 to match JSON
		self.inputs['year'] = row['asofdate'] #year of the loan
		self.inputs['state code'] = row['statecode'] #state abbreviation, 2 digits
		self.inputs['state name'] = row['statename'] #name of the state
		self.inputs['census tract'] = row['censustractnumber'] # this is currently the 7 digit tract used by the FFIEC, it includes a decimal prior to the last two digits
		self.inputs['county code'] = row['countycode'] #3 digit county code
		self.inputs['county name'] = row['countyname'] #full county name
		self.inputs['rate spread index'] = demo.rate_spread_index_3_2(self.inputs['rate spread']) #index of the rate spread for use in the JSON structure
Exemplo n.º 14
0
	def parse_A4W(self, row):
		#this code is from A-4
		MSA_index = MSA_info() #contains functions for census tract characteristics
		demo=demographics() #contains functions for borrower characteristics
		a_race = [] #race lists will hold 5 integers with 0 replacing a blank entry
		co_race = [] #race lists will hold 5 integers with 0 replacing a blank entry
		#fill race lists from the demographics class
		app_races = [row['applicantrace1'], row['applicantrace2'], row['applicantrace3'],row['applicantrace4'],row['applicantrace5']]
		co_app_races = [row['coapplicantrace1'], row['coapplicantrace2'], row['coapplicantrace3'],row['coapplicantrace4'],row['coapplicantrace5']]
		a_race = demo.make_race_list(app_races) #put applicant race codes in a list 0-5, 0 is blank field
		co_race = demo.make_race_list(co_app_races) #put co-applicant race codes in a list 0-5, 0 is blank field
		#add data elements to dictionary
		self.inputs['a_race'] = a_race
		self.inputs['co_race'] = co_race
		self.inputs['a ethn'] = row['applicantethnicity'] #ethnicity of the applicant
		self.inputs['co ethn'] = row['coapplicantethnicity'] #ethnicity of the co-applicant
		self.inputs['income'] = row['applicantincome'] #relied upon income rounded to the nearest thousand
		self.inputs['rate spread'] = row['ratespread'] # interest rate spread over APOR if spread is greater than 1.5%
		self.inputs['loan value'] = float(row['loanamount']) #loan value rounded to the nearest thousand
		self.inputs['year'] = row['asofdate'] #year or application or origination
		self.inputs['state code'] = row['statecode'] #two digit state code
		self.inputs['state name'] = row['statename'] #two character state abbreviation
		self.inputs['app sex'] = row['applicantsex']
		self.inputs['co app sex'] = row['coapplicantsex']
		self.inputs['MSA median income'] = row['ffiec_median_family_income'] #median income for the tract/msa
		self.inputs['minority percent'] = row['minoritypopulationpct'] #%of population that is minority
		self.inputs['tract to MSA income'] = row['tract_to_msa_md_income'] #ratio of tract to msa/md income
		self.inputs['sequence'] = row['sequencenumber'] #the sequence number of the loan, used for checking errors
		self.inputs['preapproval'] = row['preapproval']
		self.inputs['action taken'] = row['actiontype']
		#self.inputs['lien status'] = row['lienstatus']
		self.inputs['tract income index'] = MSA_index.tract_to_MSA_income(self.inputs) #sets the tract to MSA median income ratio to an index number for aggregation
		self.inputs['income bracket'] = MSA_index.app_income_to_MSA(self.inputs) #sets the applicant income as an index by an applicant's income as a percent of MSA median
		self.inputs['rate spread index'] = demo.rate_spread_index_11_x(self.inputs['rate spread']) #index of the rate spread for use in the JSON structure
		self.inputs['minority percent index'] = MSA_index.minority_percent(self.inputs) #sets the minority population percent to an index for aggregation
		self.inputs['app non white flag'] = demo.set_non_white(a_race) #flags the applicant as non-white if true, used in setting minority status and race
		self.inputs['co non white flag'] = demo.set_non_white(co_race) #flags the co applicant as non-white if true, used in setting minority status and race
		self.inputs['minority count'] = demo.minority_count(a_race) #determines if the number of minority races claimed by the applicant is 2 or greater
		self.inputs['joint status'] = demo.set_joint(self.inputs) #requires non white status flags be set prior to running set_joint
		self.inputs['race'] = demo.set_race(self.inputs, a_race) #requires joint status be set prior to running set_race
		self.inputs['ethnicity'] = demo.set_ethnicity(self.inputs) #requires  ethnicity be parsed prior to running set_ethnicity
		self.inputs['minority status'] = demo.set_minority_status(self.inputs) #requires non white flags be set prior to running set_minority_status
		self.inputs['gender'] = demo.set_gender(self.inputs)
Exemplo n.º 15
0
	def parse_3_1(self, row): #takes a row of tuples from a table 3-1 query and parses it to the inputs dictionary
		#parsing inputs for report 3.1
		#self.inputs will be used in the aggregation functions
		#note: sequence number did not exist prior to 2012 and HUD median income became FFIEC median income in 2012
		#instantiate classes to set loan variables
		MSA_index = MSA_info() #contains functions for census tract characteristics
		demo=demographics() #contains functions for borrower characteristics

		app_races = [row['applicantrace1'], row['applicantrace2'], row['applicantrace3'],row['applicantrace4'],row['applicantrace5']]
		co_app_races = [row['coapplicantrace1'], row['coapplicantrace2'], row['coapplicantrace3'],row['coapplicantrace4'],row['coapplicantrace5']]

		a_race = demo.make_race_list(app_races) #put applicant race codes in a list 0-5, 0 is blank field
		co_race = demo.make_race_list(co_app_races) #put co-applicant race codes in a list 0-5, 0 is blank field
		#add data elements to dictionary
		self.inputs['a_race'] = a_race
		self.inputs['co_race'] = co_race
		self.inputs['a ethn'] = row['applicantethnicity'] #ethnicity of the applicant
		self.inputs['co ethn'] = row['coapplicantethnicity'] #ethnicity of the co-applicant
		self.inputs['income'] = row['applicantincome'] #relied upon income rounded to the nearest thousand
		self.inputs['purchaser'] = int(row['purchasertype']) -1 #adjust purchaser index down 1 to match JSON structure
		self.inputs['loan value'] = float(row['loanamount']) #loan value rounded to the nearest thousand
		self.inputs['year'] = row['asofdate'] #year or application or origination
		self.inputs['state code'] = row['statecode'] #two digit state code
		self.inputs['state name'] = row['statename'] #two character state abbreviation
		self.inputs['census tract'] = row['censustractnumber'] # this is currently the 7 digit tract used by the FFIEC, it includes a decimal prior to the last two digits
		self.inputs['county code'] = row['countycode'] #3 digit county code
		self.inputs['county name'] = row['countyname'] #full text county name
		self.inputs['MSA median income'] = row['ffiec_median_family_income'] #median income for the tract/msa
		self.inputs['minority percent'] = row['minoritypopulationpct'] #%of population that is minority
		self.inputs['tract to MSA income'] = row['tract_to_msa_md_income'] #ratio of tract to msa/md income
		self.inputs['sequence'] = row['sequencenumber'] #the sequence number of the loan, used for checking errors
		self.inputs['tract income index'] = MSA_index.tract_to_MSA_income(self.inputs) #sets the tract to MSA median income ratio to an index number for aggregation
		self.inputs['income bracket'] = MSA_index.app_income_to_MSA(self.inputs) #sets the applicant income as an index by an applicant's income as a percent of MSA median
		self.inputs['minority percent index'] = MSA_index.minority_percent(self.inputs) #sets the minority population percent to an index for aggregation

		self.inputs['app non white flag'] = demo.set_non_white(a_race) #flags the applicant as non-white if true, used in setting minority status and race
		self.inputs['co non white flag'] = demo.set_non_white(co_race) #flags the co applicant as non-white if true, used in setting minority status and race
		self.inputs['minority count'] = demo.minority_count(a_race) #determines if the number of minority races claimed by the applicant is 2 or greater
		self.inputs['joint status'] = demo.set_joint(self.inputs) #requires non white status flags be set prior to running set_joint
		self.inputs['race'] = demo.set_race(self.inputs, a_race) #requires joint status be set prior to running set_race
		self.inputs['ethnicity'] = demo.set_ethnicity(self.inputs) #requires  ethnicity be parsed prior to running set_ethnicity
		self.inputs['minority status'] = demo.set_minority_status(self.inputs) #requires non white flags be set prior to running set_minority_status
Exemplo n.º 16
0
	def parse_3_1(self, row): #takes a row of tuples from a table 3-1 query and parses it to the inputs dictionary
		#parsing inputs for report 3.1
		#self.inputs will be used in the aggregation functions
		#note: sequence number did not exist prior to 2012 and HUD median income became FFIEC median income in 2012
		#instantiate classes to set loan variables
		MSA_index = MSA_info() #contains functions for census tract characteristics
		demo=demographics() #contains functions for borrower characteristics

		app_races = [row['applicantrace1'], row['applicantrace2'], row['applicantrace3'],row['applicantrace4'],row['applicantrace5']]
		co_app_races = [row['coapplicantrace1'], row['coapplicantrace2'], row['coapplicantrace3'],row['coapplicantrace4'],row['coapplicantrace5']]

		a_race = demo.make_race_list(app_races) #put applicant race codes in a list 0-5, 0 is blank field
		co_race = demo.make_race_list(co_app_races) #put co-applicant race codes in a list 0-5, 0 is blank field
		#add data elements to dictionary
		self.inputs['a_race'] = a_race
		self.inputs['co_race'] = co_race
		self.inputs['a ethn'] = row['applicantethnicity'] #ethnicity of the applicant
		self.inputs['co ethn'] = row['coapplicantethnicity'] #ethnicity of the co-applicant
		self.inputs['income'] = row['applicantincome'] #relied upon income rounded to the nearest thousand
		self.inputs['purchaser'] = int(row['purchasertype']) -1 #adjust purchaser index down 1 to match JSON structure
		self.inputs['loan value'] = float(row['loanamount']) #loan value rounded to the nearest thousand
		self.inputs['year'] = row['asofdate'] #year or application or origination
		self.inputs['state code'] = row['statecode'] #two digit state code
		self.inputs['state name'] = row['statename'] #two character state abbreviation
		self.inputs['census tract'] = row['censustractnumber'] # this is currently the 7 digit tract used by the FFIEC, it includes a decimal prior to the last two digits
		self.inputs['county code'] = row['countycode'] #3 digit county code
		self.inputs['county name'] = row['countyname'] #full text county name
		self.inputs['MSA median income'] = row['ffiec_median_family_income'] #median income for the tract/msa
		self.inputs['minority percent'] = row['minoritypopulationpct'] #%of population that is minority
		self.inputs['tract to MSA income'] = row['tract_to_msa_md_income'] #ratio of tract to msa/md income
		self.inputs['sequence'] = row['sequencenumber'] #the sequence number of the loan, used for checking errors
		self.inputs['tract income index'] = MSA_index.tract_to_MSA_income(self.inputs) #sets the tract to MSA median income ratio to an index number for aggregation
		self.inputs['income bracket'] = MSA_index.app_income_to_MSA(self.inputs) #sets the applicant income as an index by an applicant's income as a percent of MSA median
		self.inputs['minority percent index'] = MSA_index.minority_percent(self.inputs) #sets the minority population percent to an index for aggregation

		self.inputs['app non white flag'] = demo.set_non_white(a_race) #flags the applicant as non-white if true, used in setting minority status and race
		self.inputs['co non white flag'] = demo.set_non_white(co_race) #flags the co applicant as non-white if true, used in setting minority status and race
		self.inputs['minority count'] = demo.minority_count(a_race) #determines if the number of minority races claimed by the applicant is 2 or greater
		self.inputs['joint status'] = demo.set_joint(self.inputs) #requires non white status flags be set prior to running set_joint
		self.inputs['race'] = demo.set_race(self.inputs, a_race) #requires joint status be set prior to running set_race
		self.inputs['ethnicity'] = demo.set_ethnicity(self.inputs) #requires  ethnicity be parsed prior to running set_ethnicity
		self.inputs['minority status'] = demo.set_minority_status(self.inputs) #requires non white flags be set prior to running set_minority_status
Exemplo n.º 17
0
	def parse_8_x(self, row):
		#note: sequence number did not exist prior to 2012 and HUD median income became FFIEC median income in 2012

		MSA_index = MSA_info() #contains functions for census tract characteristics
		demo=demographics() #contains functions for borrower characteristics
		a_race = [] #race lists will hold 5 integers with 0 replacing a blank entry
		co_race = [] #race lists will hold 5 integers with 0 replacing a blank entry

		#fill race lists from the demographics class
		app_races = [row['applicantrace1'], row['applicantrace2'], row['applicantrace3'],row['applicantrace4'],row['applicantrace5']]
		co_app_races = [row['coapplicantrace1'], row['coapplicantrace2'], row['coapplicantrace3'],row['coapplicantrace4'],row['coapplicantrace5']]
		a_race = demo.make_race_list(app_races) #put applicant race codes in a list 0-5, 0 is blank field
		co_race = demo.make_race_list(co_app_races) #put co-applicant race codes in a list 0-5, 0 is blank field

		self.inputs['a_race'] = a_race
		self.inputs['co_race'] = co_race
		self.inputs['a ethn'] = row['applicantethnicity'] #ethnicity of the applicant
		self.inputs['co ethn'] = row['coapplicantethnicity'] #ethnicity of the co-applicant
		self.inputs['app sex'] = row['applicantsex']
		self.inputs['co app sex'] = row['coapplicantsex']
		self.inputs['income'] = row['applicantincome'] #relied upon income rounded to the nearest thousand
		self.inputs['denial reason1'] = self.adjust_denial_index(row['denialreason1'])
		self.inputs['denial reason2'] = self.adjust_denial_index(row['denialreason2'])
		self.inputs['denial reason3'] = self.adjust_denial_index(row['denialreason3'])
		self.inputs['year'] = row['asofdate'] #year or application or origination
		self.inputs['state code'] = row['statecode'] #two digit state code
		self.inputs['state name'] = row['statename'] #two character state abbreviation
		self.inputs['census tract'] = row['censustractnumber'] # this is currently the 7 digit tract used by the FFIEC, it includes a decimal prior to the last two digits
		self.inputs['county code'] = row['countycode'] #3 digit county code
		self.inputs['county name'] = row['countyname'] #full text county name
		self.inputs['MSA median income'] = row['ffiec_median_family_income'] #median income for the tract/msa
		self.inputs['income bracket'] = MSA_index.app_income_to_MSA(self.inputs) #sets the applicant income as an index by an applicant's income as a percent of MSA median
		self.inputs['app non white flag'] = demo.set_non_white(a_race) #flags the applicant as non-white if true, used in setting minority status and race
		self.inputs['co non white flag'] = demo.set_non_white(co_race) #flags the co applicant as non-white if true, used in setting minority status and race
		self.inputs['minority count'] = demo.minority_count(a_race) #determines if the number of minority races claimed by the applicant is 2 or greater
		self.inputs['joint status'] = demo.set_joint(self.inputs) #requires non white status flags be set prior to running set_joint
		self.inputs['race'] = demo.set_race(self.inputs, a_race) #requires joint status be set prior to running set_race
		self.inputs['ethnicity'] = demo.set_ethnicity(self.inputs) #requires  ethnicity be parsed prior to running set_ethnicity
		self.inputs['minority status'] = demo.set_minority_status(self.inputs) #requires non white flags be set prior to running set_minority_status
		self.inputs['gender'] = demo.set_gender(self.inputs)
		self.inputs['denial_list'] = self.denial_reasons_list(self.inputs['denial reason1'], self.inputs['denial reason2'], self.inputs['denial reason3'])
Exemplo n.º 18
0
	def parse_8_x(self, row):
		#note: sequence number did not exist prior to 2012 and HUD median income became FFIEC median income in 2012

		MSA_index = MSA_info() #contains functions for census tract characteristics
		demo=demographics() #contains functions for borrower characteristics
		a_race = [] #race lists will hold 5 integers with 0 replacing a blank entry
		co_race = [] #race lists will hold 5 integers with 0 replacing a blank entry

		#fill race lists from the demographics class
		app_races = [row['applicantrace1'], row['applicantrace2'], row['applicantrace3'],row['applicantrace4'],row['applicantrace5']]
		co_app_races = [row['coapplicantrace1'], row['coapplicantrace2'], row['coapplicantrace3'],row['coapplicantrace4'],row['coapplicantrace5']]
		a_race = demo.make_race_list(app_races) #put applicant race codes in a list 0-5, 0 is blank field
		co_race = demo.make_race_list(co_app_races) #put co-applicant race codes in a list 0-5, 0 is blank field

		self.inputs['a_race'] = a_race
		self.inputs['co_race'] = co_race
		self.inputs['a ethn'] = row['applicantethnicity'] #ethnicity of the applicant
		self.inputs['co ethn'] = row['coapplicantethnicity'] #ethnicity of the co-applicant
		self.inputs['app sex'] = row['applicantsex']
		self.inputs['co app sex'] = row['coapplicantsex']
		self.inputs['income'] = row['applicantincome'] #relied upon income rounded to the nearest thousand
		self.inputs['denial reason1'] = self.adjust_denial_index(row['denialreason1'])
		self.inputs['denial reason2'] = self.adjust_denial_index(row['denialreason2'])
		self.inputs['denial reason3'] = self.adjust_denial_index(row['denialreason3'])
		self.inputs['year'] = row['asofdate'] #year or application or origination
		self.inputs['state code'] = row['statecode'] #two digit state code
		self.inputs['state name'] = row['statename'] #two character state abbreviation
		self.inputs['census tract'] = row['censustractnumber'] # this is currently the 7 digit tract used by the FFIEC, it includes a decimal prior to the last two digits
		self.inputs['county code'] = row['countycode'] #3 digit county code
		self.inputs['county name'] = row['countyname'] #full text county name
		self.inputs['MSA median income'] = row['ffiec_median_family_income'] #median income for the tract/msa
		self.inputs['income bracket'] = MSA_index.app_income_to_MSA(self.inputs) #sets the applicant income as an index by an applicant's income as a percent of MSA median
		self.inputs['app non white flag'] = demo.set_non_white(a_race) #flags the applicant as non-white if true, used in setting minority status and race
		self.inputs['co non white flag'] = demo.set_non_white(co_race) #flags the co applicant as non-white if true, used in setting minority status and race
		self.inputs['minority count'] = demo.minority_count(a_race) #determines if the number of minority races claimed by the applicant is 2 or greater
		self.inputs['joint status'] = demo.set_joint(self.inputs) #requires non white status flags be set prior to running set_joint
		self.inputs['race'] = demo.set_race(self.inputs, a_race) #requires joint status be set prior to running set_race
		self.inputs['ethnicity'] = demo.set_ethnicity(self.inputs) #requires  ethnicity be parsed prior to running set_ethnicity
		self.inputs['minority status'] = demo.set_minority_status(self.inputs) #requires non white flags be set prior to running set_minority_status
		self.inputs['gender'] = demo.set_gender(self.inputs)
		self.inputs['denial_list'] = self.denial_reasons_list(self.inputs['denial reason1'], self.inputs['denial reason2'], self.inputs['denial reason3'])
Exemplo n.º 19
0
from demographics_indexing import demographics

demo = demographics()
print demo.rate_spread_index('1.80')
print demo.rate_spread_index('NA   ')
print demo.rate_spread_index('2.25')