us_geo 1.0.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +82 -0
  3. data/MIT_LICENSE.txt +21 -0
  4. data/README.md +77 -60
  5. data/UPDATING_TO_VERSION_2.md +172 -0
  6. data/VERSION +1 -0
  7. data/db/migrate/20190221054200_create_regions.rb +4 -2
  8. data/db/migrate/20190221054300_create_divisions.rb +4 -2
  9. data/db/migrate/20190221054400_create_states.rb +4 -2
  10. data/db/migrate/20190221054500_create_combined_statistical_areas.rb +4 -2
  11. data/db/migrate/20190221054600_create_core_based_statistical_areas.rb +4 -2
  12. data/db/migrate/20190221054650_create_metropolitan_divisions.rb +4 -2
  13. data/db/migrate/20190221054700_create_counties.rb +4 -3
  14. data/db/migrate/20190221054800_create_zctas.rb +4 -2
  15. data/db/migrate/20190221054900_create_zcta_counties.rb +4 -2
  16. data/db/migrate/20190221055000_create_urban_areas.rb +4 -2
  17. data/db/migrate/20190221055100_create_urban_area_counties.rb +4 -4
  18. data/db/migrate/20190221055200_create_zcta_urban_areas.rb +4 -4
  19. data/db/migrate/20190221060000_create_places.rb +4 -2
  20. data/db/migrate/20190221061000_create_place_counties.rb +4 -2
  21. data/db/migrate/20190221062000_create_zcta_places.rb +4 -4
  22. data/db/migrate/20190221063000_create_county_subdivisions.rb +4 -2
  23. data/db/migrate/20220722000000_allow_null_zcta_counties_demographics.rb +23 -0
  24. data/db/migrate/20220722000200_allow_null_zcta_places_demographics.rb +23 -0
  25. data/db/migrate/20230414000000_add_zcta_primary_place.rb +13 -0
  26. data/db/migrate/20230414000200_add_demographics_to_regions.rb +28 -0
  27. data/db/migrate/20230414000300_add_demographics_to_divisions.rb +28 -0
  28. data/db/migrate/20230414000400_add_demographics_to_states.rb +28 -0
  29. data/db/migrate/20230414000700_add_short_name_to_core_based_statistical_areas.rb +22 -0
  30. data/db/migrate/20230414000750_add_short_name_to_combined_statistical_areas.rb +22 -0
  31. data/db/migrate/20230414000800_create_zcta_mappings.rb +18 -0
  32. data/db/migrate/20230417000100_create_zcta_county_subdivisions.rb +22 -0
  33. data/db/migrate/20230417000200_add_unique_name_index_to_county_subdivisions.rb +26 -0
  34. data/db/migrate/20230417000250_add_zcta_primary_county_subdivision.rb +13 -0
  35. data/db/migrate/20230417000300_create_urban_area_county_subdivisions.rb +23 -0
  36. data/db/migrate/20230417000400_allow_null_urban_area_counties_demographics.rb +23 -0
  37. data/db/migrate/20230417000500_allow_null_zcta_urban_areas_demographics.rb +23 -0
  38. data/db/migrate/20230417000600_add_additional_time_zone_name_to_counties.rb +13 -0
  39. data/db/schema.rb +303 -0
  40. data/explorer_app/.gitattributes +7 -0
  41. data/explorer_app/.gitignore +34 -0
  42. data/explorer_app/Gemfile +38 -0
  43. data/explorer_app/Rakefile +6 -0
  44. data/explorer_app/app/assets/images/.keep +0 -0
  45. data/explorer_app/app/assets/stylesheets/application.css +1 -0
  46. data/explorer_app/app/controllers/application_controller.rb +64 -0
  47. data/explorer_app/app/controllers/combined_statistical_areas_controller.rb +12 -0
  48. data/explorer_app/app/controllers/concerns/.keep +0 -0
  49. data/explorer_app/app/controllers/core_based_statistical_areas_controller.rb +36 -0
  50. data/explorer_app/app/controllers/counties_controller.rb +22 -0
  51. data/explorer_app/app/controllers/county_subdivisions_controller.rb +23 -0
  52. data/explorer_app/app/controllers/divisions_controller.rb +27 -0
  53. data/explorer_app/app/controllers/home_controller.rb +6 -0
  54. data/explorer_app/app/controllers/metropolitan_divisions_controller.rb +27 -0
  55. data/explorer_app/app/controllers/places_controller.rb +23 -0
  56. data/explorer_app/app/controllers/regions_controller.rb +13 -0
  57. data/explorer_app/app/controllers/states_controller.rb +25 -0
  58. data/explorer_app/app/controllers/urban_areas_controller.rb +24 -0
  59. data/explorer_app/app/controllers/zctas_controller.rb +23 -0
  60. data/explorer_app/app/helpers/application_helper.rb +137 -0
  61. data/explorer_app/app/models/application_record.rb +3 -0
  62. data/explorer_app/app/models/concerns/.keep +0 -0
  63. data/explorer_app/app/views/combined_statistical_areas/_table.html.erb +18 -0
  64. data/explorer_app/app/views/combined_statistical_areas/index.html.erb +7 -0
  65. data/explorer_app/app/views/combined_statistical_areas/show.html.erb +52 -0
  66. data/explorer_app/app/views/core_based_statistical_areas/_table.html.erb +32 -0
  67. data/explorer_app/app/views/core_based_statistical_areas/index.html.erb +19 -0
  68. data/explorer_app/app/views/core_based_statistical_areas/show.html.erb +60 -0
  69. data/explorer_app/app/views/counties/_table.html.erb +64 -0
  70. data/explorer_app/app/views/counties/show.html.erb +96 -0
  71. data/explorer_app/app/views/county_subdivisions/_table.html.erb +48 -0
  72. data/explorer_app/app/views/county_subdivisions/show.html.erb +84 -0
  73. data/explorer_app/app/views/divisions/_table.html.erb +24 -0
  74. data/explorer_app/app/views/divisions/index.html.erb +3 -0
  75. data/explorer_app/app/views/divisions/show.html.erb +3 -0
  76. data/explorer_app/app/views/home/index.html.erb +23 -0
  77. data/explorer_app/app/views/layouts/application.html.erb +34 -0
  78. data/explorer_app/app/views/metropolitan_divisions/_table.html.erb +42 -0
  79. data/explorer_app/app/views/metropolitan_divisions/index.html.erb +8 -0
  80. data/explorer_app/app/views/metropolitan_divisions/show.html.erb +46 -0
  81. data/explorer_app/app/views/places/_table.html.erb +47 -0
  82. data/explorer_app/app/views/places/show.html.erb +92 -0
  83. data/explorer_app/app/views/regions/_table.html.erb +18 -0
  84. data/explorer_app/app/views/regions/index.html.erb +7 -0
  85. data/explorer_app/app/views/regions/show.html.erb +3 -0
  86. data/explorer_app/app/views/shared/_breadcrumbs.html.erb +13 -0
  87. data/explorer_app/app/views/shared/_demographics_cells.html.erb +5 -0
  88. data/explorer_app/app/views/shared/_demographics_headers.html.erb +5 -0
  89. data/explorer_app/app/views/states/_table.html.erb +31 -0
  90. data/explorer_app/app/views/states/index.html.erb +7 -0
  91. data/explorer_app/app/views/states/show.html.erb +54 -0
  92. data/explorer_app/app/views/urban_areas/_table.html.erb +45 -0
  93. data/explorer_app/app/views/urban_areas/index.html.erb +19 -0
  94. data/explorer_app/app/views/urban_areas/show.html.erb +68 -0
  95. data/explorer_app/app/views/zctas/_table.html.erb +60 -0
  96. data/explorer_app/app/views/zctas/show.html.erb +104 -0
  97. data/explorer_app/bin/bundle +109 -0
  98. data/explorer_app/bin/rails +4 -0
  99. data/explorer_app/bin/rake +4 -0
  100. data/explorer_app/bin/setup +33 -0
  101. data/explorer_app/config/application.rb +37 -0
  102. data/explorer_app/config/boot.rb +3 -0
  103. data/explorer_app/config/database.yml +13 -0
  104. data/explorer_app/config/environment.rb +5 -0
  105. data/explorer_app/config/environments/development.rb +59 -0
  106. data/explorer_app/config/initializers/filter_parameter_logging.rb +8 -0
  107. data/explorer_app/config/locales/en.yml +2 -0
  108. data/explorer_app/config/puma.rb +43 -0
  109. data/explorer_app/config/routes.rb +56 -0
  110. data/explorer_app/config.ru +6 -0
  111. data/explorer_app/db/seeds.rb +7 -0
  112. data/explorer_app/lib/assets/.keep +0 -0
  113. data/explorer_app/lib/tasks/.keep +0 -0
  114. data/explorer_app/log/.keep +0 -0
  115. data/explorer_app/public/404.html +67 -0
  116. data/explorer_app/public/422.html +67 -0
  117. data/explorer_app/public/500.html +66 -0
  118. data/explorer_app/public/apple-touch-icon-precomposed.png +0 -0
  119. data/explorer_app/public/apple-touch-icon.png +0 -0
  120. data/explorer_app/public/favicon.ico +0 -0
  121. data/explorer_app/public/robots.txt +1 -0
  122. data/explorer_app/tmp/.keep +0 -0
  123. data/explorer_app/tmp/pids/.keep +0 -0
  124. data/lib/tasks/us_geo/us_geo.rake +44 -3
  125. data/lib/us_geo/area.rb +44 -0
  126. data/lib/us_geo/base_record.rb +22 -16
  127. data/lib/us_geo/combined_statistical_area.rb +18 -8
  128. data/lib/us_geo/core_based_statistical_area.rb +24 -12
  129. data/lib/us_geo/county.rb +67 -16
  130. data/lib/us_geo/county_subdivision.rb +43 -7
  131. data/lib/us_geo/division.rb +17 -7
  132. data/lib/us_geo/metropolitan_area.rb +1 -5
  133. data/lib/us_geo/metropolitan_division.rb +17 -9
  134. data/lib/us_geo/micropolitan_area.rb +1 -5
  135. data/lib/us_geo/place.rb +61 -11
  136. data/lib/us_geo/place_county.rb +1 -4
  137. data/lib/us_geo/population.rb +26 -0
  138. data/lib/us_geo/region.rb +18 -8
  139. data/lib/us_geo/state.rb +32 -11
  140. data/lib/us_geo/urban_area.rb +46 -16
  141. data/lib/us_geo/urban_area_county.rb +4 -21
  142. data/lib/us_geo/urban_area_county_subdivision.rb +51 -0
  143. data/lib/us_geo/urban_cluster.rb +1 -5
  144. data/lib/us_geo/urbanized_area.rb +1 -5
  145. data/lib/us_geo/version.rb +1 -1
  146. data/lib/us_geo/zcta.rb +90 -13
  147. data/lib/us_geo/zcta_county.rb +5 -22
  148. data/lib/us_geo/zcta_county_subdivision.rb +51 -0
  149. data/lib/us_geo/zcta_mapping.rb +35 -0
  150. data/lib/us_geo/zcta_place.rb +5 -12
  151. data/lib/us_geo/zcta_urban_area.rb +3 -20
  152. data/lib/us_geo.rb +34 -31
  153. data/us_geo.gemspec +36 -0
  154. metadata +125 -129
  155. data/Gemfile +0 -5
  156. data/Gemfile.lock +0 -75
  157. data/Rakefile +0 -18
  158. data/db/migrate/20190221054490_create_designated_market_areas.rb +0 -16
  159. data/lib/us_geo/demographics.rb +0 -25
  160. data/lib/us_geo/designated_market_area.rb +0 -30
  161. data/spec/spec_helper.rb +0 -22
  162. data/spec/us_geo/base_record_spec.rb +0 -67
  163. data/spec/us_geo/combined_statistical_area_spec.rb +0 -33
  164. data/spec/us_geo/core_based_statistical_area_spec.rb +0 -56
  165. data/spec/us_geo/county_spec.rb +0 -131
  166. data/spec/us_geo/county_subdivision_spec.rb +0 -37
  167. data/spec/us_geo/demographics_spec.rb +0 -19
  168. data/spec/us_geo/designated_market_area_spec.rb +0 -29
  169. data/spec/us_geo/division_spec.rb +0 -37
  170. data/spec/us_geo/metropolitan_division_spec.rb +0 -41
  171. data/spec/us_geo/place_county_spec.rb +0 -39
  172. data/spec/us_geo/place_spec.rb +0 -71
  173. data/spec/us_geo/region_spec.rb +0 -36
  174. data/spec/us_geo/state_spec.rb +0 -70
  175. data/spec/us_geo/urban_area_county_spec.rb +0 -82
  176. data/spec/us_geo/urban_area_spec.rb +0 -98
  177. data/spec/us_geo/zcta_county_spec.rb +0 -82
  178. data/spec/us_geo/zcta_place_spec.rb +0 -82
  179. data/spec/us_geo/zcta_spec.rb +0 -99
  180. data/spec/us_geo/zcta_urban_area_spec.rb +0 -82
@@ -1,11 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module USGeo
4
-
5
4
  # Mapping of ZCTA's to urban areas they overlap with.
6
5
  class ZctaUrbanArea < BaseRecord
7
-
8
- include Demographics
6
+ include Area
9
7
 
10
8
  belongs_to :zcta, foreign_key: :zipcode, inverse_of: :zcta_urban_areas
11
9
  belongs_to :urban_area, foreign_key: :urban_area_geoid, inverse_of: :zcta_urban_areas
@@ -14,8 +12,6 @@ module USGeo
14
12
  validates :urban_area_geoid, length: {is: 5}
15
13
  validates :land_area, numericality: true, presence: true
16
14
  validates :water_area, numericality: true, presence: true
17
- validates :population, numericality: {only_integer: true}, presence: true
18
- validates :housing_units, numericality: {only_integer: true}, presence: true
19
15
 
20
16
  class << self
21
17
  def load!(uri = nil)
@@ -24,21 +20,14 @@ module USGeo
24
20
  import! do
25
21
  load_data_file(location) do |row|
26
22
  load_record!(zipcode: row["ZCTA5"], urban_area_geoid: row["Urban Area GEOID"]) do |record|
27
- record.population = row["Population"]
28
- record.housing_units = row["Housing Units"]
29
- record.land_area = area_meters_to_miles(row["Land Area"])
30
- record.water_area = area_meters_to_miles(row["Water Area"])
23
+ record.land_area = row["Land Area"]
24
+ record.water_area = row["Water Area"]
31
25
  end
