swissmedic-diff 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 03883d51e63ce4b274373d9524e82bb55b406e4b
4
- data.tar.gz: 6fcaaf92a126ae180b71c0e693c1ed9908fd3cf3
3
+ metadata.gz: ddb4d15cde4a334e2681bf63ffbf70802101b8e3
4
+ data.tar.gz: d61b0259447991ed94b439ec1560209fc0fbd2bc
5
5
  SHA512:
6
- metadata.gz: 1ba066e94fbcf0ecad22682c18cf72feea6cf264875ccfde3b974b62e533a292490446d8d5b721ca80e29bbaa18e2088d2882b3b7dd2bc79f7ca503e0553de78
7
- data.tar.gz: 30c7cce1476073047735584c2c61215f928ac7948bc6feb64b6d024d7906398276010db28cb586fb19925f2aae860f73bd04cc951cedbe0612655f221049648c
6
+ metadata.gz: da1008ec679d4e3171b22a2caf4e9089d509f38c64e06ba117ad1915a75fcf7e6ffe4530dd990360676394109b060ed7fd52e734e7740563f543a1ff2fbf68cd
7
+ data.tar.gz: e86df5b45b01f8161f09833838b722ce32accc79155cef9ac575ad58172db1230d785c4d8b36f8357e372e18024ee44b0899765faf6a86dfbe62cd7dff1f3a24
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swissmedic-diff (0.2.2)
4
+ swissmedic-diff (0.2.3)
5
5
  nokogiri
6
- rubyXL (= 3.3.1)
6
+ rubyXL (>= 3.3.1)
7
7
  rubyzip
8
8
  spreadsheet
9
9
 
@@ -11,50 +11,43 @@ GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  ansi (1.5.0)
14
- builder (3.2.2)
15
- byebug (4.0.5)
16
- columnize (= 0.9.0)
17
- coderay (1.1.0)
18
- columnize (0.9.0)
19
- hoe (3.13.1)
20
- rake (>= 0.8, < 11.0)
14
+ builder (3.2.3)
15
+ byebug (9.1.0)
16
+ coderay (1.1.2)
21
17
  method_source (0.8.2)
22
- mini_portile2 (2.0.0)
23
- minitest (5.7.0)
24
- minitest-reporters (1.0.17)
18
+ mini_portile2 (2.3.0)
19
+ minitest (5.10.3)
20
+ minitest-reporters (1.1.18)
25
21
  ansi
26
22
  builder
27
23
  minitest (>= 5.0)
28
24
  ruby-progressbar
29
- nokogiri (1.6.7)
30
- mini_portile2 (~> 2.0.0.rc2)
31
- pry (0.10.1)
25
+ nokogiri (1.8.1)
26
+ mini_portile2 (~> 2.3.0)
27
+ pry (0.11.0)
32
28
  coderay (~> 1.1.0)
33
29
  method_source (~> 0.8.1)
34
- slop (~> 3.4)
35
- pry-byebug (3.1.0)
36
- byebug (~> 4.0)
30
+ pry-byebug (3.5.0)
31
+ byebug (~> 9.1)
37
32
  pry (~> 0.10)
38
- pry-doc (0.8.0)
33
+ pry-doc (0.11.1)
39
34
  pry (~> 0.9)
40
- yard (~> 0.8)
41
- rake (10.4.2)
42
- ruby-ole (1.2.11.8)
43
- ruby-progressbar (1.7.5)
44
- rubyXL (3.3.1)
35
+ yard (~> 0.9)
36
+ rake (12.1.0)
37
+ ruby-ole (1.2.12.1)
38
+ ruby-progressbar (1.8.3)
39
+ rubyXL (3.3.26)
45
40
  nokogiri (>= 1.4.4)
46
41
  rubyzip (>= 1.1.6)
47
- rubyzip (1.1.7)
48
- slop (3.6.0)
49
- spreadsheet (1.1.0)
42
+ rubyzip (1.2.1)
43
+ spreadsheet (1.1.4)
50
44
  ruby-ole (>= 1.0)
51
- yard (0.8.7.6)
45
+ yard (0.9.9)
52
46
 
53
47
  PLATFORMS
54
48
  ruby
55
49
 
56
50
  DEPENDENCIES
57
- hoe
58
51
  minitest
59
52
  minitest-reporters
60
53
  pry-byebug
