swissmedic-diff 0.2.6 → 0.2.8

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
  SHA256:
3
- metadata.gz: b3e653dc43ed5f34c4a8c0d074de92e12153963ea047acea5b0c7e1f9948d8e7
4
- data.tar.gz: 429bdb424bc0b3df7d5b47da74d68a5815aab4aab5f7ba1f5590d8cb4bdf83b1
3
+ metadata.gz: 4c9f7f364660ce0313e6261e73e127c73e6f737b236e95a19934a817ba7e2eed
4
+ data.tar.gz: aa425b73fdfd27acc1f5a59c7b091c4655355f647e232fd91e781eef925a04e4
5
5
  SHA512:
6
- metadata.gz: 38184c2634cc1328941bd850442ee2ac4fbe74ae383c20ac8f1261c72c27d0795f6b3955ad400d5eb8e5af105faa1c929b1a0ce37f86cc74ccdde3352e21060b
7
- data.tar.gz: 7b7004e06ac569a7a5722821c0169e0addd52a1e7284ceefeb306290c8402dc7bd41c462d9f34521fe64550fc746fdc021b27ad8e1d9cc4bb17833e43514d971
6
+ metadata.gz: 002e643de90c8536d6e891420cf66960f1447636eca5bdd775a14f7469f337ad8cc98422427dc4ea8e9e9a76e046afa489667bebb705bacb983d27d7d2b6cb33
7
+ data.tar.gz: 9eda362cca9621f6f6ad60d5fe476bde48d691f5dcd058b618f1cbe69176d4e26e098a5a78e7ceca8dc39d4a5444b992a03a9b3d077b325f334f6bcff7f6cddd
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swissmedic-diff (0.2.6)
4
+ swissmedic-diff (0.2.8)
5
5
  nokogiri
6
6
  rubyXL (>= 3.3.1)
7
7
  rubyzip
@@ -11,41 +11,41 @@ GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
13
  ansi (1.5.0)
14
- builder (3.2.3)
15
- byebug (9.1.0)
16
- coderay (1.1.2)
17
- method_source (0.8.2)
18
- mini_portile2 (2.4.0)
19
- minitest (5.10.3)
20
- minitest-reporters (1.1.18)
14
+ builder (3.2.4)
15
+ byebug (11.1.3)
16
+ coderay (1.1.3)
17
+ method_source (1.0.0)
18
+ minitest (5.20.0)
19
+ minitest-reporters (1.6.1)
21
20
  ansi
22
21
  builder
23
22
  minitest (>= 5.0)
24
23
  ruby-progressbar
25
- nokogiri (1.10.1)
26
- mini_portile2 (~> 2.4.0)
27
- pry (0.11.0)
28
- coderay (~> 1.1.0)
29
- method_source (~> 0.8.1)
30
- pry-byebug (3.5.0)
31
- byebug (~> 9.1)
32
- pry (~> 0.10)
33
- pry-doc (0.11.1)
34
- pry (~> 0.9)
35
- yard (~> 0.9)
36
- rake (12.3.0)
37
- ruby-ole (1.2.12.1)
38
- ruby-progressbar (1.8.3)
39
- rubyXL (3.3.33)
40
- nokogiri (>= 1.4.4)
41
- rubyzip (>= 1.1.6)
42
- rubyzip (1.2.2)
43
- spreadsheet (1.1.9)
44
- ruby-ole (>= 1.0)
45
- yard (0.9.9)
24
+ nokogiri (1.15.4-x86_64-linux)
25
+ racc (~> 1.4)
26
+ pry (0.14.2)
27
+ coderay (~> 1.1)
28
+ method_source (~> 1.0)
29
+ pry-byebug (3.10.1)
30
+ byebug (~> 11.0)
31
+ pry (>= 0.13, < 0.15)
32
+ pry-doc (1.4.0)
33
+ pry (~> 0.11)
34
+ yard (~> 0.9.11)
35
+ racc (1.7.1)
36
+ rake (13.0.6)
37
+ ruby-ole (1.2.12.2)
38
+ ruby-progressbar (1.13.0)
39
+ rubyXL (3.4.25)
40
+ nokogiri (>= 1.10.8)
41
+ rubyzip (>= 1.3.0)
42
+ rubyzip (2.3.2)
43
+ spreadsheet (1.3.0)
44
+ ruby-ole
45
+ yard (0.9.34)
46
46
 
