geocode_records 1.1.0 → 1.1.2

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
  SHA1:
3
- metadata.gz: 9f99f57199e7a46638cfdbf0e3f234dff58af60f
4
- data.tar.gz: 934a907fa2ac94a3285b0129eb04d3b0ef4ea4bf
3
+ metadata.gz: e306eee237615f69d7580cc6a245bf23766c3396
4
+ data.tar.gz: 6824133fe7beaa511e33ee6ce7a0160fe1b08a4d
5
5
  SHA512:
6
- metadata.gz: fa195a1637c5b4f6590e5a53bb52f0b67654ea3cfc803328b81982b52061fedb00f295c98dc3a98c9a7780149c40b27d78f3c12b53c0351cffd27e4bf4aac04b
7
- data.tar.gz: c83a4804cc4aab1f68eac5e10132dae7bb837c601d4ad291bb7ef1400b7a7c5bb3cfa2c45a61db46647099dace86afba2198f367d577f091ba0f04cbf039afa5
6
+ metadata.gz: 51d9e3d00efd93895dbbd94699cbdf95bce45db2f93e5ec0479e04b1b2e3c38a22ffac70b6dd731bddde77f4032f91a9e49da98e8326732262495a752064b708
7
+ data.tar.gz: 198b8e4790376b65e8cee69dfbe697333b5cb1455132196da090519ca586220ddd4d6a810aa9cd3572d4aa0d94dc4b00b405000e59c591f097f2f5ae6789c7ee
data/CHANGELOG CHANGED
@@ -1,3 +1,16 @@
1
+ 1.1.2 / 2018-01-23
2
+
3
+ * Enhancements
4
+
5
+ * More robust house number handling
6
+
7
+ 1.1.1 / 2018-01-22
8
+
9
+ * Enhancements
10
+
11
+ * Remove non-working binary
12
+ * Remove debug warning when it doesn't find records for a glob
13
+
1
14
  1.1.0 / 2018-01-16
2
15
 
3
16
  * Breaking changes
@@ -74,7 +74,6 @@ class GeocodeRecords
74
74
  glob: glob
75
75
  ).perform
76
76
  unless File.size(ungeocoded_path) > 32
77
- $stderr.puts "No records found for #{table_name} #{subquery}, skipping"
78
77
  return
79
78
  end
80
79
  geocoded_path = GeocodeCsv.new(
@@ -34,7 +34,14 @@ class GeocodeRecords
34
34
  UPDATE $TABLE_NAME AS target
35
35
  SET
36
36
  house_number_and_street = src.ss_delivery_line_1,
37
- house_number = CASE WHEN LENGTH(src.ss_primary_number) > 7 THEN NULL ELSE src.ss_primary_number::int END,
37
+ house_number = CASE
38
+ WHEN src.ss_primary_number IS NULL THEN NULL
39
+ WHEN LENGTH(src.ss_primary_number) > 8 THEN NULL
40
+ WHEN src.ss_primary_number ~ '\\A\\d+\\Z' THEN src.ss_primary_number::int
41
+ WHEN src.ss_primary_number ~ '/' THEN (regexp_matches(src.ss_primary_number, '(\\d+)'))[1]::int
42
+ WHEN src.ss_primary_number ~ '-' THEN (SELECT ROUND(AVG(v)) FROM unnest(array_remove(regexp_split_to_array(src.ss_primary_number, '\\D+'), '')::int[]) v)
43
+ ELSE (regexp_matches(src.ss_primary_number, '(\\d+)'))[1]::int
44
+ END,
38
45
  unit_number = src.ss_secondary_number,
39
46
  city = COALESCE(src.ss_default_city_name, src.ss_city_name),
40
47
  state = src.ss_state_abbreviation,
@@ -1,3 +1,3 @@
1
1
  class GeocodeRecords
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geocode_records
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seamus Abshere
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-16 00:00:00.000000000 Z
11
+ date: 2018-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -111,8 +111,7 @@ dependencies:
111
111
  description: A quick way to re-geocode a table. Requires 2 binaries, so YMMV.
112
112
  email:
113
113
  - seamus@abshere.net
114
- executables:
115
- - geocode_records
114
+ executables: []
116
115
  extensions: []
117
116
  extra_rdoc_files: []
118
117
  files:
@@ -124,7 +123,6 @@ files:
124
123
  - LICENSE.txt
125
124
  - README.md
126
125
  - Rakefile
127
- - bin/geocode_records
128
126
  - geocode_records.gemspec
129
127
  - lib/geocode_records.rb
130
128
  - lib/geocode_records/dump_sql_to_csv.rb
data/bin/geocode_records DELETED
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'logger'
4
-
5
- require 'geocode_records'
6
-
7
- ActiveRecord::Base.establish_connection ENV.fetch('DATABASE_URL')
8
-
9
- logger = Logger.new($stderr)
10
- logger.level = Logger::WARN
11
- ActiveRecord::Base.logger = logger
12
- Upsert.logger = logger
13
-
14
- class Whatever < ActiveRecord::Base
15
- self.table_name = ARGV[0]
16
- end
17
-
18
- GeocodeRecords.new(Whatever.all).perform