loadmop 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/README.md +1 -1
- data/lib/loadmop/cli.rb +7 -7
- data/lib/loadmop/loader.rb +7 -4
- data/lib/loadmop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a7029b044d93f41028317ac778c8b24e75300a9
|
4
|
+
data.tar.gz: 54cfc07a3bb6728e92c943f34fa43b82cf4ddc2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7627ac22cb4226135881d79167176c2589daefdcb0e2ecbfe9f01f0cc66771c6c23c5515b53fcbf9265cc16a4482d0e40ed70e810247c2d762fbe881ededd29
|
7
|
+
data.tar.gz: 7edcd242425a3f20aeaef07f258c854fa3600139ece6037a0332e71a5485793dc14b385545cf4ab9cda3e876421cf98e878f47ecfff1b3ca296bb5012f8f5f41
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
+
## 0.0.4 - 2014-08-29
|
5
|
+
|
6
|
+
### Added
|
7
|
+
- Require database name as argument for each command.
|
8
|
+
|
9
|
+
### Deprecated
|
10
|
+
- Nothing.
|
11
|
+
|
12
|
+
### Removed
|
13
|
+
- Nothing.
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- #slow_load option was skipping rows and misreading headers.
|
17
|
+
|
18
|
+
|
4
19
|
## 0.0.3 - 2014-07-16
|
5
20
|
|
6
21
|
### Added
|
@@ -15,6 +30,7 @@ All notable changes to this project will be documented in this file.
|
|
15
30
|
### Fixed
|
16
31
|
- Nothing.
|
17
32
|
|
33
|
+
|
18
34
|
## 0.0.2 - 2014-07-11
|
19
35
|
|
20
36
|
### Added
|
@@ -29,6 +45,7 @@ All notable changes to this project will be documented in this file.
|
|
29
45
|
### Fixed
|
30
46
|
- Bug where schemas directory was not found when loadmop was installed as a gem
|
31
47
|
|
48
|
+
|
32
49
|
## 0.0.1 - 2014-07-10
|
33
50
|
|
34
51
|
### Added
|
data/README.md
CHANGED
@@ -72,7 +72,7 @@ Then:
|
|
72
72
|
|
73
73
|
|
74
74
|
### Loading CDM Data
|
75
|
-
- Run `bundle exec loadmop
|
75
|
+
- Run `bundle exec loadmop create_cdmv4_data /path/to/directory/holding/cdm/data/files`
|
76
76
|
- This runs all the steps for loading CDM data into a database, namely
|
77
77
|
- Creating the proper CDM tables
|
78
78
|
- Prepping the CSV files to load into the database
|
data/lib/loadmop/cli.rb
CHANGED
@@ -10,16 +10,16 @@ module Loadmop
|
|
10
10
|
aliases: :s,
|
11
11
|
desc: 'schema for database (PostgreSQL only)'
|
12
12
|
|
13
|
-
desc 'create_vocab_database vocab_files_dir', '
|
14
|
-
def create_vocab_database(vocab_files_dir)
|
15
|
-
loader = VocabLoader.new(vocab_files_dir, options)
|
13
|
+
desc 'create_vocab_database database_name vocab_files_dir', 'Creates the vocabulary tables in database_name and loads the OMOP Vocabulary data into them.'
|
14
|
+
def create_vocab_database(database_name, vocab_files_dir)
|
15
|
+
loader = VocabLoader.new(database_name, vocab_files_dir, options)
|
16
16
|
loader.create_database
|
17
17
|
end
|
18
18
|
|
19
|
-
desc '
|
20
|
-
def create_cdmv4_database(data_files_dir)
|
21
|
-
|
22
|
-
|
19
|
+
desc 'create_cdmv4_database database_name data_dir', 'Creates a set of tables in database_name for OMOP CDMv4 then loads data into them as specified by data_files_dir.'
|
20
|
+
def create_cdmv4_database(database_name, data_files_dir)
|
21
|
+
loader = CDMv4Loader.new(database_name, data_files_dir, options)
|
22
|
+
loader.create_database
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
data/lib/loadmop/loader.rb
CHANGED
@@ -8,11 +8,11 @@ module Loadmop
|
|
8
8
|
|
9
9
|
attr :options, :data_files_dir, :headers
|
10
10
|
|
11
|
-
def initialize(data_files_dir, options = {})
|
11
|
+
def initialize(database_name, data_files_dir, options = {})
|
12
12
|
@data_files_dir = Pathname.new(data_files_dir)
|
13
13
|
@options = options
|
14
14
|
@headers = {}
|
15
|
-
db(options)
|
15
|
+
db(options.merge(database: database_name))
|
16
16
|
end
|
17
17
|
|
18
18
|
def create_database
|
@@ -100,10 +100,10 @@ module Loadmop
|
|
100
100
|
all_files.each do |table_name, files|
|
101
101
|
files.each do |file|
|
102
102
|
puts "Loading #{file} into #{table_name}"
|
103
|
-
CSV.open(file
|
103
|
+
CSV.open(file) do |csv|
|
104
104
|
csv.each_slice(1000) do |rows|
|
105
105
|
print '.'
|
106
|
-
db[table_name].import(headers_for(file), rows
|
106
|
+
db[table_name].import(headers_for(file), rows)
|
107
107
|
end
|
108
108
|
end
|
109
109
|
puts
|
@@ -120,6 +120,9 @@ module Loadmop
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def headers_for(file)
|
123
|
+
if file.to_s =~ /split/
|
124
|
+
file = Pathname.new(file.dirname.to_s.sub('split', 'cleaned') + '.csv')
|
125
|
+
end
|
123
126
|
header_line = File.open(file, &:readline).downcase.gsub(/\|$/, '')
|
124
127
|
CSV.parse(header_line).first.map(&:to_sym)
|
125
128
|
end
|
data/lib/loadmop/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loadmop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Duryea
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|