47
47
  PLATFORMS
48
- ruby
48
+ x86_64-linux
49
49
 
50
50
  DEPENDENCIES
51
51
  minitest
@@ -56,4 +56,4 @@ DEPENDENCIES
56
56
  swissmedic-diff!
57
57
 
58
58
  BUNDLED WITH
59
- 1.17.2
59
+ 2.4.10
data/History.txt CHANGED
@@ -1,3 +1,13 @@
1
+ === 0.2.8 / 04.10.2023
2
+
3
+ * Fix problem when expiration_date is a string 'Unbegrenzt'
4
+ * Updated tests
5
+ * Added Ruby 3.2 for running github/workflow tests
6
+
7
+ === 0.2.7 / 13.03.2019
8
+
9
+ * Set date to nil when expiration_date is a string 'Unbegrenzt'
10
+
1
11
  === 0.2.6 / 13.02.2019
2
12
 
3
13
  * Adapt to swissmedic new XLSX files
Binary file
Binary file
@@ -23,6 +23,9 @@ require File.join(File.dirname(__FILE__), 'compatibility.rb')
23
23
  #License:: GPLv2.0 Compliance
24
24
  #Source:: http://scm.ywesee.com/?p=swissmedic-diff/.git;a=summary
25
25
  class SwissmedicDiff
26
+ VALUE_UNLIMITED = nil
27
+ REGEXP_UNLIMITED = /unbegrenzt/i
28
+
26
29
  module Diff
