oddb2xml 2.6.2 → 2.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 06c2d44fbe8f0bf48806bf8d38b6a7d15c84b948
4
- data.tar.gz: f10d3c2ffc00d2c005756851e24c64b3bd61aeac
2
+ SHA256:
3
+ metadata.gz: 070625b76250b6816b761d5e4f37474326218067dcdbd0a59824c2667e62e9b7
4
+ data.tar.gz: 04af7deafbe8160ad3283b6edb9bae596d9782bad4c7a4be8facda175f062ac8
5
5
  SHA512:
6
- metadata.gz: 9c38d2c021f76e7e159395f81aa31d8ea33d50df2b157edee9eed96d8e66f2e13c887cf17b7707a7c899bffee5c8ec090993786acbbeedf4893cc65ee19ef42a
7
- data.tar.gz: 0dfd82ddc901609d2531bc61e1641d7ac600f3fe5699e22af97be8a924bb4cdae8d9bfe9cb1ba5813ee3e528569e5176f2531b40c0b8dd21d84ceb9c7dc86e8d
6
+ metadata.gz: 3616fc763495253e24a1176ccd5d2907e08b96860e87d79c5577b14b38826bf57aaa3aebbf7777fcde28cb2d243b379e25697ba943b1df921ea6cbe6ea16edca
7
+ data.tar.gz: dba061cc87bd89396f38b792f51c9918a23f55d9452c9df9472b5a1e208859f729cbba868097763fc0364791fbb0900a6df97319525dc9721515ad921527c18c
@@ -11,17 +11,16 @@ before_install:
11
11
  script: bundle exec rspec
12
12
 
13
13
  rvm:
14
- - 2.2.7
15
- - 2.3.4
16
- - 2.4.1
17
- - 2.5.0
14
+ # Building on Versions 2.4 or earlier of Ruby fail, because URI.open was priveate
15
+ # - 2.4
16
+ - 2.5
17
+ - 2.6
18
+ - 2.7
18
19
  - ruby-head
19
20
 
20
21
  matrix:
21
22
  allow_failures:
22
23
  - rvm: ruby-head
23
- - rvm: 2.2.7
24
- - rvm: 2.3.4
25
24
 
26
25
  notifications:
27
26
  email:
@@ -1,11 +1,11 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <!-- Copyright (c) 2016 MEDEVIT. All rights reserved. This program and the
3
- accompanying materials are made available under the terms of the Eclipse
4
- Public License v1.0 which accompanies this distribution, and is available
5
- at http://www.eclipse.org/legal/epl-v10.html v002 - Ergänzung K Komplementärprodukt
6
- bei generic type, Consider ATC code of length 8 (on vet.med. articles) Relax
7
- ADDSCR occurence to 0 .. 1 v003 - PRODNO hinzugefügt LIMNAMEBAG zur formal-kennzeichnung
8
- von identen limitations v4 - Major refactoring, see https://redmine.medelexis.ch/issues/4405
2
+ <!-- Copyright (c) 2016 MEDEVIT. All rights reserved. This program and the
3
+ accompanying materials are made available under the terms of the Eclipse
4
+ Public License v1.0 which accompanies this distribution, and is available
5
+ at http://www.eclipse.org/legal/epl-v10.html v002 - Ergänzung K Komplementärprodukt
6
+ bei generic type, Consider ATC code of length 8 (on vet.med. articles) Relax
7
+ ADDSCR occurence to 0 .. 1 v003 - PRODNO hinzugefügt LIMNAMEBAG zur formal-kennzeichnung
8
+ von identen limitations v4 - Major refactoring, see https://redmine.medelexis.ch/issues/4405
9
9
  Contributors: MEDEVIT <office@medevit.at> - initial API and implementation -->
10
10
  <xs:schema targetNamespace="http://elexis.ch/Elexis_Artikelstamm_v5"
11
11
  elementFormDefault="qualified" attributeFormDefault="unqualified"
@@ -339,7 +339,6 @@
339
339
  </xs:element>
340
340
  <xs:element name="GENERIC_TYPE"
341
341
  maxOccurs="1" minOccurs="0">
342
-
343
342
  <xs:simpleType>
344
343
  <xs:annotation>
345
344
  <xs:documentation>
@@ -359,6 +358,9 @@
359
358
  <xs:enumeration
360
359
  value="K">
361
360
  </xs:enumeration>
361
+ <xs:enumeration
362
+ value="C"> <!-- BAG 9.6.2020: BDer Buchstabe C bei «Original Generika Code» steht für Co-Marketing Arzneimittel -->
363
+ </xs:enumeration>
362
364
  </xs:restriction>
363
365
  </xs:simpleType>
364
366
  </xs:element>
@@ -429,6 +431,9 @@
429
431
  </xs:documentation>
430
432
  </xs:annotation>
431
433
  </xs:element>
434
+ <xs:element name="Chapter70_HACK"
435
+ type="xs:string" minOccurs="0" maxOccurs="1">
436
+ </xs:element>
432
437
  </xs:sequence>
433
438
 
434
439
 