@@ -63,4 +56,4 @@ DEPENDENCIES
63
56
  swissmedic-diff!
64
57
 
65
58
  BUNDLED WITH
66
- 1.11.2
59
+ 1.15.4
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.2.3 / 25.09.2017
2
+
3
+ * Fix comparing Date cells
4
+ * Run travis tests for ruby 2.3 and 2.4
5
+
1
6
  === 0.2.2 / 11.01.2016
2
7
 
3
8
  * Don't fail if date cells are nil
Binary file
Binary file
data/Rakefile CHANGED
@@ -1,24 +1,7 @@
1
1
  # -*- ruby -*-
2
2
 
3
3
  require 'rubygems'
4
- require 'hoe'
4
+ require "bundler/gem_tasks"
5
5
 
6
- # Hoe.plugin :compiler
7
- # Hoe.plugin :gem_prelude_sucks
8
- # Hoe.plugin :inline
9
- # Hoe.plugin :inline
10
- # Hoe.plugin :racc
11
- # Hoe.plugin :rubyforge
12
- # Hoe.plugin :rubyforge
13
-
14
- Hoe.spec 'swissmedic-diff' do
15
- # HEY! If you fill these out in ~/.hoe_template/Rakefile.erb then
16
- # you'll never have to touch them again!
17
- # (delete this comment too, of course)
18
-
19
- developer('Masaomi Hatakeyama, Zeno R.R. Davatz', 'mhatakeyama@ywesee.com, zdavatz@ywesee.com')
20
-
21
- # self.rubyforge_name = 'swissmswissmedic-diffx' # if different than 'swissmedic-diff'
22
- end
23
-
24
- # vim: syntax=ruby
6
+ require 'rake/clean'
7
+ CLEAN.include FileList['*.log']
@@ -6,6 +6,7 @@ require 'ostruct'
6
6
  require 'spreadsheet'
7
7
  require 'rubyXL'
8
8
  require 'pp'
9
+ require File.join(File.dirname(__FILE__), 'version.rb')
9
10
 
10
11
  # add some monkey patches for Spreadsheet and rubyXL
11
12
  require File.join(File.dirname(__FILE__), 'compatibility.rb')
@@ -97,6 +98,7 @@ class SwissmedicDiff
97
98
  :atc_class => 'ATC-Code',
98
99
  }
99
100
  GALFORM_P = %r{excipiens\s+(ad|pro)\s+(?<galform>((?!\bpro\b)[^.])+)}
101
+ DATE_FORMAT = '%Y:%m:%d'
100
102
 
101
103
  def capitalize(string)
102
104
  string.split(/\s+/).collect { |word| word.capitalize }.join(' ')
@@ -264,9 +266,9 @@ class SwissmedicDiff
264
266
  if !ignore.include?(key)
265
267
  left = _comparable(key, row, @target_keys.index(key))
266
268
  right = _comparable(key, other, @latest_keys.index(key))
267
- next if left.is_a?(Date) and right.is_a?(Date) and left.start.eql?(right.start)
268
- next if left.is_a?(String) and left.empty? and not right
269
- next if right.is_a?(String) and right.empty? and not left
269
+ next if left.is_a?(Date) && right.is_a?(Date) && left.strftime(DATE_FORMAT).eql?(right.strftime(DATE_FORMAT))
270
+ next if left.is_a?(String) && left.empty? && !right
271
+ next if right.is_a?(String) && right.empty? && !left
270
272
  if left != right
271
273
  flags.push key
272
274
  end
@@ -331,7 +333,7 @@ class SwissmedicDiff
331
333
 
332
334
  def get_column_indices(spreadsheet)
333
335
  error_2014 = nil
334
- filename = spreadsheet.root.filepath
336
+ filename = spreadsheet.root.respond_to?(:filepath) ? spreadsheet.root.filepath : 'unknown'
335
337
  headerRowId = rows_to_skip(spreadsheet)-1
336
338
  row = spreadsheet.worksheet(0)[headerRowId]
337
339
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class SwissmedicDiff
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3'
3
3
  end
@@ -23,10 +23,23 @@ module ODDB
23
23
  result = @diff.diff this_month, last_month, [:atc_class, :sequence_date]
24
24
  assert(result.changes.flatten.index('Zulassungs-Nummer') == nil, "Should not find Zulassungs-Nummer in changes")
25
25
  assert_equal(1, result.news.size)
