Skip to content

Commit

Permalink
Merge pull request #18 from fullcontact/financeAlignment
Browse files Browse the repository at this point in the history
Finance alignment
  • Loading branch information
Ken Michie authored Feb 9, 2024
2 parents 53c0cb0 + da600d2 commit cbdadb3
Show file tree
Hide file tree
Showing 4 changed files with 362 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../.idea/
17 changes: 8 additions & 9 deletions fc/household.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,14 @@ type Presence struct {
}

type Finance struct {
CashValueBalanceHouseholdEstimate string `json:"cashValueBalanceHouseholdEstimate"`
FinancialDebtRangeEstimate string `json:"financialDebtRangeEstimate"`
HouseholdIncomeEstimate string `json:"income"`
NetWorthRange string `json:"netWorthRange"`
BankCard string `json:"bankCard"`
RetailCard string `json:"retailCard"`
ActiveLineOfCredit bool `json:"activeLineOfCredit"`
Bankruptcy bool `json:"bankruptcy"`
DiscretionaryIncomeEstimate int `json:"discretionaryIncomeEstimate"`
Income string `json:"income"`
DiscretionarySpendingIncome string `json:"discretionarySpendingIncome"`
FirstMortgageAmountInThousands string `json:"firstMortgageAmountInThousands"`
HomeMarketValueTaxRecord string `json:"homeMarketValueTaxRecord"`
ShortTermLiability string `json:"shortTermLiability"`
NetWorth string `json:"netWorth"`
WealthResources string `json:"wealthResources"`
PaymentMethodCreditCard string `json:"paymentMethodCreditCard"`
}

