oddb2xml 2.7.1 → 2.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +1 -2
  3. data/.standard.yml +2 -0
  4. data/Gemfile +3 -3
  5. data/History.txt +24 -0
  6. data/README.md +3 -3
  7. data/Rakefile +24 -23
  8. data/bin/check_artikelstamm +11 -11
  9. data/bin/compare_v5 +23 -23
  10. data/bin/oddb2xml +14 -13
  11. data/lib/oddb2xml/builder.rb +1070 -1038
  12. data/lib/oddb2xml/calc.rb +232 -233
  13. data/lib/oddb2xml/chapter_70_hack.rb +38 -32
  14. data/lib/oddb2xml/cli.rb +252 -236
  15. data/lib/oddb2xml/compare.rb +70 -59
  16. data/lib/oddb2xml/compositions_syntax.rb +451 -430
  17. data/lib/oddb2xml/compressor.rb +20 -20
  18. data/lib/oddb2xml/downloader.rb +157 -129
  19. data/lib/oddb2xml/extractor.rb +295 -295
  20. data/lib/oddb2xml/options.rb +34 -35
  21. data/lib/oddb2xml/parslet_compositions.rb +265 -269
  22. data/lib/oddb2xml/semantic_check.rb +39 -33
  23. data/lib/oddb2xml/util.rb +163 -163
  24. data/lib/oddb2xml/version.rb +1 -1
  25. data/lib/oddb2xml/xml_definitions.rb +32 -33
  26. data/lib/oddb2xml.rb +1 -1
  27. data/oddb2xml.gemspec +34 -34
  28. data/shell.nix +17 -0
  29. data/spec/artikelstamm_spec.rb +111 -110
  30. data/spec/builder_spec.rb +490 -505
  31. data/spec/calc_spec.rb +552 -593
  32. data/spec/check_artikelstamm_spec.rb +26 -26
  33. data/spec/cli_spec.rb +173 -174
  34. data/spec/compare_spec.rb +9 -11
  35. data/spec/composition_syntax_spec.rb +390 -409
  36. data/spec/compressor_spec.rb +48 -48
  37. data/spec/data/transfer.dat +1 -0
  38. data/spec/data_helper.rb +47 -49
  39. data/spec/downloader_spec.rb +251 -260
  40. data/spec/extractor_spec.rb +171 -159
  41. data/spec/fixtures/vcr_cassettes/oddb2xml.json +1 -1
  42. data/spec/galenic_spec.rb +233 -256
  43. data/spec/options_spec.rb +116 -119
  44. data/spec/parslet_spec.rb +896 -863
  45. data/spec/spec_helper.rb +153 -153
  46. data/test_options.rb +39 -42
  47. data/tools/win_fetch_cacerts.rb +2 -3
  48. metadata +42 -12
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c31777bcd85038bd65d38d67d6ebdf2197f174389403b76ff146b18d3ef4557e
4
- data.tar.gz: 8d8930ed04518838084ae4aeb69181418b2eddb36cfa83ece2cbc84ccd06e1f4
3
+ metadata.gz: 2b92ef261a1ad3ea6a8e2ce6d60302b0acf4c50efe1897ec9379633d31c5cced
4
+ data.tar.gz: ebaca1d2e02274a59b416e407a1049662564b48abb474f28de50b00f5b250147
5
5
  SHA512:
6
- metadata.gz: abe9685cc40ba1fbf9525c3cbeb9f332a98725e76621074c9f1df179c91e53cb50a4f15e78a800a28224351d3a47ec8aef0e3b9ee17787a8dccd519db65bc6d8
7
- data.tar.gz: 415b9049a316af98279f7af0b602ecd85b0bd2e86493133af512d37b494d43155822ef754ad6dcaa39b1aa474fddba57081860588b7e896da13bf891e9b522d6
6
+ metadata.gz: db2fe198ad3ace938014038ab1260c2351113c93b67bceed5148352aac9e8c5c4596fd7beb310869913e2dafcecb93da1abc1836b2296a8bab514e5937a47fce
7
+ data.tar.gz: 3a41d7685173bc57d9dfd0618f179ac0405140d203b50b2e750a97ebe438d2a285858972e081724d1ab525f4f106b22b7b673d2fa5511790b87287eac8e5609b
@@ -22,8 +22,7 @@ jobs:
22
22
  fail-fast: false
23
23
  matrix:
24
24
  os: [ ubuntu]
