us_geo 2.0.4 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6b963948f153ee9add87c2daa3d45fd79ec3ed1d79f156c94bec7cc8b9ca879
4
- data.tar.gz: 69b5d532013234f466319b8fc52ba4ea1809579bedc663f80258c7fd80246fef
3
+ metadata.gz: 68802aa8e92d01352ec2107646d28307fcc14fb2c4fe2a103654d40b1ec1328c
4
+ data.tar.gz: 50f856f724b528654ef89a561aa0e7bf0cd9ac4f17a3a270ac92d6a41bc23927
5
5
  SHA512:
6
- metadata.gz: 51b285a6397f15652483f2c9f36eebbf423fa8ceb7b97fd672cb5361860e351333d562a6b36fb39388c21adb67ef4e7156ceaf1ccb88e727683fab5471ff8b1c
7
- data.tar.gz: d3ff6ae39376c494ac87f4533f6aeee5017546547f56ac1a1bb1cb35f8ad84cfac89f41090792c494de889d31718db6fff15cecbb13f8eb39ad5ee4823e0ae84
6
+ metadata.gz: 4d721fcf6721324a42d7271bec405b6f0656631a3662482ddfcd9b000747040efbd7f6b6c46395607b0d752df96870328e2bf6d803b15048b55d768274e00f5b
7
+ data.tar.gz: 6aacb9847c137272d88fc212fa1ee4deb9c118d577d3bcd75f373c87d3d4c7b03b2e02a6d3bee3d125cdb3e1c35e6b78cac906fb44b095ec74786be8abb49649
data/CHANGELOG.md CHANGED
@@ -4,13 +4,28 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 2.1.0
8
+
9
+ ### Changed
10
+
11
+ - Lazy load ActiveRecord classes so they don't add overhead during application initialization.
12
+ - Update distribution data files with latest Census data as of March 2024.
13
+ - Geographic data is based on 2023 Gazetteer files.
14
+ - Population and housing data are based on 2022 ACS estimates.
15
+ - Some of the Core Based Statistical Area, Combined Statisical Area, and Metropolitan Division names have changed.
16
+ - All Urban Areas now include "Urban Area" in their name. The Census Bureau no longer distinguishes between Urbanized Areas and Urban Clusters and the data now reflects the official names.
17
+
18
+ ### Deprecated
19
+
20
+ - The USGeo::UrbanizedArea and USGeo::UrbanCluster classes are deprecated. These classes are now just aliases for USGeo::UrbanArea. You can still use the `urbanized?` and `cluster?` methods to determine the size of an UrbanArea based on the pre-2020 definition of greater or less then 50,000 residents.
21
+
7
22
  ## 2.0.4
8
23
 
24
+ ### Fixed
25
+
9
26
  - Remove "Urbanized Area" from short name for urban areas.
10
27
  - Fix short name for Louisville, KY in the in the CBSA's, CSA's, and Urban Areas to omit "Jefferson County" so it matches convention for other short names of only showing the major city.
11
28
 
12
-
13
-
14
29
  ## 2.0.3
15
30
 
16
31
  ### Added
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
1
  # USGeo
2
2
 