32
26
  end
33
27
  end
34
28
  end
35
29
  end
36
30
 
37
- # Percentage of the ZCTA population.
38
- def percent_zcta_population
39
- population.to_f / zcta.population.to_f
40
- end
41
-
42
31
  # Percentage of the ZCTA land area.
43
32
  def percent_zcta_land_area
44
33
  land_area / zcta.land_area
@@ -49,11 +38,6 @@ module USGeo
49
38
  total_area / zcta.total_area
50
39
  end
51
40
 
52
- # Percentage of the urban area population.
53
- def percent_urban_area_population
54
- population.to_f / urban_area.population.to_f
55
- end
56
-
57
41
  # Percentage of the urban area land area.
58
42
  def percent_urban_area_land_area
59
43
  land_area / urban_area.land_area
@@ -63,6 +47,5 @@ module USGeo
63
47
  def percent_urban_area_total_area
64
48
  total_area / urban_area.total_area
65
49
  end
66
-
67
50
  end
68
51
  end
data/lib/us_geo.rb CHANGED
@@ -2,36 +2,40 @@
2
2
 
3
3
  require "active_record"
4
4
 
5
- require_relative 'us_geo/version'
6
- require_relative 'us_geo/demographics'
7
- require_relative 'us_geo/base_record'
8
- require_relative 'us_geo/region'
9
- require_relative 'us_geo/division'
10
- require_relative 'us_geo/state'
11
- require_relative 'us_geo/designated_market_area'
12
- require_relative 'us_geo/combined_statistical_area'
13
- require_relative 'us_geo/core_based_statistical_area'
14
- require_relative 'us_geo/metropolitan_area'
15
- require_relative 'us_geo/micropolitan_area'
16
- require_relative 'us_geo/metropolitan_division'
17
- require_relative 'us_geo/county'
18
- require_relative 'us_geo/county_subdivision'
19
- require_relative 'us_geo/urban_area'
20
- require_relative 'us_geo/urbanized_area'
21
- require_relative 'us_geo/urban_cluster'
22
- require_relative 'us_geo/urban_area_county'
23
- require_relative 'us_geo/place'
24
- require_relative 'us_geo/place_county'
25
- require_relative 'us_geo/zcta'
26
- require_relative 'us_geo/zcta_urban_area'
27
- require_relative 'us_geo/zcta_county'
28
- require_relative 'us_geo/zcta_place'
29
-
30
- require_relative 'us_geo/engine' if defined?(::Rails::Engine)
5
+ require_relative "us_geo/version"
6
+
7
+ require_relative "us_geo/area"
8
+ require_relative "us_geo/population"
9
+ require_relative "us_geo/base_record"
10
+
11
+ require_relative "us_geo/region"
12
+ require_relative "us_geo/division"
13
+ require_relative "us_geo/state"
14
+ require_relative "us_geo/combined_statistical_area"
15
+ require_relative "us_geo/core_based_statistical_area"
16
+ require_relative "us_geo/metropolitan_area"
17
+ require_relative "us_geo/micropolitan_area"
18
+ require_relative "us_geo/metropolitan_division"
19
+ require_relative "us_geo/county"
20
+ require_relative "us_geo/county_subdivision"
21
+ require_relative "us_geo/place"
22
+ require_relative "us_geo/place_county"
23
+ require_relative "us_geo/urban_area"
24
+ require_relative "us_geo/urban_area_county"
25
+ require_relative "us_geo/urban_area_county_subdivision"
26
+ require_relative "us_geo/urban_cluster"
27
+ require_relative "us_geo/urbanized_area"
28
+ require_relative "us_geo/zcta"
29
+ require_relative "us_geo/zcta_county"
30
+ require_relative "us_geo/zcta_county_subdivision"
31
+ require_relative "us_geo/zcta_mapping"
32
+ require_relative "us_geo/zcta_place"
33
+ require_relative "us_geo/zcta_urban_area"
34
+
35
+ require_relative "us_geo/engine" if defined?(::Rails::Engine)
31
36
 
