Skip to content

Commit

Permalink
Merge branch 'develop' into HZA-419-Modify-HUBZone-map-API-to-accept-…
Browse files Browse the repository at this point in the history
…lat-long-parameters
  • Loading branch information
bryaNgwa committed May 16, 2024
2 parents dc19cfc + cc18eb1 commit 891a6a0
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 1 deletion.
30 changes: 29 additions & 1 deletion app/models/hubzone_util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,35 @@ def append_other_information(results)
results[:other_information][:alerts][:likely_qda_designations] = likely_qda_designations if likely_qda_designations.present?

# get congressional district
results[:other_information][:congressional_district] = congressional_district_assertion location || nil
#results[:other_information][:congressional_district] = congressional_district_assertion location || nil

congressional_district = {}
%w[CensusCounty CensusTract CongressionalDistrict DistrictOffice].each do |assertion_type|
puts "\n==congressional_district=0"
hz_assertion = "#{assertion_type}Assertion".constantize
hz_v = hz_assertion.assertion location
puts "\n==congressional_district=1"
# puts defined(hz_v)
puts hz_v[0]
puts hz_v.class
puts hz_v.length
#results[:other_information][:congressional_district] += hz_assertion.assertion location
if hz_v.length>0
puts "\n==congressional_district=3"
congressional_district = congressional_district.merge( hz_v[0] )
end
end
puts "\n==congressional_district="

puts congressional_district
if congressional_district.length>0
results[:other_information][:congressional_district] = [congressional_district]
else
results[:other_information][:congressional_district] = congressional_district_assertion location || nil
end



end

# query the likley_qda view and append results
Expand Down
23 changes: 23 additions & 0 deletions app/models/us_county_assertion.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

# Allows for assertion of a location against the likely_qda HubZone layer
class UsCountyAssertion
extend AssertionHelper

class << self
def assertion(location)
congressional_districts = []
assertion_by_type('data.tl_2021_us_county', location).each do |cd|
puts "\n== query result US-county"
puts cd
cd['hz_type'] = 'us_county'
cd['tract_fips'] = cd['countyfp']
cd['county'] =cd['namelsadco']
cd['state'] = cd['state_name']
cd['expires'] =nil
congressional_districts.push(cd)
end
congressional_districts
end
end
end

22 changes: 22 additions & 0 deletions app/models/us_tract_assertion.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

# Allows for assertion of a location against the likely_qda HubZone layer
class UsTractAssertion
extend AssertionHelper

class << self
def assertion(location)
congressional_districts = []
assertion_by_type('data.tl_2021_us_tract', location).each do |cd|
puts "\n== query result US-Tract"
puts cd
cd['hz_type'] = 'us_tract'
cd['tract_fips'] = cd['countyfp']
cd['county'] =cd['namelsadco']
cd['state'] = cd['state_name']
cd['expires'] =nil
congressional_districts.push(cd)
end
congressional_districts
end
end
end

0 comments on commit 891a6a0

Please sign in to comment.