swissmedic-diff 0.2.6 → 0.2.7

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: 925c71a322a4c7cd09d8c9424abd81a789e6e1f4a7873d1a57bfc00b5c8d94eb
4
+ data.tar.gz: 1e7dc182db7f46ceadfc140ee5e4d1ea10297ea9670533ba65ed6fefbf937182
5
5
  SHA512:
6
- metadata.gz: 38184c2634cc1328941bd850442ee2ac4fbe74ae383c20ac8f1261c72c27d0795f6b3955ad400d5eb8e5af105faa1c929b1a0ce37f86cc74ccdde3352e21060b
7
- data.tar.gz: 7b7004e06ac569a7a5722821c0169e0addd52a1e7284ceefeb306290c8402dc7bd41c462d9f34521fe64550fc746fdc021b27ad8e1d9cc4bb17833e43514d971
6
+ metadata.gz: 2c780ba3d8556a397b65e32bea5ceff473f7f0ced14872a02231e30d15ec4f508d495e943878346a1354e739a6292d37b07c03d8efe2e4fe480e293e33e83b6c
7
+ data.tar.gz: 3fa78fda4e35364769e91cc9c1ae41b78cd46d3b37cbf8aad5223fdc03920ef136c9470d0c201b587b40c1ffe870a5b1daec0abd9e4cfe0cddcac60ad883cacb
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swissmedic-diff (0.2.6)
4
+ swissmedic-diff (0.2.7)
5
5
  nokogiri
6
6
  rubyXL (>= 3.3.1)
7
7
  rubyzip
@@ -36,11 +36,11 @@ GEM
36
36
  rake (12.3.0)
37
37
  ruby-ole (1.2.12.1)
38
38
  ruby-progressbar (1.8.3)
39
- rubyXL (3.3.33)
39
+ rubyXL (3.4.2)
40
40
  nokogiri (>= 1.4.4)
41
41
  rubyzip (>= 1.1.6)
42
42
  rubyzip (1.2.2)
43
- spreadsheet (1.1.9)
43
+ spreadsheet (1.2.2)
44
44
  ruby-ole (>= 1.0)
45
45
  yard (0.9.9)
46
46
 
@@ -1,3 +1,7 @@
1
+ === 0.2.7 / 13.03.2019
2
+
3
+ * Set date to nil when expiration_date is a string 'Unbegrenzt'
4
+
1
5
  === 0.2.6 / 13.02.2019
2
6
 
3
7
  * Adapt to swissmedic new XLSX files
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
@@ -350,7 +353,11 @@ class SwissmedicDiff
350
353
  if cell = row[idx]
351
354
  case key
352
355
  when :registration_date, :expiry_date
353
- row[idx] && row[idx].value ? row[idx].value.to_date : nil
356
+ if row[idx] && row[idx].value && REGEXP_UNLIMITED.match(row[idx].value.to_s)
357
+ VALUE_UNLIMITED # Date.new(2099,12,31)
358
+ else
359
+ row[idx] && row[idx].value ? row[idx].value.to_date : nil
360
+ end
354
361
  when :seqnr
355
362
  sprintf "%02i", cell(row, idx).to_i
356
363
  else
@@ -1,3 +1,3 @@
1
1
  class SwissmedicDiff
2
- VERSION = '0.2.6'
2
+ VERSION = '0.2.7'
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.7
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: 2019-02-13 00:00:00.000000000 Z
11
+ date: 2019-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyXL
@@ -121,6 +121,7 @@ files:
121
121
  - History.txt
122
122
  - LICENSE
123
123
  - Manifest.txt
124
+ - Packungen-2015.07.02.xlsx
124
125
  - Packungen-2016.01.09.xlsx
125
126
  - Packungen-2017.09.07.xlsx
126
127
  - README.txt
@@ -149,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
150
  version: '0'
150
151
  requirements: []
151
152
  rubyforge_project:
152
- rubygems_version: 2.7.6
153
+ rubygems_version: 2.7.3
153
154
  signing_key:
154
155
  specification_version: 4
155
156
  summary: Find out what Products have changed on the swiss healthcare market