26
- assert_equal(1, result.changes.size)
27
- assert_equal(0, result.updates.size)
26
+ assert_equal(3, result.changes.size)
27
+ assert_equal(4, result.updates.size)
28
28
  assert_equal(['65838'], result.news.collect{|x| x[0] if x[0] == '65838'})
29
- assert_equal({"65838"=>[:new]}, result.changes)
29
+ assert_equal({"00277"=>[:name_base, :expiry_date], "00279"=>[:expiry_date], "65838"=>[:new]}, result.changes)
30
+ end
31
+
32
+ def test_diff_changes
33
+ @diff = SwissmedicDiff.new
34
+ last_month = File.expand_path 'data/Packungen-2015.06.04.xlsx', File.dirname(__FILE__)
35
+ this_month = File.expand_path 'data/Packungen-2015.07.02.xlsx', File.dirname(__FILE__)
36
+ expected = {
37
+ "00277"=>[:name_base, :expiry_date],
38
+ "00279"=>[:expiry_date],
39
+ "65838"=>[:new]
40
+ }
41
+ result = @diff.diff this_month, last_month
42
+ assert_equal(expected, result.changes)
30
43
  end
31
44
 
32
45
  def test_diff_wrong_header
@@ -41,7 +54,7 @@ module ODDB
41
54
  result = @diff.diff @february_2014, @january_2014, [:atc_class, :sequence_date]
42
55
  assert_equal 4, result.news.size