@@ -1,3 +1,24 @@
1
+ === 2.6.7 / 25.06.2020
2
+ * Added value 'C' (Co-marketing) for field GENERIC_TYPE Elexis_Artikelstamm_v5.xsd from BAG Preparations.xml
3
+ * Fixed limitations coming from the chapte 70 hack
4
+ * Ruby 2.7 compatible (No URI.open warning)
5
+
6
+ === 2.6.6 / 11.01.2020
7
+ * Fix link for varia_De.htm
8
+
9
+ === 2.6.5 / 11.01.2020
10
+ * Fix issue #37: Update BAG Download Link
11
+ ** Pending problem: varia_De.htm for Artikelstamm cannot be found anymore
12
+
13
+ === 2.6.4 / 14.08.2019
14
+ * Fix issue #35: Missing product with ATC code for 7680005850010 Varilrix when building Artikelstamm_V5
15
+
16
+ === 2.6.3 / 01.07.2019
17
+ * Use https://github.com/zdavatz/cpp2sqlite/blob/master/input/atc_codes_multi_lingual.txt instead of http://download.epha.ch/data/atc/atc.csv
18
+
19
+ === 2.6.2 / 01.07.2019
20
+ * Use https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/interactions_de_utf8.csv instead of https://download.epha.ch/cleaned/matrix.csv
21
+
1
22
  === 2.6.1 / 27.02.2019
2
23
  * Update rubyXL to 3.4.0 with fix to avoid problem reported via https://github.com/weshatheleopard/rubyXL/issues/325
3
24
  * When generating artikelstamm XML generate products (aka sequences) with name like "3TC Filmtabl 150 mg" instead of only "3TC"
@@ -114,7 +135,7 @@
114
135
 
115
136
  === 2.4.1 / 2.12.2016
116
137
 
117
- * Update oddb2xml.gemspec to add GPL-3.0 as correct license for Rubygems as stated in LICENSE file
138
+ * Update oddb2xml.gemspec to add GPL-3.0 as correct license for Rubygems as stated in LICENSE file
118
139
  * Added a hack for 24 globulina equina which commas between brackets
119
140
 
120
141
  === 2.4.0 /25.08.2016
@@ -552,7 +573,7 @@
552
573
 
553
574
  * Improve NINCD detection
554
575
  - Update timeout handling
555
- - Improve pharmacode detection
576
+ - Improve pharmacode detection
556
577
 
557
578
  === 1.5.1 / 10.06.2013
558
579
 
data/README.md CHANGED
@@ -273,7 +273,7 @@ product.xml has relation to substance as ``.
273
273
  We use the following files:
274
274
 
275
275
  * https://www.swissmedic.ch/arzneimittel/00156/00221/00222/00230/index.html?lang=de (Präparateliste und zugelassene Packungen)
276
- * https://download.epha.ch/cleaned/matrix.csv (Interactions from epha)
276
+ * https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/interactions_de_utf8.csv
277
277
  * http://refdatabase.refdata.ch/Service/Article.asmx
278
278
  * http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip
279
279
  * https://www.medregbm.admin.ch/Publikation/CreateExcelListBetriebs
@@ -16,7 +16,7 @@ require 'optimist'
16
16
  #{File.basename(__FILE__)} xml_file_to_check
17
17
  EOS
18
18
  end
19
- $stdout.sync = false
19
+ $stdout.sync = true
20
20
 
21
21
  args = ARGV
22
22
  if args.size != 1
@@ -859,7 +859,7 @@ module Oddb2xml
859
859
  @articles.sort! { |a,b| a[:ean13] <=> b[:ean13] }
860
860
  @articles.each do |obj|
861
861
  idx += 1
862
- Oddb2xml.log "build_article #{idx} of #{@articles.size} articles" if idx % 500 == 0
862
+ Oddb2xml.log "build_article #{obj[:ean13]}: #{idx} of #{@articles.size} articles" if idx % 500 == 0
863
863
  item = @items[obj[:ean13]]
864
864
  pac,no8 = nil,obj[:ean13].to_s[4..11] # BAG-XML(SL/LS)
865
865
  pack_info = nil
@@ -1449,7 +1449,7 @@ module Oddb2xml
1449
1449
  obj = @packs[no8] # obj not yet in refdata. Use data from swissmedic_package.xlsx
1450
1450
  end
1451
1451
  nr_items += 1
1452
- Oddb2xml.log "build_article #{nr_items} of #{gtins.size} articles" if nr_items % 5000 == 0
1452
+ Oddb2xml.log "build_artikelstamm #{ean13}: #{nr_items} of #{gtins.size} articles" if nr_items % 5000 == 0
1453
1453
  item = @items[ean13]
1454
1454
  pack_info = nil
1455
1455
  pack_info = @packs[no8] if no8 && /#{ean13}/.match(@packs[no8].to_s) # info from Packungen.xlsx from swissmedic_info
@@ -1509,7 +1509,7 @@ module Oddb2xml
1509
1509
  name_fr ||= (obj[:name_fr] + ', ' + obj[:desc_fr]).strip if obj[:name_fr]
1510
1510
  # ZuRorse has only german names
1511
1511
  name_fr ||= (item[:name_fr] + ', ' + item[:desc_fr]) if item
1512
- name_fr ||= '--missing--'
1512
+ name_fr ||= name
1513
1513
  xml.DSCRF(name_fr)
1514
1514
  xml.COMP do # Manufacturer
1515
1515
  xml.NAME obj[:company_name]
@@ -1558,19 +1558,19 @@ module Oddb2xml
1558
1558
  end if item && item[:deductible]
1559
1559
  prodno = Oddb2xml.getProdnoForEan13(pkg_gtin)
1560
1560
  xml.PRODNO prodno if prodno
1561
+ atc = package[:atc_code]
1562
+ atc ||= @refdata[pkg_gtin][:seq][:atc_code] if @refdata[pkg_gtin]
1561
1563
  csv = []
1562
1564
  @csv_file << [pkg_gtin, name, package[:unit], measure,
1563
1565
  pexf ? pexf : '',
1564
1566
  ppub ? ppub : '',
1565
- package[:prodno], package[:atc_code], package[:substance_swissmedic],
1567
+ prodno, atc, package[:substance_swissmedic],
1566
1568
  sequence[:org_gen_code], package[:ith_swissmedic],
1567
1569
  @items[pkg_gtin] ? 'SL' : '',
1568
1570
  ]
1569
1571
  end
1570
1572
  end
1571
1573
  else # non pharma
1572
- @csv_file << [ ean13, (obj[:desc_de] || obj[:description]), '', '',
1573
- obj[:price], obj[:pub_price], '', '', '', '', '', '' ]
1574
1574
  if @@emitted_v5_gtins.index(ean13)
1575
1575
  next
1576
1576
  else
@@ -1589,17 +1589,38 @@ module Oddb2xml
1589
1589
  xml.GTIN ean13.to_s.rjust(13, '0')
1590
1590
  xml.PHAR obj[:pharmacode]
1591
1591
  emit_salecd(xml, ean13, obj)
1592
- xml.DSCR(obj[:desc_de] || obj[:description]) # for description for zur_rose
1592
+ description = obj[:desc_de] || obj[:description] # for description for zur_rose
1593
+ xml.DSCR(description)
1593
1594
  xml.DSCRF(obj[:desc_fr] || '--missing--')
1594
1595
  xml.COMP do
1595
1596
  xml.GLN obj[:company_ean]
1596
1597
  end if obj[:company_ean] && !obj[:company_ean].empty?
1597
- xml.PEXF obj[:price] if obj[:price] && !obj[:price].empty?
1598
- xml.PPUB obj[:pub_price] if obj[:pub_price] && !obj[:pub_price].empty?
1598
+ if !(obj[:price] && !obj[:price].empty?) || !(obj[:pub_price] && !obj[:pub_price].empty?)
1599
+ zur_rose_detail = @infos_zur_rose.values.find{|x| x[:ean13].to_i == ean13.to_i}
1600
+ end
1601
+ ppub = nil; pexf=nil
1602
+ if obj[:price] && !obj[:price].empty?
1603
+ xml.PEXF (pexf = obj[:price])
1604
+ elsif zur_rose_detail
1605
+ if zur_rose_detail[:price] && !zur_rose_detail[:price].empty? && !zur_rose_detail[:price].eql?('0.00')
1606
+ Oddb2xml.log "NonPharma: #{ean13} adding PEXF #{zur_rose_detail[:price]} #{description}"
1607
+ xml.PEXF (pexf = zur_rose_detail[:price])
1608
+ end
1609
+ end
1610
+ if obj[:pub_price] && !obj[:pub_price].empty?
1611
+ xml.PPUB (ppub = obj[:pub_price])
1612
+ elsif zur_rose_detail
1613
+ if zur_rose_detail[:pub_price] && !zur_rose_detail[:pub_price].empty? && !zur_rose_detail[:pub_price].eql?('0.00')
1614
+ Oddb2xml.log "NonPharma: #{ean13} adding PPUB #{zur_rose_detail[:pub_price]} #{description}"
1615
+ xml.PPUB (ppub = zur_rose_detail[:pub_price])
1616
+ end
1617
+ end
1618
+ @csv_file << [ ean13, description, '', '', pexf, ppub, '', '', '', '', '', '' ]
1599
1619
  if chap70
1600
- xml.comment "Chapter70 hack"
1620
+ xml.comment "Chapter70 hack"
1601
1621
  xml.SL_ENTRY 'true'
1602
1622
  xml.PRODNO obj[:pharmacode]
1623
+ xml.Chapter70_HACK 'true'
1603
1624
  end
1604
1625
  end
1605
1626
  end
@@ -1658,18 +1679,20 @@ module Oddb2xml
1658
1679
  sequence ||= @products[ean][:seq] if @products[ean]
1659
1680
  next unless check_name(obj, :de)
1660
1681
  ppac = ((_ppac = @packs[ean.to_s[4..11]] and !_ppac[:is_tier]) ? _ppac : {})
1661
- unless ppac
1662
- ppac = @packs.find{|pac| pac.ean == ean }.first
1663
- end
1664
1682
  prodno = ppac[:prodno] if ppac[:prodno] and !ppac[:prodno].empty?
1665
1683
  prodno = obj[:pharmacode] if obj[:chapter70]
1684
+ myPack = @packs.values.find{ |x| x[:iksnr].to_i == obj[:seq][:swissmedic_number5].to_i } if obj[:seq]
1685
+ if myPack && !prodno
1686
+ prodno ||= myPack[:prodno]
1687
+ puts "Setting prodno #{prodno} for #{ean13} #{myPack[:sequence_name]}"
1688
+ end
1666
1689
  next unless prodno
1667
1690
  next if emitted_prodno.index(prodno)
1668
1691
  sequence ||= @articles.find{|x| x[:ean13].eql?(ean)}
1669
1692
  unless obj[:chapter70]
1670
1693
  next unless sequence && (sequence[:name_de] || sequence[:desc_de])
1671
- if Oddb2xml.getEan13forProdno(prodno).size == 0
1672
- puts "No item found for prodno #{prodno} no8 #{obj[:no8]} #{sequence[:name_de]} "
1694
+ if Oddb2xml.getEan13forProdno(prodno).size == 0 && !obj[:no8].eql?(Oddb2xml.getNo8ForEan13(ean))
1695
+ puts "No item found for prodno #{prodno} no8 #{obj[:no8]} #{sequence[:name_de]}"
1673
1696
  next
1674
1697
  end
1675
1698
  end
