Skip to content
This repository was archived by the owner on Apr 5, 2021. It is now read-only.

Commit 1a16df4

Browse files
authored
Merge pull request #108 from RTICWDT/dev-long
Handle Long Integers
2 parents d081128 + c4d6e41 commit 1a16df4

File tree

7 files changed

+29
-24
lines changed

7 files changed

+29
-24
lines changed

Gemfile.lock

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ GEM
3030
concurrent-ruby (1.1.7)
3131
crass (1.0.6)
3232
diff-lcs (1.4.4)
33-
docile (1.3.2)
33+
docile (1.3.4)
3434
dotenv (2.7.6)
3535
elasticsearch (5.0.5)
3636
elasticsearch-api (= 5.0.5)
@@ -44,13 +44,15 @@ GEM
4444
erubis (2.7.0)
4545
ethon (0.12.0)
4646
ffi (>= 1.3.0)
47-
excon (0.78.0)
48-
faraday (1.1.0)
47+
excon (0.78.1)
48+
faraday (1.3.0)
49+
faraday-net_http (~> 1.0)
4950
multipart-post (>= 1.2, < 3)
5051
ruby2_keywords
51-
ffi (1.13.1)
52+
faraday-net_http (1.0.0)
53+
ffi (1.14.2)
5254
hashie (4.1.0)
53-
i18n (1.8.5)
55+
i18n (1.8.7)
5456
concurrent-ruby (~> 1.0)
5557
jmespath (1.4.0)
5658
liquid (3.0.3)
@@ -66,18 +68,19 @@ GEM
6668
mime-types-data (~> 3.2015)
6769
mime-types-data (3.2020.1104)
6870
mini_mime (1.0.2)
69-
mini_portile2 (2.4.0)
70-
minitest (5.14.2)
71+
mini_portile2 (2.5.0)
72+
minitest (5.14.3)
7173
moneta (1.1.1)
7274
multi_json (1.15.0)
7375
multipart-post (2.1.1)
7476
mustermann (1.1.1)
7577
ruby2_keywords (~> 0.0.1)
7678
newrelic_rpm (6.14.0)
7779
nio4r (2.5.4)
78-
nokogiri (1.10.10)
79-
mini_portile2 (~> 2.4.0)
80-
oj (3.10.16)
80+
nokogiri (1.11.1)
81+
mini_portile2 (~> 2.5.0)
82+
racc (~> 1.4)
83+
oj (3.10.18)
8184
padrino (0.15.0)
8285
padrino-admin (= 0.15.0)
8386
padrino-cache (= 0.15.0)
@@ -119,6 +122,7 @@ GEM
119122
pry (~> 0.13.0)
120123
puma (4.3.7)
121124
nio4r (~> 2.0)
125+
racc (1.5.2)
122126
rack (2.2.3)
123127
rack-protection (2.1.0)
124128
rack
@@ -129,23 +133,23 @@ GEM
129133
nokogiri (>= 1.6)
130134
rails-html-sanitizer (1.3.0)
131135
loofah (~> 2.3)
132-
rake (13.0.1)
136+
rake (13.0.3)
133137
rb-fsevent (0.10.4)
134138
rb-inotify (0.10.1)
135139
ffi (~> 1.0)
136140
rspec (3.10.0)
137141
rspec-core (~> 3.10.0)
138142
rspec-expectations (~> 3.10.0)
139143
rspec-mocks (~> 3.10.0)
140-
rspec-core (3.10.0)
144+
rspec-core (3.10.1)
141145
rspec-support (~> 3.10.0)
142-
rspec-expectations (3.10.0)
146+
rspec-expectations (3.10.1)
143147
diff-lcs (>= 1.2.0, < 2.0)
144148
rspec-support (~> 3.10.0)
145-
rspec-mocks (3.10.0)
149+
rspec-mocks (3.10.1)
146150
diff-lcs (>= 1.2.0, < 2.0)
147151
rspec-support (~> 3.10.0)
148-
rspec-support (3.10.0)
152+
rspec-support (3.10.1)
149153
rspec_junit_formatter (0.4.1)
150154
rspec-core (>= 2, < 4, != 2.12.0)
151155
ruby-prof (1.4.2)
@@ -156,7 +160,7 @@ GEM
156160
sass-listen (4.0.0)
157161
rb-fsevent (~> 0.9, >= 0.9.4)
158162
rb-inotify (~> 0.9, >= 0.9.7)
159-
simplecov (0.20.0)
163+
simplecov (0.21.1)
160164
docile (~> 1.1)
161165
simplecov-html (~> 0.11)
162166
simplecov_json_formatter (~> 0.1)
@@ -175,7 +179,7 @@ GEM
175179
tilt (2.0.10)
176180
typhoeus (1.4.0)
177181
ethon (>= 0.9.0)
178-
tzinfo (1.2.8)
182+
tzinfo (1.2.9)
179183
thread_safe (~> 0.1)
180184
zeitwerk (2.4.2)
181185

lib/data_magic/index.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def self.import_with_delta(options = {})
153153

154154
private
155155
def self.valid_types
156-
%w[integer float string literal name autocomplete boolean]
156+
%w[integer float string literal name autocomplete boolean long]
157157
end
158158

159159
end # module DataMagic

lib/data_magic/index/document_builder.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ def fix_field_type(type, value, key=nil)
132132
value.to_s.downcase
133133
when "boolean"
134134
parse_boolean(value)
135+
when "long"
136+
value.to_i
135137
else # "string"
136138
value.to_s
137139
end

sample-data/data.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ version: cities100-2010
77
# then convertes to csv and removed " city" from after each city name
88
index: city-data
99
api: cities
10-
unique: ['name']
10+
unique: ["name"]
1111

1212
options:
13-
search: dictionary_only # API provides error when requesting fields not in dictionary
13+
search: dictionary_only # API provides error when requesting fields not in dictionary
1414

1515
dictionary:
1616
id:
@@ -51,7 +51,6 @@ dictionary:
5151
land_area:
5252
source: ALAND_SQMI
5353
description: Land Area (square miles)
54-
source: ALAND_SQMI
5554
type: float
5655
area.water:
5756
description: Water Area (square miles)

tasks/delta.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'data_magic'
1+
require_relative '../lib/data_magic.rb'
22

33
desc 'delta update current ES index with delta data file. ARG 1 must be title as specified in data.yaml, e.g., Most-Recent-Cohorts-All-Data-Elements.csv. ARG 2 is the filename of the new delta file nested in a "<DATA_PATH>/delta/<DELTA_CSV_FILE>" subdirectory. USAGE delta[ORIGINAL_FILENAME.csv,DELTA_FILENAME.csv]'
44
task :delta, [:original, :update] => :environment do |t, args|

tasks/es.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'data_magic'
1+
require_relative '../lib/data_magic.rb'
22

33
namespace :es do
44
desc "delete elasticsearch index (_all for all)"

tasks/import.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'data_magic'
1+
require_relative '../lib/data_magic.rb'
22
require 'ruby-prof'
33

44
desc "import files from DATA_PATH via rake import, optionally rake import[filename.csv] to restart import from a specific file, also rake import[nil,profile=true] for profile output."

0 commit comments

Comments
 (0)