43
56
  expected = {
44
- "00277"=>[:name_base],
57
+ "00277"=>[:name_base, :expiry_date],
45
58
  "65040"=>[:sequence, :replaced_package],
46
59
  "60125"=>[:new],
47
60
  "61367"=>[:new],
@@ -96,14 +109,14 @@ module ODDB
96
109
  + 60125: Otriduo Schnupfen, Dosierspray
97
110
  + 61367: Hypericum-Mepha 250, Lactab
98
111
  - 00274: Cardio-Pulmo-Rénal Sérocytol, suppositoire
99
- > 00277: Coeur-Vaisseaux Sérocytol, Namensänderung; Namensänderung (Coeur-Vaisseaux Sérocytol, Namensänderung)
112
+ > 00277: Coeur-Vaisseaux Sérocytol, Namensänderung; Namensänderung (Coeur-Vaisseaux Sérocytol, Namensänderung), Ablaufdatum der Zulassung (25.04.2020)
100
113
  > 00278: Colon Sérocytol, suppositoire; ATC-Code (J06AA)
101
114
  > 00279: Conjonctif Sérocytol, suppositoire; ATC-Code (D03AX04)
102
115
  > 65040: Panthoben, Salbe; Packungs-Nummer (001 -> 003)
103
116
  EOS
104
117
  assert_equal <<-EOS.strip, @diff.to_s(:name)
105
118
  - 00274: Cardio-Pulmo-Rénal Sérocytol, suppositoire
106
- > 00277: Coeur-Vaisseaux Sérocytol, Namensänderung; Namensänderung (Coeur-Vaisseaux Sérocytol, Namensänderung)
119
+ > 00277: Coeur-Vaisseaux Sérocytol, Namensänderung; Namensänderung (Coeur-Vaisseaux Sérocytol, Namensänderung), Ablaufdatum der Zulassung (25.04.2020)
107
120
  > 00278: Colon Sérocytol, suppositoire; ATC-Code (J06AA)
108
121
  > 00279: Conjonctif Sérocytol, suppositoire; ATC-Code (D03AX04)
109
122
  + 61367: Hypericum-Mepha 250, Lactab
@@ -112,7 +125,7 @@ module ODDB
112
125
  EOS
113
126
  assert_equal <<-EOS.strip, @diff.to_s(:registration)
114
127
  - 00274: Cardio-Pulmo-Rénal Sérocytol, suppositoire
115
- > 00277: Coeur-Vaisseaux Sérocytol, Namensänderung; Namensänderung (Coeur-Vaisseaux Sérocytol, Namensänderung)
128
+ > 00277: Coeur-Vaisseaux Sérocytol, Namensänderung; Namensänderung (Coeur-Vaisseaux Sérocytol, Namensänderung), Ablaufdatum der Zulassung (25.04.2020)
116
129
  > 00278: Colon Sérocytol, suppositoire; ATC-Code (J06AA)
117
130
  > 00279: Conjonctif Sérocytol, suppositoire; ATC-Code (D03AX04)
118
131
  + 60125: Otriduo Schnupfen, Dosierspray
metadata CHANGED
@@ -1,90 +1,140 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swissmedic-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
- - Masaomi Hatakeyama, Zeno R.R. Davatz
7
+ - Hannes Wyss, Masaomi Hatakeyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-11 00:00:00.000000000 Z
11
+ date: 2017-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rdoc
14
+ name: rubyXL
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: 3.3.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.3.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubyzip
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: spreadsheet
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: minitest
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
20
90
  type: :development
21
91
  prerelease: false
22
92
  version_requirements: !ruby/object:Gem::Requirement
23
93
  requirements:
24
- - - "~>"
94
+ - - ">="
25
95
  - !ruby/object:Gem::Version
26
- version: '4.0'
96
+ version: '0'
27
97
  - !ruby/object:Gem::Dependency
28
- name: hoe
98
+ name: minitest-reporters
29
99
  requirement: !ruby/object:Gem::Requirement
30
100
  requirements:
31
- - - "~>"
101
+ - - ">="
32
102
  - !ruby/object:Gem::Version
33
- version: '3.7'
103
+ version: '0'
34
104
  type: :development
35
105
  prerelease: false
36
106
  version_requirements: !ruby/object:Gem::Requirement
37
107
  requirements:
38
- - - "~>"
108
+ - - ">="
39
109
  - !ruby/object:Gem::Version
40
- version: '3.7'
41
- description: |-
42
- * Compares two Excel Documents provided by Swissmedic and displays the
43
- salient differences. Also: Find out what Products have changed on the
44
- swiss healthcare market.
45
-
46
- Up-To-Date file:
47
-
48
- * http://www.swissmedic.ch//daten/00080/00251/index.html
49
- email:
50
- - mhatakeyama@ywesee.com, zdavatz@ywesee.com
110
+ version: '0'
111
+ description: Compares two Excel Documents provided by Swissmedic and displays the
112
+ salient differences
113
+ email: hwyss@ywesee.com, mhatakeyama@ywesee.com
51
114
  executables:
52
115
  - swissmedic-diff
53
116
  extensions: []
54
- extra_rdoc_files:
55
- - History.txt
56
- - Manifest.txt
57
- - README.txt
117
+ extra_rdoc_files: []
58
118
  files:
59
- - ".gemtest"
60
- - ".gitignore"
61
- - ".travis.yml"
62
119
  - Gemfile
63
120
  - Gemfile.lock
64
121
  - History.txt
65
122
  - LICENSE
66
123
  - Manifest.txt
124
+ - Packungen-2016.01.09.xlsx
125
+ - Packungen-2017.09.07.xlsx
67
126
  - README.txt
68
127
  - Rakefile
69
128
  - bin/swissmedic-diff
70
129
  - lib/compatibility.rb
71
130
  - lib/swissmedic-diff.rb
72
131
  - lib/version.rb
73
- - setup.rb
74
- - swissmedic-diff.gemspec
75
- - test/data/Packungen-2014.01.01.xlsx
76
- - test/data/Packungen-2014.02.01.xlsx
77
- - test/data/Packungen-2015.06.04.xlsx
78
- - test/data/Packungen-2015.07.02.xlsx
79
132
  - test/test_swissmedic-diff.rb
80
133
  homepage: https://github.com/zdavatz/swissmedic-diff
81
- licenses:
82
- - MIT
134
+ licenses: []
83
135
  metadata: {}
84
136
  post_install_message:
85
- rdoc_options:
86
- - "--main"
87
- - README.txt
137
+ rdoc_options: []
88
138
  require_paths:
89
139
  - lib
90
140
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -98,11 +148,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
148
  - !ruby/object:Gem::Version
99
149
  version: '0'
100
150
  requirements: []
101
- rubyforge_project: swissmedic-diff
102
- rubygems_version: 2.4.5
151
+ rubyforge_project:
152
+ rubygems_version: 2.5.1
103
153
  signing_key:
104
154
  specification_version: 4
105
- summary: "* Compares two Excel Documents provided by Swissmedic and displays the salient
106
- differences"
155
+ summary: Find out what Products have changed on the swiss healthcare market
107
156
  test_files:
108
157
  - test/test_swissmedic-diff.rb
data/.gemtest DELETED
File without changes