25
- ruby: [2.4, 2.5, 2.6, 2.7, 3.0, head]
26
- continue-on-error: ${{ endsWith(matrix.ruby, 'head') }}
25
+ ruby: [2.6, 2.7, "3.0", 3.1]
27
26
  steps:
28
27
  - uses: actions/checkout@v2
29
28
  - uses: ruby/setup-ruby@v1
data/.standard.yml ADDED
@@ -0,0 +1,2 @@
1
+ ignore: # default: []
2
+ - 'vendor/**/*'
data/Gemfile CHANGED
@@ -1,8 +1,8 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
5
  group :debugger do
6
- gem 'pry-byebug'
7
- gem 'pry-doc'
6
+ gem "pry-byebug"
7
+ gem "pry-doc"
8
8
  end
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://secure.travis-ci.org/zdavatz/oddb2xml.png)](http://travis-ci.org/zdavatz/oddb2xml)
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.4 to work correctly.
110
- Ruby 2.2/2.3 have problems with i18n encoding and fail a spec test for Naropin
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
- # encoding: utf-8
3
- lib = File.expand_path('../lib', __FILE__)
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'oddb2xml/version'
5
+ require "oddb2xml/version"
6
6
  require "bundler/gem_tasks"
7
- require 'rspec/core/rake_task'
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 'Offer a gem task like hoe'
14
- task :gem => :build do
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 :spec => :clean
19
+ task spec: :clean
19
20
 
20
- desc 'Run oddb2xml with all commonly used combinations'
21
- task :test => [:clean, :spec, :gem] do
22
- log_file = 'test_options.log'
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 'rake/clean'
32
- CLEAN.include FileList['pkg/*.gem']
33
- CLEAN.include FileList['*.zip*']
34
- CLEAN.include FileList['*.xls*']
35
- CLEAN.include FileList['*.xml*']
36
- CLEAN.include FileList['*.dat*']
37
- CLEAN.include FileList['*.tar.gz']
38
- CLEAN.include FileList['*.txt.*']
39
- CLEAN.include FileList['*.csv.*']
40
- CLEAN.include FileList['*.zip.*']
41
- CLEAN.include FileList['ruby*.tmp']
42
- CLEAN.include FileList['data/download']
43
- CLEAN.include FileList['duplicate_ean13_from_zur_rose.txt']
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"]
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
2
+ require "pathname"
3
3
 
4
4
  root = Pathname.new(__FILE__).realpath.parent.parent
5
- $:.unshift root.join('lib') if $0 == __FILE__
5
+ $:.unshift root.join("lib") if $0 == __FILE__
6
6
 
7
- require 'oddb2xml/version'
8
- require 'oddb2xml/semantic_check'
9
- require 'optimist'
7
+ require "oddb2xml/version"
8
+ require "oddb2xml/semantic_check"
9
+ require "optimist"
10
10
 
11
- @opts = Optimist::options(ARGV) do
12
- version "#$0 ver.#{Oddb2xml::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
- startTime = Time.now
28
- result = Oddb2xml::SemanticCheck.new(ARGV.first).allSemanticChecks
29
- diff = (Time.now-startTime).to_i
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 'pathname'
2
+ require "pathname"
3
3
 
4
4
  root = Pathname.new(__FILE__).realpath.parent.parent
5
- $:.unshift root.join('lib') if $0 == __FILE__
5
+ $:.unshift root.join("lib") if $0 == __FILE__
6
6
 
7
- require 'oddb2xml/version'
8
- require 'oddb2xml/compare'
9
- require 'optimist'
10
- DEFAULTSx = {
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
- }
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::options(ARGV) do
19
- version "#$0 ver.#{Oddb2xml::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, "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]
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
- startTime = Time.now
39
- result = Oddb2xml::CompareV5.new(ARGV.first, ARGV.last, @opts).compare
40
- diff = (Time.now-startTime).to_i
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 'pathname'
3
+ require "pathname"
4
4
  root = Pathname.new(__FILE__).realpath.parent.parent
5
- $:.unshift root.join('lib') if $0 == __FILE__
5
+ $:.unshift root.join("lib") if $0 == __FILE__
6
6
 
7
- require 'mechanize'
8
- require 'oddb2xml'
9
- require 'oddb2xml/options'
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
- startTime = Time.now
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 = <<-MES
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-startTime).to_i
43
- puts "#{Time.now}: #{__LINE__} done. Took #{diff} seconds"; $stdout.sync
42
+ diff = (Time.now - start_time).to_i
43
+ puts "#{Time.now}: #{__LINE__} done. Took #{diff} seconds"
44
+ $stdout.sync