27
30
  COLUMNS_2014 = {
28
31
  :iksnr => /Zulassungs-Nummer/i, # column-nr: 0
@@ -152,7 +155,11 @@ class SwissmedicDiff
152
155
  sprintf "%s (%s)", txt, pairs.join(',')
153
156
  when :registration_date, :expiry_date
154
157
  row = diff.newest_rows[iksnr].sort.first.last
155
- sprintf "%s (%s)", txt, row[COLUMNS_2014.keys.index(flag)].value.strftime('%d.%m.%Y')
158
+ if row[COLUMNS_2014.keys.index(flag)].value.to_s.match(REGEXP_UNLIMITED)
159
+ sprintf "%s (%s)", txt, 'unbegrenzt'
160
+ else
161
+ sprintf "%s (%s)", txt, row[COLUMNS_2014.keys.index(flag)].value.strftime('%d.%m.%Y')
162
+ end
156
163
  else
157
164
  row = diff.newest_rows[iksnr].sort.first.last
158
165
  sprintf "%s (%s)", txt, cell(row, COLUMNS_2014.keys.index(flag))
@@ -350,7 +357,11 @@ class SwissmedicDiff
350
357
  if cell = row[idx]
351
358
  case key
352
359
  when :registration_date, :expiry_date
353
- row[idx] && row[idx].value ? row[idx].value.to_date : nil
360
+ if row[idx] && row[idx].value && REGEXP_UNLIMITED.match(row[idx].value.to_s)
361
+ VALUE_UNLIMITED # Date.new(2099,12,31)
362
+ else
363
+ row[idx] && row[idx].value ? row[idx].value.to_date : nil
364
+ end
354
365
  when :seqnr
355
366
  sprintf "%02i", cell(row, idx).to_i
356
367
  else
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class SwissmedicDiff
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.8'
3
3
  end
@@ -22,11 +22,11 @@ module ODDB
22
22
  this_month = File.expand_path 'data/Packungen-2015.07.02.xlsx', File.dirname(__FILE__)
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
- assert_equal(1, result.news.size)
26
- assert_equal(3, result.changes.size)
25
+ assert_equal(2, result.news.size)
26
+ assert_equal(4, result.changes.size)
27
27
  assert_equal(4, result.updates.size)
28
- assert_equal(['65838'], result.news.collect{|x| x[0] if x[0] == '65838'})
29
- assert_equal({"00277"=>[:name_base, :expiry_date], "00279"=>[:expiry_date], "65838"=>[:new]}, result.changes)
28
+ assert_equal(['65838', nil], result.news.collect{|x| x[0] if x[0] == '65838'})
29
+ assert_equal({"00277"=>[:name_base, :expiry_date], "00279"=>[:expiry_date], "65838"=>[:new], "15219"=>[:new]}, result.changes)
30
30
  end
31
31
 
32
32
  def test_diff_changes
@@ -34,9 +34,10 @@ module ODDB
34
34
  last_month = File.expand_path 'data/Packungen-2015.06.04.xlsx', File.dirname(__FILE__)
35
35
  this_month = File.expand_path 'data/Packungen-2015.07.02.xlsx', File.dirname(__FILE__)
36
36
  expected = {
37
- "00277"=>[:name_base, :expiry_date],
38
- "00279"=>[:expiry_date],
39
- "65838"=>[:new]
37
+ "00277"=>[:name_base, :expiry_date],
38
+ "00279"=>[:expiry_date],
39
+ "65838"=>[:new],
40
+ "15219"=>[:new]
40
41
  }
41
42
  result = @diff.diff this_month, last_month
42
43
  assert_equal(expected, result.changes)
@@ -46,9 +47,9 @@ module ODDB
46
47
  def test_diff_changes_february_2019
47
48
  @diff = SwissmedicDiff.new
48
49
  last_month = File.expand_path 'data/Packungen-2015.07.02.xlsx', File.dirname(__FILE__)
49
- this_month = File.expand_path 'data/Packungen-2019.01.31.xlsx', File.dirname(__FILE__)
50
+ this_month = File.expand_path 'data/Packungen-2019.03.06.xlsx', File.dirname(__FILE__)
50
51
  expected = {"00277"=>[:name_base, :expiry_date, :production_science],
51
- "15219"=>[:new],
52
+ "15219"=>[:expiry_date, :indication_registration, :indication_sequence, :sequence],
52
53
  "16105"=>[:new],
53
54
  "16598"=>[:new],
54
55
  "28486"=>[:new],
@@ -85,8 +86,7 @@ module ODDB
85
86
  "00279"=>[:delete],
86
87
  "65837"=>[:delete],
87
88
  "65838"=>[:delete]
88
- }
89
-
89
+ }
90
90
  result = @diff.diff this_month, last_month
91
91
  assert_equal(expected, result.changes)
92
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swissmedic-diff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hannes Wyss, Masaomi Hatakeyama
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-13 00:00:00.000000000 Z
11
+ date: 1980-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyXL
@@ -121,8 +121,8 @@ files:
121
121
  - History.txt
122
122
  - LICENSE
123
123
  - Manifest.txt
124
- - Packungen-2016.01.09.xlsx
125
- - Packungen-2017.09.07.xlsx
124
+ - Packungen-2023.08.08.xlsx
125
+ - Packungen-2023.09.08.xlsx
126
126
  - README.txt
127
127
  - Rakefile
128
128
  - bin/swissmedic-diff
@@ -133,7 +133,7 @@ files:
133
133
  homepage: https://github.com/zdavatz/swissmedic-diff
134
134
  licenses: []
135
135
  metadata: {}
136
- post_install_message:
136
+ post_install_message:
137
137
  rdoc_options: []
138
138
  require_paths:
139
139
  - lib
@@ -148,9 +148,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  requirements: []
151
- rubyforge_project:
152
- rubygems_version: 2.7.6
153
- signing_key:
151
+ rubygems_version: 3.4.13
152
+ signing_key:
154
153
  specification_version: 4
155
154
  summary: Find out what Products have changed on the swiss healthcare market
156
155
  test_files:
Binary file
Binary file