type LocationInfo struct {
Expand Down
23 changes: 15 additions & 8 deletions fc/person_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fullcontact

import (
"os"
"strings"
"testing"

Expand All @@ -9,8 +10,9 @@ import (

func TestPersonEnrich(t *testing.T) {
ch := make(chan *APIResponse)
respJson := "{\"fullName\":\"Marquita H Ross\",\"ageRange\":\"37-47\",\"gender\":\"Female\",\"location\":\"San Francisco, California, United States\",\"title\":\"Senior Petroleum Manager\",\"organization\":\"Mostow Co.\",\"twitter\":\"https://twitter.com/marqross91\",\"linkedin\":\"https://www.linkedin.com/in/marquita-ross-5b6b72192\",\"facebook\":null,\"bio\":\"Senior Petroleum Manager at Mostow Co.\",\"avatar\":\"https://img.fullcontact.com/sandbox/1gagrO2K67_oc5DLG_siVCpYVE5UvCu2Z.png\",\"website\":\"http://marquitaas8.com/\",\"details\":{\"name\":{\"given\":\"Marquita\",\"family\":\"Ross\",\"full\":\"Marquita H Ross\"},\"age\":{\"range\":\"35-44\",\"value\":42},\"gender\":\"Female\",\"household\":{\"familyInfo\":{\"totalAdults\":2,\"totalChildren\":1,\"totalPeopleInHousehold\":3},\"homeInfo\":{\"dwellingType\":\"Multi Family Dwelling/Apartment\",\"homeValueEstimate\":513,\"loanToValueEstimate\":4},\"locationInfo\":{\"seasonalAddress\":true,\"carrierRoute\":\"PO Box\",\"designatedMarketArea\":\"807\",\"coreBasedStatisticalArea\":\"41860 - San Francisco-Oakland-Hayward, CA Metropolitan Statistical Area\",\"nielsenCountySize\":\"B - All counties in the next largest set of metropolitan areas which toher account for 30% of U.S. households according to the 2000 Census. No non-metropolitan counties qualify as A or B counties.\",\"congressionalDistrict\":\"14\",\"numericCountyCode\":222},\"presence\":{\"multigenerationalResident\":\"PRESENT\",\"children\":\"PRESENT\"},\"finance\":{\"discretionaryIncomeEstimate\":45,\"financialDebtRangeEstimate\":\"$0\",\"income\":\"$150,000 - $199,999\",\"netWorthRange\":\"$50,000 - $74,999\",\"cashValueBalanceHouseholdEstimate\":\"$25,000 - $49,999\"}},\"demographics\":{\"gender\":\"Female\",\"age\":{\"range\":\"35-44\",\"value\":42},\"livingStatus\":\"Probable Homeowner\",\"maritalStatus\":\"MARRIED\",\"occupation\":\"Professional - Engineer/Industrial\"},\"survey\":{\"own\":{\"ownDigitalCamera\":true,\"ownDog\":true,\"ownSwimmingPool\":true,\"ownRv\":true},\"collectibles\":{\"general\":true,\"coins\":true,\"stamps\":true},\"creditCards\":{\"premium\":{\"amex\":true,\"store\":true,\"visaOrMasterCard\":true},\"regular\":{\"amex\":true,\"other\":true,\"visaOrMasterCard\":true},\"debit\":true},\"dietConcerns\":{\"general\":true,\"loseWeight\":true,\"vitaminSupplements\":true,\"healthy\":true},\"hobby\":{\"general\":true,\"baking\":true,\"cigarSmoking\":true,\"gourmetCooking\":true,\"cooking\":true,\"gardening\":{\"general\":true,\"flowers\":true},\"homeImprovement\":true,\"exercise3xPerWeek\":true,\"lowFatCooking\":true,\"diy\":true,\"spirituality\":true},\"onlinePurchaser\":true,\"investments\":true,\"music\":{\"general\":true,\"christianOrGospel\":true,\"classical\":true,\"other\":true,\"rhythmAndBlues\":true},\"reading\":{\"likesToRead\":true,\"bibleOrDevotional\":true,\"bestSellingFiction\":true,\"childrens\":true,\"history\":true,\"health\":true,\"naturalHealthRemedies\":true,\"entertainment\":true,\"worldNewsOrPolitics\":true,\"bestSellers\":true,\"magazines\":true},\"sporting\":{\"fitness\":true,\"walking\":true,\"running\":true},\"travel\":{\"general\":true,\"usBusiness\":true,\"casinoVacations\":true,\"frequentFlyer\":true},\"religious\":true,\"electronics\":{\"appleDevice\":true,\"cableTv\":true,\"highSpeedInternet\":true,\"dvdPlayer\":true,\"hdtv\":true,\"homeTheater\":true,\"other\":true},\"purchase\":{\"homeDecorating\":true,\"beautyProducts\":true,\"clubStores\":true,\"usesCoupons\":true}},\"finance\":{\"bankCard\":\"Multiple Bank Card\",\"activeLineOfCredit\":true,\"retailCard\":\"Multiple Retail Card\"},\"census\":{\"basicTractNumber\":145,\"basicBlockGroup\":2,\"year2010\":{\"educationLevel\":\"High School Diploma\",\"average\":{\"numberOfCarsInHousehold\":2.3000000000000003},\"percent\":{\"abovePovertyLevel\":74,\"belowPovertyLevel\":28,\"black\":17,\"blueCollarEmployed\":35,\"divorcedOrSeparated\":14,\"hispanic\":43,\"homesBuiltSince2000\":52,\"homeowner\":90,\"householdsWithChildren\":38,\"married\":36,\"mobileHome\":45,\"movedToAreaSince2000\":21,\"salariedProfessional\":35,\"singleFamilyHome\":43,\"vehicleOwnership\":84,\"white\":35},\"median\":{\"ageOfHouseholder\":23,\"effectiveBuyingIncome\":18,\"homeValue\":35,\"householdIncome\":18,\"householdIncomeByState\":69},\"populationDensity\":{\"centileInState\":67,\"centileInUs\":17},\"socioEconomicScore\":29}},\"buyer\":{\"catalog\":{\"payment\":{\"amx\":true,\"creditCard\":true,\"houseCharge\":true,\"masterCard\":true,\"retailCard\":true,\"visa\":true},\"apparel\":{\"general\":true,\"children\":true,\"men\":true,\"mensBigTall\":true,\"nonGenderSpecific\":true,\"womenPetiteSize\":true,\"womenPlusSize\":true},\"beauty\":true,\"books\":true,\"childrenProducts\":true,\"electronics\":true,\"furniture\":true,\"health\":true,\"jewelry\":true,\"music\":true,\"stationery\":true,\"travel\":true,\"videoEntertainment\":true},\"retail\":{\"apparel\":{\"general\":true,\"children\":true,\"women\":true},\"beauty\":true,\"books\":true,\"childrenProducts\":true,\"collectibles\":true,\"foodBeverages\":true,\"gift\":true,\"health\":true,\"homeFurnishings\":true,\"jewelry\":true,\"music\":true,\"stationery\":true,\"travel\":true}},\"emails\":[],\"phones\":[],\"profiles\":{\"twitter\":{\"username\":\"marqross91\",\"url\":\"https://twitter.com/marqross91\",\"bio\":\"Senior Petroleum Manager at Mostow Co.\",\"service\":\"twitter\"},\"pinterest\":{\"username\":\"marquitaross006\",\"url\":\"http://www.pinterest.com/marquitaross006/\",\"bio\":\"Senior Petroleum Manager at Mostow Co.\",\"service\":\"pinterest\"},\"linkedin\":{\"username\":\"marquita-ross-5b6b72192\",\"userid\":\"761326554\",\"url\":\"https://www.linkedin.com/in/marquita-ross-5b6b72192\",\"bio\":\"Senior Petroleum Manager at Mostow Co.\",\"service\":\"linkedin\"}},\"locations\":[{\"city\":\"San Francisco\",\"region\":\"California\",\"regionCode\":\"CA\",\"country\":\"United States\",\"countryCode\":\"US\",\"formatted\":\"San Francisco, California, United States\"}],\"employment\":[{\"name\":\"Mostow Co.\",\"current\":true,\"title\":\"Senior Petroleum Manager\",\"start\":{\"year\":2019,\"month\":9}}],\"photos\":[{\"label\":\"avatar\",\"value\":\"https://img.fullcontact.com/sandbox/1gagrO2K67_oc5DLG_siVCpYVE5UvCu2Z.png\"}],\"education\":[{\"name\":\"University of California, Berkeley\",\"degree\":\"Bachelors\",\"end\":{\"year\":1998}}],\"urls\":[{\"value\":\"http://marquitaas8.com/\"}],\"interests\":[]},\"extended\":{\"epsilon_key_1\": \"9\",\"epsilon_key_2\": \"H\",\"epsilon_key_3\": \"Q\",\"epsilon_key_4\": \"0\",\"epsilon_key_5\": \"11\"},\"isSandboxProfile\":true,\"updated\":\"1970-01-01\"}"
fcTestClient, testServer := getTestServerAndClient(personEnrichUrl, respJson, 200)
respJson, _ := os.ReadFile("person_test.json")

fcTestClient, testServer := getTestServerAndClient(personEnrichUrl, string(respJson), 200)
defer testServer.Close()
go fcTestClient.do(testServer.URL, nil, ch)
resp := <-ch
Expand Down Expand Up @@ -51,14 +53,19 @@ func TestPersonEnrich(t *testing.T) {
assert.Equal(t, 222, response.Details.Household.LocationInfo.NumericCountyCode)
assert.Equal(t, "PRESENT", response.Details.Household.Presence.MultigenerationalResident)
assert.Equal(t, "PRESENT", response.Details.Household.Presence.Children)
assert.Equal(t, 45, response.Details.Household.Finance.DiscretionaryIncomeEstimate)
assert.Equal(t, "$150,000 - $199,999", response.Details.Household.Finance.HouseholdIncomeEstimate)
assert.Equal(t, "$25,000 - $49,999", response.Details.Household.Finance.CashValueBalanceHouseholdEstimate)

// Finance
assert.Equal(t, "$30,000 - $39,999", response.Details.Household.Finance.Income)
assert.Equal(t, "$65,000 - $74,999", response.Details.Household.Finance.DiscretionarySpendingIncome)
assert.Equal(t, "5147", response.Details.Household.Finance.FirstMortgageAmountInThousands)
assert.Equal(t, "453", response.Details.Household.Finance.HomeMarketValueTaxRecord)
assert.Equal(t, "$50,000 or more", response.Details.Household.Finance.ShortTermLiability)
assert.Equal(t, "$150,000 - $249,999", response.Details.Household.Finance.NetWorth)
assert.Equal(t, "$250,000 - $499,999", response.Details.Household.Finance.WealthResources)
assert.Equal(t, "Y", response.Details.Household.Finance.PaymentMethodCreditCard)

assert.Equal(t, "Probable Homeowner", response.Details.Demographics.LivingStatus)
assert.Equal(t, "Professional - Engineer/Industrial", response.Details.Demographics.Occupation)
assert.Equal(t, "Multiple Bank Card", response.Details.Finance.BankCard)
assert.Equal(t, "Multiple Retail Card", response.Details.Finance.RetailCard)
assert.True(t, response.Details.Finance.ActiveLineOfCredit)
assert.Equal(t, 145, response.Details.Census.BasicTractNumber)
assert.Equal(t, 2, response.Details.Census.BasicBlockGroup)
assert.Equal(t, "High School Diploma", response.Details.Census.Year2010.EducationLevel)
Expand Down
Loading

0 comments on commit cbdadb3

Please sign in to comment.