oddb2xml 2.6.8 → 2.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +40 -0
- data/.standard.yml +2 -0
- data/Elexis_Artikelstamm_v5.xsd +0 -3
- data/Gemfile +3 -3
- data/History.txt +29 -0
- data/README.md +3 -3
- data/Rakefile +24 -23
- data/bin/check_artikelstamm +11 -11
- data/bin/compare_v5 +23 -23
- data/bin/oddb2xml +14 -13
- data/lib/oddb2xml.rb +1 -1
- data/lib/oddb2xml/builder.rb +1075 -1048
- data/lib/oddb2xml/calc.rb +232 -233
- data/lib/oddb2xml/chapter_70_hack.rb +38 -32
- data/lib/oddb2xml/cli.rb +252 -233
- data/lib/oddb2xml/compare.rb +70 -59
- data/lib/oddb2xml/compositions_syntax.rb +448 -430
- data/lib/oddb2xml/compressor.rb +20 -20
- data/lib/oddb2xml/downloader.rb +154 -128
- data/lib/oddb2xml/extractor.rb +295 -302
- data/lib/oddb2xml/options.rb +34 -35
- data/lib/oddb2xml/parslet_compositions.rb +263 -265
- data/lib/oddb2xml/semantic_check.rb +39 -33
- data/lib/oddb2xml/util.rb +166 -164
- data/lib/oddb2xml/version.rb +1 -1
- data/lib/oddb2xml/xml_definitions.rb +32 -33
- data/oddb2xml.gemspec +31 -30
- data/spec/artikelstamm_spec.rb +116 -135
- data/spec/builder_spec.rb +495 -524
- data/spec/calc_spec.rb +552 -593
- data/spec/check_artikelstamm_spec.rb +26 -26
- data/spec/cli_spec.rb +182 -157
- data/spec/compare_spec.rb +9 -11
- data/spec/composition_syntax_spec.rb +390 -409
- data/spec/compressor_spec.rb +48 -48
- data/spec/data/refdata_NonPharma.xml +0 -3
- data/spec/data/refdata_Pharma.xml +0 -26
- data/spec/data/transfer.dat +1 -0
- data/spec/data/varia_De.htm +2 -2
- data/spec/data_helper.rb +47 -49
- data/spec/downloader_spec.rb +247 -260
- data/spec/extractor_spec.rb +172 -164
- data/spec/galenic_spec.rb +233 -256
- data/spec/options_spec.rb +116 -119
- data/spec/parslet_spec.rb +833 -861
- data/spec/spec_helper.rb +154 -153
- data/test_options.rb +39 -42
- data/tools/win_fetch_cacerts.rb +2 -3
- metadata +48 -4
- data/.travis.yml +0 -29
data/lib/oddb2xml/version.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Definitions for the sax-machine parse to parse
|
2
2
|
# Preparations.xml
|
3
3
|
|
4
|
-
require
|
4
|
+
require "sax-machine"
|
5
5
|
|
6
|
-
|
6
|
+
STRIP_FOR_SAX_MACHINE = '<?xml version="1.0" encoding="utf-8"?>' + "\n"
|
7
7
|
|
8
8
|
class PriceElement
|
9
9
|
include SAXMachine
|
@@ -31,8 +31,8 @@ end
|
|
31
31
|
|
32
32
|
class PricesElement
|
33
33
|
include SAXMachine
|
34
|
-
element :ExFactoryPrice, :
|
35
|
-
element :PublicPrice, :
|
34
|
+
element :ExFactoryPrice, class: PriceElement
|
35
|
+
element :PublicPrice, class: PriceElement
|
36
36
|
end
|
37
37
|
|
38
38
|
class LimitationElement
|
@@ -50,7 +50,7 @@ end
|
|
50
50
|
|
51
51
|
class LimitationsElement
|
52
52
|
include SAXMachine
|
53
|
-
elements :Limitation, :
|
53
|
+
elements :Limitation, class: LimitationElement
|
54
54
|
end
|
55
55
|
|
56
56
|
class PointLimitationElement
|
@@ -63,7 +63,7 @@ end
|
|
63
63
|
|
64
64
|
class PointLimitationsElement
|
65
65
|
include SAXMachine
|
66
|
-
elements :PointLimitation, :
|
66
|
+
elements :PointLimitation, class: PointLimitationElement
|
67
67
|
end
|
68
68
|
|
69
69
|
class PackContent
|
@@ -79,14 +79,14 @@ class PackContent
|
|
79
79
|
element :FlagModal
|
80
80
|
element :BagDossierNo
|
81
81
|
element :GTIN
|
82
|
-
element :Limitations, :
|
83
|
-
element :PointLimitations, :
|
84
|
-
element :Prices, :
|
82
|
+
element :Limitations, class: LimitationsElement
|
83
|
+
element :PointLimitations, class: PointLimitationsElement
|
84
|
+
element :Prices, class: PricesElement
|
85
85
|
end
|
86
86
|
|
87
87
|
class PacksElement
|
88
88
|
include SAXMachine
|
89
|
-
elements :Pack, :
|
89
|
+
elements :Pack, class: PackContent
|
90
90
|
end
|
91
91
|
|
92
92
|
class ItCodeContent
|
@@ -95,18 +95,18 @@ class ItCodeContent
|
|
95
95
|
element :DescriptionDe
|
96
96
|
element :DescriptionFr
|
97
97
|
element :DescriptionIt
|
98
|
-
element :Limitations, :
|
98
|
+
element :Limitations, class: LimitationsElement
|
99
99
|
end
|
100
100
|
|
101
101
|
class ItCodeEntry
|
102
102
|
include SAXMachine
|
103
|
-
element :ItCode, :
|
103
|
+
element :ItCode, class: ItCodeContent
|
104
104
|
end
|
105
105
|
|
106
106
|
# handling attributes as suggested by https://github.com/pauldix/sax-machine/issues/30
|
107
107
|
class ItCodesElement
|
108
108
|
include SAXMachine
|
109
|
-
elements :ItCode, :
|
109
|
+
elements :ItCode, class: ItCodeContent
|
110
110
|
end
|
111
111
|
|
112
112
|
class SubstanceElement
|
@@ -118,7 +118,7 @@ end
|
|
118
118
|
|
119
119
|
class SubstancesElement
|
120
120
|
include SAXMachine
|
121
|
-
elements :Substance, :
|
121
|
+
elements :Substance, class: SubstanceElement
|
122
122
|
end
|
123
123
|
|
124
124
|
class PreparationContent
|
@@ -127,7 +127,7 @@ class PreparationContent
|
|
127
127
|
element :NameFr
|
128
128
|
element :NameDe
|
129
129
|
element :NameIt
|
130
|
-
element :Status, :
|
130
|
+
element :Status, class: StatusElement
|
131
131
|
element :Dummy
|
132
132
|
element :DescriptionDe
|
133
133
|
element :DescriptionFr
|
@@ -141,29 +141,28 @@ class PreparationContent
|
|
141
141
|
element :CommentFr
|
142
142
|
element :CommentIt
|
143
143
|
element :VatInEXF
|
144
|
-
element :Limitations, :
|
145
|
-
element :Substances, :
|
146
|
-
element :Packs, :
|
147
|
-
element :ItCodes, :
|
144
|
+
element :Limitations, class: LimitationsElement
|
145
|
+
element :Substances, class: SubstancesElement
|
146
|
+
element :Packs, class: PacksElement
|
147
|
+
element :ItCodes, class: ItCodesElement
|
148
148
|
end
|
149
149
|
|
150
150
|
class PreparationEntry
|
151
151
|
include SAXMachine
|
152
|
-
element :Preparation, :
|
152
|
+
element :Preparation, class: PreparationContent
|
153
153
|
end
|
154
154
|
|
155
155
|
class PreparationsContent
|
156
156
|
include SAXMachine
|
157
157
|
attribute :ReleaseDate
|
158
|
-
elements :Preparation, :
|
158
|
+
elements :Preparation, class: PreparationContent
|
159
159
|
end
|
160
160
|
|
161
161
|
class PreparationsEntry
|
162
162
|
include SAXMachine
|
163
|
-
element :Preparations, :
|
163
|
+
element :Preparations, class: PreparationsContent
|
164
164
|
end
|
165
165
|
|
166
|
-
|
167
166
|
class CompElement
|
168
167
|
include SAXMachine
|
169
168
|
element :NAME
|
@@ -181,20 +180,20 @@ class ItemContent
|
|
181
180
|
element :DSCR
|
182
181
|
element :ADDSCR
|
183
182
|
element :ATC
|
184
|
-
element :COMP, :
|
183
|
+
element :COMP, class: CompElement
|
185
184
|
end
|
186
185
|
|
187
186
|
class PharmaContent
|
188
187
|
include SAXMachine
|
189
188
|
attribute :CREATION_DATETIME
|
190
|
-
elements :ITEM, :
|
189
|
+
elements :ITEM, class: ItemContent
|
191
190
|
end
|
192
191
|
|
193
192
|
class PharmaEntry
|
194
193
|
include SAXMachine
|
195
194
|
element :CREATION_DATETIME
|
196
|
-
element :NONPHARMA, :
|
197
|
-
element :PHARMA, :
|
195
|
+
element :NONPHARMA, as: :PHARMA, class: PharmaContent
|
196
|
+
element :PHARMA, class: PharmaContent
|
198
197
|
end
|
199
198
|
|
200
199
|
class ItemContent
|
@@ -208,7 +207,7 @@ class ItemContent
|
|
208
207
|
element :DSCR
|
209
208
|
element :ADDSCR
|
210
209
|
element :ATC
|
211
|
-
element :COMP, :
|
210
|
+
element :COMP, class: CompElement
|
212
211
|
end
|
213
212
|
|
214
213
|
class MedicalInformationContent
|
@@ -225,17 +224,17 @@ end
|
|
225
224
|
|
226
225
|
class MedicalInformationEntry
|
227
226
|
include SAXMachine
|
228
|
-
element :medicalInformation, :
|
227
|
+
element :medicalInformation, class: MedicalInformationContent
|
229
228
|
end
|
230
229
|
|
231
230
|
class MedicalInformationsContent
|
232
231
|
include SAXMachine
|
233
|
-
elements :medicalInformation, :
|
232
|
+
elements :medicalInformation, class: MedicalInformationContent
|
234
233
|
end
|
235
234
|
|
236
235
|
class MedicalInformationsEntry
|
237
236
|
include SAXMachine
|
238
|
-
element :medicalInformations, :
|
237
|
+
element :medicalInformations, class: MedicalInformationsContent
|
239
238
|
end
|
240
239
|
|
241
240
|
class SwissRegItemContentContent
|
@@ -256,11 +255,11 @@ end
|
|
256
255
|
class SwissRegArticleContent
|
257
256
|
include SAXMachine
|
258
257
|
attribute :CREATION_DATETIME
|
259
|
-
elements :ITEM, :
|
258
|
+
elements :ITEM, class: SwissRegItemContentContent
|
260
259
|
end
|
261
260
|
|
262
261
|
class SwissRegArticleEntry
|
263
262
|
include SAXMachine
|
264
263
|
element :CREATION_DATETIME
|
265
|
-
element :ARTICLE, :
|
264
|
+
element :ARTICLE, class: SwissRegArticleContent
|
266
265
|
end
|
data/oddb2xml.gemspec
CHANGED
@@ -1,42 +1,44 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require
|
3
|
+
require "oddb2xml/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.author
|
10
|
-
spec.email
|
6
|
+
spec.name = "oddb2xml"
|
7
|
+
spec.version = Oddb2xml::VERSION
|
8
|
+
spec.author = "Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger"
|
9
|
+
spec.email = "yasaka@ywesee.com, zdavatz@ywesee.com, ngiger@ywesee.com"
|
11
10
|
spec.description = "oddb2xml creates xml files using swissINDEX, BAG-XML and Swissmedic."
|
12
|
-
spec.summary
|
13
|
-
spec.homepage
|
14
|
-
spec.license
|
15
|
-
spec.files
|
16
|
-
spec.executables
|
17
|
-
spec.test_files
|
11
|
+
spec.summary = "oddb2xml creates xml files."
|
12
|
+
spec.homepage = "https://github.com/zdavatz/oddb2xml"
|
13
|
+
spec.license = "GPL-3.0"
|
14
|
+
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
16
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
17
|
spec.require_paths = ["lib"]
|
19
18
|
spec.required_ruby_version = ">= 2.2.0"
|
20
19
|
|
21
20
|
# We fix the version of the spec to newer versions only in the third position
|
22
21
|
# hoping that these version fix only security/severe bugs
|
23
22
|
# Consulted the Gemfile.lock to get
|
24
|
-
spec.add_dependency
|
25
|
-
spec.add_dependency
|
26
|
-
spec.add_dependency
|
27
|
-
spec.add_dependency
|
28
|
-
spec.add_dependency
|
29
|
-
spec.add_dependency
|
30
|
-
spec.add_dependency
|
31
|
-
spec.add_dependency
|
32
|
-
spec.add_dependency
|
33
|
-
spec.add_dependency
|
34
|
-
spec.add_dependency
|
35
|
-
spec.add_dependency
|
36
|
-
spec.add_dependency
|
37
|
-
spec.add_dependency
|
38
|
-
spec.add_dependency
|
39
|
-
spec.add_dependency
|
23
|
+
spec.add_dependency "rubyzip" # , '~> 1.1.3'
|
24
|
+
spec.add_dependency "minitar" # , '~> 0.5.2'
|
25
|
+
spec.add_dependency "mechanize" # , '~> 2.5.1'
|
26
|
+
spec.add_dependency "nokogiri", ">= 1.8.2"
|
27
|
+
spec.add_dependency "savon" # , '~> 2.11.0'
|
28
|
+
spec.add_dependency "spreadsheet" # , '~> 1.0.0'
|
29
|
+
spec.add_dependency "rubyXL", "~> 3.4.0"
|
30
|
+
spec.add_dependency "sax-machine" # , '~> 0.1.0'
|
31
|
+
spec.add_dependency "parslet" # , '~> 1.7.0'
|
32
|
+
spec.add_dependency "rubyntlm", "0.5.1"
|
33
|
+
spec.add_dependency "multi_json" # , '>= 0.3.2'
|
34
|
+
spec.add_dependency "httpi" # , '>= 2.4.1'
|
35
|
+
spec.add_dependency "optimist"
|
36
|
+
spec.add_dependency "xml-simple"
|
37
|
+
spec.add_dependency "ox"
|
38
|
+
spec.add_dependency "htmlentities"
|
39
|
+
spec.add_dependency "webrick"
|
40
|
+
spec.add_dependency "rexml"
|
41
|
+
spec.add_dependency "standardrb"
|
40
42
|
|
41
43
|
spec.add_development_dependency "bundler"
|
42
44
|
spec.add_development_dependency "rake"
|
@@ -47,4 +49,3 @@ Gem::Specification.new do |spec|
|
|
47
49
|
spec.add_development_dependency "timecop"
|
48
50
|
spec.add_development_dependency "flexmock"
|
49
51
|
end
|
50
|
-
|
data/spec/artikelstamm_spec.rb
CHANGED
@@ -1,22 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require 'spec_helper'
|
1
|
+
require "spec_helper"
|
4
2
|
require "rexml/document"
|
5
|
-
require
|
6
|
-
include REXML
|
7
|
-
RUN_ALL = true
|
3
|
+
require "webmock/rspec"
|
8
4
|
|
9
5
|
describe Oddb2xml::Builder do
|
10
|
-
|
11
|
-
|
12
|
-
NrSubstances = 14
|
13
|
-
NrLimitations = 5
|
14
|
-
NrInteractions = 5
|
15
|
-
NrCodes = 5
|
16
|
-
NrProdno = 23
|
17
|
-
NrPackages = 24
|
18
|
-
NrProducts = 19
|
19
|
-
RegExpDesitin = /1125819012LEVETIRACETAM DESITIN Mini Filmtab 250 mg 30 Stk/
|
6
|
+
include REXML
|
7
|
+
raise "Cannot rspec in directroy containing a spac" if / /.match?(Oddb2xml::SpecData)
|
20
8
|
include ServerMockHelper
|
21
9
|
def check_artikelstamm_xml(key, expected_value)
|
22
10
|
expect(@artikelstamm_name).not_to be nil
|
@@ -24,69 +12,69 @@ describe Oddb2xml::Builder do
|
|
24
12
|
unless @inhalt.index(expected_value)
|
25
13
|
puts expected_value
|
26
14
|
end
|
27
|
-
# binding.pry
|
15
|
+
# binding.pry if defined?(Pry) && !@inhalt.index(expected_value)
|
28
16
|
expect(@inhalt.index(expected_value)).not_to be nil
|
29
17
|
end
|
18
|
+
|
30
19
|
def common_run_init(options = {})
|
31
|
-
@
|
32
|
-
@oddb2xml_xsd = File.expand_path(File.join(File.dirname(__FILE__),
|
33
|
-
@oddb_calc_xsd = File.expand_path(File.join(File.dirname(__FILE__),
|
34
|
-
@elexis_v5_xsd = File.expand_path(File.join(__FILE__,
|
35
|
-
@elexis_v5_csv = File.join(Oddb2xml::
|
20
|
+
@saved_dir = Dir.pwd
|
21
|
+
@oddb2xml_xsd = File.expand_path(File.join(File.dirname(__FILE__), "..", "oddb2xml.xsd"))
|
22
|
+
@oddb_calc_xsd = File.expand_path(File.join(File.dirname(__FILE__), "..", "oddb_calc.xsd"))
|
23
|
+
@elexis_v5_xsd = File.expand_path(File.join(__FILE__, "..", "..", "Elexis_Artikelstamm_v5.xsd"))
|
24
|
+
@elexis_v5_csv = File.join(Oddb2xml::WORK_DIR, "artikelstamm_#{Date.today.strftime("%d%m%Y")}_v5.csv")
|
36
25
|
|
37
26
|
expect(File.exist?(@oddb2xml_xsd)).to eq true
|
38
27
|
expect(File.exist?(@oddb_calc_xsd)).to eq true
|
39
28
|
expect(File.exist?(@elexis_v5_xsd)).to eq true
|
40
29
|
cleanup_directories_before_run
|
41
|
-
FileUtils.makedirs(Oddb2xml::
|
42
|
-
Dir.chdir(Oddb2xml::
|
30
|
+
FileUtils.makedirs(Oddb2xml::WORK_DIR)
|
31
|
+
Dir.chdir(Oddb2xml::WORK_DIR)
|
43
32
|
mock_downloads
|
44
33
|
end
|
45
34
|
|
46
35
|
after(:all) do
|
47
|
-
Dir.chdir @
|
36
|
+
Dir.chdir @saved_dir if @saved_dir && File.directory?(@saved_dir)
|
48
37
|
end
|
49
|
-
context
|
38
|
+
context "when artikelstamm option is given" do
|
50
39
|
before(:all) do
|
51
40
|
common_run_init
|
52
|
-
options = Oddb2xml::Options.parse([
|
41
|
+
options = Oddb2xml::Options.parse(["--artikelstamm"]) # , '--log'])
|
53
42
|
# @res = buildr_capture(:stdout){ Oddb2xml::Cli.new(options).run }
|
54
43
|
Oddb2xml::Cli.new(options).run # to debug
|
55
|
-
@artikelstamm_name = File.join(Oddb2xml::
|
44
|
+
@artikelstamm_name = File.join(Oddb2xml::WORK_DIR, "artikelstamm_#{Date.today.strftime("%d%m%Y")}_v5.xml")
|
56
45
|
@doc = Nokogiri::XML(File.open(@artikelstamm_name))
|
57
46
|
# @rexml = REXML::Document.new File.read(@artikelstamm_name)
|
58
47
|
@inhalt = IO.read(@artikelstamm_name)
|
59
48
|
end
|
60
49
|
|
61
|
-
it
|
62
|
-
expect(File.
|
50
|
+
it "should exist" do
|
51
|
+
expect(File.exist?(@artikelstamm_name)).to eq true
|
63
52
|
end
|
64
53
|
|
65
|
-
it
|
66
|
-
expect(File.
|
54
|
+
it "should create transfer.ut8" do
|
55
|
+
expect(File.exist?(File.join(Oddb2xml::DOWNLOADS, "transfer.utf8"))).to eq true
|
67
56
|
end
|
68
57
|
|
69
|
-
it
|
70
|
-
expect(@inhalt).to match
|
58
|
+
it "should have a comment" do
|
59
|
+
expect(@inhalt).to match(/<!--Produced by/)
|
71
60
|
end
|
72
61
|
|
73
|
-
it
|
62
|
+
it "should have a GTIN and a public price with 14 chars (ean14)" do
|
63
|
+
# Till January 2021 it was possible to find a price via transfer.dat
|
64
|
+
# as the pharmacode was given in the refdata_NonPharma.xml
|
74
65
|
expected = %(<ITEM PHARMATYPE="N">
|
75
66
|
<GTIN>68711428066649</GTIN>
|
76
|
-
<PHAR>5863450</PHAR>
|
77
67
|
<SALECD>A</SALECD>
|
78
68
|
<DSCR>3M MEDIPORE+PAD Absorbtionsverb 10x15cm 8 x 25 Stk</DSCR>
|
79
69
|
<DSCRF>3M MEDIPORE+PAD compr absorb 10x15cm 8 x 25 pce</DSCRF>
|
80
70
|
<COMP>
|
81
71
|
<GLN>7610182000007</GLN>
|
82
72
|
</COMP>
|
83
|
-
<PEXF>108.01</PEXF>
|
84
|
-
<PPUB>178.20</PPUB>
|
85
73
|
</ITEM>)
|
86
74
|
expect(@inhalt.index(expected)).not_to be nil
|
87
75
|
end
|
88
76
|
|
89
|
-
it
|
77
|
+
it "should have a ATC for product PRIORIX TETRA" do
|
90
78
|
expected = %(<PRODUCT>
|
91
79
|
<PRODNO>5815801</PRODNO>
|
92
80
|
<SALECD>A</SALECD>
|
@@ -97,35 +85,35 @@ describe Oddb2xml::Builder do
|
|
97
85
|
expect(@inhalt.index(expected)).not_to be nil
|
98
86
|
end
|
99
87
|
|
100
|
-
it
|
101
|
-
expect(File.
|
102
|
-
inhalt = File.open(@elexis_v5_csv,
|
88
|
+
it "should produce a Elexis_Artikelstamm_v5.csv" do
|
89
|
+
expect(File.exist?(@elexis_v5_csv)).to eq true
|
90
|
+
inhalt = File.open(@elexis_v5_csv, "r+").read
|
103
91
|
expect(inhalt.size).to be > 0
|
104
|
-
expect(inhalt).to match
|
92
|
+
expect(inhalt).to match(/7680284860144/)
|
105
93
|
end
|
106
94
|
|
107
|
-
it
|
108
|
-
v3_name = @artikelstamm_name.sub(
|
95
|
+
it "should NOT generate a v3 nonpharma xml" do
|
96
|
+
v3_name = @artikelstamm_name.sub("_v5.xml", "_v3.xml").sub("artikelstamm_", "artikelstamm_N_")
|
109
97
|
expect(File.exist?(v3_name)).to eq false
|
110
98
|
end
|
111
99
|
|
112
|
-
it
|
113
|
-
v3_name = @artikelstamm_name.sub(
|
100
|
+
it "should NOT generate a vx pharma xml" do
|
101
|
+
v3_name = @artikelstamm_name.sub("_v5.xml", "_v3.xml").sub("artikelstamm_", "artikelstamm_P_")
|
114
102
|
expect(File.exist?(v3_name)).to eq false
|
115
103
|
end
|
116
104
|
|
117
|
-
it
|
118
|
-
expect(@inhalt.index(
|
105
|
+
it "should contain a LIMITATION_PTS" do
|
106
|
+
expect(@inhalt.index("<LIMITATION_PTS>40</LIMITATION_PTS>")).not_to be nil
|
119
107
|
end
|
120
108
|
|
121
|
-
it
|
122
|
-
expect(File.
|
123
|
-
inhalt = File.open(@elexis_v5_csv,
|
109
|
+
it "should find price from Preparations.xml by setting" do
|
110
|
+
expect(File.exist?(@elexis_v5_csv)).to eq true
|
111
|
+
inhalt = File.open(@elexis_v5_csv, "r+").read
|
124
112
|
expected = %(7680658560014,Dibase 10'000 Tropfen 10000 IE/ml Fl 10 ml,,Flasche(n),5,9.25,6585601,A11CC05,,"",,SL)
|
125
113
|
expect(inhalt.index(expected)).to be > 0
|
126
114
|
end
|
127
115
|
|
128
|
-
it
|
116
|
+
it "should contain a PRODUCT which was not in refdata" do
|
129
117
|
expected = %(<PRODUCT>
|
130
118
|
<PRODNO>5559401</PRODNO>
|
131
119
|
<SALECD>A</SALECD>
|
@@ -136,12 +124,12 @@ describe Oddb2xml::Builder do
|
|
136
124
|
expect(@inhalt.index(expected)).not_to be nil
|
137
125
|
end
|
138
126
|
|
139
|
-
it
|
140
|
-
expect(File.
|
141
|
-
inhalt = File.open(@elexis_v5_csv,
|
127
|
+
it "should have a price for Lynparza" do
|
128
|
+
expect(File.exist?(@elexis_v5_csv)).to eq true
|
129
|
+
inhalt = File.open(@elexis_v5_csv, "r+").read
|
142
130
|
expect(inhalt.index('7680651600014,Lynparza Kaps 50 mg 448 Stk,,Kapsel(n),5562.48,5947.55,6516001,L01XX46,,"",,S')).not_to be nil
|
143
131
|
end
|
144
|
-
it
|
132
|
+
it "should trim the ean13 to 13 length" do
|
145
133
|
gtin14 = "00040565124346"
|
146
134
|
expect(gtin14.length).to eq 14
|
147
135
|
expected14 = %(<GTIN>#{gtin14}</GTIN>)
|
@@ -152,41 +140,35 @@ describe Oddb2xml::Builder do
|
|
152
140
|
expect(@inhalt.index(expected13)).not_to be nil
|
153
141
|
end
|
154
142
|
|
155
|
-
it
|
156
|
-
expect(@inhalt.index(
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'should contain a GTIN starting 0' do
|
160
|
-
expect(@inhalt.index('GTIN>0')).to be > 0
|
143
|
+
it "should not contain a GTIN=0" do
|
144
|
+
expect(@inhalt.index("GTIN>0</GTIN")).to be nil
|
161
145
|
end
|
162
146
|
|
163
|
-
it
|
164
|
-
expect(@inhalt.index(
|
165
|
-
# Marco leaves the 14 GTIN digit in previous importes. As of January 2018 force it to the 13 digits
|
166
|
-
expect(@inhalt.index('<GTIN>0040565124346</GTIN>')).to be > 0
|
147
|
+
it "should contain a GTIN starting 0" do
|
148
|
+
expect(@inhalt.index("GTIN>0")).to be > 0
|
167
149
|
end
|
168
150
|
|
169
|
-
it
|
151
|
+
it "should a DSCRF for 4042809018288 TENSOPLAST Kompressionsbinde 5cmx4.5m" do
|
170
152
|
skip("Where does the DSCR for 4042809018288 come from. It should be TENSOPLAST bande compression 5cmx4.5m")
|
171
153
|
end
|
172
154
|
|
173
|
-
it
|
155
|
+
it "should NOT add GTIN 7680172330414 SELSUN and ean13 start with 7680 (Swissmedic) which is marked as inactive in transfer.dat" do
|
174
156
|
@inhalt = IO.read(@artikelstamm_name)
|
175
|
-
expect(@inhalt.index(
|
157
|
+
expect(@inhalt.index("7680172330414")).to be nil
|
176
158
|
end
|
177
159
|
|
178
|
-
it
|
160
|
+
it "should add GTIN 3605520301605 Armani Attitude which is marked as inactive in transfer.dat" do
|
179
161
|
@inhalt = IO.read(@artikelstamm_name)
|
180
|
-
expect(@inhalt.index(
|
162
|
+
expect(@inhalt.index("3605520301605")).not_to be nil
|
181
163
|
end
|
182
164
|
|
183
|
-
it
|
165
|
+
it "should add BIOMARIS Voll Meersalz which is marked as inactive in transfer.dat but has PPUB and PEXF" do
|
184
166
|
@inhalt = IO.read(@artikelstamm_name)
|
185
|
-
expect(@inhalt.index(
|
167
|
+
expect(@inhalt.index("BIOMARIS Voll Meersalz 500 g")).not_to be nil
|
186
168
|
end
|
187
169
|
|
188
|
-
it
|
189
|
-
#1128809544Sildenafil Suspension 7mg/ml 100ml 0030850045801000000000000000000000002
|
170
|
+
it "Should not contain PHAR 8809544 Sildenavil with pexf and ppub 0.0" do
|
171
|
+
# 1128809544Sildenafil Suspension 7mg/ml 100ml 0030850045801000000000000000000000002
|
190
172
|
@inhalt = IO.read(@artikelstamm_name)
|
191
173
|
expected = %(<ITEM PHARMATYPE="N">
|
192
174
|
<GTIN>9999998809544</GTIN>
|
@@ -200,23 +182,21 @@ describe Oddb2xml::Builder do
|
|
200
182
|
expect(@inhalt.index(expected)).to be nil
|
201
183
|
end
|
202
184
|
|
203
|
-
it
|
185
|
+
it "should a company EAN for 4042809018288 TENSOPLAST Kompressionsbinde 5cmx4.5m" do
|
204
186
|
skip("Where does the COMP GLN for 4042809018288 come from. It should be 7601003468441")
|
205
187
|
end
|
206
188
|
|
207
|
-
it
|
208
|
-
expect(@inhalt.index(
|
189
|
+
it "shoud contain Lamivudinum as 3TC substance" do
|
190
|
+
expect(@inhalt.index("<SUBSTANCE>Lamivudinum</SUBSTANCE>")).not_to be nil
|
209
191
|
end
|
210
192
|
|
211
|
-
it
|
212
|
-
expect(@inhalt.index(
|
193
|
+
it "shoud contain GENERIC_TYPE" do
|
194
|
+
expect(@inhalt.index("<GENERIC_TYPE")).not_to be nil
|
213
195
|
end
|
214
196
|
|
215
|
-
it
|
197
|
+
it "should contain DIBASE with phar" do
|
216
198
|
expected = %(<ITEM PHARMATYPE="P">
|
217
199
|
<GTIN>7680658560014</GTIN>
|
218
|
-
<!--obsolete override-->
|
219
|
-
<PHAR>7199565</PHAR>
|
220
200
|
<SALECD>A</SALECD>
|
221
201
|
<DSCR>Dibase 10'000 Tropfen 10000 IE/ml Fl 10 ml</DSCR>
|
222
202
|
<DSCRF>Dibase 10'000 gouttes 10000 UI/ml fl 10 ml</DSCRF>
|
@@ -238,18 +218,17 @@ describe Oddb2xml::Builder do
|
|
238
218
|
expect(@inhalt.index(expected)).not_to be nil
|
239
219
|
end
|
240
220
|
|
241
|
-
it
|
242
|
-
expect(@inhalt.index(
|
243
|
-
expect(@inhalt.index(
|
221
|
+
it "should contain PEVISONE Creme 30 g" do
|
222
|
+
expect(@inhalt.index("Pevisone Creme 15 g")).not_to be nil # 7680406620144
|
223
|
+
expect(@inhalt.index("Pevisone Creme 30 g")).not_to be nil # 7680406620229
|
244
224
|
# Should also check for price!
|
245
225
|
end
|
246
|
-
it
|
226
|
+
it "should validate against artikelstamm.xsd" do
|
247
227
|
validate_via_xsd(@elexis_v5_xsd, @artikelstamm_name)
|
248
228
|
end
|
249
|
-
|
250
|
-
|
229
|
+
tests = {"item 7680403330459 CARBADERM only in Preparations(SL) with public price" =>
|
230
|
+
%(<ITEM PHARMATYPE="P">
|
251
231
|
<GTIN>7680403330459</GTIN>
|
252
|
-
<PHAR>3603779</PHAR>
|
253
232
|
<SALECD>A</SALECD>
|
254
233
|
<DSCR>Carbaderm Creme Tb 300 ml</DSCR>
|
255
234
|
<DSCRF>Carbaderm crème tb 300 ml</DSCRF>
|
@@ -259,8 +238,8 @@ describe Oddb2xml::Builder do
|
|
259
238
|
<IKSCAT>D</IKSCAT>
|
260
239
|
<DEDUCTIBLE>10</DEDUCTIBLE>
|
261
240
|
</ITEM>),
|
262
|
-
|
263
|
-
|
241
|
+
"item 4042809018288 TENSOPLAST" =>
|
242
|
+
%(<ITEM PHARMATYPE="N">
|
264
243
|
<GTIN>4042809018288</GTIN>
|
265
244
|
<PHAR>0055805</PHAR>
|
266
245
|
<SALECD>A</SALECD>
|
@@ -269,9 +248,8 @@ describe Oddb2xml::Builder do
|
|
269
248
|
<PEXF>0.00</PEXF>
|
270
249
|
<PPUB>22.95</PPUB>
|
271
250
|
</ITEM>),
|
272
|
-
|
251
|
+
"product 3247501 LANSOYL" => '<ITEM PHARMATYPE="P">
|
273
252
|
<GTIN>7680324750190</GTIN>
|
274
|
-
<PHAR>0023722</PHAR>
|
275
253
|
<SALECD>A</SALECD>
|
276
254
|
<DSCR>LANSOYL Gel 225 g</DSCR>
|
277
255
|
<DSCRF>LANSOYL gel 225 g</DSCRF>
|
@@ -279,6 +257,8 @@ describe Oddb2xml::Builder do
|
|
279
257
|
<NAME>Actipharm SA</NAME>
|
280
258
|
<GLN>7601001002012</GLN>
|
281
259
|
</COMP>
|
260
|
+
<PEXF>10.54</PEXF>
|
261
|
+
<PPUB>16.25</PPUB>
|
282
262
|
<PKG_SIZE>225</PKG_SIZE>
|
283
263
|
<MEASURE>g</MEASURE>
|
284
264
|
<MEASUREF>g</MEASUREF>
|
@@ -287,10 +267,9 @@ describe Oddb2xml::Builder do
|
|
287
267
|
<LPPV>true</LPPV>
|
288
268
|
<PRODNO>3247501</PRODNO>
|
289
269
|
</ITEM>',
|
290
|
-
|
291
|
-
|
270
|
+
"product 5366201 3TC" =>
|
271
|
+
%(<ITEM PHARMATYPE="P">
|
292
272
|
<GTIN>7680536620137</GTIN>
|
293
|
-
<PHAR>1699947</PHAR>
|
294
273
|
<SALECD>A</SALECD>
|
295
274
|
<DSCR>3TC Filmtabl 150 mg 60 Stk</DSCR>
|
296
275
|
<DSCRF>3TC cpr pell 150 mg 60 pce</DSCRF>
|
@@ -311,10 +290,9 @@ describe Oddb2xml::Builder do
|
|
311
290
|
<DEDUCTIBLE>10</DEDUCTIBLE>
|
312
291
|
<PRODNO>5366201</PRODNO>
|
313
292
|
</ITEM>),
|
314
|
-
|
315
|
-
|
293
|
+
"item 7680161050583 HIRUDOID 40g" =>
|
294
|
+
%(<ITEM PHARMATYPE="P">
|
316
295
|
<GTIN>7680161050583</GTIN>
|
317
|
-
<PHAR>2731179</PHAR>
|
318
296
|
<SALECD>A</SALECD>
|
319
297
|
<DSCR>Hirudoid Creme 3 mg/g 40 g</DSCR>
|
320
298
|
<DSCRF>Hirudoid crème 3 mg/g 40 g</DSCRF>
|
@@ -333,10 +311,9 @@ describe Oddb2xml::Builder do
|
|
333
311
|
<DEDUCTIBLE>10</DEDUCTIBLE>
|
334
312
|
<PRODNO>1610501</PRODNO>
|
335
313
|
</ITEM>),
|
336
|
-
|
337
|
-
|
314
|
+
"item 7680161050743 Hirudoid Creme 3 mg/g 100 g" =>
|
315
|
+
%( <ITEM PHARMATYPE="P">
|
338
316
|
<GTIN>7680161050743</GTIN>
|
339
|
-
<PHAR>2731179</PHAR>
|
340
317
|
<SALECD>A</SALECD>
|
341
318
|
<DSCR>Hirudoid Creme 3 mg/g 100 g</DSCR>
|
342
319
|
<DSCRF>Hirudoid crème 3 mg/g 100 g</DSCRF>
|
@@ -350,9 +327,8 @@ describe Oddb2xml::Builder do
|
|
350
327
|
<IKSCAT>D</IKSCAT>
|
351
328
|
<DEDUCTIBLE>10</DEDUCTIBLE>
|
352
329
|
</ITEM>),
|
353
|
-
|
330
|
+
"item 7680284860144 ANCOPIR" => '<ITEM PHARMATYPE="P">
|
354
331
|
<GTIN>7680284860144</GTIN>
|
355
|
-
<PHAR>0177804</PHAR>
|
356
332
|
<SALECD>A</SALECD>
|
357
333
|
<DSCR>ANCOPIR Inj Lös 5 Amp 2 ml</DSCR>
|
358
334
|
<DSCRF>Ancopir, sol inj</DSCRF>
|
@@ -372,9 +348,8 @@ describe Oddb2xml::Builder do
|
|
372
348
|
<DEDUCTIBLE>10</DEDUCTIBLE>
|
373
349
|
<PRODNO>2848601</PRODNO>
|
374
350
|
</ITEM>',
|
375
|
-
|
351
|
+
"FERRO-GRADUMET price from ZurRose " => %(<ITEM PHARMATYPE="P">
|
376
352
|
<GTIN>7680316440115</GTIN>
|
377
|
-
<PHAR>0020244</PHAR>
|
378
353
|
<SALECD>A</SALECD>
|
379
354
|
<DSCR>FERRO-GRADUMET Depottabl 30 Stk</DSCR>
|
380
355
|
<DSCRF>FERRO-GRADUMET cpr dépôt 30 pce</DSCRF>
|
@@ -392,7 +367,7 @@ describe Oddb2xml::Builder do
|
|
392
367
|
<IKSCAT>C</IKSCAT>
|
393
368
|
<PRODNO>3164402</PRODNO>
|
394
369
|
</ITEM>),
|
395
|
-
|
370
|
+
"product 3TC Filmtabl" => %(<PRODUCT>
|
396
371
|
<PRODNO>5366201</PRODNO>
|
397
372
|
<SALECD>A</SALECD>
|
398
373
|
<DSCR>3TC Filmtabl 150 mg</DSCR>
|
@@ -400,9 +375,8 @@ describe Oddb2xml::Builder do
|
|
400
375
|
<ATC>J05AF05</ATC>
|
401
376
|
<SUBSTANCE>Lamivudinum</SUBSTANCE>
|
402
377
|
</PRODUCT>),
|
403
|
-
|
378
|
+
"nur aus Packungen Coeur-Vaisseaux Sérocytol," => %(<ITEM PHARMATYPE="P">
|
404
379
|
<GTIN>7680002770014</GTIN>
|
405
|
-
<PHAR>0361815</PHAR>
|
406
380
|
<SALECD>A</SALECD>
|
407
381
|
<DSCR>SEROCYTOL Herz-Gefässe Supp 3 Stk</DSCR>
|
408
382
|
<DSCRF>SEROCYTOL Coeur-Vaisseaux supp 3 pce</DSCRF>
|
@@ -417,9 +391,8 @@ describe Oddb2xml::Builder do
|
|
417
391
|
<IKSCAT>B</IKSCAT>
|
418
392
|
<PRODNO>0027701</PRODNO>
|
419
393
|
</ITEM>),
|
420
|
-
|
394
|
+
"HUMALOG (Richter)" => %(<ITEM PHARMATYPE="P">
|
421
395
|
<GTIN>7680532900196</GTIN>
|
422
|
-
<PHAR>1699999</PHAR>
|
423
396
|
<SALECD>A</SALECD>
|
424
397
|
<DSCR>Humalog Inj Lös Durchstf 10 ml</DSCR>
|
425
398
|
<DSCRF>Humalog sol inj flac 10 ml</DSCRF>
|
@@ -439,7 +412,19 @@ describe Oddb2xml::Builder do
|
|
439
412
|
<DEDUCTIBLE>20</DEDUCTIBLE>
|
440
413
|
<PRODNO>5329001</PRODNO>
|
441
414
|
</ITEM>),
|
442
|
-
|
415
|
+
"Kolon with Pharmacode for EAN 7680002780013" => %(<ITEM PHARMATYPE="P">
|
416
|
+
<GTIN>7680002780013</GTIN>
|
417
|
+
<PHAR>0361821</PHAR>
|
418
|
+
<SALECD>I</SALECD>
|
419
|
+
<DSCR>SEROCYTOL Kolon Supp 3 Stk</DSCR>
|
420
|
+
<DSCRF>SEROCYTOL Côlon supp 3 pce</DSCRF>
|
421
|
+
<COMP>
|
422
|
+
<GLN>7640128710004</GLN>
|
423
|
+
</COMP>
|
424
|
+
<PEXF>22.75</PEXF>
|
425
|
+
<PPUB>39.60</PPUB>
|
426
|
+
</ITEM>),
|
427
|
+
"Varilrix product" => %(<PRODUCT>
|
443
428
|
<PRODNO>0058501</PRODNO>
|
444
429
|
<SALECD>A</SALECD>
|
445
430
|
<DSCR>Varilrix Trockensub c solv</DSCR>
|
@@ -448,9 +433,8 @@ describe Oddb2xml::Builder do
|
|
448
433
|
<LIMNAMEBAG>0808</LIMNAMEBAG>
|
449
434
|
<SUBSTANCE>Vaccinum virus varicellae vivus attenuat. (Stamm OKA)</SUBSTANCE>
|
450
435
|
</PRODUCT>),
|
451
|
-
|
436
|
+
"Varilrix item" => %(<ITEM PHARMATYPE="P">
|
452
437
|
<GTIN>7680005850010</GTIN>
|
453
|
-
<PHAR>1770177</PHAR>
|
454
438
|
<SALECD>A</SALECD>
|
455
439
|
<DSCR>Varilrix Trockensub c solv Fertspr 0.500 ml</DSCR>
|
456
440
|
<DSCRF>Varilrix subst sèche c solv ser prê 0.500 ml</DSCRF>
|
@@ -465,14 +449,14 @@ describe Oddb2xml::Builder do
|
|
465
449
|
<DEDUCTIBLE>10</DEDUCTIBLE>
|
466
450
|
<PRODNO>0058501</PRODNO>
|
467
451
|
</ITEM),
|
468
|
-
|
452
|
+
"Chapter 70 product" => %(<PRODUCT>
|
469
453
|
<PRODNO>2069639</PRODNO>
|
470
|
-
<!--Chapter70 hack-->
|
454
|
+
<!--Chapter70 hack prodno 2069639 Ceres Urtinkturen gemäss L2 mit - im Kommentar-->
|
471
455
|
<SALECD>A</SALECD>
|
472
|
-
<DSCR>Ceres Urtinkturen gemäss L2</DSCR>
|
456
|
+
<DSCR>Ceres Urtinkturen gemäss L2 mit -- im Kommentar</DSCR>
|
473
457
|
<DSCRF/>
|
474
458
|
</PRODUCT>),
|
475
|
-
|
459
|
+
"Chapter 70 item" => %(<ITEM PHARMATYPE="P">
|
476
460
|
<GTIN>2500000588532</GTIN>
|
477
461
|
<PHAR>2069639</PHAR>
|
478
462
|
<SALECD>A</SALECD>
|
@@ -480,38 +464,35 @@ describe Oddb2xml::Builder do
|
|
480
464
|
<DSCRF>--missing--</DSCRF>
|
481
465
|
<PEXF>23.44</PEXF>
|
482
466
|
<PPUB>31.30</PPUB>
|
483
|
-
<!--Chapter70 hack-->
|
467
|
+
<!--Chapter70 hack 2500000588532 EINF ARZNEI Ceres Urtinktur spez 20ml-->
|
484
468
|
<SL_ENTRY>true</SL_ENTRY>
|
485
469
|
<PRODNO>2069639</PRODNO>
|
486
|
-
<Chapter70_HACK>true</Chapter70_HACK>
|
487
470
|
</ITEM>),
|
488
|
-
|
471
|
+
"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.
|
489
472
|
|
490
473
|
Der behandelnde Arzt ist verpflichtet, die erforderlichen Daten laufend im vorgegebenen Internettool des Registers, abrufbar auf http://www.olaparib-registry.ch, zu erfassen. Eine schriftliche Einwilligung der Patientin muss vorliegen. Es sind folgende Daten zu erfassen:
|
491
474
|
|
492
475
|
1\) Geburtsjahr, sowie Vortherapien für das OC
|
493
476
|
|
494
477
|
2\) Datum Therapiestart, Dosierung, Dosisanpassungen, Datum Therapieende.
|
495
|
-
</DSCR>)
|
496
|
-
}
|
478
|
+
</DSCR>)}
|
497
479
|
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
end
|
480
|
+
tests.each do |key, expected|
|
481
|
+
it "should a valid entry for #{key}" do
|
482
|
+
check_artikelstamm_xml(key, expected)
|
502
483
|
end
|
484
|
+
end
|
503
485
|
end
|
504
|
-
context
|
486
|
+
context "chapter 70 hack" do
|
505
487
|
before(:all) do
|
506
488
|
mock_downloads
|
507
489
|
end
|
508
|
-
it
|
509
|
-
require
|
510
|
-
result = Oddb2xml::Chapter70xtractor.parse
|
490
|
+
it "parsing" do
|
491
|
+
require "oddb2xml/chapter_70_hack"
|
492
|
+
result = Oddb2xml::Chapter70xtractor.parse
|
511
493
|
expect(result.class).to eq Array
|
512
494
|
expect(result.first).to eq ["2069562", "70.01.10", "Urtinktur", "1--10 g/ml", "13.40", ""]
|
513
|
-
expect(result.last).to eq
|
495
|
+
expect(result.last).to eq ["6516727", "70.02", "Allergenorum extractum varium / Inj. Susp. \tFortsetzungsbehandlung", "1 Durchstfl 1.5 ml", "311.85", "L"]
|
514
496
|
end
|
515
|
-
|
516
497
|
end
|
517
498
|
end
|