3
- [![Build Status](https://travis-ci.com/bdurand/us_geo.svg?branch=master)](https://travis-ci.com/bdurand/us_geo)
3
+ [![Continuous Integration](https://github.com/bdurand/us_geo/actions/workflows/continuous_integration.yml/badge.svg)](https://github.com/bdurand/us_geo/actions/workflows/continuous_integration.yml)
4
4
  [![Ruby Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/testdouble/standard)
5
+ [![Gem Version](https://badge.fury.io/rb/us_geo.svg)](https://badge.fury.io/rb/us_geo)
5
6
 
6
7
  This gem provides a variety of U.S. geographic data ActiveRecord models. It is designed to provide a normalized way to access the data from a relational database. This is by no means a complete set of data.
7
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.4
1
+ 2.1.0
@@ -5,13 +5,10 @@ class UrbanAreasController < ApplicationController
5
5
  urban_areas = USGeo::UrbanArea.not_removed
6
6
 
7
7
  @tab = params[:tab]
8
- if @tab.present?
9
- type = if @tab == "urbanized"
10
- "UrbanizedArea"
11
- elsif @tab == "cluster"
12
- "UrbanCluster"
13
- end
14
- urban_areas = urban_areas.where(type: type)
8
+ if @tab == "urbanized"
9
+ urban_areas = urban_areas.where(population: 50_000..)
10
+ elsif @tab == "cluster"
11
+ urban_areas = urban_areas.where(population: ...50_000)
15
12
  end
16
13
 
17
14
  @urban_areas = urban_areas.order(:name)
@@ -85,12 +85,18 @@ module USGeo
85
85
  end
86
86
  end
87
87
 
88
+ # Return true if the population is greater than or equal to 50,000.
89
+ #
90
+ # @return [Boolean]
88
91
  def urbanized?
89
- raise NotImplementedError
92
+ population >= 50_000
90
93
  end
91
94
 
95
+ # Return true if the population is less than 50,000.
96
+ #
97
+ # @return [Boolean]
92
98
  def cluster?
93
- raise NotImplementedError
99
+ population < 50_000
94
100
  end
95
101
  end
96
102
  end
@@ -2,6 +2,8 @@
2
2
 
3
3
  module USGeo
4
4
  # Urban area with population < 50,000.
5
+ #
6
+ # @deprecated This class will be removed in version 3.0 and only UrbanArea will be used.
5
7
  class UrbanCluster < UrbanArea
6
8
  def urbanized?
7
9
  false
@@ -2,6 +2,8 @@
2
2
 
3
3
  module USGeo
4
4
  # Urban area with population >= 50,000.
5
+ #
6
+ # @deprecated This class will be removed in version 3.0 and only UrbanArea will be used.
5
7
  class UrbanizedArea < UrbanArea
6
8
  def urbanized?
7
9
  true
data/lib/us_geo.rb CHANGED
@@ -4,37 +4,37 @@ require "active_record"
4
4
 
5
5
  require_relative "us_geo/version"
6
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
7
  require_relative "us_geo/engine" if defined?(::Rails::Engine)
36
8
 
37
9
  module USGeo
10
+ autoload :Area, "us_geo/area"
11
+ autoload :Population, "us_geo/population"
12
+ autoload :BaseRecord, "us_geo/base_record"
13
+
14
+ autoload :Region, "us_geo/region"
15
+ autoload :Division, "us_geo/division"
16
+ autoload :State, "us_geo/state"
17
+ autoload :CombinedStatisticalArea, "us_geo/combined_statistical_area"
18
+ autoload :CoreBasedStatisticalArea, "us_geo/core_based_statistical_area"
19
+ autoload :MetropolitanArea, "us_geo/metropolitan_area"
20
+ autoload :MicropolitanArea, "us_geo/micropolitan_area"
21
+ autoload :MetropolitanDivision, "us_geo/metropolitan_division"
22
+ autoload :County, "us_geo/county"
23
+ autoload :CountySubdivision, "us_geo/county_subdivision"
24
+ autoload :Place, "us_geo/place"
25
+ autoload :PlaceCounty, "us_geo/place_county"
26
+ autoload :UrbanArea, "us_geo/urban_area"
27
+ autoload :UrbanAreaCounty, "us_geo/urban_area_county"
28
+ autoload :UrbanAreaCountySubdivision, "us_geo/urban_area_county_subdivision"
29
+ autoload :UrbanCluster, "us_geo/urban_cluster"
30
+ autoload :UrbanizedArea, "us_geo/urbanized_area"
31
+ autoload :Zcta, "us_geo/zcta"
32
+ autoload :ZctaCounty, "us_geo/zcta_county"
33
+ autoload :ZctaCountySubdivision, "us_geo/zcta_county_subdivision"
34
+ autoload :ZctaMapping, "us_geo/zcta_mapping"
35
+ autoload :ZctaPlace, "us_geo/zcta_place"
36
+ autoload :ZctaUrbanArea, "us_geo/zcta_urban_area"
37
+
38
38
  BASE_DATA_URI = "https://raw.githubusercontent.com/bdurand/us_geo/master/data/2020_dist"
39
39
 
40
40
  class << self
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: 2.0.4
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Durand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-20 00:00:00.000000000 Z
11
+ date: 2024-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord