us_geo 1.0.3 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +88 -0
- data/MIT_LICENSE.txt +21 -0
- data/README.md +77 -60
- data/UPDATING_TO_VERSION_2.md +172 -0
- data/VERSION +1 -0
- data/db/migrate/20190221054200_create_regions.rb +4 -2
- data/db/migrate/20190221054300_create_divisions.rb +4 -2
- data/db/migrate/20190221054400_create_states.rb +4 -2
- data/db/migrate/20190221054500_create_combined_statistical_areas.rb +4 -2
- data/db/migrate/20190221054600_create_core_based_statistical_areas.rb +4 -2
- data/db/migrate/20190221054650_create_metropolitan_divisions.rb +4 -2
- data/db/migrate/20190221054700_create_counties.rb +4 -3
- data/db/migrate/20190221054800_create_zctas.rb +4 -2
- data/db/migrate/20190221054900_create_zcta_counties.rb +4 -2
- data/db/migrate/20190221055000_create_urban_areas.rb +4 -2
- data/db/migrate/20190221055100_create_urban_area_counties.rb +4 -4
- data/db/migrate/20190221055200_create_zcta_urban_areas.rb +4 -4
- data/db/migrate/20190221060000_create_places.rb +4 -2
- data/db/migrate/20190221061000_create_place_counties.rb +4 -2
- data/db/migrate/20190221062000_create_zcta_places.rb +4 -4
- data/db/migrate/20190221063000_create_county_subdivisions.rb +4 -2
- data/db/migrate/20220722000000_allow_null_zcta_counties_demographics.rb +23 -0
- data/db/migrate/20220722000200_allow_null_zcta_places_demographics.rb +23 -0
- data/db/migrate/20230414000000_add_zcta_primary_place.rb +13 -0
- data/db/migrate/20230414000200_add_demographics_to_regions.rb +28 -0
- data/db/migrate/20230414000300_add_demographics_to_divisions.rb +28 -0
- data/db/migrate/20230414000400_add_demographics_to_states.rb +28 -0
- data/db/migrate/20230414000700_add_short_name_to_core_based_statistical_areas.rb +22 -0
- data/db/migrate/20230414000750_add_short_name_to_combined_statistical_areas.rb +22 -0
- data/db/migrate/20230414000800_create_zcta_mappings.rb +18 -0
- data/db/migrate/20230417000100_create_zcta_county_subdivisions.rb +22 -0
- data/db/migrate/20230417000200_add_unique_name_index_to_county_subdivisions.rb +26 -0
- data/db/migrate/20230417000250_add_zcta_primary_county_subdivision.rb +13 -0
- data/db/migrate/20230417000300_create_urban_area_county_subdivisions.rb +23 -0
- data/db/migrate/20230417000400_allow_null_urban_area_counties_demographics.rb +23 -0
- data/db/migrate/20230417000500_allow_null_zcta_urban_areas_demographics.rb +23 -0
- data/db/migrate/20230417000600_add_additional_time_zone_name_to_counties.rb +13 -0
- data/db/migrate/20230426000100_add_index_on_zctas_geoids.rb +18 -0
- data/db/schema.rb +303 -0
- data/explorer_app/.gitattributes +7 -0
- data/explorer_app/.gitignore +34 -0
- data/explorer_app/Gemfile +38 -0
- data/explorer_app/Rakefile +6 -0
- data/explorer_app/app/assets/images/.keep +0 -0
- data/explorer_app/app/assets/stylesheets/application.css +1 -0
- data/explorer_app/app/controllers/application_controller.rb +64 -0
- data/explorer_app/app/controllers/combined_statistical_areas_controller.rb +12 -0
- data/explorer_app/app/controllers/concerns/.keep +0 -0
- data/explorer_app/app/controllers/core_based_statistical_areas_controller.rb +36 -0
- data/explorer_app/app/controllers/counties_controller.rb +22 -0
- data/explorer_app/app/controllers/county_subdivisions_controller.rb +23 -0
- data/explorer_app/app/controllers/divisions_controller.rb +27 -0
- data/explorer_app/app/controllers/home_controller.rb +6 -0
- data/explorer_app/app/controllers/metropolitan_divisions_controller.rb +27 -0
- data/explorer_app/app/controllers/places_controller.rb +23 -0
- data/explorer_app/app/controllers/regions_controller.rb +13 -0
- data/explorer_app/app/controllers/states_controller.rb +25 -0
- data/explorer_app/app/controllers/urban_areas_controller.rb +24 -0
- data/explorer_app/app/controllers/zctas_controller.rb +23 -0
- data/explorer_app/app/helpers/application_helper.rb +137 -0
- data/explorer_app/app/models/application_record.rb +3 -0
- data/explorer_app/app/models/concerns/.keep +0 -0
- data/explorer_app/app/views/combined_statistical_areas/_table.html.erb +18 -0
- data/explorer_app/app/views/combined_statistical_areas/index.html.erb +7 -0
- data/explorer_app/app/views/combined_statistical_areas/show.html.erb +52 -0
- data/explorer_app/app/views/core_based_statistical_areas/_table.html.erb +32 -0
- data/explorer_app/app/views/core_based_statistical_areas/index.html.erb +19 -0
- data/explorer_app/app/views/core_based_statistical_areas/show.html.erb +60 -0
- data/explorer_app/app/views/counties/_table.html.erb +64 -0
- data/explorer_app/app/views/counties/show.html.erb +96 -0
- data/explorer_app/app/views/county_subdivisions/_table.html.erb +48 -0
- data/explorer_app/app/views/county_subdivisions/show.html.erb +84 -0
- data/explorer_app/app/views/divisions/_table.html.erb +24 -0
- data/explorer_app/app/views/divisions/index.html.erb +3 -0
- data/explorer_app/app/views/divisions/show.html.erb +3 -0
- data/explorer_app/app/views/home/index.html.erb +23 -0
- data/explorer_app/app/views/layouts/application.html.erb +34 -0
- data/explorer_app/app/views/metropolitan_divisions/_table.html.erb +42 -0
- data/explorer_app/app/views/metropolitan_divisions/index.html.erb +8 -0
- data/explorer_app/app/views/metropolitan_divisions/show.html.erb +46 -0
- data/explorer_app/app/views/places/_table.html.erb +47 -0
- data/explorer_app/app/views/places/show.html.erb +92 -0
- data/explorer_app/app/views/regions/_table.html.erb +18 -0
- data/explorer_app/app/views/regions/index.html.erb +7 -0
- data/explorer_app/app/views/regions/show.html.erb +3 -0
- data/explorer_app/app/views/shared/_breadcrumbs.html.erb +13 -0
- data/explorer_app/app/views/shared/_demographics_cells.html.erb +5 -0
- data/explorer_app/app/views/shared/_demographics_headers.html.erb +5 -0
- data/explorer_app/app/views/states/_table.html.erb +31 -0
- data/explorer_app/app/views/states/index.html.erb +7 -0
- data/explorer_app/app/views/states/show.html.erb +54 -0
- data/explorer_app/app/views/urban_areas/_table.html.erb +45 -0
- data/explorer_app/app/views/urban_areas/index.html.erb +19 -0
- data/explorer_app/app/views/urban_areas/show.html.erb +68 -0
- data/explorer_app/app/views/zctas/_table.html.erb +60 -0
- data/explorer_app/app/views/zctas/show.html.erb +104 -0
- data/explorer_app/bin/bundle +109 -0
- data/explorer_app/bin/rails +4 -0
- data/explorer_app/bin/rake +4 -0
- data/explorer_app/bin/setup +33 -0
- data/explorer_app/config/application.rb +37 -0
- data/explorer_app/config/boot.rb +3 -0
- data/explorer_app/config/database.yml +13 -0
- data/explorer_app/config/environment.rb +5 -0
- data/explorer_app/config/environments/development.rb +59 -0
- data/explorer_app/config/initializers/filter_parameter_logging.rb +8 -0
- data/explorer_app/config/locales/en.yml +2 -0
- data/explorer_app/config/puma.rb +43 -0
- data/explorer_app/config/routes.rb +56 -0
- data/explorer_app/config.ru +6 -0
- data/explorer_app/db/seeds.rb +7 -0
- data/explorer_app/lib/assets/.keep +0 -0
- data/explorer_app/lib/tasks/.keep +0 -0
- data/explorer_app/log/.keep +0 -0
- data/explorer_app/public/404.html +67 -0
- data/explorer_app/public/422.html +67 -0
- data/explorer_app/public/500.html +66 -0
- data/explorer_app/public/apple-touch-icon-precomposed.png +0 -0
- data/explorer_app/public/apple-touch-icon.png +0 -0
- data/explorer_app/public/favicon.ico +0 -0
- data/explorer_app/public/robots.txt +1 -0
- data/explorer_app/tmp/.keep +0 -0
- data/explorer_app/tmp/pids/.keep +0 -0
- data/lib/tasks/us_geo/us_geo.rake +44 -3
- data/lib/us_geo/area.rb +44 -0
- data/lib/us_geo/base_record.rb +22 -16
- data/lib/us_geo/combined_statistical_area.rb +18 -8
- data/lib/us_geo/core_based_statistical_area.rb +24 -12
- data/lib/us_geo/county.rb +67 -16
- data/lib/us_geo/county_subdivision.rb +43 -7
- data/lib/us_geo/division.rb +17 -7
- data/lib/us_geo/metropolitan_area.rb +1 -5
- data/lib/us_geo/metropolitan_division.rb +17 -9
- data/lib/us_geo/micropolitan_area.rb +1 -5
- data/lib/us_geo/place.rb +61 -11
- data/lib/us_geo/place_county.rb +1 -4
- data/lib/us_geo/population.rb +26 -0
- data/lib/us_geo/region.rb +18 -8
- data/lib/us_geo/state.rb +32 -11
- data/lib/us_geo/urban_area.rb +46 -16
- data/lib/us_geo/urban_area_county.rb +4 -21
- data/lib/us_geo/urban_area_county_subdivision.rb +51 -0
- data/lib/us_geo/urban_cluster.rb +1 -5
- data/lib/us_geo/urbanized_area.rb +1 -5
- data/lib/us_geo/version.rb +1 -1
- data/lib/us_geo/zcta.rb +90 -13
- data/lib/us_geo/zcta_county.rb +5 -22
- data/lib/us_geo/zcta_county_subdivision.rb +51 -0
- data/lib/us_geo/zcta_mapping.rb +35 -0
- data/lib/us_geo/zcta_place.rb +5 -12
- data/lib/us_geo/zcta_urban_area.rb +3 -20
- data/lib/us_geo.rb +34 -31
- data/us_geo.gemspec +36 -0
- metadata +126 -129
- data/Gemfile +0 -5
- data/Gemfile.lock +0 -75
- data/Rakefile +0 -18
- data/db/migrate/20190221054490_create_designated_market_areas.rb +0 -16
- data/lib/us_geo/demographics.rb +0 -25
- data/lib/us_geo/designated_market_area.rb +0 -30
- data/spec/spec_helper.rb +0 -22
- data/spec/us_geo/base_record_spec.rb +0 -67
- data/spec/us_geo/combined_statistical_area_spec.rb +0 -33
- data/spec/us_geo/core_based_statistical_area_spec.rb +0 -56
- data/spec/us_geo/county_spec.rb +0 -131
- data/spec/us_geo/county_subdivision_spec.rb +0 -37
- data/spec/us_geo/demographics_spec.rb +0 -19
- data/spec/us_geo/designated_market_area_spec.rb +0 -29
- data/spec/us_geo/division_spec.rb +0 -37
- data/spec/us_geo/metropolitan_division_spec.rb +0 -41
- data/spec/us_geo/place_county_spec.rb +0 -39
- data/spec/us_geo/place_spec.rb +0 -71
- data/spec/us_geo/region_spec.rb +0 -36
- data/spec/us_geo/state_spec.rb +0 -70
- data/spec/us_geo/urban_area_county_spec.rb +0 -82
- data/spec/us_geo/urban_area_spec.rb +0 -98
- data/spec/us_geo/zcta_county_spec.rb +0 -82
- data/spec/us_geo/zcta_place_spec.rb +0 -82
- data/spec/us_geo/zcta_spec.rb +0 -99
- data/spec/us_geo/zcta_urban_area_spec.rb +0 -82
data/db/schema.rb
ADDED
@@ -0,0 +1,303 @@
|
|
1
|
+
# This file is auto-generated from the current state of the database. Instead
|
2
|
+
# of editing this file, please use the migrations feature of Active Record to
|
3
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
4
|
+
#
|
5
|
+
# This file is the source Rails uses to define your schema when running `bin/rails
|
6
|
+
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
|
7
|
+
# be faster and is potentially less error prone than running all of your
|
8
|
+
# migrations from scratch. Old migrations may fail to apply correctly if those
|
9
|
+
# migrations use external dependencies or application code.
|
10
|
+
#
|
11
|
+
# It's strongly recommended that you check this file into your version control system.
|
12
|
+
|
13
|
+
ActiveRecord::Schema[7.0].define(version: 2023_04_21_004258) do
|
14
|
+
create_table "us_geo_combined_statistical_areas", primary_key: "geoid", id: { type: :string, limit: 3 }, force: :cascade do |t|
|
15
|
+
t.string "name", limit: 60, null: false
|
16
|
+
t.float "land_area", null: false
|
17
|
+
t.float "water_area", null: false
|
18
|
+
t.integer "population", null: false
|
19
|
+
t.integer "housing_units", null: false
|
20
|
+
t.datetime "updated_at", precision: nil, null: false
|
21
|
+
t.integer "status", limit: 1, default: 0, null: false
|
22
|
+
t.string "short_name", null: false
|
23
|
+
t.index ["name"], name: "index_us_geo_combined_statistical_areas_on_name", unique: true
|
24
|
+
t.index ["short_name"], name: "index_us_geo_combined_statistical_areas_on_short_name", unique: true
|
25
|
+
end
|
26
|
+
|
27
|
+
create_table "us_geo_core_based_statistical_areas", primary_key: "geoid", id: { type: :string, limit: 5 }, force: :cascade do |t|
|
28
|
+
t.string "csa_geoid", limit: 5
|
29
|
+
t.string "name", limit: 60, null: false
|
30
|
+
t.string "type", limit: 30, null: false
|
31
|
+
t.float "land_area", null: false
|
32
|
+
t.float "water_area", null: false
|
33
|
+
t.integer "population", null: false
|
34
|
+
t.integer "housing_units", null: false
|
35
|
+
t.float "lat", null: false
|
36
|
+
t.float "lng", null: false
|
37
|
+
t.datetime "updated_at", precision: nil, null: false
|
38
|
+
t.integer "status", limit: 1, default: 0, null: false
|
39
|
+
t.string "short_name", null: false
|
40
|
+
t.index ["csa_geoid"], name: "index_us_geo_core_based_statistical_areas_on_csa_geoid"
|
41
|
+
t.index ["name"], name: "index_us_geo_core_based_statistical_areas_on_name", unique: true
|
42
|
+
t.index ["short_name"], name: "index_us_geo_core_based_statistical_areas_on_short_name", unique: true
|
43
|
+
end
|
44
|
+
|
45
|
+
create_table "us_geo_counties", primary_key: "geoid", id: { type: :string, limit: 5 }, force: :cascade do |t|
|
46
|
+
t.integer "gnis_id", null: false
|
47
|
+
t.string "cbsa_geoid", limit: 5
|
48
|
+
t.string "metropolitan_division_geoid", limit: 5
|
49
|
+
t.string "name", limit: 60, null: false
|
50
|
+
t.string "short_name", limit: 30, null: false
|
51
|
+
t.string "state_code", limit: 2, null: false
|
52
|
+
t.boolean "central", default: false
|
53
|
+
t.string "fips_class_code", limit: 2, null: false
|
54
|
+
t.string "time_zone_name", limit: 30
|
55
|
+
t.string "dma_code", limit: 3
|
56
|
+
t.float "land_area"
|
57
|
+
t.float "water_area"
|
58
|
+
t.integer "population"
|
59
|
+
t.integer "housing_units"
|
60
|
+
t.float "lat"
|
61
|
+
t.float "lng"
|
62
|
+
t.datetime "updated_at", precision: nil, null: false
|
63
|
+
t.integer "status", limit: 1, default: 0, null: false
|
64
|
+
t.string "time_zone_2_name", limit: 30
|
65
|
+
t.index ["cbsa_geoid"], name: "index_us_geo_counties_on_cbsa_geoid"
|
66
|
+
t.index ["dma_code"], name: "index_us_geo_counties_on_dma_code"
|
67
|
+
t.index ["gnis_id"], name: "index_us_geo_counties_on_gnis_id"
|
68
|
+
t.index ["metropolitan_division_geoid"], name: "index_us_geo_counties_on_metropolitan_division_geoid"
|
69
|
+
t.index ["name", "state_code"], name: "index_us_geo_counties_on_name_and_state_code", unique: true
|
70
|
+
t.index ["short_name", "state_code"], name: "index_us_geo_counties_on_short_name_and_state_code", unique: true
|
71
|
+
t.index ["state_code"], name: "index_us_geo_counties_on_state_code"
|
72
|
+
end
|
73
|
+
|
74
|
+
create_table "us_geo_county_subdivisions", primary_key: "geoid", id: { type: :string, limit: 10 }, force: :cascade do |t|
|
75
|
+
t.integer "gnis_id", null: false
|
76
|
+
t.string "name", limit: 60, null: false
|
77
|
+
t.string "county_geoid", limit: 5, null: false
|
78
|
+
t.string "fips_class_code", limit: 2, null: false
|
79
|
+
t.float "land_area"
|
80
|
+
t.float "water_area"
|
81
|
+
t.integer "population"
|
82
|
+
t.integer "housing_units"
|
83
|
+
t.float "lat", null: false
|
84
|
+
t.float "lng", null: false
|
85
|
+
t.datetime "updated_at", precision: nil, null: false
|
86
|
+
t.integer "status", limit: 1, default: 0, null: false
|
87
|
+
t.index ["county_geoid"], name: "index_us_geo_county_subdivisions_on_county_geoid"
|
88
|
+
t.index ["gnis_id"], name: "index_us_geo_county_subdivisions_on_gnis_id"
|
89
|
+
t.index ["name", "county_geoid"], name: "index_us_geo_county_subdivisions_on_unique_name", unique: true
|
90
|
+
end
|
91
|
+
|
92
|
+
create_table "us_geo_designated_market_areas", primary_key: "code", id: { type: :string, limit: 3 }, force: :cascade do |t|
|
93
|
+
t.string "name", limit: 60, null: false
|
94
|
+
t.datetime "updated_at", precision: nil, null: false
|
95
|
+
t.integer "status", limit: 1, default: 0, null: false
|
96
|
+
t.index ["name"], name: "index_us_geo_designated_market_areas_on_name", unique: true
|
97
|
+
end
|
98
|
+
|
99
|
+
create_table "us_geo_divisions", force: :cascade do |t|
|
100
|
+
t.integer "region_id", limit: 1, null: false
|
101
|
+
t.string "name", limit: 30, null: false
|
102
|
+
t.datetime "updated_at", precision: nil, null: false
|
103
|
+
t.integer "status", limit: 1, default: 0, null: false
|
104
|
+
t.float "land_area"
|
105
|
+
t.float "water_area"
|
106
|
+
t.integer "population"
|
107
|
+
t.integer "housing_units"
|
108
|
+
t.index ["name"], name: "index_us_geo_divisions_on_name", unique: true
|
109
|
+
t.index ["region_id"], name: "index_us_geo_divisions_on_region_id"
|
110
|
+
end
|
111
|
+
|
112
|
+
create_table "us_geo_metropolitan_divisions", primary_key: "geoid", id: { type: :string, limit: 5 }, force: :cascade do |t|
|
113
|
+
t.string "cbsa_geoid", limit: 5
|
114
|
+
t.string "name", limit: 60, null: false
|
115
|
+
t.float "land_area", null: false
|
116
|
+
t.float "water_area", null: false
|
117
|
+
t.integer "population", null: false
|
118
|
+
t.integer "housing_units", null: false
|
119
|
+
t.datetime "updated_at", precision: nil, null: false
|
120
|
+
t.integer "status", limit: 1, default: 0, null: false
|
121
|
+
t.index ["cbsa_geoid"], name: "index_us_geo_metropolitan_divisions_on_cbsa_geoid"
|
122
|
+
t.index ["name"], name: "index_us_geo_metropolitan_divisions_on_name", unique: true
|
123
|
+
end
|
124
|
+
|
125
|
+
create_table "us_geo_place_counties", force: :cascade do |t|
|
126
|
+
t.string "place_geoid", limit: 7, null: false
|
127
|
+
t.string "county_geoid", limit: 5, null: false
|
128
|
+
t.datetime "updated_at", precision: nil, null: false
|
129
|
+
t.integer "status", limit: 1, default: 0, null: false
|
130
|
+
t.index ["county_geoid"], name: "index_us_geo_place_counties_on_county_geoid"
|
131
|
+
t.index ["place_geoid", "county_geoid"], name: "index_us_geo_place_counties_uniq", unique: true
|
132
|
+
end
|
133
|
+
|
134
|
+
create_table "us_geo_places", primary_key: "geoid", id: { type: :string, limit: 7 }, force: :cascade do |t|
|
135
|
+
t.integer "gnis_id", null: false
|
136
|
+
t.string "name", limit: 60, null: false
|
137
|
+
t.string "short_name", limit: 30, null: false
|
138
|
+
t.string "state_code", limit: 2, null: false
|
139
|
+
t.string "primary_county_geoid", limit: 5, null: false
|
140
|
+
t.string "urban_area_geoid", limit: 5
|
141
|
+
t.string "fips_class_code", limit: 2, null: false
|
142
|
+
t.float "land_area"
|
143
|
+
t.float "water_area"
|
144
|
+
t.integer "population"
|
145
|
+
t.integer "housing_units"
|
146
|
+
t.float "lat", null: false
|
147
|
+
t.float "lng", null: false
|
148
|
+
t.datetime "updated_at", precision: nil, null: false
|
149
|
+
t.integer "status", limit: 1, default: 0, null: false
|
150
|
+
t.index ["gnis_id"], name: "index_us_geo_places_on_gnis_id"
|
151
|
+
t.index ["name"], name: "index_us_geo_places_on_name"
|
152
|
+
t.index ["primary_county_geoid"], name: "index_us_geo_places_on_primary_county_geoid"
|
153
|
+
t.index ["short_name"], name: "index_us_geo_places_on_short_name"
|
154
|
+
t.index ["state_code"], name: "index_us_geo_places_on_state_code"
|
155
|
+
t.index ["urban_area_geoid"], name: "index_us_geo_places_on_urban_area_geoid"
|
156
|
+
end
|
157
|
+
|
158
|
+
create_table "us_geo_regions", force: :cascade do |t|
|
159
|
+
t.string "name", limit: 30, null: false
|
160
|
+
t.datetime "updated_at", precision: nil, null: false
|
161
|
+
t.integer "status", limit: 1, default: 0, null: false
|
162
|
+
t.float "land_area"
|
163
|
+
t.float "water_area"
|
164
|
+
t.integer "population"
|
165
|
+
t.integer "housing_units"
|
166
|
+
t.index ["name"], name: "index_us_geo_regions_on_name", unique: true
|
167
|
+
end
|
168
|
+
|
169
|
+
create_table "us_geo_states", primary_key: "code", id: { type: :string, limit: 2 }, force: :cascade do |t|
|
170
|
+
t.string "name", limit: 30, null: false
|
171
|
+
t.string "fips", limit: 2, null: false
|
172
|
+
t.string "type", limit: 30, null: false
|
173
|
+
t.integer "region_id", limit: 1
|
174
|
+
t.integer "division_id", limit: 1
|
175
|
+
t.datetime "updated_at", precision: nil, null: false
|
176
|
+
t.integer "status", limit: 1, default: 0, null: false
|
177
|
+
t.float "land_area"
|
178
|
+
t.float "water_area"
|
179
|
+
t.integer "population"
|
180
|
+
t.integer "housing_units"
|
181
|
+
t.index ["division_id"], name: "index_us_geo_states_on_division_id"
|
182
|
+
t.index ["fips"], name: "index_us_geo_states_on_fips", unique: true
|
183
|
+
t.index ["name"], name: "index_us_geo_states_on_name", unique: true
|
184
|
+
t.index ["region_id"], name: "index_us_geo_states_on_region_id"
|
185
|
+
end
|
186
|
+
|
187
|
+
create_table "us_geo_urban_area_counties", force: :cascade do |t|
|
188
|
+
t.string "urban_area_geoid", limit: 5, null: false
|
189
|
+
t.string "county_geoid", limit: 5, null: false
|
190
|
+
t.float "land_area", null: false
|
191
|
+
t.float "water_area", null: false
|
192
|
+
t.integer "population"
|
193
|
+
t.integer "housing_units"
|
194
|
+
t.datetime "updated_at", precision: nil, null: false
|
195
|
+
t.integer "status", limit: 1, default: 0, null: false
|
196
|
+
t.index ["county_geoid"], name: "index_us_geo_urban_area_counties_on_county_geoid"
|
197
|
+
t.index ["urban_area_geoid", "county_geoid"], name: "index_us_geo_urban_area_counties_uniq", unique: true
|
198
|
+
end
|
199
|
+
|
200
|
+
create_table "us_geo_urban_area_county_subdivisions", force: :cascade do |t|
|
201
|
+
t.string "urban_area_geoid", limit: 5, null: false
|
202
|
+
t.string "county_subdivision_geoid", limit: 10, null: false
|
203
|
+
t.float "land_area", null: false
|
204
|
+
t.float "water_area", null: false
|
205
|
+
t.datetime "updated_at", precision: nil, null: false
|
206
|
+
t.integer "status", limit: 1, default: 0, null: false
|
207
|
+
t.index ["county_subdivision_geoid"], name: "index_us_geo_urban_area_county_subdivisions_geoid"
|
208
|
+
t.index ["urban_area_geoid", "county_subdivision_geoid"], name: "index_us_geo_urban_area_county_subdivisions_uniq", unique: true
|
209
|
+
end
|
210
|
+
|
211
|
+
create_table "us_geo_urban_areas", primary_key: "geoid", id: { type: :string, limit: 5 }, force: :cascade do |t|
|
212
|
+
t.string "name", limit: 90, null: false
|
213
|
+
t.string "short_name", limit: 60, null: false
|
214
|
+
t.string "primary_county_geoid", limit: 5, null: false
|
215
|
+
t.string "type", limit: 30, null: false
|
216
|
+
t.float "land_area", null: false
|
217
|
+
t.float "water_area", null: false
|
218
|
+
t.integer "population", null: false
|
219
|
+
t.integer "housing_units", null: false
|
220
|
+
t.float "lat", null: false
|
221
|
+
t.float "lng", null: false
|
222
|
+
t.datetime "updated_at", precision: nil, null: false
|
223
|
+
t.integer "status", limit: 1, default: 0, null: false
|
224
|
+
t.index ["name"], name: "index_us_geo_urban_areas_on_name", unique: true
|
225
|
+
t.index ["primary_county_geoid"], name: "index_us_geo_urban_areas_on_primary_county_geoid"
|
226
|
+
t.index ["short_name"], name: "index_us_geo_urban_areas_on_short_name", unique: true
|
227
|
+
end
|
228
|
+
|
229
|
+
create_table "us_geo_zcta_counties", force: :cascade do |t|
|
230
|
+
t.string "zipcode", limit: 5, null: false
|
231
|
+
t.string "county_geoid", limit: 5, null: false
|
232
|
+
t.float "land_area", null: false
|
233
|
+
t.float "water_area", null: false
|
234
|
+
t.integer "population"
|
235
|
+
t.integer "housing_units"
|
236
|
+
t.datetime "updated_at", precision: nil, null: false
|
237
|
+
t.integer "status", limit: 1, default: 0, null: false
|
238
|
+
t.index ["county_geoid"], name: "index_us_geo_zcta_counties_on_county_geoid"
|
239
|
+
t.index ["zipcode", "county_geoid"], name: "index_us_geo_zcta_counties_uniq", unique: true
|
240
|
+
end
|
241
|
+
|
242
|
+
create_table "us_geo_zcta_county_subdivisions", force: :cascade do |t|
|
243
|
+
t.string "zipcode", limit: 5, null: false
|
244
|
+
t.string "county_subdivision_geoid", limit: 10, null: false
|
245
|
+
t.float "land_area", null: false
|
246
|
+
t.float "water_area", null: false
|
247
|
+
t.datetime "updated_at", precision: nil, null: false
|
248
|
+
t.integer "status", limit: 1, default: 0, null: false
|
249
|
+
t.index ["county_subdivision_geoid"], name: "index_us_geo_zcta_county_subdivisions_on_geoid"
|
250
|
+
t.index ["zipcode", "county_subdivision_geoid"], name: "index_us_geo_zcta_county_subdivisions_uniq", unique: true
|
251
|
+
end
|
252
|
+
|
253
|
+
create_table "us_geo_zcta_mappings", primary_key: "zipcode", id: { type: :string, limit: 5 }, force: :cascade do |t|
|
254
|
+
t.string "zcta_zipcode", limit: 5, null: false
|
255
|
+
t.datetime "updated_at", precision: nil, null: false
|
256
|
+
t.integer "status", limit: 1, default: 0, null: false
|
257
|
+
t.index ["zcta_zipcode"], name: "index_us_geo_zcta_mappings_on_zcta_zipcode"
|
258
|
+
end
|
259
|
+
|
260
|
+
create_table "us_geo_zcta_places", force: :cascade do |t|
|
261
|
+
t.string "zipcode", limit: 5, null: false
|
262
|
+
t.string "place_geoid", limit: 7, null: false
|
263
|
+
t.float "land_area", null: false
|
264
|
+
t.float "water_area", null: false
|
265
|
+
t.integer "population"
|
266
|
+
t.integer "housing_units"
|
267
|
+
t.datetime "updated_at", precision: nil, null: false
|
268
|
+
t.integer "status", limit: 1, default: 0, null: false
|
269
|
+
t.index ["place_geoid"], name: "index_us_geo_zcta_places_on_place_geoid"
|
270
|
+
t.index ["zipcode", "place_geoid"], name: "index_us_geo_us_geo_zcta_places_uniq", unique: true
|
271
|
+
end
|
272
|
+
|
273
|
+
create_table "us_geo_zcta_urban_areas", force: :cascade do |t|
|
274
|
+
t.string "zipcode", limit: 5, null: false
|
275
|
+
t.string "urban_area_geoid", limit: 5, null: false
|
276
|
+
t.float "land_area", null: false
|
277
|
+
t.float "water_area", null: false
|
278
|
+
t.integer "population"
|
279
|
+
t.integer "housing_units"
|
280
|
+
t.datetime "updated_at", precision: nil, null: false
|
281
|
+
t.integer "status", limit: 1, default: 0, null: false
|
282
|
+
t.index ["urban_area_geoid", "zipcode"], name: "index_us_geo_urban_area_zctas_uniq", unique: true
|
283
|
+
t.index ["zipcode"], name: "index_us_geo_zcta_urban_areas_on_zipcode"
|
284
|
+
end
|
285
|
+
|
286
|
+
create_table "us_geo_zctas", primary_key: "zipcode", id: { type: :string, limit: 5 }, force: :cascade do |t|
|
287
|
+
t.string "primary_county_geoid", limit: 5, null: false
|
288
|
+
t.string "primary_urban_area_geoid", limit: 5
|
289
|
+
t.float "land_area", null: false
|
290
|
+
t.float "water_area", null: false
|
291
|
+
t.integer "population", null: false
|
292
|
+
t.integer "housing_units", null: false
|
293
|
+
t.float "lat", null: false
|
294
|
+
t.float "lng", null: false
|
295
|
+
t.datetime "updated_at", precision: nil, null: false
|
296
|
+
t.integer "status", limit: 1, default: 0, null: false
|
297
|
+
t.string "primary_place_geoid", limit: 7
|
298
|
+
t.string "primary_county_subdivision_geoid", limit: 10
|
299
|
+
t.index ["primary_county_geoid"], name: "index_us_geo_zctas_on_primary_county_geoid"
|
300
|
+
t.index ["primary_urban_area_geoid"], name: "index_us_geo_zctas_on_primary_urban_area_geoid"
|
301
|
+
end
|
302
|
+
|
303
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore the default SQLite database.
|
11
|
+
/db/*.sqlite3
|
12
|
+
/db/*.sqlite3-*
|
13
|
+
|
14
|
+
/db/schema.rb
|
15
|
+
/db/migrate/*
|
16
|
+
|
17
|
+
# Ignore all logfiles and tempfiles.
|
18
|
+
/log/*
|
19
|
+
/tmp/*
|
20
|
+
!/log/.keep
|
21
|
+
!/tmp/.keep
|
22
|
+
|
23
|
+
# Ignore pidfiles, but keep the directory.
|
24
|
+
/tmp/pids/*
|
25
|
+
!/tmp/pids/
|
26
|
+
!/tmp/pids/.keep
|
27
|
+
|
28
|
+
/public/assets
|
29
|
+
|
30
|
+
# Ignore master key for decrypting credentials and more.
|
31
|
+
/config/master.key
|
32
|
+
|
33
|
+
/vendor/
|
34
|
+
!/vendor/.keep
|
@@ -0,0 +1,38 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
|
4
|
+
gemspec path: "../"
|
5
|
+
|
6
|
+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
|
7
|
+
gem "rails", "~> 7.0.4", ">= 7.0.4.3"
|
8
|
+
|
9
|
+
# Use sqlite3 as the database for Active Record
|
10
|
+
gem "sqlite3", "~> 1.4"
|
11
|
+
|
12
|
+
# Use the Puma web server [https://github.com/puma/puma]
|
13
|
+
gem "puma", "~> 5.0"
|
14
|
+
|
15
|
+
# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
|
16
|
+
# gem "kredis"
|
17
|
+
|
18
|
+
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
|
19
|
+
# gem "bcrypt", "~> 3.1.7"
|
20
|
+
|
21
|
+
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
22
|
+
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
|
23
|
+
|
24
|
+
group :development, :test do
|
25
|
+
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
|
26
|
+
gem "debug", platforms: %i[mri mingw x64_mingw]
|
27
|
+
end
|
28
|
+
|
29
|
+
group :development do
|
30
|
+
# Use console on exceptions pages [https://github.com/rails/web-console]
|
31
|
+
gem "web-console"
|
32
|
+
|
33
|
+
# Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
|
34
|
+
# gem "rack-mini-profiler"
|
35
|
+
|
36
|
+
# Speed up commands on slow machines / big apps [https://github.com/rails/spring]
|
37
|
+
# gem "spring"
|
38
|
+
end
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
/* Application styles */
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ApplicationController < ActionController::Base
|
4
|
+
def add_breadcrumb(breadcrumbs)
|
5
|
+
@breadcrumbs ||= HashWithIndifferentAccess.new
|
6
|
+
@breadcrumbs.merge!(breadcrumbs)
|
7
|
+
end
|
8
|
+
|
9
|
+
def add_region_breadcrumb
|
10
|
+
if params[:region_id]
|
11
|
+
@region = USGeo::Region.find(params[:region_id])
|
12
|
+
add_breadcrumb(region_id: @region)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_division_breadcrumb
|
17
|
+
if params[:division_id]
|
18
|
+
@division = USGeo::Division.find(params[:division_id])
|
19
|
+
add_breadcrumb(division_id: @division)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_state_breadcrumb
|
24
|
+
if params[:state_id]
|
25
|
+
@state = USGeo::State.find(params[:state_id])
|
26
|
+
add_breadcrumb(state_id: @state)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def add_county_breadcrumb
|
31
|
+
if params[:county_id]
|
32
|
+
@county = USGeo::County.find(params[:county_id])
|
33
|
+
add_breadcrumb(county_id: @county)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def add_core_based_statistical_area_breadcrumb
|
38
|
+
if params[:core_based_statistical_area_id]
|
39
|
+
@core_based_statistical_area = USGeo::CoreBasedStatisticalArea.find(params[:core_based_statistical_area_id])
|
40
|
+
add_breadcrumb(core_based_statistical_area_id: @core_based_statistical_area)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_combined_statistical_area_breadcrumb
|
45
|
+
if params[:combined_statistical_area_id]
|
46
|
+
@combined_statistical_area = USGeo::CombinedStatisticalArea.find(params[:combined_statistical_area_id])
|
47
|
+
add_breadcrumb(combined_statistical_area_id: @combined_statistical_area)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def add_metropolitan_division_breadcrumb
|
52
|
+
if params[:metropolitan_division_id]
|
53
|
+
@metropolitan_division = USGeo::MetropolitanDivision.find(params[:metropolitan_division_id])
|
54
|
+
add_breadcrumb(metropolitan_division_id: @metropolitan_division)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def add_urban_area_breadcrumb
|
59
|
+
if params[:urban_area_id]
|
60
|
+
@urban_area = USGeo::UrbanArea.find(params[:urban_area_id])
|
61
|
+
add_breadcrumb(urban_area_id: @urban_area)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CombinedStatisticalAreasController < ApplicationController
|
4
|
+
def index
|
5
|
+
@combined_statistical_areas = USGeo::CombinedStatisticalArea.not_removed.order(:name)
|
6
|
+
end
|
7
|
+
|
8
|
+
def show
|
9
|
+
@combined_statistical_area = USGeo::CombinedStatisticalArea.find(params[:id])
|
10
|
+
add_breadcrumb(combined_statistical_area_id: @combined_statistical_area)
|
11
|
+
end
|
12
|
+
end
|
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CoreBasedStatisticalAreasController < ApplicationController
|
4
|
+
before_action :set_breadcrumbs
|
5
|
+
|
6
|
+
def index
|
7
|
+
cbsas = if @combined_statistical_area
|
8
|
+
@combined_statistical_area.core_based_statistical_areas.order(:name)
|
9
|
+
else
|
10
|
+
USGeo::CoreBasedStatisticalArea.not_removed.order(:name)
|
11
|
+
end
|
12
|
+
|
13
|
+
@tab = params[:tab]
|
14
|
+
if @tab.present?
|
15
|
+
type = if @tab == "metropolitan"
|
16
|
+
"MetropolitanArea"
|
17
|
+
elsif @tab == "micropolitan"
|
18
|
+
"MicropolitanArea"
|
19
|
+
end
|
20
|
+
cbsas = cbsas.where(type: type)
|
21
|
+
end
|
22
|
+
|
23
|
+
@core_based_statistical_areas = cbsas.order(:name)
|
24
|
+
end
|
25
|
+
|
26
|
+
def show
|
27
|
+
@core_based_statistical_area = USGeo::CoreBasedStatisticalArea.find(params[:id])
|
28
|
+
add_breadcrumb(core_based_statistical_area_id: @core_based_statistical_area)
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def set_breadcrumbs
|
34
|
+
add_combined_statistical_area_breadcrumb
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CountiesController < ApplicationController
|
4
|
+
before_action :set_breadcrumbs
|
5
|
+
|
6
|
+
def show
|
7
|
+
@county = USGeo::County.find(params[:id])
|
8
|
+
add_breadcrumb(county_id: @county)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def set_breadcrumbs
|
14
|
+
add_region_breadcrumb
|
15
|
+
add_division_breadcrumb
|
16
|
+
add_state_breadcrumb
|
17
|
+
add_combined_statistical_area_breadcrumb
|
18
|
+
add_core_based_statistical_area_breadcrumb
|
19
|
+
add_metropolitan_division_breadcrumb
|
20
|
+
add_urban_area_breadcrumb
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CountySubdivisionsController < ApplicationController
|
4
|
+
before_action :set_breadcrumbs
|
5
|
+
|
6
|
+
def show
|
7
|
+
@county_subdivision = USGeo::CountySubdivision.find(params[:id])
|
8
|
+
add_breadcrumb(county_subdivision_id: @county_subdivision)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def set_breadcrumbs
|
14
|
+
add_region_breadcrumb
|
15
|
+
add_division_breadcrumb
|
16
|
+
add_state_breadcrumb
|
17
|
+
add_county_breadcrumb
|
18
|
+
add_combined_statistical_area_breadcrumb
|
19
|
+
add_core_based_statistical_area_breadcrumb
|
20
|
+
add_metropolitan_division_breadcrumb
|
21
|
+
add_urban_area_breadcrumb
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class DivisionsController < ApplicationController
|
4
|
+
before_action :set_breadcrumbs
|
5
|
+
|
6
|
+
def index
|
7
|
+
@divisions = if @region
|
8
|
+
@region.divisions.order(:id)
|
9
|
+
else
|
10
|
+
USGeo::Division.not_removed.order(:id)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def show
|
15
|
+
@division = USGeo::Division.find(params[:id])
|
16
|
+
add_breadcrumb(division_id: @division)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def set_breadcrumbs
|
22
|
+
if params[:region_id]
|
23
|
+
@region = USGeo::Region.find(params[:region_id])
|
24
|
+
add_breadcrumb(region_id: @region)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class MetropolitanDivisionsController < ApplicationController
|
4
|
+
before_action :set_breadcrumbs
|
5
|
+
|
6
|
+
def index
|
7
|
+
@metropolitan_divisions = if @combined_statistical_area
|
8
|
+
@combined_statistical_area.metropolitan_divisions.order(:name)
|
9
|
+
elsif @core_based_statistical_area
|
10
|
+
@core_based_statistical_area.metropolitan_divisions.order(:name)
|
11
|
+
else
|
12
|
+
USGeo::MetropolitanDivision.not_removed.order(:name)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def show
|
17
|
+
@metropolitan_division = USGeo::MetropolitanDivision.find(params[:id])
|
18
|
+
add_breadcrumb(metropolitan_division_id: @metropolitan_division)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def set_breadcrumbs
|
24
|
+
add_combined_statistical_area_breadcrumb
|
25
|
+
add_core_based_statistical_area_breadcrumb
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class PlacesController < ApplicationController
|
4
|
+
before_action :set_breadcrumbs
|
5
|
+
|
6
|
+
def show
|
7
|
+
@place = USGeo::Place.find(params[:id])
|
8
|
+
add_breadcrumb(place_id: @place)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def set_breadcrumbs
|
14
|
+
add_region_breadcrumb
|
15
|
+
add_division_breadcrumb
|
16
|
+
add_state_breadcrumb
|
17
|
+
add_county_breadcrumb
|
18
|
+
add_combined_statistical_area_breadcrumb
|
19
|
+
add_core_based_statistical_area_breadcrumb
|
20
|
+
add_metropolitan_division_breadcrumb
|
21
|
+
add_urban_area_breadcrumb
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class RegionsController < ApplicationController
|
4
|
+
def index
|
5
|
+
@regions = USGeo::Region.not_removed.order(:id)
|
6
|
+
end
|
7
|
+
|
8
|
+
def show
|
9
|
+
@region = USGeo::Region.find(params[:id])
|
10
|
+
@divisions = @region.divisions.order(:id)
|
11
|
+
add_breadcrumb(region_id: @region)
|
12
|
+
end
|
13
|
+
end
|