swissmedic-diff 0.2.4 → 0.2.6

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
- SHA1:
3
- metadata.gz: 26c1b2ae5e7c5715217e3e077a1d9b7d92847964
4
- data.tar.gz: 0e419155ef09ed8644fdf33b8f8074cf0f2c49f7
2
+ SHA256:
3
+ metadata.gz: b3e653dc43ed5f34c4a8c0d074de92e12153963ea047acea5b0c7e1f9948d8e7
4
+ data.tar.gz: 429bdb424bc0b3df7d5b47da74d68a5815aab4aab5f7ba1f5590d8cb4bdf83b1
5
5
  SHA512:
6
- metadata.gz: db303825649d60d416d1983f2f96c4ab0b1f484edf3285c2d9a5af2af4bf03eb4c9f94a61755a3c5bb708d9df58497c09fc16dcd1cbaf4c923a9b7c183930776
7
- data.tar.gz: d9943467f6e700c4df0913d1b8bbc9ec96f9af0e2c15cfe872a91eac08f90ab9430c1d0cbb1b7cf458d6efb087abac68446838fdea2d1a91b48eb1eb03cf7f43
6
+ metadata.gz: 38184c2634cc1328941bd850442ee2ac4fbe74ae383c20ac8f1261c72c27d0795f6b3955ad400d5eb8e5af105faa1c929b1a0ce37f86cc74ccdde3352e21060b
7
+ data.tar.gz: 7b7004e06ac569a7a5722821c0169e0addd52a1e7284ceefeb306290c8402dc7bd41c462d9f34521fe64550fc746fdc021b27ad8e1d9cc4bb17833e43514d971
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- swissmedic-diff (0.2.4)
4
+ swissmedic-diff (0.2.6)
5
5
  nokogiri
6
6
  rubyXL (>= 3.3.1)
7
7
  rubyzip
@@ -15,15 +15,15 @@ GEM
15
15
  byebug (9.1.0)
16
16
  coderay (1.1.2)
17
17
  method_source (0.8.2)
18
- mini_portile2 (2.3.0)
18
+ mini_portile2 (2.4.0)
19
19
  minitest (5.10.3)
20
20
  minitest-reporters (1.1.18)
21
21
  ansi
22
22
  builder
23
23
  minitest (>= 5.0)
24
24
  ruby-progressbar
25
- nokogiri (1.8.1)
26
- mini_portile2 (~> 2.3.0)
25
+ nokogiri (1.10.1)
26
+ mini_portile2 (~> 2.4.0)
27
27
  pry (0.11.0)
28
28
  coderay (~> 1.1.0)
29
29
  method_source (~> 0.8.1)
@@ -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.26)
39
+ rubyXL (3.3.33)
40
40
  nokogiri (>= 1.4.4)
41
41
  rubyzip (>= 1.1.6)
42
- rubyzip (1.2.1)
43
- spreadsheet (1.1.4)
42
+ rubyzip (1.2.2)
43
+ spreadsheet (1.1.9)
44
44
  ruby-ole (>= 1.0)
45
45
  yard (0.9.9)
46
46
 
@@ -56,4 +56,4 @@ DEPENDENCIES
56
56
  swissmedic-diff!
57
57
 
58
58
  BUNDLED WITH
59
- 1.16.1
59
+ 1.17.2
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.2.6 / 13.02.2019
2
+
3
+ * Adapt to swissmedic new XLSX files
4
+
1
5
  === 0.2.5 / 05.02.2018
2
6
 
3
7
  * Adapte to swissmedic fixing a typo for betäubunsmittel
@@ -53,7 +53,7 @@ class SwissmedicDiff
53
53
 
54
54
  COLUMNS_JULY_2015 = {
55
55
  :iksnr => /Zulassungs-Nummer/i, # column-nr: 0
56
- :seqnr => /Dosisstärke-nummer/i,
56
+ :seqnr => /Dosis+tärke-nummer/i,
57
57
  :name_base => /Präparatebezeichnung/i,
58
58
  :company => /Zulassungsinhaberin/i,
59
59
  :production_science => /Heilmittelcode/i,
@@ -78,6 +78,33 @@ class SwissmedicDiff
78
78
  :drug_index => /Verz. bei betäubun.*smittel-haltigen Präparaten/i,
79
79
  }
80
80
 
