us_geo 1.0.2 → 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 +127 -132
  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
@@ -0,0 +1,84 @@
1
+ <%= breadcrumbs @county_subdivision.name, active: @county_subdivision %>
2
+
3
+ <h1><%= @county_subdivision.name %></h1>
4
+
5
+ <table class="table table-striped">
6
+ <tbody>
7
+ <tr>
8
+ <th>GEOID</th>
9
+ <td><%= @county_subdivision.geoid %></td>
10
+ </tr>
11
+ <tr>
12
+ <th>County</th>
13
+ <td><%= link_to @county_subdivision.county.name, county_path(@county_subdivision.county, breadcrumb_params) %></td>
14
+ </tr>
15
+ <tr>
16
+ <th>State</th>
17
+ <td><%= link_to @county_subdivision.state.name, state_path(@county_subdivision.state, breadcrumb_params) %></td>
18
+ </tr>
19
+ <tr>
20
+ <th>FIP Class Code</th>
21
+ <td><%= @county_subdivision.fips_class_code %></td>
22
+ </tr>
23
+ <tr>
24
+ <th>Time Zone</th>
25
+ <td><%= @county_subdivision.time_zone_name %></td>
26
+ </tr>
27
+ <% if @county_subdivision.combined_statistical_area %>
28
+ <tr>
29
+ <th>Combined Statistical Area</th>
30
+ <td><%= link_to @county_subdivision.combined_statistical_area.name, combined_statistical_area_path(@county_subdivision.combined_statistical_area, breadcrumb_params) %></td>
31
+ </tr>
32
+ <% end %>
33
+ <% if @county_subdivision.core_based_statistical_area %>
34
+ <tr>
35
+ <th>Core Based Statistical Area</th>
36
+ <td><%= link_to @county_subdivision.core_based_statistical_area.name, core_based_statistical_area_path(@county_subdivision.core_based_statistical_area, breadcrumb_params) %></td>
37
+ </tr>
38
+ <% end %>
39
+ <% if @county_subdivision.metropolitan_division %>
40
+ <tr>
41
+ <th>Metropolitan Division</th>
42
+ <td><%= link_to @county_subdivision.metropolitan_division.name, metropolitan_division_path(@county_subdivision.metropolitan_division, breadcrumb_params) %></td>
43
+ </tr>
44
+ <% end %>
45
+ <tr>
46
+ <th>Population</th>
47
+ <td><%= formatted_number(@county_subdivision.population) %></td>
48
+ </tr>
49
+ <tr>
50
+ <th>Population Density</th>
51
+ <td><%= population_density(@county_subdivision) %></td>
52
+ </tr>
53
+ <tr>
54
+ <th>Housing Units</th>
55
+ <td><%= formatted_number(@county_subdivision.housing_units) %></td>
56
+ </tr>
57
+ <tr>
58
+ <th>Land Area (mi<sup>2</sup>)</th>
59
+ <td><%= formatted_number(@county_subdivision.land_area, round: 0) %></td>
60
+ </tr>
61
+ <tr>
62
+ <th>Water Area (mi<sup>2</sup>)</th>
63
+ <td><%= formatted_number(@county_subdivision.water_area, round: 0) %></td>
64
+ </tr>
65
+ <tr>
66
+ <th>Coordinates</th>
67
+ <td><%= google_maps_link(@county_subdivision) %></td>
68
+ </tr>
69
+ </tbody>
70
+ </table>
71
+
72
+ <% if @county_subdivision.urban_areas.present? %>
73
+ <br>
74
+
75
+ <h2><%= pluralize(@county_subdivision.urban_areas.count, "Urban Area") %></h2>
76
+
77
+ <%= render "urban_areas/table", urban_areas: @county_subdivision.urban_areas, county_subdivision: @county_subdivision %>
78
+ <% end %>
79
+
80
+ <br>
81
+
82
+ <h2><%= pluralize(@county_subdivision.zctas.count, "ZIP Code Tabulation Area") %></h2>
83
+
84
+ <%= render "zctas/table", zctas: @county_subdivision.zctas, county_subdivision: @county_subdivision %>
@@ -0,0 +1,24 @@
1
+ <table class="table table-striped sortable">
2
+ <thead>
3
+ <tr>
4
+ <th>ID</th>
5
+ <th>Name</th>
6
+ <% unless defined?(region) && region %>
7
+ <th>Region</th>
8
+ <% end %>
9
+ <%= demographics_headers %>
10
+ </th>
11
+ </thead>
12
+ <tbody>
13
+ <% divisions.each do |division| %>
14
+ <tr>
15
+ <td><%= division.id %></td>
16
+ <td><%= link_to division.name, division_path(division, breadcrumb_params) %></td>
17
+ <% unless defined?(region) && region %>
18
+ <td><%= link_to division.region.name, region_path(division.region, breadcrumb_params) %></td>
19
+ <% end %>
20
+ <%= demographics_cells(division, round_area: 0) %>
21
+ </tr>
22
+ <% end %>
23
+ </tbody>
24
+ </table>
@@ -0,0 +1,3 @@
1
+ <%= breadcrumbs "Divisions" %>
2
+
3
+ <%= render "table", divisions: @divisions %>
@@ -0,0 +1,3 @@
1
+ <%= breadcrumbs "States" %>
2
+
3
+ <%= render "states/table", states: @division.states, division: @division %>
@@ -0,0 +1,23 @@
1
+ <ul>
2
+ <li>
3
+ <%= link_to "Regions", regions_path %>
4
+ </li>
5
+ <li>
6
+ <%= link_to "Divisions", divisions_path %>
7
+ </li>
8
+ <li>
9
+ <%= link_to "States", states_path %>
10
+ </li>
11
+ <li>
12
+ <%= link_to "Combined Statistical Areas", combined_statistical_areas_path %>
13
+ </li>
14
+ <li>
15
+ <%= link_to "Core Based Statistical Areas", core_based_statistical_areas_path %>
16
+ </li>
17
+ <li>
18
+ <%= link_to "Metropolitan Divisions", metropolitan_divisions_path %>
19
+ </li>
20
+ <li>
21
+ <%= link_to "Urban Areas", urban_areas_path %>
22
+ </li>
23
+ </ul>
@@ -0,0 +1,34 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>U.S. Geo Data</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+
9
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
10
+
11
+ <link href="https://cdn.jsdelivr.net/gh/tofsjonas/sortable@latest/sortable.min.css" rel="stylesheet" />
12
+ <script src="https://cdn.jsdelivr.net/gh/tofsjonas/sortable@latest/sortable.min.js"></script>
13
+
14
+ <style type="text/css">
15
+ .sortable th {
16
+ white-space: normal;
17
+ }
18
+ </style>
19
+
20
+ <%= stylesheet_link_tag "application" %>
21
+ </head>
22
+
23
+ <body>
24
+ <nav class="navbar navbar-light bg-light">
25
+ <div class="container-fluid">
26
+ <%= link_to "U.S. Geo Data", root_path, class: "navbar-brand mb-0 h1" %>
27
+ </div>
28
+ </nav>
29
+
30
+ <div class="container-fluid">
31
+ <%= yield %>
32
+ </div>
33
+ </body>
34
+ </html>
@@ -0,0 +1,42 @@
1
+ <table class="table table-striped sortable">
2
+ <thead>
3
+ <tr>
4
+ <th>GEOID</th>
5
+ <th>Name</th>
6
+ <% unless defined?(core_based_statistical_area) && core_based_statistical_area %>
7
+ <th>Core Based Statistical Area</th>
8
+ <% end %>
9
+ <% unless defined?(combined_statistical_area) && combined_statistical_area %>
10
+ <th>Combined Statistical Area</th>
11
+ <% end %>
12
+ <%= demographics_headers %>
13
+ </th>
14
+ </thead>
15
+ <tbody>
16
+ <% metropolitan_divisions.each do |metropolitan_division| %>
17
+ <tr>
18
+ <td><%= metropolitan_division.geoid %></td>
19
+ <td><%= link_to metropolitan_division.name, metropolitan_division_path(metropolitan_division, breadcrumb_params) %></td>
20
+ <% unless defined?(core_based_statistical_area) && core_based_statistical_area %>
21
+ <td>
22
+ <% if metropolitan_division.core_based_statistical_area %>
23
+ <%= link_to metropolitan_division.core_based_statistical_area.name, core_based_statistical_area_path(metropolitan_division.core_based_statistical_area, breadcrumb_params) %>
24
+ <% else %>
25
+ -
26
+ <% end %>
27
+ </td>
28
+ <% end %>
29
+ <% unless defined?(combined_statistical_area) && combined_statistical_area %>
30
+ <td>
31
+ <% if metropolitan_division.combined_statistical_area %>
32
+ <%= link_to metropolitan_division.combined_statistical_area.name, combined_statistical_area_path(metropolitan_division.combined_statistical_area) %>
33
+ <% else %>
34
+ -
35
+ <% end %>
36
+ </td>
37
+ <% end %>
38
+ <%= demographics_cells(metropolitan_division, round_area: 0) %>
39
+ </tr>
40
+ <% end %>
41
+ </tbody>
42
+ </table>
@@ -0,0 +1,8 @@
1
+
2
+ <h1>
3
+ <%= pluralize @metropolitan_divisions.size, "Metropolitan Division" %>
4
+ </h1>
5
+
6
+ <%= breadcrumbs "Metropolitan Divisions" %>
7
+
8
+ <%= render "table", metropolitan_divisions: @metropolitan_divisions, core_based_statistical_area: @core_based_statistical_area, combined_statistical_area: @combined_statistical_area %>
@@ -0,0 +1,46 @@
1
+ <%= breadcrumbs @metropolitan_division.name, active: @metropolitan_division %>
2
+
3
+ <h1><%= @metropolitan_division.name %></h1>
4
+
5
+ <table class="table table-striped">
6
+ <tbody>
7
+ <tr>
8
+ <th>GEOID</th>
9
+ <td><%= @metropolitan_division.geoid %></td>
10
+ </tr>
11
+ <% if @metropolitan_division.combined_statistical_area %>
12
+ <tr>
13
+ <th>Combined Statistical Area</th>
14
+ <td><%= link_to @metropolitan_division.combined_statistical_area.name, combined_statistical_area_path(@metropolitan_division.combined_statistical_area) %></td>
15
+ </tr>
16
+ <% end %>
17
+ <% if @metropolitan_division.core_based_statistical_area %>
18
+ <tr>
19
+ <th>Core Based Statistical Area</th>
20
+ <td><%= link_to @metropolitan_division.core_based_statistical_area.name, core_based_statistical_area_path(@metropolitan_division.core_based_statistical_area) %></td>
21
+ </tr>
22
+ <% end %>
23
+ <tr>
24
+ <th>Population</th>
25
+ <td><%= formatted_number(@metropolitan_division.population) %></td>
26
+ </tr>
27
+ <tr>
28
+ <th>Housing Units</th>
29
+ <td><%= formatted_number(@metropolitan_division.housing_units) %></td>
30
+ </tr>
31
+ <tr>
32
+ <th>Land Area (mi<sup>2</sup>)</th>
33
+ <td><%= formatted_number(@metropolitan_division.land_area, round: 0) %></td>
34
+ </tr>
35
+ <tr>
36
+ <th>Water Area (mi<sup>2</sup>)</th>
37
+ <td><%= formatted_number(@metropolitan_division.water_area, round: 0) %></td>
38
+ </tr>
39
+ </tbody>
40
+ </table>
41
+
42
+ <br>
43
+
44
+ <h2><%= pluralize(@metropolitan_division.counties.count, "County") %></h2>
45
+
46
+ <%= render "counties/table", counties: @metropolitan_division.counties, metropolitan_division: @metropolitan_division %>
@@ -0,0 +1,47 @@
1
+ <%
2
+ zcta ||= nil
3
+ overlap = (zcta)
4
+ %>
5
+
6
+ <table class="table table-striped sortable">
7
+ <thead>
8
+ <tr>
9
+ <th>GEOID</th>
10
+ <th>Name</th>
11
+ <th>Primary County</th>
12
+ <th>FIPS Class Code</th>
13
+
14
+ <%= demographics_headers %>
15
+
16
+ <% if overlap %>
17
+ <th class="text-end">Overlap</th>
18
+ <% end %>
19
+ </th>
20
+ </thead>
21
+ <tbody>
22
+ <% places.each do |place| %>
23
+ <tr>
24
+ <td><%= place.geoid %></td>
25
+ <td><%= link_to place.name, place_path(place, breadcrumb_params) %></td>
26
+ <td>
27
+ <% if place.primary_county %>
28
+ <%= link_to place.primary_county.full_name, county_path(place.primary_county, breadcrumb_params) %>
29
+ <% else %>
30
+ -
31
+ <% end %>
32
+ </td>
33
+ <td><%= place.fips_class_code %></td>
34
+
35
+ <%= demographics_cells(place, round_area: 1) %>
36
+
37
+ <% if overlap %>
38
+ <td class="text-end">
39
+ <% if zcta %>
40
+ <%= overlap_percentage(zcta, place, :zcta_places) %>
41
+ <% end %>
42
+ </td>
43
+ <% end %>
44
+ </tr>
45
+ <% end %>
46
+ </tbody>
47
+ </table>
@@ -0,0 +1,92 @@
1
+ <%= breadcrumbs @place.full_name, active: @place %>
2
+
3
+ <h1><%= @place.name %></h1>
4
+
5
+ <table class="table table-striped">
6
+ <tbody>
7
+ <tr>
8
+ <th>GEOID</th>
9
+ <td><%= @place.geoid %></td>
10
+ </tr>
11
+ <tr>
12
+ <th>Short Name</th>
13
+ <td><%= @place.short_name %></td>
14
+ </tr>
15
+ <% if @place.primary_county %>
16
+ <tr>
17
+ <th>Primary County</th>
18
+ <td><%= link_to @place.primary_county.full_name, county_path(@place.primary_county, breadcrumb_params) %></td>
19
+ </tr>
20
+ <% end %>
21
+ <% if @place.urban_area %>
22
+ <tr>
23
+ <th>Urban Area</th>
24
+ <td><%= link_to @place.urban_area.name, urban_area_path(@place.urban_area, breadcrumb_params) %></td>
25
+ </tr>
26
+ <% end %>
27
+ <tr>
28
+ <th>State</th>
29
+ <td><%= link_to @place.state.name, state_path(@place.state, breadcrumb_params) %></td>
30
+ </tr>
31
+ <tr>
32
+ <th>FIP Class Code</th>
33
+ <td><%= @place.fips_class_code %></td>
34
+ </tr>
35
+ <% if @place.combined_statistical_area %>
36
+ <tr>
37
+ <th>Combined Statistical Area</th>
38
+ <td><%= link_to @place.combined_statistical_area.name, combined_statistical_area_path(@place.combined_statistical_area, breadcrumb_params) %></td>
39
+ </tr>
40
+ <% end %>
41
+ <% if @place.core_based_statistical_area %>
42
+ <tr>
43
+ <th>Core Based Statistical Area</th>
44
+ <td><%= link_to @place.core_based_statistical_area.name, core_based_statistical_area_path(@place.core_based_statistical_area, breadcrumb_params) %></td>
45
+ </tr>
46
+ <% end %>
47
+ <% if @place.metropolitan_division %>
48
+ <tr>
49
+ <th>Metropolitan Division</th>
50
+ <td><%= link_to @place.metropolitan_division.name, metropolitan_division_path(@place.metropolitan_division, breadcrumb_params) %></td>
51
+ </tr>
52
+ <% end %>
53
+ <tr>
54
+ <th>Population</th>
55
+ <td><%= formatted_number(@place.population) %></td>
56
+ </tr>
57
+ <tr>
58
+ <th>Population Density</th>
59
+ <td><%= population_density(@place) %></td>
60
+ </tr>
61
+ <tr>
62
+ <th>Housing Units</th>
63
+ <td><%= formatted_number(@place.housing_units) %></td>
64
+ </tr>
65
+ <tr>
66
+ <th>Land Area (mi<sup>2</sup>)</th>
67
+ <td><%= formatted_number(@place.land_area, round: 0) %></td>
68
+ </tr>
69
+ <tr>
70
+ <th>Water Area (mi<sup>2</sup>)</th>
71
+ <td><%= formatted_number(@place.water_area, round: 0) %></td>
72
+ </tr>
73
+ <tr>
74
+ <th>Coordinates</th>
75
+ <td><%= google_maps_link(@place) %></td>
76
+ </tr>
77
+ </tbody>
78
+ </table>
79
+
80
+ <% if @place.counties.size > 1 %>
81
+ <br>
82
+
83
+ <h2><%= pluralize(@place.counties.count, "County") %></h2>
84
+
85
+ <%= render "counties/table", counties: @place.counties, place: @place %>
86
+ <% end %>
87
+
88
+ <br>
89
+
90
+ <h2><%= pluralize(@place.zctas.count, "ZIP Code Tabulation Area") %></h2>
91
+
92
+ <%= render "zctas/table", zctas: @place.zctas, place: @place %>
@@ -0,0 +1,18 @@
1
+ <table class="table table-striped sortable">
2
+ <thead>
3
+ <tr>
4
+ <th>ID</th>
5
+ <th>Name</th>
6
+ <%= demographics_headers %>
7
+ </th>
8
+ </thead>
9
+ <tbody>
10
+ <% regions.each do |region| %>
11
+ <tr>
12
+ <td><%= region.id %></td>
13
+ <td><%= link_to region.name, region_path(region, breadcrumb_params) %></td>
14
+ <%= demographics_cells(region, round_area: 0) %>
15
+ </tr>
16
+ <% end %>
17
+ </tbody>
18
+ </table>
@@ -0,0 +1,7 @@
1
+ <%= breadcrumbs "Regions" %>
2
+
3
+ <h1>
4
+ <%= pluralize @regions.size, "Region" %>
5
+ </h1>
6
+
7
+ <%= render "table", regions: @regions %>
@@ -0,0 +1,3 @@
1
+ <%= breadcrumbs "Divisions" %>
2
+
3
+ <%= render "divisions/table", divisions: @region.divisions, region: @region %>
@@ -0,0 +1,13 @@
1
+ <nav aria-label="breadcrumb">
2
+ <ol class="breadcrumb mt-2">
3
+ <% links.each do |label, url| %>
4
+ <li class="breadcrumb-item">
5
+ <%= link_to label, url %>
6
+ </li>
7
+ <% end %>
8
+
9
+ <li class="breadcrumb-item active" aria-current="page"">
10
+ <%= active_label %>
11
+ </li>
12
+ </ol>
13
+ </nav>
@@ -0,0 +1,5 @@
1
+ <%= content_tag(:td, (entity.population ? formatted_number(entity.population) : "-"), class: "text-end", data: {sort: entity.population.to_i}) %>
2
+ <%= content_tag(:td, population_density(entity), class: "text-end", data: {sort: entity.population_density.to_f}) %>
3
+ <%= content_tag(:td, (entity.housing_units ? formatted_number(entity.housing_units) : "-"), class: "text-end", data: {sort: entity.housing_units.to_i}) %>
4
+ <%= content_tag(:td, (entity.land_area ? formatted_number(entity.land_area, round: round_area) : "-"), class: "text-end", data: {sort: entity.land_area.to_i}) %>
5
+ <%= content_tag(:td, (entity.water_area ? formatted_number(entity.water_area, round: round_area) : "-"), class: "text-end", data: {sort: entity.water_area.to_i}) %>
@@ -0,0 +1,5 @@
1
+ <th class="text-end">Population</th>
2
+ <th class="text-end">Population Density</th>
3
+ <th class="text-end">Housing Units</th>
4
+ <th class="text-end">Land Area</th>
5
+ <th class="text-end">Water Area</th>
@@ -0,0 +1,31 @@
1
+ <table class="table table-striped sortable">
2
+ <thead>
3
+ <tr>
4
+ <th>Code</th>
5
+ <th>Name</th>
6
+ <% unless defined?(division) && division %>
7
+ <th>Region</th>
8
+ <th>Division</th>
9
+ <% end %>
10
+ <%= demographics_headers %>
11
+ </th>
12
+ </thead>
13
+ <tbody>
14
+ <% states.each do |state| %>
15
+ <tr>
16
+ <td><%= state.code %></td>
17
+ <td><%= link_to state.name, state_path(state, breadcrumb_params) %></td>
18
+ <% unless defined?(division) && division %>
19
+ <% if state.division %>
20
+ <td><%= link_to state.division.region.name, region_path(state.division.region) %></td>
21
+ <td><%= link_to state.division.name, division_path(state.division) %></td>
22
+ <% else %>
23
+ <td>-</td>
24
+ <td>-</td>
25
+ <% end %>
26
+ <% end %>
27
+ <%= demographics_cells(state, round_area: 0) %>
28
+ </tr>
29
+ <% end %>
30
+ </tbody>
31
+ </table>
@@ -0,0 +1,7 @@
1
+ <%= breadcrumbs "States" %>
2
+
3
+ <h1>
4
+ <%= pluralize @states.size, "State" %>
5
+ </h1>
6
+
7
+ <%= render "table", states: @states %>
@@ -0,0 +1,54 @@
1
+ <%= breadcrumbs @state.name, active: @state %>
2
+
3
+ <h1><%= @state.name %></h1>
4
+
5
+ <table class="table table-striped">
6
+ <tbody>
7
+ <tr>
8
+ <th>Code</th>
9
+ <td><%= @state.code %></td>
10
+ </tr>
11
+ <tr>
12
+ <th>FIPS ID</th>
13
+ <td><%= @state.fips %></td>
14
+ </tr>
15
+ <tr>
16
+ <th>Type</th>
17
+ <td><%= @state.type %></td>
18
+ </tr>
19
+ <% if @state.region %>
20
+ <tr>
21
+ <th>Region</th>
22
+ <td><%= link_to @state.region.name, region_path(@state.region) %></td>
23
+ </tr>
24
+ <% end %>
25
+ <% if @state.division %>
26
+ <tr>
27
+ <th>Division</th>
28
+ <td><%= link_to @state.division.name, division_path(@state.division) %></td>
29
+ </tr>
30
+ <% end %>
31
+ <tr>
32
+ <th>Population</th>
33
+ <td><%= formatted_number(@state.population) %></td>
34
+ </tr>
35
+ <tr>
36
+ <th>Housing Units</th>
37
+ <td><%= formatted_number(@state.housing_units) %></td>
38
+ </tr>
39
+ <tr>
40
+ <th>Land Area (mi<sup>2</sup>)</th>
41
+ <td><%= formatted_number(@state.land_area, round: 0) %></td>
42
+ </tr>
43
+ <tr>
44
+ <th>Water Area (mi<sup>2</sup>)</th>
45
+ <td><%= formatted_number(@state.water_area, round: 0) %></td>
46
+ </tr>
47
+ </tbody>
48
+ </table>
49
+
50
+ <br>
51
+
52
+ <h2><%= pluralize(@state.counties.count, "County") %></h2>
53
+
54
+ <%= render "counties/table", counties: @state.counties, state: @state %>
@@ -0,0 +1,45 @@
1
+ <%
2
+ county ||= nil
3
+ county_subdivision ||= nil
4
+ zcta ||= nil
5
+ overlap = (county || county_subdivision || zcta)
6
+ %>
7
+
8
+ <table class="table table-striped sortable">
9
+ <thead>
10
+ <tr>
11
+ <th>GEOID</th>
12
+ <th>Name</th>
13
+ <th>Type</th>
14
+
15
+ <%= demographics_headers %>
16
+
17
+ <% if overlap %>
18
+ <th class="text-end">Overlap</th>
19
+ <% end %>
20
+ </th>
21
+ </thead>
22
+ <tbody>
23
+ <% urban_areas.each do |urban_area| %>
24
+ <tr>
25
+ <td><%= urban_area.geoid %></td>
26
+ <td><%= link_to urban_area.name, urban_area_path(urban_area, breadcrumb_params) %></td>
27
+ <td><%= urban_area.urbanized? ? "Urbanized Area" : "Urban Cluster" %></td>
28
+
29
+ <%= demographics_cells(urban_area, round_area: 0) %>
30
+
31
+ <% if overlap %>
32
+ <td class="text-end">
33
+ <% if county %>
34
+ <%= overlap_percentage(county, urban_area, :urban_area_counties) %>
35
+ <% elsif county_subdivision %>
36
+ <%= overlap_percentage(county_subdivision, urban_area, :urban_area_county_subdivisions) %>
37
+ <% elsif zcta %>
38
+ <%= overlap_percentage(zcta, urban_area, :zcta_urban_areas) %>
39
+ <% end %>
40
+ </td>
41
+ <% end %>
42
+ </tr>
43
+ <% end %>
44
+ </tbody>
45
+ </table>
@@ -0,0 +1,19 @@
1
+ <%= breadcrumbs "Urban Areas" %>
2
+
3
+ <ul class="nav nav-tabs">
4
+ <li class="nav-item">
5
+ <%= link_to "All", urban_areas_path(breadcrumb_params.merge(tab: nil)), class: "nav-link #{'active' if @tab.blank?}" %>
6
+ </li>
7
+ <li class="nav-item">
8
+ <%= link_to "Urbanized Areas", urban_areas_path(breadcrumb_params.merge(tab: "urbanized")), class: "nav-link #{'active' if @tab == 'metropolitan'}" %>
9
+ </li>
10
+ <li class="nav-item">
11
+ <%= link_to "Urban Cluster", urban_areas_path(breadcrumb_params.merge(tab: "cluster")), class: "nav-link #{'active' if @tab == 'micropolitan'}" %>
12
+ </li>
13
+ </ul>
14
+
15
+ <h1>
16
+ <%= pluralize @urban_areas.size, "Urban Area" %>
17
+ </h1>
18
+
19
+ <%= render "table", urban_areas: @urban_areas %>