32
37
  module USGeo
33
-
34
- BASE_DATA_URI = "https://raw.githubusercontent.com/bdurand/us_geo/master/data/dist"
38
+ BASE_DATA_URI = "https://raw.githubusercontent.com/bdurand/us_geo/master/data/2020_dist"
35
39
 
36
40
  class << self
37
41
  # The root URI as a string of where to find the data files. This can be a URL
@@ -41,13 +45,12 @@ module USGeo
41
45
  if defined?(@base_data_uri) && @base_data_uri
42
46
  @base_data_uri
43
47
  else
44
- BASE_DATA_URI
48
+ ENV.fetch("US_GEO_BASE_DATA_URI", BASE_DATA_URI)
45
49
  end
46
50
  end
47
51
 
48
52
  def base_data_uri=(value)
49
- @base_data_uri = (value.nil? ? nil : value.to_s)
53
+ @base_data_uri = value&.to_s
50
54
  end
51
55
  end
52
-
53
56
  end
data/us_geo.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ Gem::Specification.new do |spec|
2
+ spec.name = "us_geo"
3
+ spec.version = File.read(File.expand_path("../VERSION", __FILE__)).strip
4
+ spec.authors = ["Brian Durand"]
5
+ spec.email = ["bbdurand@gmail.com"]
6
+
7
+ spec.summary = "Collection of geographic data for the United States for use with ActiveRecord"
8
+ spec.homepage = "https://github.com/bdurand/us_geo"
9
+ spec.license = "MIT"
10
+
11
+ # Specify which files should be added to the gem when it is released.
12
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
13
+ ignore_files = %w[
14
+ .
15
+ Appraisals
16
+ Gemfile
17
+ Gemfile.lock
18
+ Rakefile
19
+ bin/
20
+ gemfiles/
21
+ spec/
22
+ data/
23
+ sampleapp/
24
+ ]
25
+ spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| ignore_files.any? { |path| f.start_with?(path) } }
27
+ end
28
+
29
+ spec.require_paths = ["lib"]
30
+
31
+ spec.add_dependency "activerecord", ">= 5.2"
32
+
33
+ spec.add_development_dependency "bundler"
34
+
35
+ spec.required_ruby_version = ">= 2.6"
36
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: us_geo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-23 00:00:00.000000000 Z
11
+ date: 2023-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,86 +16,16 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '5.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
26
+ version: '5.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.16'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.16'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '10.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '10.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.8'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.8'
69
- - !ruby/object:Gem::Dependency
70
- name: sqlite3
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '1.3'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '1.3'
83
- - !ruby/object:Gem::Dependency
84
- name: webmock
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.4'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '3.4'
97
- - !ruby/object:Gem::Dependency
98
- name: appraisal
99
29
  requirement: !ruby/object:Gem::Requirement
100
30
  requirements:
101
31
  - - ">="
@@ -108,20 +38,21 @@ dependencies:
108
38
  - - ">="
109
39
  - !ruby/object:Gem::Version
110
40
  version: '0'
111
- description:
112
- email:
41
+ description:
42
+ email:
43
+ - bbdurand@gmail.com
113
44
  executables: []
114
45
  extensions: []
115
46
  extra_rdoc_files: []
116
47
  files:
117
- - Gemfile
118
- - Gemfile.lock
48
+ - CHANGELOG.md
49
+ - MIT_LICENSE.txt
119
50
  - README.md
120
- - Rakefile
51
+ - UPDATING_TO_VERSION_2.md
52
+ - VERSION
121
53
  - db/migrate/20190221054200_create_regions.rb
122
54
  - db/migrate/20190221054300_create_divisions.rb
123
55
  - db/migrate/20190221054400_create_states.rb
124
- - db/migrate/20190221054490_create_designated_market_areas.rb
125
56
  - db/migrate/20190221054500_create_combined_statistical_areas.rb
126
57
  - db/migrate/20190221054600_create_core_based_statistical_areas.rb
127
58
  - db/migrate/20190221054650_create_metropolitan_divisions.rb
@@ -135,15 +66,115 @@ files:
135
66
  - db/migrate/20190221061000_create_place_counties.rb
136
67
  - db/migrate/20190221062000_create_zcta_places.rb
137
68
  - db/migrate/20190221063000_create_county_subdivisions.rb
69
+ - db/migrate/20220722000000_allow_null_zcta_counties_demographics.rb
70
+ - db/migrate/20220722000200_allow_null_zcta_places_demographics.rb
71
+ - db/migrate/20230414000000_add_zcta_primary_place.rb
72
+ - db/migrate/20230414000200_add_demographics_to_regions.rb
73
+ - db/migrate/20230414000300_add_demographics_to_divisions.rb
74
+ - db/migrate/20230414000400_add_demographics_to_states.rb
75
+ - db/migrate/20230414000700_add_short_name_to_core_based_statistical_areas.rb
76
+ - db/migrate/20230414000750_add_short_name_to_combined_statistical_areas.rb
77
+ - db/migrate/20230414000800_create_zcta_mappings.rb
78
+ - db/migrate/20230417000100_create_zcta_county_subdivisions.rb
79
+ - db/migrate/20230417000200_add_unique_name_index_to_county_subdivisions.rb
80
+ - db/migrate/20230417000250_add_zcta_primary_county_subdivision.rb
81
+ - db/migrate/20230417000300_create_urban_area_county_subdivisions.rb
82
+ - db/migrate/20230417000400_allow_null_urban_area_counties_demographics.rb
83
+ - db/migrate/20230417000500_allow_null_zcta_urban_areas_demographics.rb
84
+ - db/migrate/20230417000600_add_additional_time_zone_name_to_counties.rb
85
+ - db/schema.rb
86
+ - explorer_app/.gitattributes
87
+ - explorer_app/.gitignore
88
+ - explorer_app/Gemfile
89
+ - explorer_app/Rakefile
90
+ - explorer_app/app/assets/images/.keep
91
+ - explorer_app/app/assets/stylesheets/application.css
92
+ - explorer_app/app/controllers/application_controller.rb
93
+ - explorer_app/app/controllers/combined_statistical_areas_controller.rb
94
+ - explorer_app/app/controllers/concerns/.keep
95
+ - explorer_app/app/controllers/core_based_statistical_areas_controller.rb
96
+ - explorer_app/app/controllers/counties_controller.rb
97
+ - explorer_app/app/controllers/county_subdivisions_controller.rb
98
+ - explorer_app/app/controllers/divisions_controller.rb
99
+ - explorer_app/app/controllers/home_controller.rb
100
+ - explorer_app/app/controllers/metropolitan_divisions_controller.rb
101
+ - explorer_app/app/controllers/places_controller.rb
102
+ - explorer_app/app/controllers/regions_controller.rb
103
+ - explorer_app/app/controllers/states_controller.rb
104
+ - explorer_app/app/controllers/urban_areas_controller.rb
105
+ - explorer_app/app/controllers/zctas_controller.rb
106
+ - explorer_app/app/helpers/application_helper.rb
107
+ - explorer_app/app/models/application_record.rb
108
+ - explorer_app/app/models/concerns/.keep
109
+ - explorer_app/app/views/combined_statistical_areas/_table.html.erb
110
+ - explorer_app/app/views/combined_statistical_areas/index.html.erb
111
+ - explorer_app/app/views/combined_statistical_areas/show.html.erb
112
+ - explorer_app/app/views/core_based_statistical_areas/_table.html.erb
113
+ - explorer_app/app/views/core_based_statistical_areas/index.html.erb
114
+ - explorer_app/app/views/core_based_statistical_areas/show.html.erb
115
+ - explorer_app/app/views/counties/_table.html.erb
116
+ - explorer_app/app/views/counties/show.html.erb
117
+ - explorer_app/app/views/county_subdivisions/_table.html.erb
118
+ - explorer_app/app/views/county_subdivisions/show.html.erb
119
+ - explorer_app/app/views/divisions/_table.html.erb
120
+ - explorer_app/app/views/divisions/index.html.erb
121
+ - explorer_app/app/views/divisions/show.html.erb
122
+ - explorer_app/app/views/home/index.html.erb
123
+ - explorer_app/app/views/layouts/application.html.erb
124
+ - explorer_app/app/views/metropolitan_divisions/_table.html.erb
125
+ - explorer_app/app/views/metropolitan_divisions/index.html.erb
126
+ - explorer_app/app/views/metropolitan_divisions/show.html.erb
127
+ - explorer_app/app/views/places/_table.html.erb
128
+ - explorer_app/app/views/places/show.html.erb
129
+ - explorer_app/app/views/regions/_table.html.erb
130
+ - explorer_app/app/views/regions/index.html.erb
131
+ - explorer_app/app/views/regions/show.html.erb
132
+ - explorer_app/app/views/shared/_breadcrumbs.html.erb
133
+ - explorer_app/app/views/shared/_demographics_cells.html.erb
134
+ - explorer_app/app/views/shared/_demographics_headers.html.erb
135
+ - explorer_app/app/views/states/_table.html.erb
136
+ - explorer_app/app/views/states/index.html.erb
137
+ - explorer_app/app/views/states/show.html.erb
138
+ - explorer_app/app/views/urban_areas/_table.html.erb
139
+ - explorer_app/app/views/urban_areas/index.html.erb
140
+ - explorer_app/app/views/urban_areas/show.html.erb
141
+ - explorer_app/app/views/zctas/_table.html.erb
142
+ - explorer_app/app/views/zctas/show.html.erb
143
+ - explorer_app/bin/bundle
144
+ - explorer_app/bin/rails
145
+ - explorer_app/bin/rake
146
+ - explorer_app/bin/setup
147
+ - explorer_app/config.ru
148
+ - explorer_app/config/application.rb
149
+ - explorer_app/config/boot.rb
150
+ - explorer_app/config/database.yml
151
+ - explorer_app/config/environment.rb
152
+ - explorer_app/config/environments/development.rb
153
+ - explorer_app/config/initializers/filter_parameter_logging.rb
154
+ - explorer_app/config/locales/en.yml
155
+ - explorer_app/config/puma.rb
156
+ - explorer_app/config/routes.rb
157
+ - explorer_app/db/seeds.rb
158
+ - explorer_app/lib/assets/.keep
159
+ - explorer_app/lib/tasks/.keep
160
+ - explorer_app/log/.keep
161
+ - explorer_app/public/404.html
162
+ - explorer_app/public/422.html
163
+ - explorer_app/public/500.html
164
+ - explorer_app/public/apple-touch-icon-precomposed.png
165
+ - explorer_app/public/apple-touch-icon.png
166
+ - explorer_app/public/favicon.ico
167
+ - explorer_app/public/robots.txt
168
+ - explorer_app/tmp/.keep
169
+ - explorer_app/tmp/pids/.keep
138
170
  - lib/tasks/us_geo/us_geo.rake