81
+ COLUMNS_FEBRUARY_2019= {
82
+ :iksnr => /Zulassungs-Nummer/i, # column-nr: 0
83
+ :seqnr => /Dosisstärke-nummer/i,
84
+ :name_base => /Bezeichnung des Arzneimittels/i,
85
+ :company => /Zulassungsinhaberin/i,
86
+ :production_science => /Heilmittelcode/i,
87
+ :index_therapeuticus => /IT-Nummer/i, # column-nr: 5
88
+ :atc_class => /ATC-Code/i,
89
+ :registration_date => /Erstzul.datum Arzneimittel/i,
90
+ :sequence_date => /Zul.datum Dosisstärke/i,
91
+ :expiry_date => /Gültigkeitsdauer der Zulassung/i,
92
+ :ikscd => /Packungscode/i, # column-nr: 10
93
+ :size => /Packungsgrösse/i,
94
+ :unit => /Einheit/i,
95
+ :ikscat => /Abgabekategorie Packung/i,
96
+ :ikscat_seq => /Abgabekategorie Dosisstärke/i,
97
+ :ikscat_preparation => /Abgabekategorie Arzneimittel/i, # column-nr: 15
98
+ :substances => /Wirkstoff/i,
99
+ :composition => /Zusammensetzung/i,
100
+ :composition_AMZV => /Volldeklaration rev. AMZV umgesetzt/i,
101
+ :indication_registration => /Anwendungsgebiet Arzneimittel/i,
102
+ :indication_sequence => /Anwendungsgebiet Dosisstärke/i, # column-nr 20
103
+ :gen_production => /Gentechnisch hergestellte Wirkstoffe/i,
104
+ :insulin_category => /Kategorie bei Insulinen/i,
105
+ # swissmedi corrected in february 2018 the typo betäubunsmittel to betäubungsmittel-
106
+ :drug_index => /Verz. bei betäubungsmittel-haltigen Arzneimittel/i,
107
+ }
81
108
  FLAGS = {
82
109
  :new => 'Neues Produkt',
83
110
  :name_base => 'Namensänderung',
@@ -366,7 +393,33 @@ class SwissmedicDiff
366
393
  end
367
394
  return COLUMNS_JULY_2015
368
395
  end
369
- raise "#{error_2015}\n#{error_2014}"
396
+ row = spreadsheet.worksheet(0)[5] # Headers are found at row 5 since February 5
397
+ error_2019 = nil
398
+ if spreadsheet.worksheet(0)[5].size != COLUMNS_FEBRUARY_2019.size
399
+ raise "#{error_2015}\n#{error_2014}"
400
+ else
401
+ 0.upto((COLUMNS_FEBRUARY_2019.size) -1).each{ |idx| puts "#{idx}: #{row[idx].value}" } if $VERBOSE
402
+ COLUMNS_FEBRUARY_2019.each{
403
+ |key, value|
404
+ header_name = row[COLUMNS_FEBRUARY_2019.keys.index(key)].value.to_s
405
+ unless value.match(header_name)
406
+ puts "#{__LINE__}: #{key} -> #{COLUMNS_FEBRUARY_2019.keys.index(key)} #{value}\nbut was #{header_name}" if $VERBOSE
407
+ error_2019 = "Packungen.xlslx_has_unexpected_column_#{COLUMNS_FEBRUARY_2019.keys.index(key)}_#{key}_#{value.to_s}_but_was_#{header_name}"
408
+ require 'pry'; binding.pry
409
+ break
410
+ end
411
+ }
412
+ unless error_2015
413
+ idx14 = COLUMNS_2014.keys.index(:name_base)
414
+ idx15 = COLUMNS_2014.keys.index(:name_base)
415
+ if (idx14 != idx15)
416
+ raise ":name_base must be same index in COLUMNS_JULY_2015 and COLUMNS_2014. Is #{idx14} and #{idx15}"
417
+ end
418
+ return COLUMNS_FEBRUARY_2019
419
+ end
420
+ raise "#{error_2019}" if error_2019
421
+ end
422
+ COLUMNS_FEBRUARY_2019
370
423
  end
371
424
  #=== iterate over all valid rows of a swissmedic Packungen.xls
372
425
  #
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class SwissmedicDiff
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.6'
3
3
  end
@@ -42,6 +42,55 @@ module ODDB
42
42
  assert_equal(expected, result.changes)
43
43
  end
44
44
 
45
+
46
+ def test_diff_changes_february_2019
47
+ @diff = SwissmedicDiff.new
48
+ 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
+ expected = {"00277"=>[:name_base, :expiry_date, :production_science],
51
+ "15219"=>[:new],
52
+ "16105"=>[:new],
53
+ "16598"=>[:new],
54
+ "28486"=>[:new],
55
+ "30015"=>[:new],
56
+ "31644"=>[:new],
57
+ "32475"=>[:new],
58
+ "35366"=>[:new],
59
+ "43454"=>[:new],
60
+ "44625"=>[:new],
61
+ "45882"=>[:new],
62
+ "53290"=>[:new],
63
+ "53662"=>[:new],
64
+ "54015"=>[:new],
65
+ "54534"=>[:new],
66
+ "55558"=>[:new],
67
+ "66297"=>[:new],
68
+ "55594"=>[:new],
69
+ "55674"=>[:new],
70
+ "56352"=>[:new],
71
+ "58943"=>[:new],
72
+ "59267"=>[:new],
73
+ "61186"=>[:new],
74
+ "62069"=>[:new],
75
+ "62132"=>[:new],
76
+ "65856"=>[:new],
77
+ "65857"=>[:new],
78
+ "58734"=>[:new],
79
+ "55561"=>[:new],
80
+ "65160"=>[:new],
81
+ "58158"=>[:new],
82
+ "44447"=>[:new],
83
+ "39252"=>[:new],
84
+ "00278"=>[:delete],
85
+ "00279"=>[:delete],
86
+ "65837"=>[:delete],
87
+ "65838"=>[:delete]
88
+ }
89
+
90
+ result = @diff.diff this_month, last_month
91
+ assert_equal(expected, result.changes)
92
+ end
93
+
45
94
  def test_diff_wrong_header
46
95
  @diff = SwissmedicDiff.new
47
96
  last_month = File.expand_path 'data/Packungen-2015.06.04.xlsx', File.dirname(__FILE__)
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.4
4
+ version: 0.2.6
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: 2018-02-05 00:00:00.000000000 Z
11
+ date: 2019-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyXL
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  requirements: []
151
151
  rubyforge_project:
152
- rubygems_version: 2.5.1
152
+ rubygems_version: 2.7.6
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Find out what Products have changed on the swiss healthcare market