@@ -1699,12 +1722,14 @@ module Oddb2xml
1699
1722
  used_limitations << lim_code unless used_limitations.index(lim_code)
1700
1723
  xml.LIMNAMEBAG lim_code
1701
1724
  elsif obj[:chapter70]
1702
- used_limitations << obj[:code]
1703
1725
  xml.comment "Chapter70 hack"
1704
1726
  xml.SALECD('A') # these products are always active!
1705
1727
  xml.DSCR obj[:description]
1706
1728
  xml.DSCRF ''
1707
- xml.LIMNAMEBAG obj[:code]
1729
+ if @limitations.index(obj[:code])
1730
+ xml.LIMNAMEBAG obj[:code]
1731
+ used_limitations << obj[:code]
1732
+ end
1708
1733
  end
1709
1734
  if sequence && sequence[:substances]
1710
1735
  value = nil
@@ -12,7 +12,7 @@ module Oddb2xml
12
12
  puts "parse_td returns: #{res}" if $VERBOSE
13
13
  rescue => exc
14
14
  puts "Unable to pars #{elem} #{exc}"
15
- binding.pry
15
+ # binding.pry
16
16
  return nil
17
17
  end
18
18
  res.flatten # .join("\t")
@@ -26,14 +26,14 @@ module Oddb2xml
26
26
  def self.items
27
27
  @@items
28
28
  end
29
- def self.parse(html_file = 'http://bag.e-mediat.net/Sl2007.web.external/varia_De.htm')
29
+ def self.parse(html_file = 'http://www.spezialitaetenliste.ch/varia_De.htm')
30
30
  data = Hash.new{|h,k| h[k] = [] }
31
31
  Ox.default_options = {
32
32
  mode: :generic,
33
33
  effort: :tolerant,
34
34
  smart: true
35
35
  }
36
- res = Ox.load(open(html_file).read, mode: :hash_no_attrs).values.first['body']
36
+ res = Ox.load(URI.open(html_file).read, mode: :hash_no_attrs).values.first['body']
37
37
  result = []
38
38
  idx = 0
39
39
  @@items = {}
@@ -50,15 +50,16 @@ module Oddb2xml
50
50
  data = {}
51
51
  pharma_code = entry.first
52
52
  ean13 = (Oddb2xml::FAKE_GTIN_START + pharma_code.to_s)
53
- german = entry[2].force_encoding('ISO-8859-1').encode('UTF-8')
54
- while !german.eql?(HTMLEntities.new.decode(german))
55
- german = HTMLEntities.new.decode(german)
53
+ if entry[2].encoding.to_s.eql?('ASCII-8BIT')
54
+ german = CGI.unescape(entry[2].force_encoding('ISO-8859-1'))
55
+ else
56
+ german = entry[2]
56
57
  end