139
171
  - lib/us_geo.rb
172
+ - lib/us_geo/area.rb
140
173
  - lib/us_geo/base_record.rb
141
174
  - lib/us_geo/combined_statistical_area.rb
142
175
  - lib/us_geo/core_based_statistical_area.rb
143
176
  - lib/us_geo/county.rb
144
177
  - lib/us_geo/county_subdivision.rb
145
- - lib/us_geo/demographics.rb
146
- - lib/us_geo/designated_market_area.rb
147
178
  - lib/us_geo/division.rb
148
179
  - lib/us_geo/engine.rb
149
180
  - lib/us_geo/metropolitan_area.rb
@@ -151,42 +182,27 @@ files:
151
182
  - lib/us_geo/micropolitan_area.rb
152
183
  - lib/us_geo/place.rb
153
184
  - lib/us_geo/place_county.rb
185
+ - lib/us_geo/population.rb
154
186
  - lib/us_geo/region.rb
155
187
  - lib/us_geo/state.rb
156
188
  - lib/us_geo/urban_area.rb
157
189
  - lib/us_geo/urban_area_county.rb
190
+ - lib/us_geo/urban_area_county_subdivision.rb
158
191
  - lib/us_geo/urban_cluster.rb
159
192
  - lib/us_geo/urbanized_area.rb
160
193
  - lib/us_geo/version.rb
161
194
  - lib/us_geo/zcta.rb
162
195
  - lib/us_geo/zcta_county.rb
196
+ - lib/us_geo/zcta_county_subdivision.rb
197
+ - lib/us_geo/zcta_mapping.rb
163
198
  - lib/us_geo/zcta_place.rb
164
199
  - lib/us_geo/zcta_urban_area.rb
165
- - spec/spec_helper.rb
166
- - spec/us_geo/base_record_spec.rb
167
- - spec/us_geo/combined_statistical_area_spec.rb
168
- - spec/us_geo/core_based_statistical_area_spec.rb
169
- - spec/us_geo/county_spec.rb
170
- - spec/us_geo/county_subdivision_spec.rb
171
- - spec/us_geo/demographics_spec.rb
172
- - spec/us_geo/designated_market_area_spec.rb
173
- - spec/us_geo/division_spec.rb
174
- - spec/us_geo/metropolitan_division_spec.rb
175
- - spec/us_geo/place_county_spec.rb
176
- - spec/us_geo/place_spec.rb
177
- - spec/us_geo/region_spec.rb
178
- - spec/us_geo/state_spec.rb
179
- - spec/us_geo/urban_area_county_spec.rb
180
- - spec/us_geo/urban_area_spec.rb
181
- - spec/us_geo/zcta_county_spec.rb
182
- - spec/us_geo/zcta_place_spec.rb
183
- - spec/us_geo/zcta_spec.rb
184
- - spec/us_geo/zcta_urban_area_spec.rb
185
- homepage:
200
+ - us_geo.gemspec
201
+ homepage: https://github.com/bdurand/us_geo
186
202
  licenses:
187
203
  - MIT
188
204
  metadata: {}
189
- post_install_message:
205
+ post_install_message:
190
206
  rdoc_options: []
191
207
  require_paths:
192
208
  - lib
@@ -194,35 +210,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
210
  requirements:
195
211
  - - ">="
196
212
  - !ruby/object:Gem::Version
197
- version: '0'
213
+ version: '2.6'
198
214
  required_rubygems_version: !ruby/object:Gem::Requirement
199
215
  requirements:
200
216
  - - ">="
201
217
  - !ruby/object:Gem::Version
202
218
  version: '0'
203
219
  requirements: []
204
- rubygems_version: 3.0.3
205
- signing_key:
220
+ rubygems_version: 3.4.12
221
+ signing_key:
206
222
  specification_version: 4
207
223
  summary: Collection of geographic data for the United States for use with ActiveRecord
208
- test_files:
209
- - spec/spec_helper.rb
210
- - spec/us_geo/designated_market_area_spec.rb
211
- - spec/us_geo/zcta_spec.rb
212
- - spec/us_geo/county_spec.rb
213
- - spec/us_geo/zcta_urban_area_spec.rb
214
- - spec/us_geo/urban_area_county_spec.rb
215
- - spec/us_geo/place_county_spec.rb
216
- - spec/us_geo/place_spec.rb
217
- - spec/us_geo/metropolitan_division_spec.rb
218
- - spec/us_geo/state_spec.rb
219
- - spec/us_geo/zcta_county_spec.rb
220
- - spec/us_geo/core_based_statistical_area_spec.rb
221
- - spec/us_geo/demographics_spec.rb
222
- - spec/us_geo/county_subdivision_spec.rb
223
- - spec/us_geo/zcta_place_spec.rb
224
- - spec/us_geo/region_spec.rb
225
- - spec/us_geo/urban_area_spec.rb
226
- - spec/us_geo/combined_statistical_area_spec.rb
227
- - spec/us_geo/division_spec.rb
228
- - spec/us_geo/base_record_spec.rb
224
+ test_files: []
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- gemspec
data/Gemfile.lock DELETED
@@ -1,75 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- us_geo (1.0.3)
5
- activerecord (>= 5.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- activemodel (5.2.3)
11
- activesupport (= 5.2.3)
12
- activerecord (5.2.3)
13
- activemodel (= 5.2.3)
14
- activesupport (= 5.2.3)
15
- arel (>= 9.0)
16
- activesupport (5.2.3)
17
- concurrent-ruby (~> 1.0, >= 1.0.2)
18
- i18n (>= 0.7, < 2)
19
- minitest (~> 5.1)
20
- tzinfo (~> 1.1)
21
- addressable (2.6.0)
22
- public_suffix (>= 2.0.2, < 4.0)
23
- appraisal (2.2.0)
24
- bundler
25
- rake
26
- thor (>= 0.14.0)
27
- arel (9.0.0)
28
- concurrent-ruby (1.1.5)
29
- crack (0.4.3)
30
- safe_yaml (~> 1.0.0)
31
- diff-lcs (1.3)
32
- hashdiff (0.3.7)
33
- i18n (1.6.0)
34
- concurrent-ruby (~> 1.0)
35
- minitest (5.11.3)
36
- public_suffix (3.0.3)
37
- rake (10.5.0)
38
- rspec (3.8.0)
39
- rspec-core (~> 3.8.0)
40
- rspec-expectations (~> 3.8.0)
41
- rspec-mocks (~> 3.8.0)
42
- rspec-core (3.8.0)
43
- rspec-support (~> 3.8.0)
44
- rspec-expectations (3.8.2)
45
- diff-lcs (>= 1.2.0, < 2.0)
46
- rspec-support (~> 3.8.0)
47
- rspec-mocks (3.8.0)
48
- diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.8.0)
50
- rspec-support (3.8.0)
51
- safe_yaml (1.0.4)
52
- sqlite3 (1.3.13)
53
- thor (0.20.3)
54
- thread_safe (0.3.6)
55
- tzinfo (1.2.5)
56
- thread_safe (~> 0.1)
57
- webmock (3.4.2)
58
- addressable (>= 2.3.6)
59
- crack (>= 0.3.2)
60
- hashdiff
61
-
62
- PLATFORMS
63
- ruby
64
-
65
- DEPENDENCIES
66
- appraisal
67
- bundler (~> 1.16)
68
- rake (~> 10.0)
69
- rspec (~> 3.8)
70
- sqlite3 (>= 1.3)
71
- us_geo!
72
- webmock (~> 3.4)
73
-
74
- BUNDLED WITH
75
- 1.17.2
data/Rakefile DELETED
@@ -1,18 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :appraisals
7
-
8
- desc "run the specs using appraisal"
9
- task :appraisals do
10
- exec "bundle exec appraisal rake spec"
11
- end
12
-
13
- namespace :appraisals do
14
- desc "install all the appraisal gemspecs"
15
- task :install do
16
- exec "bundle exec appraisal install"
17
- end
18
- end
@@ -1,16 +0,0 @@
1
- class CreateDesignatedMarketAreas < ActiveRecord::Migration[5.0]
2
-
3
- def up
4
- create_table :us_geo_designated_market_areas, id: false do |t|
5
- t.string :code, primary_key: true, null: false, limit: 3
6
- t.string :name, null: false, limit: 60, index: {unique: true}
7
- t.datetime :updated_at, null: false
8
- t.integer :status, null: false, default: 0, limit: 1
9
- end
10
- end
11
-
12
- def down
13
- drop_table :us_geo_designated_market_areas
14
- end
15
-
16
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module USGeo
4
-
5
- # This module is mixed into all models. Note that the area given for land and water
6
- # is in square miles.
7
- module Demographics
8
-
9
- # Population per square mile.
10
- def population_density
11
- population.to_f / land_area if population && land_area
12
- end
13
-
14
- # Total area of both land an water in square miles
15
- def total_area
16
- land_area.to_f + water_area.to_f if land_area
17
- end
18
-
19
- # The fraction of the area that is composed of land instead of water.
20
- def percent_land
21
- land_area / total_area if land_area
22
- end
23
-
24
- end
25
- end