oddb2xml 1.8.0 → 1.8.1
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 +15 -0
- data/Gemfile.lock +4 -1
- data/History.txt +22 -0
- data/Rakefile +3 -0
- data/lib/oddb2xml/builder.rb +6 -4
- data/lib/oddb2xml/downloader.rb +9 -2
- data/lib/oddb2xml/extractor.rb +100 -78
- data/lib/oddb2xml/version.rb +1 -1
- data/lib/oddb2xml/xml_definitions.rb +250 -0
- data/oddb2xml.gemspec +1 -1
- data/spec/builder_spec.rb +64 -34
- data/spec/data/Preparation.xml +642 -225
- data/spec/data/Preparations.xml +641 -98
- data/spec/data/XMLPublications.zip +0 -0
- data/spec/data/epha_interactions.csv +3 -3
- data/spec/extractor_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +20 -31
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MGEzYWEzNGQ4NjlmODA3MzA5MGVlODkyOTY3YTYzM2RmZjllNmM0Mg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDJiNjI4NzM4NmRmMjY1NzBhMzc4NWMwYmZlMjhmODQ4NGE3NDdmMg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZjQ1ZDk0MmQyNmFkMzg3MDg0N2NlNWY1ZmUwNGUwNGI3MjYxZmI4ODFjM2Fh
|
10
|
+
YzIzY2NmMGFjYmMzNWM2ZGMyMTZjNjYzY2FmZWIyNGIzNDIzMGJhZDQwNTRk
|
11
|
+
NjhlODBiNmY0NDZmMjZlOGJiM2UzNzg2Y2NlYzE5Yjc1NGI2MmQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OWFmMTU4YzVhYzIwYjFkNTdhOTg1OTY1ODdiYWEwMGIyODljOTY4ZmM2NGZm
|
14
|
+
NDA0YTVhYzY0YTA4NjlkOTM5NTIwMTc3M2UzYjExZWMzMDI5NWI2NGIxYTgx
|
15
|
+
OTA0YWY5NTRkYThhZTgyNjVlMWRjNmIyZWQ2ZTAxMTc2ZTBiZDg=
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
oddb2xml (1.8.
|
4
|
+
oddb2xml (1.8.1)
|
5
5
|
archive-tar-minitar
|
6
6
|
mechanize (~> 2.5.1)
|
7
7
|
nokogiri (~> 1.5.10)
|
8
8
|
rubyXL (~> 2.5)
|
9
9
|
rubyzip (~> 1.0)
|
10
10
|
savon (~> 2.0)
|
11
|
+
sax-machine
|
11
12
|
spreadsheet
|
12
13
|
|
13
14
|
GEM
|
@@ -87,6 +88,8 @@ GEM
|
|
87
88
|
nokogiri (>= 1.4.0)
|
88
89
|
nori (~> 2.3.0)
|
89
90
|
wasabi (~> 3.2.2)
|
91
|
+
sax-machine (0.1.0)
|
92
|
+
nokogiri (> 0.0.0)
|
90
93
|
slop (3.5.0)
|
91
94
|
spreadsheet (0.9.7)
|
92
95
|
ruby-ole (>= 1.0)
|
data/History.txt
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
=== 1.8.1 / 30.04.2014
|
2
|
+
|
3
|
+
* Fix building NONPHARMA
|
4
|
+
* Using SAX-Parser and sax-machine
|
5
|
+
* Adapt to new location of epha interaction.csv
|
6
|
+
|
7
|
+
=== 1.8.0 / 28.04.2014
|
8
|
+
|
9
|
+
* Improved rake clean targer
|
10
|
+
* More logging and exit 2 unless substances and limitations okay for extended
|
11
|
+
* Fix problem with empty substances and limitation when running -e
|
12
|
+
|
13
|
+
=== 1.7.9 / 22.04.2014
|
14
|
+
|
15
|
+
* Added log option
|
16
|
+
* Added clean target to rake
|
17
|
+
* Added test target to rake
|
18
|
+
* Add spec task to rake
|
19
|
+
* Fix rspec
|
20
|
+
* Avoid ArgumentError for sprintf
|
21
|
+
* Orphan is now an xlsx file, too
|
22
|
+
|
1
23
|
=== 1.7.8 / 02.04.2014
|
2
24
|
|
3
25
|
* Don't emit field BC starting with 000000
|
data/Rakefile
CHANGED
@@ -26,6 +26,9 @@ require 'rake/clean'
|
|
26
26
|
CLEAN.include FileList['*.xls*']
|
27
27
|
CLEAN.include FileList['*.xml*']
|
28
28
|
CLEAN.include FileList['*.dat*']
|
29
|
+
CLEAN.include FileList['*.tar.gz']
|
30
|
+
CLEAN.include FileList['*.txt.*']
|
31
|
+
CLEAN.include FileList['*.csv.*']
|
29
32
|
CLEAN.include FileList['ruby*.tmp']
|
30
33
|
CLEAN.include FileList['data/download']
|
31
34
|
CLEAN.include FileList['duplicate_ean13_from_zur_rose.txt']
|
data/lib/oddb2xml/builder.rb
CHANGED
@@ -357,10 +357,12 @@ module Oddb2xml
|
|
357
357
|
#xml.GRP2F
|
358
358
|
xml.EFFD ix[:effect]
|
359
359
|
#xml.EFFF
|
360
|
-
if
|
361
|
-
|
362
|
-
|
363
|
-
|
360
|
+
if @codes and ix[:grad]
|
361
|
+
if dict = @codes[ix[:grad].upcase]
|
362
|
+
xml.RLV dict[:int]
|
363
|
+
xml.RLVD dict[:txt]
|
364
|
+
#xml.RLVF
|
365
|
+
end
|
364
366
|
end
|
365
367
|
#xml.EFFTXTD
|
366
368
|
#xml.EFFTXTF
|
data/lib/oddb2xml/downloader.rb
CHANGED
@@ -99,7 +99,7 @@ module Oddb2xml
|
|
99
99
|
class EphaDownloader < Downloader
|
100
100
|
include DownloadMethod
|
101
101
|
def download
|
102
|
-
@url ||= '
|
102
|
+
@url ||= 'https://download.epha.ch/cleaned/matrix.csv'
|
103
103
|
download_as('epha_interactions.csv', 'r')
|
104
104
|
end
|
105
105
|
end
|
@@ -165,7 +165,14 @@ module Oddb2xml
|
|
165
165
|
response = nil # win
|
166
166
|
end
|
167
167
|
end
|
168
|
-
read_xml_form_zip(/^Preparation/iu, file)
|
168
|
+
inhalt = read_xml_form_zip(/^Preparation/iu, file)
|
169
|
+
if @options[:skip_download]
|
170
|
+
FileUtils.makedirs(Backup)
|
171
|
+
outfile = File.join(Backup, 'Preparations.xml')
|
172
|
+
Oddb2xml.log "Downloader saving outfile #{outfile} for #{self.class}"
|
173
|
+
File.open(outfile, 'w+') { |file| file.write inhalt}
|
174
|
+
end
|
175
|
+
inhalt
|
169
176
|
rescue Timeout::Error, Errno::ETIMEDOUT
|
170
177
|
retrievable? ? retry : raise
|
171
178
|
ensure
|
data/lib/oddb2xml/extractor.rb
CHANGED
@@ -4,8 +4,11 @@ require 'nokogiri'
|
|
4
4
|
require 'spreadsheet'
|
5
5
|
require 'stringio'
|
6
6
|
require 'rubyXL'
|
7
|
+
require 'csv'
|
8
|
+
require 'oddb2xml/xml_definitions'
|
7
9
|
|
8
10
|
module Oddb2xml
|
11
|
+
Strip_For_Sax_Machine = '<?xml version="1.0" encoding="utf-8"?>'+"\n"
|
9
12
|
module TxtExtractorMethods
|
10
13
|
def initialize(str)
|
11
14
|
@io = StringIO.new(str)
|
@@ -39,77 +42,91 @@ module Oddb2xml
|
|
39
42
|
class LppvExtractor < Extractor
|
40
43
|
include TxtExtractorMethods
|
41
44
|
end
|
45
|
+
|
42
46
|
class BagXmlExtractor < Extractor
|
43
47
|
def to_hash
|
44
48
|
data = {}
|
45
|
-
|
46
|
-
|
49
|
+
result = PreparationsEntry.parse(@xml.sub(Strip_For_Sax_Machine, ''), :lazy => true)
|
50
|
+
result.Preparations.Preparation.each do |seq|
|
47
51
|
item = {}
|
48
|
-
item[:product_key] = seq.
|
49
|
-
item[:desc_de] = (desc = seq.
|
50
|
-
item[:desc_fr] = (desc = seq.
|
51
|
-
item[:name_de] = (name = seq.
|
52
|
-
item[:name_fr] = (name = seq.
|
53
|
-
item[:swissmedic_number5] = (num5 = seq.
|
54
|
-
item[:org_gen_code] = (orgc = seq.
|
55
|
-
item[:deductible] = (ddbl = seq.
|
56
|
-
item[:atc_code] = (atcc = seq.
|
57
|
-
item[:comment_de] = (info = seq.
|
58
|
-
item[:comment_fr] = (info = seq.
|
52
|
+
item[:product_key] = seq.ProductCommercial
|
53
|
+
item[:desc_de] = (desc = seq.DescriptionDe) ? desc : ''
|
54
|
+
item[:desc_fr] = (desc = seq.DescriptionFr) ? desc : ''
|
55
|
+
item[:name_de] = (name = seq.NameDe) ? name : ''
|
56
|
+
item[:name_fr] = (name = seq.NameFr) ? name : ''
|
57
|
+
item[:swissmedic_number5] = (num5 = seq.SwissmedicNo5) ? (num5.rjust(5,'0')) : ''
|
58
|
+
item[:org_gen_code] = (orgc = seq.OrgGenCode) ? orgc : ''
|
59
|
+
item[:deductible] = (ddbl = seq.FlagSB20) ? ddbl : ''
|
60
|
+
item[:atc_code] = (atcc = seq.AtcCode) ? atcc : ''
|
61
|
+
item[:comment_de] = (info = seq.CommentDe) ? info : ''
|
62
|
+
item[:comment_fr] = (info = seq.CommentFr) ? info : ''
|
59
63
|
item[:it_code] = ''
|
60
|
-
seq.
|
64
|
+
seq.ItCodes.ItCode.each do |itc|
|
61
65
|
if item[:it_code].to_s.empty?
|
62
|
-
it_code = itc.
|
66
|
+
it_code = itc.Code.to_s
|
63
67
|
item[:it_code] = (it_code =~ /(\d+)\.(\d+)\.(\d+)./) ? it_code : ''
|
64
68
|
end
|
65
69
|
end
|
66
70
|
item[:substances] = []
|
67
|
-
seq.
|
71
|
+
seq.Substances.Substance.each_with_index do |sub, i|
|
68
72
|
item[:substances] << {
|
69
73
|
:index => i.to_s,
|
70
|
-
:name => (name = sub.
|
71
|
-
:quantity => (qtty = sub.
|
72
|
-
:unit => (unit = sub.
|
74
|
+
:name => (name = sub.DescriptionLa) ? name : '',
|
75
|
+
:quantity => (qtty = sub.Quantity) ? qtty : '',
|
76
|
+
:unit => (unit = sub.QuantityUnit) ? unit : '',
|
73
77
|
}
|
74
78
|
end
|
75
79
|
item[:pharmacodes] = []
|
76
80
|
item[:packages] = {} # pharmacode => package
|
77
|
-
seq.
|
78
|
-
phar = pac.
|
81
|
+
seq.Packs.Pack.each do |pac|
|
82
|
+
phar = pac.Pharmacode
|
79
83
|
phar = correct_code(phar.to_s, 7)
|
80
|
-
ean = pac.
|
81
|
-
search_key = phar.to_i != 0 ? phar : ean
|
84
|
+
ean = pac.GTIN
|
85
|
+
search_key = phar.to_i != 0 ? phar : ean
|
82
86
|
# as common key with swissINDEX
|
83
87
|
item[:pharmacodes] << phar
|
84
88
|
# packages
|
89
|
+
exf = {:price => '', :valid_date => '', :price_code => ''}
|
90
|
+
if pac.Prices and pac.Prices.ExFactoryPrice
|
91
|
+
exf[:price] = pac.Prices.ExFactoryPrice.Price if pac.Prices.ExFactoryPrice.Price
|
92
|
+
exf[:valid_date] = pac.Prices.ExFactoryPrice.ValidFromDate if pac.Prices.ExFactoryPrice.ValidFromDate
|
93
|
+
exf[:price_code] = pac.Prices.ExFactoryPrice.PriceTypeCode if pac.Prices.ExFactoryPrice.PriceTypeCode
|
94
|
+
end
|
95
|
+
pub = {:price => '', :valid_date => '', :price_code => ''}
|
96
|
+
if pac.Prices and pac.Prices.PublicPrice
|
97
|
+
pub[:price] = pac.Prices.PublicPrice.Price if pac.Prices.PublicPrice.Price
|
98
|
+
pub[:valid_date] = pac.Prices.PublicPrice.ValidFromDate if pac.Prices.PublicPrice.ValidFromDate
|
99
|
+
pub[:price_code] = pac.Prices.PublicPrice.PriceTypeCode if pac.Prices.PublicPrice.PriceTypeCode
|
100
|
+
end
|
85
101
|
item[:packages][search_key] = {
|
86
102
|
:pharmacode => phar,
|
87
|
-
:ean => (ean) ? ean
|
88
|
-
:swissmedic_category => (cat = pac.
|
89
|
-
:swissmedic_number8 => (num = pac.
|
90
|
-
:narcosis_flag => (flg = pac.
|
91
|
-
:prices => {
|
92
|
-
:exf_price => {
|
93
|
-
:price => (exf = pac.at_xpath('.//ExFactoryPrice/Price')) ? exf.text : '',
|
94
|
-
:valid_date => (exf = pac.at_xpath('.//ExFactoryPrice/ValidFromDate')) ? exf.text : '',
|
95
|
-
:price_code => (exf = pac.at_xpath('.//ExFactoryPrice/PriceTypeCode')) ? exf.text : '',
|
96
|
-
},
|
97
|
-
:pub_price => {
|
98
|
-
:price => (pub = pac.at_xpath('.//PublicPrice/Price')) ? pub.text : '',
|
99
|
-
:valid_date => (pub = pac.at_xpath('.//PublicPrice/ValidFromDate')) ? pub.text : '',
|
100
|
-
:price_code => (pub = pac.at_xpath('.//PublicPrice/PriceTypeCode')) ? pub.text : '',
|
101
|
-
}
|
102
|
-
}
|
103
|
+
:ean => (ean) ? ean : '',
|
104
|
+
:swissmedic_category => (cat = pac.SwissmedicCategory) ? cat : '',
|
105
|
+
:swissmedic_number8 => (num = pac.SwissmedicNo8) ? num.rjust(8, '0') : '',
|
106
|
+
:narcosis_flag => (flg = pac.FlagNarcosis) ? flg : '',
|
107
|
+
:prices => { :exf_price => exf, :pub_price => pub },
|
103
108
|
}
|
104
109
|
# related all limitations
|
105
110
|
item[:packages][search_key][:limitations] = []
|
106
111
|
limitations = Hash.new{|h,k| h[k] = [] }
|
107
|
-
|
108
|
-
|
112
|
+
if seq.Limitations
|
113
|
+
limitations[:seq] = seq.Limitations.Limitation.collect { |x| x }
|
114
|
+
else
|
115
|
+
limitations[:seq] = nil
|
116
|
+
end
|
109
117
|
# in it-codes
|
110
|
-
|
118
|
+
if seq and seq.ItCodes and seq.ItCodes.ItCode
|
119
|
+
limitations[:itc] = []
|
120
|
+
seq.ItCodes.ItCode.each { |x| limitations[:itc] += x.Limitations.Limitation if x.Limitations.Limitation}
|
121
|
+
else
|
122
|
+
limitations[:itc] =nil
|
123
|
+
end
|
111
124
|
# in pac
|
112
|
-
|
125
|
+
if pac and pac.Limitations
|
126
|
+
limitations[:pac] = (lims = pac.Limitations.Limitation) ? lims.to_a : nil
|
127
|
+
else
|
128
|
+
limitations[:pac] = nil
|
129
|
+
end
|
113
130
|
limitations.each_pair do |lim_key, lims|
|
114
131
|
key = ''
|
115
132
|
id = ''
|
@@ -130,16 +147,16 @@ module Oddb2xml
|
|
130
147
|
:it => item[:it_code],
|
131
148
|
:key => key,
|
132
149
|
:id => id,
|
133
|
-
:code => (lic = lim.
|
134
|
-
:type => (lit = lim.
|
135
|
-
:value => (liv = lim.
|
136
|
-
:niv => (niv = lim.
|
137
|
-
:desc_de => (dsc = lim.
|
138
|
-
:desc_fr => (dsc = lim.
|
139
|
-
:vdate => (dat = lim.
|
150
|
+
:code => (lic = lim.LimitationCode) ? lic : '',
|
151
|
+
:type => (lit = lim.LimitationType) ? lit : '',
|
152
|
+
:value => (liv = lim.LimitationValue) ? liv : '',
|
153
|
+
:niv => (niv = lim.LimitationNiveau) ? niv : '',
|
154
|
+
:desc_de => (dsc = lim.DescriptionDe) ? dsc : '',
|
155
|
+
:desc_fr => (dsc = lim.DescriptionFr) ? dsc : '',
|
156
|
+
:vdate => (dat = lim.ValidFromDate) ? dat : '',
|
140
157
|
}
|
141
158
|
deleted = false
|
142
|
-
if upto = ((thr = lim.
|
159
|
+
if upto = ((thr = lim.ValidThruDate) ? thr : nil) and
|
143
160
|
upto =~ /\d{2}\.\d{2}\.\d{2}/
|
144
161
|
begin
|
145
162
|
deleted = true if Date.strptime(upto, '%d.%m.%y') >= Date.today
|
@@ -148,18 +165,18 @@ module Oddb2xml
|
|
148
165
|
end
|
149
166
|
limitation[:del] = deleted
|
150
167
|
item[:packages][search_key][:limitations] << limitation
|
151
|
-
end
|
168
|
+
end if lims
|
152
169
|
end
|
153
170
|
# limitation points
|
154
|
-
pts = pac.
|
155
|
-
item[:packages][search_key][:limitation_points] = pts ? pts.
|
156
|
-
# pharmacode => seq (same data)
|
171
|
+
pts = pac.PointLimitations.PointLimitation.first # only first points
|
172
|
+
item[:packages][search_key][:limitation_points] = pts ? pts.Points : ''
|
157
173
|
data[search_key] = item
|
158
174
|
end
|
159
175
|
end
|
160
176
|
data
|
161
177
|
end
|
162
178
|
end
|
179
|
+
|
163
180
|
class SwissIndexExtractor < Extractor
|
164
181
|
def initialize(xml, type)
|
165
182
|
@type = (type == :pharma ? 'PHARMA' : 'NONPHARMA')
|
@@ -167,23 +184,24 @@ module Oddb2xml
|
|
167
184
|
end
|
168
185
|
def to_hash
|
169
186
|
data = {}
|
170
|
-
|
171
|
-
|
172
|
-
|
187
|
+
result = PharmaEntry.parse(@xml.sub(Strip_For_Sax_Machine, ''), :lazy => true)
|
188
|
+
items = result.PHARMA.ITEM
|
189
|
+
$stderr.puts "SwissIndexExtractor #{__LINE__}: #{@type} with #{items.size} items"; $stderr.flush
|
190
|
+
items.each do |pac|
|
173
191
|
item = {}
|
174
192
|
item[:_type] = @type.downcase.intern
|
175
|
-
item[:ean] = (gtin = pac.
|
176
|
-
item[:pharmacode] = (phar = pac.
|
177
|
-
item[:status] = (stat = pac.
|
178
|
-
item[:stat_date] = (date = pac.
|
179
|
-
item[:lang] = (lang = pac.
|
180
|
-
item[:desc] = (dscr = pac.
|
181
|
-
item[:atc_code] = (code = pac.
|
193
|
+
item[:ean] = (gtin = pac.GTIN) ? gtin: ''
|
194
|
+
item[:pharmacode] = (phar = pac.PHAR) ? phar: ''
|
195
|
+
item[:status] = (stat = pac.STATUS) ? stat: ''
|
196
|
+
item[:stat_date] = (date = pac.SDATE) ? date: ''
|
197
|
+
item[:lang] = (lang = pac.LANG) ? lang: ''
|
198
|
+
item[:desc] = (dscr = pac.DSCR) ? dscr: ''
|
199
|
+
item[:atc_code] = (code = pac.ATC) ? code.to_s : ''
|
182
200
|
# as quantity text
|
183
|
-
item[:additional_desc] = (dscr = pac.
|
184
|
-
if comp = pac.
|
185
|
-
item[:company_name] = (nam = comp.
|
186
|
-
item[:company_ean] = (gln = comp.
|
201
|
+
item[:additional_desc] = (dscr = pac.ADDSCR) ? dscr: ''
|
202
|
+
if comp = pac.COMP
|
203
|
+
item[:company_name] = (nam = comp.NAME) ? nam: ''
|
204
|
+
item[:company_ean] = (gln = comp.GLN) ? gln: ''
|
187
205
|
end
|
188
206
|
unless item[:pharmacode].empty?
|
189
207
|
item[:pharmacode] = correct_code(item[:pharmacode].to_s, 7)
|
@@ -308,17 +326,19 @@ module Oddb2xml
|
|
308
326
|
data
|
309
327
|
end
|
310
328
|
end
|
329
|
+
|
311
330
|
class SwissmedicInfoExtractor < Extractor
|
312
331
|
def to_hash
|
313
332
|
data = Hash.new{|h,k| h[k] = [] }
|
314
|
-
|
315
|
-
|
316
|
-
|
333
|
+
return data unless @xml.size > 0
|
334
|
+
result = MedicalInformationsContent.parse(@xml.sub(Strip_For_Sax_Machine, ''), :lazy => true)
|
335
|
+
result.medicalInformation.each do |pac|
|
336
|
+
lang = pac.lang.to_s
|
317
337
|
next unless lang =~ /de|fr/
|
318
338
|
item = {}
|
319
|
-
item[:name] = (name =
|
320
|
-
item[:owner] = (ownr =
|
321
|
-
if content =
|
339
|
+
item[:name] = (name = pac.title) ? name : ''
|
340
|
+
item[:owner] = (ownr = pac.authHolder) ? ownr : ''
|
341
|
+
if content = /cdata/.match(pac.content)
|
322
342
|
html = Nokogiri::HTML(content.to_s)
|
323
343
|
# all HTML contents without MonTitle and ownerCompany
|
324
344
|
item[:paragraph] = "<title><p>#{item[:name]}</p></title>" +
|
@@ -344,9 +364,11 @@ module Oddb2xml
|
|
344
364
|
def to_arry
|
345
365
|
data = []
|
346
366
|
ixno = 0
|
347
|
-
|
348
|
-
|
349
|
-
|
367
|
+
inhalt = @io.read
|
368
|
+
inhalt.split("\n").each do |line|
|
369
|
+
next if line =~ /ATC1.*Name1.*ATC2.*Name2/
|
370
|
+
line = '"'+line unless /^"/.match(line)
|
371
|
+
row = CSV.parse_line(line)
|
350
372
|
ixno += 1
|
351
373
|
action = {}
|
352
374
|
action[:ixno] = ixno
|
data/lib/oddb2xml/version.rb
CHANGED
@@ -0,0 +1,250 @@
|
|
1
|
+
# Definitions for the sax-machine parse to parse
|
2
|
+
# Preparations.xml
|
3
|
+
|
4
|
+
require 'sax-machine'
|
5
|
+
|
6
|
+
class PriceElement
|
7
|
+
include SAXMachine
|
8
|
+
element :Price
|
9
|
+
element :ValidFromDate
|
10
|
+
element :DivisionDescription
|
11
|
+
element :PriceTypeCode
|
12
|
+
element :PriceTypeDescriptionDe
|
13
|
+
element :PriceTypeDescriptionFr
|
14
|
+
element :PriceTypeDescriptionIt
|
15
|
+
element :PriceChangeTypeDescriptionDe
|
16
|
+
element :PriceChangeTypeDescriptionFr
|
17
|
+
element :PriceChangeTypeDescriptionIt
|
18
|
+
end
|
19
|
+
|
20
|
+
class StatusElement
|
21
|
+
include SAXMachine
|
22
|
+
element :IntegrationDate
|
23
|
+
element :ValidFromDate
|
24
|
+
element :ValidThruDate
|
25
|
+
element :StatusTypeCodeSl
|
26
|
+
element :StatusTypeDescriptionSl
|
27
|
+
element :FlagApd
|
28
|
+
end
|
29
|
+
|
30
|
+
class PricesElement
|
31
|
+
include SAXMachine
|
32
|
+
element :ExFactoryPrice, :class => PriceElement
|
33
|
+
element :PublicPrice, :class => PriceElement
|
34
|
+
end
|
35
|
+
|
36
|
+
class LimitationElement
|
37
|
+
include SAXMachine
|
38
|
+
element :LimitationCode
|
39
|
+
element :LimitationType
|
40
|
+
element :LimitationValue
|
41
|
+
element :LimitationNiveau
|
42
|
+
element :DescriptionDe
|
43
|
+
element :DescriptionFr
|
44
|
+
element :DescriptionIt
|
45
|
+
element :ValidFromDate
|
46
|
+
element :ValidThruDate
|
47
|
+
end
|
48
|
+
|
49
|
+
class LimitationsElement
|
50
|
+
include SAXMachine
|
51
|
+
elements :Limitation, :class => LimitationElement
|
52
|
+
end
|
53
|
+
|
54
|
+
class PointLimitationElement
|
55
|
+
include SAXMachine
|
56
|
+
element :Points
|
57
|
+
element :Packs
|
58
|
+
element :ValidFromDate
|
59
|
+
element :ValidThruDate
|
60
|
+
end
|
61
|
+
|
62
|
+
class PointLimitationsElement
|
63
|
+
include SAXMachine
|
64
|
+
elements :PointLimitation, :class => PointLimitationElement
|
65
|
+
end
|
66
|
+
|
67
|
+
class PackContent
|
68
|
+
include SAXMachine
|
69
|
+
attribute :ProductKey
|
70
|
+
attribute :Pharmacode
|
71
|
+
attribute :PackId
|
72
|
+
element :DescriptionDe
|
73
|
+
element :DescriptionFr
|
74
|
+
element :DescriptionIt
|
75
|
+
element :SwissmedicCategory
|
76
|
+
element :SwissmedicNo8
|
77
|
+
element :FlagNarcosis
|
78
|
+
element :FlagModal
|
79
|
+
element :BagDossierNo
|
80
|
+
element :GTIN
|
81
|
+
element :Limitations, :class => LimitationsElement
|
82
|
+
element :PointLimitations, :class => PointLimitationsElement
|
83
|
+
element :Prices, :class => PricesElement
|
84
|
+
end
|
85
|
+
|
86
|
+
class PacksElement
|
87
|
+
include SAXMachine
|
88
|
+
elements :Pack, :class => PackContent
|
89
|
+
end
|
90
|
+
|
91
|
+
class ItCodeContent
|
92
|
+
include SAXMachine
|
93
|
+
attribute :Code
|
94
|
+
element :DescriptionDe
|
95
|
+
element :DescriptionFr
|
96
|
+
element :DescriptionIt
|
97
|
+
element :Limitations, :class => LimitationsElement
|
98
|
+
end
|
99
|
+
|
100
|
+
class ItCodeEntry
|
101
|
+
include SAXMachine
|
102
|
+
element :ItCode, :class => ItCodeContent
|
103
|
+
end
|
104
|
+
|
105
|
+
# handling attributes as suggested by https://github.com/pauldix/sax-machine/issues/30
|
106
|
+
class ItCodesElement
|
107
|
+
include SAXMachine
|
108
|
+
elements :ItCode, :class => ItCodeContent
|
109
|
+
end
|
110
|
+
|
111
|
+
class SubstanceElement
|
112
|
+
include SAXMachine
|
113
|
+
element :DescriptionLa
|
114
|
+
element :Quantity
|
115
|
+
element :QuantityUnit
|
116
|
+
end
|
117
|
+
|
118
|
+
class SubstancesElement
|
119
|
+
include SAXMachine
|
120
|
+
elements :Substance, :class => SubstanceElement
|
121
|
+
end
|
122
|
+
|
123
|
+
class PreparationContent
|
124
|
+
include SAXMachine
|
125
|
+
attribute :ProductCommercial
|
126
|
+
element :NameFr
|
127
|
+
element :NameDe
|
128
|
+
element :NameIt
|
129
|
+
element :Status, :class => StatusElement
|
130
|
+
element :Dummy
|
131
|
+
element :DescriptionDe
|
132
|
+
element :DescriptionFr
|
133
|
+
element :DescriptionIt
|
134
|
+
element :AtcCode
|
135
|
+
element :SwissmedicNo5
|
136
|
+
element :FlagItLimitation
|
137
|
+
element :OrgGenCode
|
138
|
+
element :FlagSB20
|
139
|
+
element :CommentDe
|
140
|
+
element :CommentFr
|
141
|
+
element :CommentIt
|
142
|
+
element :VatInEXF
|
143
|
+
element :Limitations, :class => LimitationsElement
|
144
|
+
element :Substances, :class => SubstancesElement
|
145
|
+
element :Packs, :class => PacksElement
|
146
|
+
element :ItCodes, :class => ItCodesElement
|
147
|
+
end
|
148
|
+
|
149
|
+
class PreparationEntry
|
150
|
+
include SAXMachine
|
151
|
+
element :Preparation, :class => PreparationContent
|
152
|
+
end
|
153
|
+
|
154
|
+
class PreparationsContent
|
155
|
+
include SAXMachine
|
156
|
+
attribute :ReleaseDate
|
157
|
+
elements :Preparation, :class => PreparationContent
|
158
|
+
end
|
159
|
+
|
160
|
+
class PreparationsEntry
|
161
|
+
include SAXMachine
|
162
|
+
element :Preparations, :class => PreparationsContent
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
class CompElement
|
167
|
+
include SAXMachine
|
168
|
+
element :NAME
|
169
|
+
element :GLN
|
170
|
+
end
|
171
|
+
|
172
|
+
class ItemContent
|
173
|
+
include SAXMachine
|
174
|
+
attribute :DT
|
175
|
+
element :GTIN
|
176
|
+
element :PHAR
|
177
|
+
element :STATUS
|
178
|
+
element :SDATE
|
179
|
+
element :LANG
|
180
|
+
element :DSCR
|
181
|
+
element :ADDSCR
|
182
|
+
element :ATC
|
183
|
+
element :COMP, :class => CompElement
|
184
|
+
end
|
185
|
+
|
186
|
+
class PharmaContent
|
187
|
+
include SAXMachine
|
188
|
+
attribute :CREATION_DATETIME
|
189
|
+
elements :ITEM, :class => ItemContent
|
190
|
+
end
|
191
|
+
|
192
|
+
class PharmaEntry
|
193
|
+
include SAXMachine
|
194
|
+
element :CREATION_DATETIME
|
195
|
+
element :NONPHARMA, :as => :PHARMA, :class => PharmaContent
|
196
|
+
element :PHARMA, :class => PharmaContent
|
197
|
+
end
|
198
|
+
|
199
|
+
class ItemContent
|
200
|
+
include SAXMachine
|
201
|
+
attribute :DT
|
202
|
+
element :GTIN
|
203
|
+
element :PHAR
|
204
|
+
element :STATUS
|
205
|
+
element :STDATE
|
206
|
+
element :LANG
|
207
|
+
element :DSCR
|
208
|
+
element :ADDSCR
|
209
|
+
element :ATC
|
210
|
+
element :COMP, :class => CompElement
|
211
|
+
end
|
212
|
+
|
213
|
+
class PharmaContent
|
214
|
+
include SAXMachine
|
215
|
+
attribute :CREATION_DATETIME
|
216
|
+
elements :ITEM, :class => ItemContent
|
217
|
+
end
|
218
|
+
|
219
|
+
class PharmaEntry
|
220
|
+
include SAXMachine
|
221
|
+
element :CREATION_DATETIME
|
222
|
+
element :PHARMA, :class => PharmaContent
|
223
|
+
end
|
224
|
+
|
225
|
+
class MedicalInformationContent
|
226
|
+
include SAXMachine
|
227
|
+
attribute :type
|
228
|
+
attribute :version
|
229
|
+
attribute :lang
|
230
|
+
element :title
|
231
|
+
element :authHolder
|
232
|
+
element :style
|
233
|
+
element :content
|
234
|
+
end
|
235
|
+
|
236
|
+
class MedicalInformationEntry
|
237
|
+
include SAXMachine
|
238
|
+
element :medicalInformation, :class => MedicalInformationContent
|
239
|
+
end
|
240
|
+
|
241
|
+
class MedicalInformationsContent
|
242
|
+
include SAXMachine
|
243
|
+
elements :medicalInformation, :class => MedicalInformationContent
|
244
|
+
end
|
245
|
+
|
246
|
+
class MedicalInformationsEntry
|
247
|
+
include SAXMachine
|
248
|
+
element :medicalInformations, :class => MedicalInformationsContent
|
249
|
+
end
|
250
|
+
|