57
58
  @@items[ean13] = {
58
59
  :data_origin => 'Chapter70',
59
60
  :line => entry.join(","),
60
61
  :ean13 => ean13,
61
- :description => Oddb2xml.html_decode(entry[2]),
62
+ :description => german,
62
63
  :quantity => entry[3],
63
64
  :pharmacode => pharma_code,
64
65
  :pub_price => entry[4],
@@ -70,5 +71,3 @@ module Oddb2xml
70
71
  end
71
72
  end
72
73
  end
73
-
74
-
@@ -23,7 +23,7 @@ module Oddb2xml
23
23
  else
24
24
  begin
25
25
  io = File.open(file, option)
26
- data = open(@url).read
26
+ data = URI.open(@url).read
27
27
  io.write(data)
28
28
  rescue => error
29
29
  puts "error #{error} while fetching #{@url}"
@@ -197,7 +197,7 @@ module Oddb2xml
197
197
  include DownloadMethod
198
198
  def init
199
199
  super
200
- @url ||= 'http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip'
200
+ @url ||= 'http://www.xn--spezialittenliste-yqb.ch/File.axd?file=XMLPublications.zip'
201
201
  end
202
202
  def download
203
203
  file = File.join(WorkDir, 'XMLPublications.zip')
@@ -283,7 +283,7 @@ module Oddb2xml
283
283
  include DownloadMethod
284
284
  def initialize(type=:orphan, options = {})
285
285
  url = BASE_URL + '/swissmedic/de/home/services/listen_neu.html'
286
- doc = Nokogiri::HTML(open(url))
286
+ doc = Nokogiri::HTML(URI.open(url))
287
287
  @type = type
288
288
  @options = options
289
289
  case @type
@@ -319,6 +319,7 @@ module Oddb2xml
319
319
  Oddb2xml.setEan13forProdno(prodno, ean13)
320
320
  Oddb2xml.setEan13forNo8(no8, ean13)
321
321
  data[no8] = {
322
+ :iksnr => row[iksnr].value.to_i,
322
323
  :no8 => no8,
323
324
  :ean13 => ean13,
324
325
  :prodno => prodno,
@@ -64,7 +64,7 @@ module Oddb2xml
64
64
  end
65
65
  end
66
66
  end
67
-
67
+
68
68
  def everyPharmaArticleHasAProductItem
69
69
  result = true
70
70
  puts "#{Time.now.strftime("%H:%M:%S")}: everyPharmaArticleHasAProductItem"
@@ -74,7 +74,7 @@ module Oddb2xml
74
74
  unless allProductNumbers.index(item[:PRODNO])
75
75
  puts "Item #{item[:GTIN]} has no Product #{item[:PRODNO]} #{item[:DSCR]}"
76
76
  result = false
77
- end
77
+ end unless item[:Chapter70_HACK]
78
78
  end
79
79
  result
80
80
  end
@@ -91,17 +91,19 @@ module Oddb2xml
91
91
  end
92
92
  result
93
93
  end
94
-
94
+
95
95
  def everyReferencedLimitationIsIncluded
96
+ result = true
96
97
  puts "#{Time.now.strftime("%H:%M:%S")}: everyReferencedLimitationIsIncluded"
97
98
  allLimitations = limitations.collect{ |lim| lim[:LIMNAMEBAG] }
98
99
  products.each do |product|
99
100
  next unless product[:LIMNAMEBAG]
100
101
  unless allLimitations.index(product[:LIMNAMEBAG])
101
102
  puts "product #{product[:PRODNO]} has no limitation #{product[:LIMNAMEBAG]} #{product[:DSCR]}"
102
- return false
103
+ result = false
103
104
  end
104
105
  end
106
+ result
105
107
  end
106
108
 
107
109
  def checkPackageSize
@@ -23,7 +23,7 @@ module Oddb2xml
23
23
  Downloads = "#{Dir.pwd}/downloads"
24
24
  end
25
25
  @options = {}
26
- @atc_csv_origin = 'http://download.epha.ch/data/atc/atc.csv'
26
+ @atc_csv_origin = 'https://github.com/zdavatz/cpp2sqlite/blob/master/input/atc_codes_multi_lingual.txt'
27
27
  @atc_csv_content = {}
28
28
 
29
29
  def Oddb2xml.html_decode(string)
@@ -34,7 +34,7 @@ module Oddb2xml
34
34
  end
35
35
  Oddb2xml.patch_some_utf8(german).gsub('<br>',"\n")
36
36
  end
37
-
37
+
38
38
  def Oddb2xml.patch_some_utf8(line)
39
39
  begin
40
40
  line = line.encode('utf-8')
@@ -86,7 +86,7 @@ module Oddb2xml
86
86
  def Oddb2xml.skip_download?
87
87
  @options[:skip_download]
88
88
  end
89
-
89
+
90
90
  def Oddb2xml.skip_download(file)
91
91
  return false if defined?(VCR)
92
92
  dest = "#{Downloads}/#{File.basename(file)}"
@@ -96,7 +96,7 @@ module Oddb2xml
96
96
  end
97
97
  false
98
98
  end
99
-
99
+
100
100
  def Oddb2xml.download_finished(file, remove_file = true)
101
101
  src = "#{WorkDir}/#{File.basename(file)}"
102
102
  dest = "#{Downloads}/#{File.basename(file)}"
@@ -232,7 +232,7 @@ COLUMNS_FEBRUARY_2019= {
232
232
  @@ean13_to_no8 = {}
233
233
  def Oddb2xml.setEan13forProdno(prodno, ean13)
234
234
  if ean13.to_i == 7680006660045 || ean13.to_i == 7680006660014
235
- puts "setEan13forProdno #{prodno} ean13 #{ean13}"
235
+ Oddb2xml.log "setEan13forProdno #{prodno} ean13 #{ean13}"
236
236
  end
237
237
  @@prodno_to_ean13[prodno] ||= []
238
238
  @@prodno_to_ean13[prodno] << ean13
@@ -240,13 +240,13 @@ COLUMNS_FEBRUARY_2019= {
240
240
  end
241
241
  def Oddb2xml.setEan13forNo8(no8, ean13)
242
242
  if ean13.to_i == 7680006660045 || ean13.to_i == 7680006660014
243
- puts "setEan13forNo8 #{no8} ean13 #{ean13}"
243
+ Oddb2xml.log "setEan13forNo8 #{no8} ean13 #{ean13}"
244
244
  end
245
245
  if @@no8_to_ean13[no8].nil?
246
246
  @@no8_to_ean13[no8] = ean13
247
247
  @@ean13_to_no8[ean13] = no8
248
248
  elsif !@@no8_to_ean13[no8].eql?(ean13)
249
- puts "@@no8_to_ean13[no8] #{@@no8_to_ean13[no8]} not overridden by #{ean13}"
249
+ Oddb2xml.log "@@no8_to_ean13[no8] #{@@no8_to_ean13[no8]} not overridden by #{ean13}"
250
250
  end
251
251
  end
252
252
  def Oddb2xml.getEan13forProdno(prodno)
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "2.6.2"
2
+ VERSION = "2.6.7"
3
3
  end
@@ -24,7 +24,7 @@ describe Oddb2xml::Builder do
24
24
  unless @inhalt.index(expected_value)
25
25
  puts expected_value
26
26
  end
27
- # binding.pry unless @inhalt.index(expected_value)
27
+ binding.pry unless @inhalt.index(expected_value)
28
28
  expect(@inhalt.index(expected_value)).not_to be nil
29
29
  end
30
30
  def common_run_init(options = {})
@@ -121,7 +121,7 @@ describe Oddb2xml::Builder do
121
121
  it 'should find price from Preparations.xml by setting' do
122
122
  expect(File.exists?(@elexis_v5_csv)).to eq true
123
123
  inhalt = File.open(@elexis_v5_csv, 'r+').read
124
- expected = %(7680658560014,Dibase 10'000 Tropfen 10000 IE/ml Fl 10 ml,,Flasche(n),5,9.25,,,,"",,SL)
124
+ expected = %(7680658560014,Dibase 10'000 Tropfen 10000 IE/ml Fl 10 ml,,Flasche(n),5,9.25,6585601,A11CC05,,"",,SL)
125
125
  expect(inhalt.index(expected)).to be > 0
126
126
  end
127
127
 
@@ -139,7 +139,7 @@ describe Oddb2xml::Builder do
139
139
  it 'should have a price for Lynparza' do
140
140
  expect(File.exists?(@elexis_v5_csv)).to eq true
141
141
  inhalt = File.open(@elexis_v5_csv, 'r+').read
142
- expect(inhalt.index('7680651600014,Lynparza Kaps 50 mg 448 Stk,,Kapsel(n),5562.48,5947.55,,,,"",,SL')).not_to be nil
142
+ expect(inhalt.index('7680651600014,Lynparza Kaps 50 mg 448 Stk,,Kapsel(n),5562.48,5947.55,6516001,L01XX46,,"",,S')).not_to be nil
143
143
  end
144
144
  it 'should trim the ean13 to 13 length' do
145
145
  gtin14 = "00040565124346"
@@ -184,7 +184,7 @@ describe Oddb2xml::Builder do
184
184
  @inhalt = IO.read(@artikelstamm_name)
185
185
  expect(@inhalt.index('BIOMARIS Voll Meersalz 500 g')).not_to be nil
186
186
  end
187
-
187
+
188
188
  it 'Should not contain PHAR 8809544 Sildenavil with pexf and ppub 0.0' do
189
189
  #1128809544Sildenafil Suspension 7mg/ml 100ml 0030850045801000000000000000000000002
190
190
  @inhalt = IO.read(@artikelstamm_name)
@@ -211,29 +211,33 @@ describe Oddb2xml::Builder do
211
211
  it 'shoud contain GENERIC_TYPE' do
212
212
  expect(@inhalt.index('<GENERIC_TYPE')).not_to be nil
213
213
  end
214
-
214
+
215
215
  it 'should contain DIBASE with phar' do
216
216
  expected = %(<ITEM PHARMATYPE="P">
217
- <GTIN>7680658570013</GTIN>
218
- <!--override with-->
217
+ <GTIN>7680658560014</GTIN>
218
+ <!--obsolete override-->
219
+ <PHAR>7199565</PHAR>
219
220
  <SALECD>A</SALECD>
220
- <DSCR>DIBASE 25'000, Lösung zum Einnehmen</DSCR>
221
- <DSCRF>--missing--</DSCRF>
221
+ <DSCR>Dibase 10'000 Tropfen 10000 IE/ml Fl 10 ml</DSCR>
222
+ <DSCRF>Dibase 10'000 gouttes 10000 UI/ml fl 10 ml</DSCRF>
222
223
  <COMP>
223
224
  <NAME>Gebro Pharma AG</NAME>
224
- <GLN/>
225
+ <GLN>7612053000000</GLN>
225
226
  </COMP>
227
+ <PEXF>5</PEXF>
228
+ <PPUB>9.25</PPUB>
226
229
  <PKG_SIZE>1</PKG_SIZE>
227
230
  <MEASURE>Flasche(n)</MEASURE>
228
231
  <MEASUREF>Flasche(n)</MEASUREF>
229
- <DOSAGE_FORM>Lösung</DOSAGE_FORM>
230
- <DOSAGE_FORMF>Solution</DOSAGE_FORMF>
232
+ <DOSAGE_FORM>orale Tropflösung</DOSAGE_FORM>
233
+ <SL_ENTRY>true</SL_ENTRY>
231
234
  <IKSCAT>D</IKSCAT>
232
- <PRODNO>6585701</PRODNO>
233
- </ITEM>)
235
+ <DEDUCTIBLE>10</DEDUCTIBLE>
236
+ <PRODNO>6585601</PRODNO>
237
+ </ITEM)
234
238
  expect(@inhalt.index(expected)).not_to be nil
235
239
  end
236
-
240
+
237
241
  it 'should contain PEVISONE Creme 30 g' do
238
242
  expect(@inhalt.index('Pevisone Creme 15 g')).not_to be nil # 7680406620144
239
243
  expect(@inhalt.index('Pevisone Creme 30 g')).not_to be nil # 7680406620229
@@ -329,7 +333,7 @@ describe Oddb2xml::Builder do
329
333
  <DEDUCTIBLE>10</DEDUCTIBLE>
330
334
  <PRODNO>1610501</PRODNO>
331
335
  </ITEM>),
332
- 'item 7680161050743 100g ' =>
336
+ 'item 7680161050743 Hirudoid Creme 3 mg/g 100 g' =>
333
337
  %( <ITEM PHARMATYPE="P">
334
338
  <GTIN>7680161050743</GTIN>
335
339
  <PHAR>2731179</PHAR>
@@ -345,7 +349,7 @@ describe Oddb2xml::Builder do
345
349
  <SL_ENTRY>true</SL_ENTRY>
346
350
  <IKSCAT>D</IKSCAT>
347
351
  <DEDUCTIBLE>10</DEDUCTIBLE>
348
- </ITEM>),
352
+ </ITEM>),
349
353
  'item 7680284860144 ANCOPIR' =>'<ITEM PHARMATYPE="P">
350
354
  <GTIN>7680284860144</GTIN>
351
355
  <PHAR>0177804</PHAR>
@@ -387,7 +391,7 @@ describe Oddb2xml::Builder do
387
391
  <DOSAGE_FORMF>Compresse</DOSAGE_FORMF>
388
392
  <IKSCAT>C</IKSCAT>
389
393
  <PRODNO>3164402</PRODNO>
390
- </ITEM>),
394
+ </ITEM>),
391
395
  'product 3TC Filmtabl' => %(<PRODUCT>
392
396
  <PRODNO>5366201</PRODNO>
393
397
  <SALECD>A</SALECD>
@@ -435,20 +439,12 @@ describe Oddb2xml::Builder do
435
439
  <DEDUCTIBLE>20</DEDUCTIBLE>
436
440
  <PRODNO>5329001</PRODNO>
437
441
  </ITEM>),
438
- 'Chapter 70 limitation' => %(<LIMITATION>
439
- <!--Chapter70 hack-->
440
- <LIMNAMEBAG>L1, L2</LIMNAMEBAG>
441
- <DSCR>Eine Flasche zu 20 ml Urtinktur einer bestimmten Pflanze pro Monat. Für Aesculus, Carduus Marianus, Ginkgo, Hedera helix, Hypericum perforatum, Lavandula, Rosmarinus officinalis, Taraxacum officinale.</DSCR>
442
- <DSCRF/>
443
- <LIMITATION_PTS>1</LIMITATION_PTS>
444
- </LIMITATION>),
445
442
  'Chapter 70 product' => %(<PRODUCT>
446
443
  <PRODNO>2069639</PRODNO>
447
444
  <!--Chapter70 hack-->
448
445
  <SALECD>A</SALECD>
449
446
  <DSCR>Ceres Urtinkturen gemäss L2</DSCR>
450
447
  <DSCRF/>
451
- <LIMNAMEBAG>L1, L2</LIMNAMEBAG>
452
448
  </PRODUCT>),
453
449
  'Chapter 70 item' => %(<ITEM PHARMATYPE="P">
454
450
  <GTIN>2500000588532</GTIN>
@@ -461,6 +457,7 @@ describe Oddb2xml::Builder do
461
457
  <!--Chapter70 hack-->
462
458
  <SL_ENTRY>true</SL_ENTRY>
463
459
  <PRODNO>2069639</PRODNO>
460
+ <Chapter70_HACK>true</Chapter70_HACK>
464
461
  </ITEM>),
465
462
  'HTML-encoded limitation' => %(<DSCR>Zur Erhaltungstherapie (Monotherapie) bei erwachsenen Patientinnen mit rezidiviertem, fortgeschrittenem Ovarialkarzinom mit BRCA Mutation im Anschluss an eine platinhaltige Chemotherapie bei Vorliegen einer kompletten oder partiellen Remission.
466
463
 
@@ -59,7 +59,7 @@ ARTICLE_NAROPIN = %(1
59
59
  <BCSTAT>A</BCSTAT>
60
60
  </ARTBAR>
61
61
  </ART>)
62
-
62
+
63
63
  ARTICLE_COMMON_ELEMENTS = [
64
64
  ['ARTICLE/ART/REF_DATA', '1'],
65
65
  ['ARTICLE/ART/SMCAT', 'A'],
@@ -256,7 +256,7 @@ def check_result(inhalt, nbr_record)
256
256
  expect(inhalt.index('<ERROR_CODE/>')).to be > 0
257
257
  m = /<NBR_RECORD>(\d+)<\/NBR_RECORD>/.match(inhalt)
258
258
  expect(m).not_to be nil
259
- expect(m[1].to_i).to eq nbr_record
259
+ expect(m[1].to_i).to eq nbr_record
260
260
  end
261
261
 
262
262
  def checkItemForRefdata(doc, pharmacode, isRefdata)
@@ -476,7 +476,7 @@ describe Oddb2xml::Builder do
476
476
  NrExtendedArticles = 76
477
477
  NrSubstances = 27
478
478
  NrLimitations = 14
479
-
479
+
480
480
  NrInteractions = 2
481
481
  NrCodes = 5
482
482
  NrProdno = 31
@@ -532,7 +532,7 @@ describe Oddb2xml::Builder do
532
532
 
533
533
  check_attributes(oddb_article_xml, ARTICLE_ATTRIBUTE_TESTS)
534
534
  check_elements(oddb_article_xml, ARTICLE_COMMON_ELEMENTS)
535
-
535
+
536
536
  it 'should validate XSD article' do
537
537
  @inhalt = File.read(oddb_article_xml)
538
538
  # This fails on Ruby < 2.4 as NAROPIN INJ LÖS 0.2 % 10 is wrongly encoded
@@ -552,7 +552,7 @@ describe Oddb2xml::Builder do
552
552
  end
553
553
 
554
554
  it 'should have a correct insulin (gentechnik) for 7680532900196' do
555
- expect(XPath.match( @rexml, "//ART/[BC='7680532900196']").size).to eq 1
555
+ expect(@inhalt.match(/.*<BC>7680532900196<\/BC>.*/).class).to be MatchData
556
556
  expect(XPath.match( @rexml, "//ART//GEN_PRODUCTION").size).to be >= 1
557
557
  expect(XPath.match( @rexml, "//ART//GEN_PRODUCTION").first.text).to eq 'X'
558
558
  expect(XPath.match( @rexml, "//ART//INSULIN_CATEGORY").size).to eq 1
@@ -568,7 +568,7 @@ describe Oddb2xml::Builder do
568
568
  ean_with_drug_index = 7680555610041
569
569
  it "should have a correct drug information for #{ean_with_drug_index}" do
570
570
  doc = REXML::Document.new IO.read(checkAndGetArticleXmlName)
571
- expect(XPath.match( @rexml, "//ART/[BC='#{ean_with_drug_index}']").size).to eq 1
571
+ expect(@inhalt.match(/.*<BC>#{ean_with_drug_index}<\/BC>.*/).class).to be MatchData
572
572
  expect(XPath.match( @rexml, "//ART//DRUG_INDEX").size).to eq 1
573
573
  expect(XPath.match( @rexml, "//ART//DRUG_INDEX").first.text).to eq 'd'
574
574
  found = false
@@ -605,11 +605,11 @@ describe Oddb2xml::Builder do
605
605
  <CPT/>)
606
606
  expect(oddb_product_xml.index(text2)).to be >= 1
607
607
  end
608
-
608
+
609
609
  it 'should generate SALECD A for swissmedic packages' do
610
610
  expect(IO.read(oddb_article_xml).index('<SALECD>A<!--Overriding status I nincd 10 for 7680658560014 as in refdata_pharma--></SALECD>')).to be >= 1
611
611
  end
612
-
612
+
613
613
  end
614
614
 
615
615
  context 'when -o for fachinfo is given' do
@@ -76,7 +76,7 @@ def common_before
76
76
  FileUtils.makedirs(Oddb2xml::WorkDir)
77
77
  Dir.chdir(Oddb2xml::WorkDir)
78
78
  WebMock.enable!
79
- { 'https://download.epha.ch/cleaned/matrix.csv' => 'epha_interactions.csv',
79
+ { 'https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/interactions_de_utf8.csv' => 'epha_interactions.csv',
80
80
  }.each do |url, file|
81
81
  inhalt = File.read(File.join(Oddb2xml::SpecData, file))
82
82
  stub_request(:get,url).to_return(body: inhalt)
@@ -966,7 +966,7 @@
966
966
  ]
967
967
  },
968
968
  "method": "get",
969
- "uri": "http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip"
969
+ "uri": "http://www.xn--spezialittenliste-yqb.ch/File.axd?file=XMLPublications.zip"
970
970
  },
971
971
  "response": {
972
972
  "body": {
@@ -1025,7 +1025,7 @@
1025
1025
  ]
1026
1026
  },
1027
1027
  "method": "get",
1028
- "uri": "http://download.epha.ch/data/atc/atc.csv"
1028
+ "uri": "https://github.com/zdavatz/cpp2sqlite/blob/master/input/atc_codes_multi_lingual.txt"
1029
1029
  },
1030
1030
  "response": {
1031
1031
  "body": {
@@ -1141,7 +1141,7 @@
1141
1141
  ]
1142
1142
  },
1143
1143
  "method": "get",
1144
- "uri": "https://download.epha.ch/cleaned/matrix.csv"
1144
+ "uri": "https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/interactions_de_utf8.csv"
1145
1145
  },
