wz2008 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/english.tsv +1835 -0
- data/data/original.tsv +1835 -0
- data/data/transform.rb +15 -0
- data/db/migrate/20141204185230_create_wz2008_categories.rb +16 -0
- data/lib/wz2008/version.rb +1 -1
- metadata +6 -2
data/data/transform.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'pry'
|
2
|
+
headlines = [:lfdnr, :wzcode, :bezeichnung, :isic]
|
3
|
+
couples = File.read('data/original.tsv').lines.map{|l|
|
4
|
+
t = l.split("\t")
|
5
|
+
t.pop
|
6
|
+
Hash[headlines.zip(t)]
|
7
|
+
}
|
8
|
+
current_category = nil
|
9
|
+
couples.each do |abschnitt|
|
10
|
+
if abschnitt[:wzcode][/^[A-Z]+$/]
|
11
|
+
current_category = abschnitt[:wzcode]
|
12
|
+
end
|
13
|
+
abschnitt[:category] = current_category
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateWz2008Categories < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :wz2008_categories do |t|
|
4
|
+
t.string :wz_code
|
5
|
+
t.string :description_en
|
6
|
+
t.string :description_de
|
7
|
+
t.string :isic
|
8
|
+
t.string :ancestry
|
9
|
+
t.string :hierarchy
|
10
|
+
t.integer :ancestry_depth, default: 0
|
11
|
+
end
|
12
|
+
add_index :wz2008_categories, :ancestry
|
13
|
+
add_index :wz2008_categories, :ancestry_depth
|
14
|
+
add_index :wz2008_categories, :hierarchy
|
15
|
+
end
|
16
|
+
end
|
data/lib/wz2008/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wz2008
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Wienert
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -90,6 +90,10 @@ files:
|
|
90
90
|
- MIT-LICENSE
|
91
91
|
- Rakefile
|
92
92
|
- app/models/wz2008/category.rb
|
93
|
+
- data/english.tsv
|
94
|
+
- data/original.tsv
|
95
|
+
- data/transform.rb
|
96
|
+
- db/migrate/20141204185230_create_wz2008_categories.rb
|
93
97
|
- lib/wz2008.rb
|
94
98
|
- lib/wz2008/engine.rb
|
95
99
|
- lib/wz2008/import.rb
|