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 +4 -4
- data/Gemfile.lock +23 -30
- data/History.txt +5 -0
- data/Packungen-2016.01.09.xlsx +0 -0
- data/Packungen-2017.09.07.xlsx +0 -0
- data/Rakefile +3 -20
- data/lib/swissmedic-diff.rb +6 -4
- data/lib/version.rb +1 -1
- data/test/test_swissmedic-diff.rb +20 -7
- metadata +94 -45
- data/.gemtest +0 -0
- data/.gitignore +0 -9
- data/.travis.yml +0 -17
- data/setup.rb +0 -1345
- data/swissmedic-diff.gemspec +0 -27
- data/test/data/Packungen-2014.01.01.xlsx +0 -0
- data/test/data/Packungen-2014.02.01.xlsx +0 -0
- data/test/data/Packungen-2015.06.04.xlsx +0 -0
- data/test/data/Packungen-2015.07.02.xlsx +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ddb4d15cde4a334e2681bf63ffbf70802101b8e3
|
4
|
+
data.tar.gz: d61b0259447991ed94b439ec1560209fc0fbd2bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
4
|
+
swissmedic-diff (0.2.3)
|
5
5
|
nokogiri
|
6
|
-
rubyXL (
|
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.
|
15
|
-
byebug (
|
16
|
-
|
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.
|
23
|
-
minitest (5.
|
24
|
-
minitest-reporters (1.
|
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.
|
30
|
-
mini_portile2 (~> 2.
|
31
|
-
pry (0.
|
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
|
-
|
35
|
-
|
36
|
-
byebug (~> 4.0)
|
30
|
+
pry-byebug (3.5.0)
|
31
|
+
byebug (~> 9.1)
|
37
32
|
pry (~> 0.10)
|
38
|
-
pry-doc (0.
|
33
|
+
pry-doc (0.11.1)
|
39
34
|
pry (~> 0.9)
|
40
|
-
yard (~> 0.
|
41
|
-
rake (
|
42
|
-
ruby-ole (1.2.
|
43
|
-
ruby-progressbar (1.
|
44
|
-
rubyXL (3.3.
|
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
|
48
|
-
|
49
|
-
spreadsheet (1.1.0)
|
42
|
+
rubyzip (1.2.1)
|
43
|
+
spreadsheet (1.1.4)
|
50
44
|
ruby-ole (>= 1.0)
|
51
|
-
yard (0.
|
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.
|
59
|
+
1.15.4
|
data/History.txt
CHANGED
Binary file
|
Binary file
|
data/Rakefile
CHANGED
@@ -1,24 +1,7 @@
|
|
1
1
|
# -*- ruby -*-
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
-
require
|
4
|
+
require "bundler/gem_tasks"
|
5
5
|
|
6
|
-
|
7
|
-
|
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']
|
data/lib/swissmedic-diff.rb
CHANGED
@@ -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)
|
268
|
-
next if left.is_a?(String)
|
269
|
-
next if right.is_a?(String)
|
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
@@ -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(
|
27
|
-
assert_equal(
|
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.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Hannes Wyss, Masaomi Hatakeyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rubyXL
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
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: '
|
96
|
+
version: '0'
|
27
97
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
98
|
+
name: minitest-reporters
|
29
99
|
requirement: !ruby/object:Gem::Requirement
|
30
100
|
requirements:
|
31
|
-
- - "
|
101
|
+
- - ">="
|
32
102
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
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: '
|
41
|
-
description:
|
42
|
-
|
43
|
-
|
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:
|
102
|
-
rubygems_version: 2.
|
151
|
+
rubyforge_project:
|
152
|
+
rubygems_version: 2.5.1
|
103
153
|
signing_key:
|
104
154
|
specification_version: 4
|
105
|
-
summary:
|
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
|