1146
1146
  "response": {
1147
1147
  "body": {
@@ -1230,7 +1230,7 @@
1230
1230
  ]
1231
1231
  },
1232
1232
  "method": "get",
1233
- "uri": "https://download.epha.ch/cleaned/matrix.csv"
1233
+ "uri": "https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/interactions_de_utf8.csv"
1234
1234
  },
1235
1235
  "response": {
1236
1236
  "body": {
@@ -249,15 +249,15 @@ def mock_downloads
249
249
  cmd = "zip --quiet --junk-paths #{zip_file} #{files.join(' ')}"
250
250
  system(cmd)
251
251
  end
252
- { 'https://download.epha.ch/cleaned/matrix.csv' => 'epha_interactions.csv',
252
+ { 'https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/interactions_de_utf8.csv' => 'epha_interactions.csv',
253
253
  'https://www.swissmedic.ch/swissmedic/de/home/services/listen_neu.html' => 'listen_neu.html',
254
254
  'https://www.swissmedic.ch/dam/swissmedic/de/dokumente/internetlisten/status_ophan%20Drug.xlsx.download.xlsx/Liste_OrphanDrug_Internet_2019_01_31.xlsx' => 'swissmedic_orphan.xlsx',
255
255
  'https://www.swissmedic.ch/dam/swissmedic/de/dokumente/internetlisten/zugelassene_packungen_ham.xlsx.download.xlsx/Zugelassene_Packungen%20HAM_31012019.xlsx' => 'swissmedic_package.xlsx',
256
256
  'http://pillbox.oddb.org/TRANSFER.ZIP' => 'transfer.zip',
257
- 'https://raw.githubusercontent.com/epha/robot/master/data/manual/swissmedic/atc.csv' => 'atc.csv',
257
+ 'https://github.com/zdavatz/cpp2sqlite/blob/master/input/atc_codes_multi_lingual.txt' => 'atc.csv',
258
258
  'https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/LPPV.txt' => 'oddb2xml_files_lppv.txt',
259
- 'http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip' => 'XMLPublications.zip',
260
- 'http://bag.e-mediat.net/Sl2007.web.external/varia_De.htm' => 'varia_De.htm',
259
+ 'http://www.xn--spezialittenliste-yqb.ch/File.axd?file=XMLPublications.zip' => 'XMLPublications.zip',
260
+ 'http://www.spezialitaetenliste.ch/varia_De.htm' => 'varia_De.htm',
261
261
  # 'http://refdatabase.refdata.ch/Service/Article.asmx?WSDL' => 'refdata_Pharma.xml',
262
262
  }.each do |url, file|
263
263
  inhalt = File.read(File.join(Oddb2xml::SpecData, file))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oddb2xml
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.2
4
+ version: 2.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-01 00:00:00.000000000 Z
11
+ date: 2020-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -486,8 +486,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
486
486
  - !ruby/object:Gem::Version
487
487
  version: '0'
488
488
  requirements: []
489
- rubyforge_project:
490
- rubygems_version: 2.6.8
489
+ rubygems_version: 3.1.2
491
490
  signing_key:
492
491
  specification_version: 4
493
492
  summary: oddb2xml creates xml files.