oddb2xml 2.6.8 → 2.6.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/History.txt +5 -0
- data/lib/oddb2xml/builder.rb +1 -1
- data/lib/oddb2xml/cli.rb +3 -1
- data/lib/oddb2xml/parslet_compositions.rb +5 -1
- data/lib/oddb2xml/util.rb +1 -1
- data/lib/oddb2xml/version.rb +1 -1
- data/spec/cli_spec.rb +26 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 57997dab6b06c6ad0aa8bff72b8fb5050f025255
|
4
|
+
data.tar.gz: 57b14760b0448b1cc5a24b4fd7f5f313f3257a19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b2e2bd8a4ffa584e74422da0c77cf9755c48908bc3c82210a71848109704a59a918bda7092ba3c056dc9e1423317b8ceb94b715639d08e19ecd8b9e95db4e7c
|
7
|
+
data.tar.gz: c277c5c81259a52031f97ce7b346c80e124385efc128f549c97ed4e7f26ab739316ab7dae1b1315842c310c4028dae2db0d1a372a44ea429e3e70382c0acdd4f
|
data/History.txt
CHANGED
data/lib/oddb2xml/builder.rb
CHANGED
@@ -1337,7 +1337,7 @@ module Oddb2xml
|
|
1337
1337
|
else
|
1338
1338
|
('0' * DAT_LEN[:ITHE])
|
1339
1339
|
end.to_i
|
1340
|
-
row << "%0#{DAT_LEN[:CEAN]}d" % (sprintf('%013d', ean).match(/^000000/) ? 0 : ean.to_i)
|
1340
|
+
row << "%0#{DAT_LEN[:CEAN]}d" % (sprintf('%013d', ean.to_i).match(/^000000/) ? 0 : ean.to_i)
|
1341
1341
|
row << "%#{DAT_LEN[:CMWS]}s" % '2' # pharma
|
1342
1342
|
rows << row
|
1343
1343
|
end
|
data/lib/oddb2xml/cli.rb
CHANGED
@@ -157,7 +157,9 @@ module Oddb2xml
|
|
157
157
|
end
|
158
158
|
end
|
159
159
|
if @options[:calc]
|
160
|
-
|
160
|
+
ext = File.extname(file)
|
161
|
+
dest = File.join(WorkDir, file.sub(ext, '_'+Time.now.strftime("%d.%m.%Y_%H.%M")+ext))
|
162
|
+
FileUtils.cp(File.join(WorkDir, file), dest, :verbose => false)
|
161
163
|
end
|
162
164
|
end
|
163
165
|
rescue Interrupt
|
@@ -88,7 +88,11 @@ module ParseUtil
|
|
88
88
|
composition.substances.each do
|
89
89
|
|substance_item|
|
90
90
|
active_substance_name = substance_item.name.downcase.sub(/^cum\s/, '')
|
91
|
-
substance_item.is_active_agent = (active_agents.find {|x| /#{x.downcase.
|
91
|
+
substance_item.is_active_agent = (active_agents.find {|x| /#{x.downcase.
|
92
|
+
gsub('(', '\(').
|
93
|
+
gsub(')', '\)').
|
94
|
+
gsub('[', '\[').
|
95
|
+
gsub(']', '\]')}($|\s)/.match(active_substance_name) } != nil)
|
92
96
|
substance_item.is_active_agent = true if substance_item.chemical_substance and active_agents.find {|x| x.downcase.eql?(substance_item.chemical_substance.name.downcase) }
|
93
97
|
end
|
94
98
|
comps << composition
|
data/lib/oddb2xml/util.rb
CHANGED
@@ -69,7 +69,7 @@ module Oddb2xml
|
|
69
69
|
def Oddb2xml.add_epha_changes_for_ATC(iksnr, atc_code, force_run: false)
|
70
70
|
@atc_csv_content = {} if force_run
|
71
71
|
if @atc_csv_content.size == 0
|
72
|
-
|
72
|
+
Oddb2xml.uri_open(@atc_csv_origin).readlines.each{
|
73
73
|
|line|
|
74
74
|
items = line.split(',')
|
75
75
|
@atc_csv_content[[items[0], items[1]]] = items[2]
|
data/lib/oddb2xml/version.rb
CHANGED
data/spec/cli_spec.rb
CHANGED
@@ -184,6 +184,32 @@ describe Oddb2xml::Cli do
|
|
184
184
|
}
|
185
185
|
end
|
186
186
|
end
|
187
|
+
context 'when -e and -f dat option is given' do
|
188
|
+
before(:all) do
|
189
|
+
cleanup_directories_before_run
|
190
|
+
options = Oddb2xml::Options.parse('-e -f dat')
|
191
|
+
@cli = Oddb2xml::Cli.new(options)
|
192
|
+
@cli_output = buildr_capture(:stdout) { @cli.run }
|
193
|
+
end
|
194
|
+
it_behaves_like 'any interface for product'
|
195
|
+
it 'should have calc option' do
|
196
|
+
expect(@cli).to have_option(:format => :dat)
|
197
|
+
expect(@cli).to have_option(:calc => true)
|
198
|
+
expect(@cli).to have_option(:extended => true)
|
199
|
+
end
|
200
|
+
it 'should create xml files' do
|
201
|
+
expect(@cli_output).to match(/NonPharma/)
|
202
|
+
file_today = "oddb_calc_#{Time.now.strftime("%d.%m.%Y_%H.%M")}.xml"
|
203
|
+
expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_calc.xml')).size).to eq 1
|
204
|
+
expect(Dir.glob(File.join(Oddb2xml::WorkDir, file_today)).size).to eq 1
|
205
|
+
end
|
206
|
+
it 'should create migel files' do
|
207
|
+
expect(@cli_output).to match(/NonPharma/)
|
208
|
+
file_today = "oddb_with_migel_#{Time.now.strftime("%d.%m.%Y_%H.%M")}.dat"
|
209
|
+
expect(Dir.glob(File.join(Oddb2xml::WorkDir, 'oddb_with_migel.dat')).size).to eq 1
|
210
|
+
expect(Dir.glob(File.join(Oddb2xml::WorkDir, file_today)).size).to eq 1
|
211
|
+
end
|
212
|
+
end
|
187
213
|
|
188
214
|
context 'when -a nonpharma option is given' do
|
189
215
|
before(:all) do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oddb2xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.
|
4
|
+
version: 2.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -486,7 +486,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
486
486
|
- !ruby/object:Gem::Version
|
487
487
|
version: '0'
|
488
488
|
requirements: []
|
489
|
-
|
489
|
+
rubyforge_project:
|
490
|
+
rubygems_version: 2.6.8
|
490
491
|
signing_key:
|
491
492
|
specification_version: 4
|
492
493
|
summary: oddb2xml creates xml files.
|