oddb2xml 2.7.1 → 2.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -2
- data/.standard.yml +2 -0
- data/Gemfile +3 -3
- data/History.txt +24 -0
- data/README.md +3 -3
- data/Rakefile +24 -23
- data/bin/check_artikelstamm +11 -11
- data/bin/compare_v5 +23 -23
- data/bin/oddb2xml +14 -13
- data/lib/oddb2xml/builder.rb +1070 -1038
- data/lib/oddb2xml/calc.rb +232 -233
- data/lib/oddb2xml/chapter_70_hack.rb +38 -32
- data/lib/oddb2xml/cli.rb +252 -236
- data/lib/oddb2xml/compare.rb +70 -59
- data/lib/oddb2xml/compositions_syntax.rb +451 -430
- data/lib/oddb2xml/compressor.rb +20 -20
- data/lib/oddb2xml/downloader.rb +157 -129
- data/lib/oddb2xml/extractor.rb +295 -295
- data/lib/oddb2xml/options.rb +34 -35
- data/lib/oddb2xml/parslet_compositions.rb +265 -269
- data/lib/oddb2xml/semantic_check.rb +39 -33
- data/lib/oddb2xml/util.rb +163 -163
- data/lib/oddb2xml/version.rb +1 -1
- data/lib/oddb2xml/xml_definitions.rb +32 -33
- data/lib/oddb2xml.rb +1 -1
- data/oddb2xml.gemspec +34 -34
- data/shell.nix +17 -0
- data/spec/artikelstamm_spec.rb +111 -110
- data/spec/builder_spec.rb +490 -505
- data/spec/calc_spec.rb +552 -593
- data/spec/check_artikelstamm_spec.rb +26 -26
- data/spec/cli_spec.rb +173 -174
- data/spec/compare_spec.rb +9 -11
- data/spec/composition_syntax_spec.rb +390 -409
- data/spec/compressor_spec.rb +48 -48
- data/spec/data/transfer.dat +1 -0
- data/spec/data_helper.rb +47 -49
- data/spec/downloader_spec.rb +251 -260
- data/spec/extractor_spec.rb +171 -159
- data/spec/fixtures/vcr_cassettes/oddb2xml.json +1 -1
- data/spec/galenic_spec.rb +233 -256
- data/spec/options_spec.rb +116 -119
- data/spec/parslet_spec.rb +896 -863
- data/spec/spec_helper.rb +153 -153
- data/test_options.rb +39 -42
- data/tools/win_fetch_cacerts.rb +2 -3
- metadata +42 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b92ef261a1ad3ea6a8e2ce6d60302b0acf4c50efe1897ec9379633d31c5cced
|
4
|
+
data.tar.gz: ebaca1d2e02274a59b416e407a1049662564b48abb474f28de50b00f5b250147
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db2fe198ad3ace938014038ab1260c2351113c93b67bceed5148352aac9e8c5c4596fd7beb310869913e2dafcecb93da1abc1836b2296a8bab514e5937a47fce
|
7
|
+
data.tar.gz: 3a41d7685173bc57d9dfd0618f179ac0405140d203b50b2e750a97ebe438d2a285858972e081724d1ab525f4f106b22b7b673d2fa5511790b87287eac8e5609b
|
data/.github/workflows/ruby.yml
CHANGED
data/.standard.yml
ADDED
data/Gemfile
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
=== 2.7.5 / 1.02.2022
|
2
|
+
* Specify old versions of savon and rdoc to avoid importing psych
|
3
|
+
* Added ruby 3.1 to tested ruby versions
|
4
|
+
* Removed ruby 2.5 from supported versions
|
5
|
+
* Force psych to < 4.0 to avoid the error Psych::DisallowedClass: Tried to load unspecified class: Struct::GalenicGroup
|
6
|
+
* Therefor rdoc < 6.4
|
7
|
+
|
8
|
+
=== 2.7.4 / 30.03.2021
|
9
|
+
* Update needed Ruby-Version to 2.5.0 in gemspec
|
10
|
+
* Ensure downloads directory is created at first run
|
11
|
+
|
12
|
+
=== 2.7.3 / 29.03.2021
|
13
|
+
* Do not delete swissmedic_package.xlsx and swissmedic_orphan.xlsx
|
14
|
+
* Save swissmedic_package.xlsx and swissmedic_orphan.xlsx under downloads
|
15
|
+
* Log removing files
|
16
|
+
|
17
|
+
=== 2.7.2 / 18.03.2021
|
18
|
+
* Added https://github.com/testdouble/standard and fixed all useful warnings
|
19
|
+
* Added standard to rake tasks
|
20
|
+
* Use ATC-code from refdata if available and show differences
|
21
|
+
* Get pharmacode from tranfer.dat for artikelstamm if possible
|
22
|
+
* We do not longer test Ruby 2.4 with github/actions
|
23
|
+
* Update build status to use github/actions instead of travis
|
24
|
+
|
1
25
|
=== 2.7.1 / 03.02.2021
|
2
26
|
* travis-ci -> Github Actions
|
3
27
|
* limit DSCRD/DSCRF to 120 chars as specified in the XSD
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# oddb2xml
|
2
2
|
|
3
|
-
[![Build Status](https://
|
3
|
+
[![Build Status](https://github.com/zdavatz/oddb2xml/workflows/Ruby/badge.svg)](https://github.com/zdavatz/oddb2xml/actions)
|
4
4
|
|
5
5
|
* oddb2xml -a nonpharma -o fi
|
6
6
|
|
@@ -106,8 +106,8 @@ FR
|
|
106
106
|
|
107
107
|
## Supported ruby version
|
108
108
|
|
109
|
-
We run tests on travis-ci.org for the Ruby versions mentioned in the .travis.yml file. You will need ruby > 2.
|
110
|
-
|
109
|
+
We run tests on travis-ci.org for the Ruby versions mentioned in the .travis.yml file. You will need ruby > 2.5 to work correctly.
|
110
|
+
Look at the github actions to see the spec test results. We ignore errors against ruby head, as it is sometimes unstable.
|
111
111
|
|
112
112
|
|
113
113
|
## XSD files
|
data/Rakefile
CHANGED
@@ -1,25 +1,26 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
lib = File.expand_path(
|
2
|
+
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require
|
5
|
+
require "oddb2xml/version"
|
6
6
|
require "bundler/gem_tasks"
|
7
|
-
require
|
7
|
+
require "standard/rake"
|
8
|
+
require "rspec/core/rake_task"
|
8
9
|
|
9
10
|
RSpec::Core::RakeTask.new(:spec)
|
10
11
|
|
11
12
|
# dependencies are now declared in oddb2xml.gemspec
|
12
13
|
|
13
|
-
desc
|
14
|
-
task :
|
14
|
+
desc "Offer a gem task like hoe"
|
15
|
+
task gem: :build do
|
15
16
|
Rake::Task[:build].invoke
|
16
17
|
end
|
17
18
|
|
18
|
-
task :
|
19
|
+
task spec: :clean
|
19
20
|
|
20
|
-
desc
|
21
|
-
task :
|
22
|
-
log_file =
|
21
|
+
desc "Run oddb2xml with all commonly used combinations"
|
22
|
+
task test: [:clean, :spec, :gem] do
|
23
|
+
log_file = "test_options.log"
|
23
24
|
puts "Running test_options.rb with Output redirected to #{log_file}. This will take some time (e.g. 20 minutes)"
|
24
25
|
# must use bash -o pipefail to catch error in test_options.rb and not tee
|
25
26
|
# see http://stackoverflow.com/questions/985876/tee-and-exit-status
|
@@ -28,16 +29,16 @@ task :test => [:clean, :spec, :gem] do
|
|
28
29
|
exit 1 unless res
|
29
30
|
end
|
30
31
|
|
31
|
-
require
|
32
|
-
CLEAN.include FileList[
|
33
|
-
CLEAN.include FileList[
|
34
|
-
CLEAN.include FileList[
|
35
|
-
CLEAN.include FileList[
|
36
|
-
CLEAN.include FileList[
|
37
|
-
CLEAN.include FileList[
|
38
|
-
CLEAN.include FileList[
|
39
|
-
CLEAN.include FileList[
|
40
|
-
CLEAN.include FileList[
|
41
|
-
CLEAN.include FileList[
|
42
|
-
CLEAN.include FileList[
|
43
|
-
CLEAN.include FileList[
|
32
|
+
require "rake/clean"
|
33
|
+
CLEAN.include FileList["pkg/*.gem"]
|
34
|
+
CLEAN.include FileList["*.zip*"]
|
35
|
+
CLEAN.include FileList["*.xls*"]
|
36
|
+
CLEAN.include FileList["*.xml*"]
|
37
|
+
CLEAN.include FileList["*.dat*"]
|
38
|
+
CLEAN.include FileList["*.tar.gz"]
|
39
|
+
CLEAN.include FileList["*.txt.*"]
|
40
|
+
CLEAN.include FileList["*.csv.*"]
|
41
|
+
CLEAN.include FileList["*.zip.*"]
|
42
|
+
CLEAN.include FileList["ruby*.tmp"]
|
43
|
+
CLEAN.include FileList["data/download"]
|
44
|
+
CLEAN.include FileList["duplicate_ean13_from_zur_rose.txt"]
|
data/bin/check_artikelstamm
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
2
|
+
require "pathname"
|
3
3
|
|
4
4
|
root = Pathname.new(__FILE__).realpath.parent.parent
|
5
|
-
$:.unshift root.join(
|
5
|
+
$:.unshift root.join("lib") if $0 == __FILE__
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
7
|
+
require "oddb2xml/version"
|
8
|
+
require "oddb2xml/semantic_check"
|
9
|
+
require "optimist"
|
10
10
|
|
11
|
-
@opts = Optimist
|
12
|
-
version "
|
11
|
+
@opts = Optimist.options(ARGV) do
|
12
|
+
version "#{$0} ver.#{Oddb2xml::VERSION}"
|
13
13
|
banner <<-EOS
|
14
14
|
Runs various semanti_check for the Elexis artikelstamm
|
15
15
|
Usage:
|
16
16
|
#{File.basename(__FILE__)} xml_file_to_check
|
17
|
-
EOS
|
17
|
+
EOS
|
18
18
|
end
|
19
19
|
$stdout.sync = true
|
20
20
|
|
@@ -24,7 +24,7 @@ if args.size != 1
|
|
24
24
|
exit 2
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
diff = (Time.now-
|
27
|
+
start_time = Time.now
|
28
|
+
Oddb2xml::SemanticCheck.new(ARGV.first).allSemanticChecks
|
29
|
+
diff = (Time.now - start_time).to_i
|
30
30
|
puts "#{Time.now.strftime("%H:%M:%S")}: #{__FILE__} done. Took #{diff} seconds"
|
data/bin/compare_v5
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
2
|
+
require "pathname"
|
3
3
|
|
4
4
|
root = Pathname.new(__FILE__).realpath.parent.parent
|
5
|
-
$:.unshift root.join(
|
5
|
+
$:.unshift root.join("lib") if $0 == __FILE__
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
require "oddb2xml/version"
|
8
|
+
require "oddb2xml/compare"
|
9
|
+
require "optimist"
|
10
|
+
DEFAULTS_X = {
|
11
|
+
components: ["PRODUCTS", "LIMITATIONS", "ITEMS"],
|
12
|
+
fields_to_ignore: ["COMP", "DOSAGE_FORMF", "MEASUREF"],
|
13
|
+
fields_as_floats: ["PEXT", "PEXF", "PPUB"],
|
14
|
+
min_diff_for_floats: 0.01,
|
15
|
+
case_insensitive: true
|
16
|
+
}
|
17
17
|
|
18
|
-
@opts = Optimist
|
19
|
-
version "
|
18
|
+
@opts = Optimist.options(ARGV) do
|
19
|
+
version "#{$0} ver.#{Oddb2xml::VERSION}"
|
20
20
|
banner <<-EOS
|
21
21
|
Usage:
|
22
22
|
compare_v5 [option] first_v5_xml second_v5_xml
|
23
|
-
EOS
|
24
|
-
opt :components,
|
25
|
-
opt :fields_as_floats,
|
26
|
-
opt :fields_to_ignore,
|
27
|
-
opt :min_diff_for_floats, "Minimal difference when comparing floats", :
|
28
|
-
opt :case_insensitive,
|
23
|
+
EOS
|
24
|
+
opt :components, "components to compare", default: Oddb2xml::CompareV5::DEFAULTS[:components]
|
25
|
+
opt :fields_as_floats, "Fields that should be compared as floats", default: Oddb2xml::CompareV5::DEFAULTS[:fields_as_floats]
|
26
|
+
opt :fields_to_ignore, "Ignore these fields", default: Oddb2xml::CompareV5::DEFAULTS[:fields_to_ignore]
|
27
|
+
opt :min_diff_for_floats, "Minimal difference when comparing floats", default: Oddb2xml::CompareV5::DEFAULTS[:min_diff_for_floats]
|
28
|
+
opt :case_insensitive, "case_insensitive comparison", default: Oddb2xml::CompareV5::DEFAULTS[:case_insensitive]
|
29
29
|
end
|
30
30
|
$stdout.sync = false
|
31
31
|
|
@@ -35,7 +35,7 @@ if args.size != 2
|
|
35
35
|
exit 2
|
36
36
|
end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
diff = (Time.now-
|
38
|
+
start_time = Time.now
|
39
|
+
Oddb2xml::CompareV5.new(ARGV.first, ARGV.last, @opts).compare
|
40
|
+
diff = (Time.now - start_time).to_i
|
41
41
|
puts "#{Time.now.strftime("%H:%M:%S")}: #{__FILE__} done. Took #{diff} seconds"
|
data/bin/oddb2xml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require "pathname"
|
4
4
|
root = Pathname.new(__FILE__).realpath.parent.parent
|
5
|
-
$:.unshift root.join(
|
5
|
+
$:.unshift root.join("lib") if $0 == __FILE__
|
6
6
|
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
7
|
+
require "mechanize"
|
8
|
+
require "oddb2xml"
|
9
|
+
require "oddb2xml/options"
|
10
10
|
$stdout.sync = true
|
11
11
|
|
12
12
|
opts = Oddb2xml::Options.parse(ARGV)
|
@@ -17,21 +17,21 @@ if args.size > 0
|
|
17
17
|
exit 2
|
18
18
|
end
|
19
19
|
# TEMP
|
20
|
-
if path = args.first
|
20
|
+
if (path = args.first)
|
21
21
|
opts[:transfer_dat] = path
|
22
22
|
end
|
23
23
|
|
24
|
-
|
24
|
+
start_time = Time.now
|
25
25
|
ui = Oddb2xml::Cli.new(opts)
|
26
26
|
begin
|
27
27
|
if opts[:format] == :xml
|
28
28
|
opts[:ean14] = true # force
|
29
29
|
end
|
30
|
-
#puts opts if opts[:debug]
|
30
|
+
# puts opts if opts[:debug]
|
31
31
|
if RUBY_VERSION.to_f < 1.9
|
32
|
-
message =
|
33
|
-
Once you find some time, please upgrade your Ruby to 1.9.3 ;)
|
34
|
-
then you will not see anymore warnings
|
32
|
+
message = <<~MES
|
33
|
+
Once you find some time, please upgrade your Ruby to 1.9.3 ;)
|
34
|
+
then you will not see anymore warnings
|
35
35
|
MES
|
36
36
|
warn message
|
37
37
|
end
|
@@ -39,5 +39,6 @@ then you will not see anymore warnings
|
|
39
39
|
rescue Interrupt
|
40
40
|
exit
|
41
41
|
end
|
42
|
-
diff = (Time.now-
|
43
|
-
puts "#{Time.now}: #{__LINE__} done. Took #{diff} seconds"
|
42
|
+
diff = (Time.now - start_time).to_i
|
43
|
+
puts "#{Time.now}: #{__LINE__} done. Took #{diff} seconds"
|
44
|
+
$stdout.sync
|