oddb2xml 1.9.9 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile.lock +1 -1
- data/History.txt +5 -0
- data/lib/oddb2xml/builder.rb +16 -15
- data/lib/oddb2xml/calc.rb +67 -86
- data/lib/oddb2xml/version.rb +1 -1
- data/spec/calc_spec.rb +94 -57
- data/spec/data/swissmedic_package-galenic.xlsx +0 -0
- metadata +33 -33
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZmIzODJjZTg3MjUyMjFjNTY2YmViMWNlZmZkMGU0OTE0YTc0NzVkNA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3a0dff7ea1897c93913176510675ffb84641763c
|
4
|
+
data.tar.gz: ea3b174167d1a38862cf5eba377989c3ed8244f2
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MWE2MmU2M2UxZTdjZDRmOTIxNDZkNzA3OTQwNjZmZWQ1MGUxZjlhMWIyMzdh
|
11
|
-
MGNjZWUxZTYwM2U0NjZkMjlhYTllYTk1MThjNmU4NmNlMDI0YWM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NzhiNzFkNWM0MWM2MDA4MWNkNTA0Zjc1NWJmYWQzNjA0ZjlkZTI5M2U3YWRi
|
14
|
-
NWVmZmE5ZDJjNzk1YThiOGMxODIzM2JhYTM5MDkxY2E3YzQ4ZDc3NTVhYzMz
|
15
|
-
NzcyMjRkNzRmYmQyMjU0NDMxODBiYmMzOTA2MDlkMTFkMDQwMjU=
|
6
|
+
metadata.gz: ab2bef6593e7fbd5957d97d0e7fe42808527585ad63af64d689630fb29650ce7d0b4fd2cf208e7e81ff9e2bc66a807f4cb2ed6c05831cd80daff0a71427415a8
|
7
|
+
data.tar.gz: 61757a8be3030715495f361467febf3f991e6669637b5cefe2cb967739d20009f2feca35c0ac12e88a2e9aafda421e4c3c7db654f1f4a085d77f302a8016bc91
|
data/Gemfile.lock
CHANGED
data/History.txt
CHANGED
data/lib/oddb2xml/builder.rb
CHANGED
@@ -668,11 +668,7 @@ module Oddb2xml
|
|
668
668
|
xml.NAME info.name
|
669
669
|
xml.PKG_SIZE info.pkg_size
|
670
670
|
xml.SELLING_UNITS info.selling_units
|
671
|
-
# xml.COUNT info.count
|
672
|
-
# xml.MULTI info.multi
|
673
671
|
xml.MEASURE info.measure # Nur wenn Lösung wen Spalte M ml, Spritze
|
674
|
-
# xml.ADDITION info.addition
|
675
|
-
# xml.SCALE info.scale
|
676
672
|
if info.galenic_form.is_a?(String)
|
677
673
|
xml.GALENIC_FORM info.galenic_form
|
678
674
|
xml.GALENIC_GROUP "Unknown"
|
@@ -681,18 +677,23 @@ module Oddb2xml
|
|
681
677
|
xml.GALENIC_GROUP info.galenic_group ? info.galenic_group.description : "Unknown"
|
682
678
|
end
|
683
679
|
xml.COMPOSITIONS {
|
684
|
-
info.compositions.each {
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
680
|
+
info.compositions.each { |composition|
|
681
|
+
xml.COMPOSITION {
|
682
|
+
# xml.SOURCE composition.source # emit this if you want to debug the results
|
683
|
+
xml.LABEL composition.label if composition.label
|
684
|
+
xml.SUBSTANCES {
|
685
|
+
composition.substances.each { |substance|
|
686
|
+
xml.SUBSTANCE {
|
687
|
+
xml.SUBSTANCE_NAME substance.name
|
688
|
+
if substance.unit
|
689
|
+
xml.QTY substance.qty
|
690
|
+
xml.UNIT substance.unit
|
691
|
+
end
|
692
|
+
}
|
693
|
+
}
|
694
|
+
} if composition.substances
|
694
695
|
}
|
695
|
-
|
696
|
+
}
|
696
697
|
}
|
697
698
|
} if info.compositions
|
698
699
|
end
|
data/lib/oddb2xml/calc.rb
CHANGED
@@ -6,7 +6,6 @@ require 'yaml'
|
|
6
6
|
module Oddb2xml
|
7
7
|
# Calc is responsible for analysing the columns "Packungsgrösse" and "Einheit"
|
8
8
|
#
|
9
|
-
Composition = Struct.new("Composition", :name, :qty, :unit, :label)
|
10
9
|
GalenicGroup = Struct.new("GalenicGroup", :oid, :descriptions)
|
11
10
|
GalenicForm = Struct.new("GalenicForm", :oid, :descriptions, :galenic_group)
|
12
11
|
|
@@ -103,7 +102,7 @@ module Oddb2xml
|
|
103
102
|
@@names_without_galenic_forms = []
|
104
103
|
@@rules_counter = {}
|
105
104
|
attr_accessor :galenic_form, :unit, :pkg_size
|
106
|
-
attr_reader :name, :substances, :composition, :compositions
|
105
|
+
attr_reader :name, :substances, :composition, :compositions
|
107
106
|
attr_reader :selling_units, :count, :multi, :measure, :addition, :scale # s.a. commercial_form in oddb.org/src/model/part.rb
|
108
107
|
def self.get_galenic_group(name, lang = 'de')
|
109
108
|
@@galenic_groups.values.collect { |galenic_group|
|
@@ -158,6 +157,71 @@ private
|
|
158
157
|
string ? string.to_s.gsub(/\s\s+/, ' ') : nil
|
159
158
|
end
|
160
159
|
public
|
160
|
+
# Update of active substances, etc picked up from oddb.org/src/plugin/swissmedic.rb update_compositions
|
161
|
+
Composition = Struct.new("Composition", :source, :label, :substances, :galenic_form, :route_of_administration)
|
162
|
+
Substance = Struct.new("Substance", :name, :qty, :unit, :chemical_substance, :chemical_dose)
|
163
|
+
def update_compositions(active_substance)
|
164
|
+
rep_1 = '----'; to_1 = '('
|
165
|
+
rep_2 = '-----'; to_2 = ')'
|
166
|
+
rep_3 = '------'; to_3 = ','
|
167
|
+
|
168
|
+
comps = []
|
169
|
+
label_pattern = /^(?<label>A|I|B|II|C|III|D|IV|E|V|F|VI)[)]\s*(?<designation>[^)]+):/
|
170
|
+
composition_text = composition.gsub(/\r\n?/u, "\n")
|
171
|
+
puts "composition_text for #{name}: #{composition_text}" if composition_text.split(/\n/u).size > 1 and $VERBOSE
|
172
|
+
lines = composition_text.split(/\n/u)
|
173
|
+
idx = 0
|
174
|
+
compositions = lines.select do |line|
|
175
|
+
if match = label_pattern.match(line)
|
176
|
+
label = match[:label]
|
177
|
+
else
|
178
|
+
label = nil
|
179
|
+
end
|
180
|
+
idx += 1
|
181
|
+
next if idx > 1 and not label # avoid lines like 'I) et II)'
|
182
|
+
substances = []
|
183
|
+
filler = line.split(',')[-1].sub(/\.$/, '')
|
184
|
+
filler_match = /^(?<name>[^,\d]+)\s*(?<dose>[\d\-.]+(\s*(?:(Mio\.?\s*)?(U\.\s*Ph\.\s*Eur\.|[^\s,]+))))/.match(filler)
|
185
|
+
components = line.split(/([^\(]+\([^)]+\)[^,]+|),/).each {
|
186
|
+
|component|
|
187
|
+
next unless component.size > 0
|
188
|
+
to_consider = component.strip.split(':')[-1] # remove label
|
189
|
+
# very ugly hack to ignore ,()
|
190
|
+
m = /^(?<name>[^,\d()]+)\s*(?<dose>[\d\-.]+(\s*(?:(Mio\.?\s*)?(U\.\s*Ph\.\s*Eur\.|[^\s,]+))))/.match(to_consider
|
191
|
+
.gsub(to_1, rep_1).gsub(to_2, rep_2).gsub(to_3, rep_3))
|
192
|
+
if m2 = /^(|[^:]+:\s)(E\s+\d+)$/.match(component.strip)
|
193
|
+
to_add = Substance.new(m2[2], '', '')
|
194
|
+
substances << to_add
|
195
|
+
elsif m
|
196
|
+
ptrn = /(\s*(?:ut|corresp\.?)\s+(?<chemical>[^\d,]+)\s*(?<cdose>[\d\-.]+(\s*(?:(Mio\.?\s*)?(U\.\s*Ph\.\s*Eur\.|[^\s,]+))(\s*[mv]\/[mv])?))?)/
|
197
|
+
m3 = ptrn.match(component.strip)
|
198
|
+
dose = nil
|
199
|
+
unit = nil
|
200
|
+
name = m[:name].split(/\s/).collect{ |x| x.capitalize }.join(' ').strip.gsub(rep_3, to_3).gsub(rep_2, to_2).gsub(rep_1, to_1)
|
201
|
+
dose = m[:dose].split(/\b\s*(?![.,\d\-]|Mio\.?)/u, 2) if m[:dose]
|
202
|
+
if dose && (scale = SCALE_P.match(filler)) && dose[1] && !dose[1].include?('/')
|
203
|
+
unit = dose[1] << '/'
|
204
|
+
num = scale[:qty].to_f
|
205
|
+
if num <= 1
|
206
|
+
unit << scale[:unit]
|
207
|
+
else
|
208
|
+
unit << scale[:scale]
|
209
|
+
end
|
210
|
+
elsif dose.size == 2
|
211
|
+
unit = dose[1]
|
212
|
+
end
|
213
|
+
next if /\s+pro($|\s+)|emulsion|solution/i.match(name)
|
214
|
+
chemical = m3 ? capitalize(m3[:chemical]) : nil
|
215
|
+
cdose = m3 ? m3[:cdose] : nil
|
216
|
+
substances << Substance.new(name, dose ? dose[0].to_f : nil, unit ? unit.gsub(rep_3, to_3).gsub(rep_2, to_2).gsub(rep_1, to_1) : nil,
|
217
|
+
chemical, cdose)
|
218
|
+
end
|
219
|
+
}
|
220
|
+
comps << Composition.new(line, label, substances) if substances.size > 0
|
221
|
+
end
|
222
|
+
comps
|
223
|
+
end
|
224
|
+
|
161
225
|
def initialize(name = nil, size = nil, unit = nil, active_substance = nil, composition= nil)
|
162
226
|
@name = remove_duplicated_spaces(name)
|
163
227
|
@pkg_size = remove_duplicated_spaces(size)
|
@@ -171,91 +235,8 @@ public
|
|
171
235
|
|
172
236
|
unless active_substance
|
173
237
|
@compositions = []
|
174
|
-
@active_substances = []
|
175
238
|
else
|
176
|
-
|
177
|
-
@active_substances = active_substance.split(/\s*,(?!\d|[^(]+\))\s*/u).collect { |name| capitalize(name) }.uniq
|
178
|
-
|
179
|
-
res = []
|
180
|
-
numbers = [ "A|I", "B|II", "C|III", "D|IV", "E|V", "F|VI" ]
|
181
|
-
current = numbers.shift
|
182
|
-
labels = []
|
183
|
-
composition_text = composition.gsub(/\r\n?/u, "\n")
|
184
|
-
puts "composition_text for #{name}: #{composition_text}" if composition_text.split(/\n/u).size > 1 and $VERBOSE
|
185
|
-
compositions = composition_text.split(/\n/u).select do |line|
|
186
|
-
if match = /^(#{current})\)([^:]+)/.match(line)
|
187
|
-
labels.push [match[1], match[2]]
|
188
|
-
current = numbers.shift
|
189
|
-
end
|
190
|
-
end
|
191
|
-
puts "labels for #{name}: #{labels}" if labels.size > 0 and $VERBOSE
|
192
|
-
if composition_text.split(/\n/u).size > 1
|
193
|
-
last_line = composition_text.split(/\n/u)[-1]
|
194
|
-
@composition_comment = last_line
|
195
|
-
else
|
196
|
-
@composition_comment = nil
|
197
|
-
end
|
198
|
-
if compositions.empty?
|
199
|
-
compositions.push composition_text.gsub(/\n/u, ' ')
|
200
|
-
end
|
201
|
-
agents = []
|
202
|
-
comps = []
|
203
|
-
units = 'U\.\s*Ph\.\s*Eur\.'
|
204
|
-
name = 'dummy'
|
205
|
-
ptrn = %r{(?ix)
|
206
|
-
(^|[[:punct:]]|\bet|\bex)\s*#{Regexp.escape name}(?![:\-])
|
207
|
-
(\s*(?<dose>[\d\-.]+(\s*(?:(Mio\.?\s*)?(#{units}|[^\s,]+))
|
208
|
-
(\s*[mv]/[mv])?)))?
|
209
|
-
(\s*(?:ut|corresp\.?)\s+(?<chemical>[^\d,]+)
|
210
|
-
\s*(?<cdose>[\d\-.]+(\s*(?:(Mio\.?\s*)?(#{units}|[^\s,]+))
|
211
|
-
(\s*[mv]/[mv])?))?)?
|
212
|
-
}u
|
213
|
-
rep_1 = '----'; to_1 = '('
|
214
|
-
rep_2 = '-----'; to_2 = ')'
|
215
|
-
rep_3 = '------'; to_3 = ','
|
216
|
-
compositions.each_with_index do |composition, idx|
|
217
|
-
composition.gsub!(/'/, '')
|
218
|
-
label = nil
|
219
|
-
composition_text.split(/\n/u).each {
|
220
|
-
|line|
|
221
|
-
if m = /^(?<part_id>A|I|B|II|C|III|D|IV|E|V|F|VI)\)\s+(?<part_name>[^\s:, ]+):/.match(line)
|
222
|
-
label = "#{m[:part_id]} #{m[:part_name]}"
|
223
|
-
end
|
224
|
-
filler = line.split(',')[-1].sub(/\.$/, '')
|
225
|
-
filler_match = /^(?<name>[^,\d]+)\s*(?<dose>[\d\-.]+(\s*(?:(Mio\.?\s*)?(U\.\s*Ph\.\s*Eur\.|[^\s,]+))))/.match(filler)
|
226
|
-
components = line.split(/([^\(]+\([^)]+\)[^,]+|),/).each {
|
227
|
-
|component|
|
228
|
-
next unless component.size > 0
|
229
|
-
to_consider = component.strip.split(':')[-1] # remove label
|
230
|
-
# very ugly hack to ignore ,()
|
231
|
-
m = /^(?<name>[^,\d()]+)\s*(?<dose>[\d\-.]+(\s*(?:(Mio\.?\s*)?(U\.\s*Ph\.\s*Eur\.|[^\s,]+))))/.match(to_consider
|
232
|
-
.gsub(to_1, rep_1).gsub(to_2, rep_2).gsub(to_3, rep_3))
|
233
|
-
if m2 = /^(|[^:]+:\s)(E\s+\d+)$/.match(component.strip)
|
234
|
-
to_add = Composition.new(m2[2], '', '', nil)
|
235
|
-
res << to_add
|
236
|
-
elsif m
|
237
|
-
dose = nil
|
238
|
-
unit = nil
|
239
|
-
name = m[:name].split(/\s/).collect{ |x| x.capitalize }.join(' ').strip.gsub(rep_3, to_3).gsub(rep_2, to_2).gsub(rep_1, to_1)
|
240
|
-
dose = m[:dose].split(/\b\s*(?![.,\d\-]|Mio\.?)/u, 2) if m[:dose]
|
241
|
-
if dose && (scale = SCALE_P.match(filler)) && dose[1] && !dose[1].include?('/')
|
242
|
-
unit = dose[1] << '/'
|
243
|
-
num = scale[:qty].to_f
|
244
|
-
if num <= 1
|
245
|
-
unit << scale[:unit]
|
246
|
-
else
|
247
|
-
unit << scale[:scale]
|
248
|
-
end
|
249
|
-
elsif dose.size == 2
|
250
|
-
unit = dose[1]
|
251
|
-
end
|
252
|
-
to_add = Composition.new(name, dose ? dose[0].to_f : nil, unit ? unit.gsub(rep_3, to_3).gsub(rep_2, to_2).gsub(rep_1, to_1) : nil, label)
|
253
|
-
res << to_add
|
254
|
-
end
|
255
|
-
}
|
256
|
-
}
|
257
|
-
end
|
258
|
-
@compositions = res
|
239
|
+
@compositions = update_compositions(active_substance)
|
259
240
|
end
|
260
241
|
end
|
261
242
|
|
data/lib/oddb2xml/version.rb
CHANGED
data/spec/calc_spec.rb
CHANGED
@@ -22,10 +22,25 @@ describe Oddb2xml::Calc do
|
|
22
22
|
FileUtils.rm(Dir.glob(File.join(Oddb2xml::WorkDir, '*.csv')))
|
23
23
|
end
|
24
24
|
|
25
|
+
Line_1 = 'I) Glucoselösung: glucosum anhydricum 150 g ut glucosum monohydricum, natrii dihydrogenophosphas dihydricus 2.34 g, zinci acetas dihydricus 6.58 mg, aqua ad iniectabilia q.s. ad solutionem pro 500 ml.'
|
26
|
+
Line_2 = 'II) Fettemulsion: sojae oleum 25 g, triglycerida saturata media 25 g, lecithinum ex ovo 3 g, glycerolum, natrii oleas, aqua q.s. ad emulsionem pro 250 ml.'
|
27
|
+
Line_3 = 'III) Aminosäurenlösung: isoleucinum 2.34 g, leucinum 3.13 g, lysinum anhydricum 2.26 g ut lysini hydrochloridum, methioninum 1.96 g, aqua ad iniectabilia q.s. ad solutionem pro 400 ml.'
|
28
|
+
Line_4 = 'I) et II) et III) corresp.: aminoacida 32 g/l, acetas 32 mmol/l, acidum citricum monohydricum, in emulsione recenter mixta 1250 ml.'
|
29
|
+
Line_5 = 'Corresp. 4000 kJ.'
|
30
|
+
|
25
31
|
# after each name you find the column of swissmedic_package.xlsx file
|
26
32
|
TestExample = Struct.new("TestExample", :test_description, :iksnr_A, :seqnr_B, :pack_K, :name_C, :package_size_L, :einheit_M, :active_substance_0, :composition_P,
|
27
33
|
:values_to_compare)
|
28
34
|
|
35
|
+
tst_grains_de_valse = TestExample.new('Grains de Vals',
|
36
|
+
55491, 1, 1, "Grains de Vals, comprimés ",
|
37
|
+
'20', 'Tablette(n)',
|
38
|
+
'sennae folii extractum methanolicum siccum',
|
39
|
+
'sennae folii extractum methanolicum siccum 78-104 mg corresp. sennosidum B 12.5 mg, DER: 18:1, excipiens pro compresso.',
|
40
|
+
{ :selling_units => 20,
|
41
|
+
:measure => 'Tablette(n)',
|
42
|
+
}
|
43
|
+
)
|
29
44
|
tst_cardio_pumal = TestExample.new('Cardio-Pulmo-Rénal Sérocytol',
|
30
45
|
274, 1, 1, "Cardio-Pulmo-Rénal Sérocytol, suppositoire",
|
31
46
|
'3', 'Suppositorien',
|
@@ -88,7 +103,7 @@ describe Oddb2xml::Calc do
|
|
88
103
|
}
|
89
104
|
)
|
90
105
|
tst_nutriflex = TestExample.new('Nutriflex Lipid plus ohne Elektrolyte, Infusionsemulsion 1250ml',
|
91
|
-
56089, 1, 1, 'Nutriflex Lipid plus
|
106
|
+
56089, 1, 1, 'Nutriflex Lipid plus, Infusionsemulsion, 1250ml',
|
92
107
|
'5 x 1250', 'ml',
|
93
108
|
'glucosum anhydricum, isoleucinum, leucinum, lysinum anhydricum, methioninum, phenylalaninum, threoninum, tryptophanum, valinum, argininum, histidinum, alaninum, acidum asparticum, acidum glutamicum, glycinum, prolinum, serinum, aminoacida, carbohydrata, materia crassa, sojae oleum, triglycerida saturata media',
|
94
109
|
"I) Glucoselösung: glucosum anhydricum 150 g ut glucosum monohydricum, acidum citricum anhydricum, aqua ad iniectabilia q.s. ad solutionem pro 500 ml.
|
@@ -296,8 +311,10 @@ Corresp. 5300 kJ.",
|
|
296
311
|
puts "Testing key #{key.inspect} #{value.inspect} against #{result} seems to fail" unless result == value.to_s
|
297
312
|
result.should eq value.to_s
|
298
313
|
}
|
299
|
-
XPath.match( doc, "//ARTICLE[GTIN='7680545250363']/COMPOSITIONS/
|
314
|
+
XPath.match( doc, "//ARTICLE[GTIN='7680545250363']/COMPOSITIONS/COMPOSITION/SUBSTANCES/SUBSTANCE/SUBSTANCE_NAME").last.text.should eq 'Alprostadilum'
|
300
315
|
XPath.match( doc, "//ARTICLE[GTIN='7680458820202']/NAME").last.text.should eq 'Magnesiumchlorid 0,5 molar B. Braun, Zusatzampulle für Infusionslösungen'
|
316
|
+
XPath.match( doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL").first.text.should eq 'I'
|
317
|
+
XPath.match( doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL").last.text.should eq 'III'
|
301
318
|
end
|
302
319
|
end
|
303
320
|
|
@@ -328,8 +345,7 @@ Corresp. 5300 kJ.",
|
|
328
345
|
context 'find correct result for Nutriflex' do
|
329
346
|
info = Calc.new(tst_nutriflex.name_C, tst_nutriflex.package_size_L, tst_nutriflex.einheit_M, tst_nutriflex.active_substance_0, tst_nutriflex.composition_P)
|
330
347
|
specify { expect(info.selling_units).to eq 5 }
|
331
|
-
|
332
|
-
# specify { expect(info.galenic_form.description).to eq "Infusionsemulsion" }
|
348
|
+
specify { expect(info.galenic_form.description).to eq "Infusionsemulsion" }
|
333
349
|
end
|
334
350
|
|
335
351
|
context 'should handle CFU' do
|
@@ -337,56 +353,14 @@ Corresp. 5300 kJ.",
|
|
337
353
|
'lactobacillus acidophilus cryodesiccatus min. 10^9 CFU, bifidobacterium infantis min. 10^9 CFU, color.: E 127, E 132, E 104, excipiens pro capsula.')
|
338
354
|
skip "Infloran, capsule mit cryodesiccatus min. 10^9 CFU"
|
339
355
|
end
|
340
|
-
|
341
|
-
context 'find correct result compositions' do
|
342
|
-
text = 'I) Glucoselösung: glucosum anhydricum 80 g ut glucosum monohydricum, natrii dihydrogenophosphas dihydricus 1.17 g glycerolum, zinci acetas dihydricus 6.625 mg, natrii oleas, aqua q.s. ad emulsionem pro 250 ml.
|
343
|
-
II) Fettemulsion: sojae oleum 25 g, triglycerida saturata media 25 g, lecithinum ex ovo 3 g, glycerolum, natrii oleas, aqua q.s. ad emulsionem pro 250 ml.
|
344
|
-
III) Aminosäurenlösung: isoleucinum 2.34 g, leucinum 3.13 g, lysinum anhydricum 2.26 g ut lysini hydrochloridum, methioninum 1.96 g, aqua ad iniectabilia q.s. ad solutionem pro 400 ml.
|
345
|
-
.
|
346
|
-
I) et II) et III) corresp.: aminoacida 32 g/l, acetas 32 mmol/l, acidum citricum monohydricum, in emulsione recenter mixta 1250 ml.
|
347
|
-
Corresp. 4000 kJ.'
|
348
|
-
result = Calc.new('Nutriflex Lipid peri, Infusionsemulsion, 1250ml', nil, nil,
|
349
|
-
'glucosum anhydricum, zinci acetas dihydricus, isoleucinum, leucinum',
|
350
|
-
text
|
351
|
-
)
|
352
|
-
specify { expect(result.compositions.first.name).to eq 'Glucosum Anhydricum' }
|
353
|
-
specify { expect(result.compositions.first.qty).to eq 80.0}
|
354
|
-
specify { expect(result.compositions.first.unit).to eq 'g/250 ml'}
|
355
|
-
specify { expect(result.compositions.first.label).to eq 'I Glucoselösung' }
|
356
|
-
|
357
|
-
# from II)
|
358
|
-
lecithinum = result.compositions.find{ |x| x.name.match(/lecithinum/i) }
|
359
|
-
specify { expect(lecithinum).not_to eq nil}
|
360
|
-
if lecithinum
|
361
|
-
specify { expect(lecithinum.name).to eq 'Lecithinum Ex Ovo' }
|
362
|
-
specify { expect(lecithinum.qty).to eq 3.0}
|
363
|
-
specify { expect(lecithinum.unit).to eq 'g/250 ml'}
|
364
|
-
specify { expect(lecithinum.label).to eq 'II Fettemulsion' }
|
365
|
-
end
|
366
|
-
|
367
|
-
# From III
|
368
|
-
leucinum = result.compositions.find{ |x| x.name.eql?('Leucinum') and x.label.match(/^III /) }
|
369
|
-
specify { expect(leucinum).not_to eq nil}
|
370
|
-
if leucinum
|
371
|
-
specify { expect(leucinum.name).to eq 'Leucinum' }
|
372
|
-
specify { expect(leucinum.qty).to eq 3.13}
|
373
|
-
specify { expect(leucinum.unit).to eq 'g/400 ml'}
|
374
|
-
specify { expect(leucinum.label).to eq 'III Aminosäurenlösung' }
|
375
|
-
end
|
376
|
-
leucinum_I = result.compositions.find{ |x| x.name.eql?('Leucinum') and x.label.match(/^I /) }
|
377
|
-
specify { expect(leucinum_I).to eq nil}
|
378
|
-
leucinum_II = result.compositions.find{ |x| x.name.eql?('Leucinum') and x.label.match(/^II /) }
|
379
|
-
specify { expect(leucinum_II).to eq nil}
|
380
|
-
end
|
381
|
-
|
382
356
|
context 'find correct result compositions' do
|
383
357
|
result = Calc.new(nil, nil, nil, 'rutosidum trihydricum, aescinum', 'rutosidum trihydricum 20 mg, aescinum 25 mg, aromatica, excipiens pro compresso.')
|
384
|
-
specify { expect(result.compositions.first.name).to eq 'Rutosidum Trihydricum' }
|
385
|
-
specify { expect(result.compositions.first.qty).to eq 20}
|
386
|
-
specify { expect(result.compositions.first.unit).to eq 'mg'}
|
387
|
-
specify { expect(result.compositions[1].name).to eq 'Aescinum' }
|
388
|
-
specify { expect(result.compositions[1].qty).to eq 25}
|
389
|
-
specify { expect(result.compositions[1].unit).to eq 'mg'}
|
358
|
+
specify { expect(result.compositions.first.substances.first.name).to eq 'Rutosidum Trihydricum' }
|
359
|
+
specify { expect(result.compositions.first.substances.first.qty).to eq 20}
|
360
|
+
specify { expect(result.compositions.first.substances.first.unit).to eq 'mg'}
|
361
|
+
specify { expect(result.compositions.first.substances[1].name).to eq 'Aescinum' }
|
362
|
+
specify { expect(result.compositions.first.substances[1].qty).to eq 25}
|
363
|
+
specify { expect(result.compositions.first.substances[1].unit).to eq 'mg'}
|
390
364
|
end
|
391
365
|
|
392
366
|
context 'find correct result for Inflora, capsule' do
|
@@ -397,14 +371,14 @@ Corresp. 4000 kJ.'
|
|
397
371
|
specify { expect(info.pkg_size).to eq '2x10' }
|
398
372
|
specify { expect(info.selling_units).to eq 20 }
|
399
373
|
skip { expect(info.measure).to eq '0' }
|
400
|
-
bifidobacterium = info.compositions.find{ |x| x.name.match(/Bifidobacterium/i) }
|
374
|
+
bifidobacterium = info.compositions.first.substances.find{ |x| x.name.match(/Bifidobacterium/i) }
|
401
375
|
specify { expect(bifidobacterium).not_to eq nil}
|
402
376
|
if bifidobacterium
|
403
377
|
specify { expect(bifidobacterium.name).to eq 'Bifidobacterium Infantis Min.' }
|
404
378
|
skip { expect(bifidobacterium.qty).to eq '10^9'}
|
405
379
|
skip { expect(bifidobacterium.unit).to eq 'CFU'}
|
406
380
|
end
|
407
|
-
e_127 = info.compositions.find{ |x| x.name.match(/E 127/i) }
|
381
|
+
e_127 = info.compositions.first.substances.find{ |x| x.name.match(/E 127/i) }
|
408
382
|
skip { expect(e_127).not_to eq nil}
|
409
383
|
if e_127
|
410
384
|
specify { expect(e_127.name).to eq 'E 127' }
|
@@ -420,21 +394,84 @@ Corresp. 4000 kJ.'
|
|
420
394
|
specify { expect(info.selling_units).to eq 3 }
|
421
395
|
specify { expect(info.name).to eq 'Cardio-Pulmo-Rénal Sérocytol, suppositoire'}
|
422
396
|
specify { expect(info.measure).to eq 'Suppositorien' }
|
423
|
-
globulina = info.compositions.find{ |x| x.name.match(/porcins|globulina/i) }
|
397
|
+
globulina = info.compositions.first.substances.find{ |x| x.name.match(/porcins|globulina/i) }
|
424
398
|
specify { expect(globulina).not_to eq nil}
|
425
399
|
if globulina
|
426
400
|
specify { expect(globulina.name).to eq 'Globulina Equina (immunisé Avec Coeur, Tissu Pulmonaire, Reins De Porcins)' }
|
427
401
|
specify { expect(globulina.qty).to eq 8.0}
|
428
402
|
specify { expect(globulina.unit).to eq 'mg'}
|
429
403
|
end
|
430
|
-
e_216 = info.compositions.find{ |x| x.name.match(/E 216/i) }
|
404
|
+
e_216 = info.compositions.first.substances.find{ |x| x.name.match(/E 216/i) }
|
431
405
|
specify { expect(e_216).not_to eq nil}
|
432
406
|
if e_216
|
433
407
|
specify { expect(e_216.name).to eq 'E 216' }
|
434
408
|
specify { expect(e_216.unit).to eq ''}
|
435
409
|
end
|
436
|
-
e_218 = info.compositions.find{ |x| x.name.match(/E 218/i) }
|
410
|
+
e_218 = info.compositions.first.substances.find{ |x| x.name.match(/E 218/i) }
|
437
411
|
specify { expect(e_218).not_to eq nil}
|
438
412
|
end
|
439
413
|
|
414
|
+
context 'find correct result compositions for nutriflex' do
|
415
|
+
text = "#{Line_1}\n#{Line_2}\n#{Line_3}\n#{Line_4}\n#{Line_5}"
|
416
|
+
result = Calc.new('Nutriflex Lipid peri, Infusionsemulsion, 1250ml', nil, nil,
|
417
|
+
'glucosum anhydricum, zinci acetas dihydricus, isoleucinum, leucinum',
|
418
|
+
text
|
419
|
+
)
|
420
|
+
specify { expect(result.compositions.first.substances.first.name).to eq 'Glucosum Anhydricum'}
|
421
|
+
specify { expect(result.compositions.first.substances.first.chemical_substance).to eq 'Glucosum Monohydricum'}
|
422
|
+
specify { expect(result.compositions.first.substances.first.chemical_dose).to eq nil}
|
423
|
+
|
424
|
+
specify { expect(result.compositions[0].source).to eq Line_1}
|
425
|
+
specify { expect(result.compositions[0].label).to eq 'I'}
|
426
|
+
specify { expect(result.compositions[1].label).to eq 'II' }
|
427
|
+
specify { expect(result.compositions[2].label).to eq 'III' }
|
428
|
+
glucosum = result.compositions.first.substances.first
|
429
|
+
specify { expect(glucosum.name).to eq 'Glucosum Anhydricum' }
|
430
|
+
specify { expect(glucosum.qty).to eq 150.0}
|
431
|
+
specify { expect(glucosum.unit).to eq 'g/500 ml'}
|
432
|
+
specify { expect(result.compositions.size).to eq 3}
|
433
|
+
specify { expect(result.compositions[0].substances.size).to eq 3}
|
434
|
+
specify { expect(result.compositions[1].substances.size).to eq 3}
|
435
|
+
specify { expect(result.compositions[2].substances.size).to eq 4}
|
436
|
+
specify { expect(result.compositions[1].source).to eq Line_2}
|
437
|
+
specify { expect(result.compositions[2].source).to eq Line_3}
|
438
|
+
|
439
|
+
# from II)
|
440
|
+
lecithinum = result.compositions[1].substances.find{ |x| x.name.match(/lecithinum/i) }
|
441
|
+
specify { expect(lecithinum).not_to eq nil}
|
442
|
+
if lecithinum
|
443
|
+
specify { expect(lecithinum.name).to eq 'Lecithinum Ex Ovo' }
|
444
|
+
specify { expect(lecithinum.qty).to eq 3.0}
|
445
|
+
specify { expect(lecithinum.unit).to eq 'g/250 ml'}
|
446
|
+
end
|
447
|
+
|
448
|
+
# From III
|
449
|
+
leucinum = result.compositions[2].substances.find{ |x| x.name.eql?('Leucinum') }
|
450
|
+
specify { expect(leucinum).not_to eq nil}
|
451
|
+
if leucinum
|
452
|
+
specify { expect(leucinum.name).to eq 'Leucinum' }
|
453
|
+
specify { expect(leucinum.qty).to eq 3.13}
|
454
|
+
specify { expect(leucinum.unit).to eq 'g/400 ml'}
|
455
|
+
end
|
456
|
+
leucinum_I = result.compositions[0].substances.find{ |x| x.name.eql?('Leucinum') }
|
457
|
+
specify { expect(leucinum_I).to eq nil}
|
458
|
+
leucinum_II = result.compositions[1].substances.find{ |x| x.name.eql?('Leucinum') }
|
459
|
+
specify { expect(leucinum_II).to eq nil}
|
460
|
+
aqua = result.compositions[2].substances.find{ |x| /aqua ad/i.match(x.name) }
|
461
|
+
specify { expect(aqua).to eq nil}
|
462
|
+
end
|
463
|
+
|
464
|
+
context 'find correct result compositions for tst_grains_de_valse with chemical_dose' do
|
465
|
+
info = Calc.new(tst_grains_de_valse.name_C, tst_grains_de_valse.package_size_L, tst_grains_de_valse.einheit_M, tst_grains_de_valse.active_substance_0, tst_grains_de_valse.composition_P)
|
466
|
+
sennosidum = info.compositions.first.substances.find{ |x| x.name.match(/Sennae/i) }
|
467
|
+
specify { expect(sennosidum).not_to eq nil}
|
468
|
+
if sennosidum
|
469
|
+
specify { expect(sennosidum.name).to eq 'Sennae Folii Extractum Methanolicum Siccum' }
|
470
|
+
specify { expect(sennosidum.chemical_substance).to eq 'Sennosidum B' }
|
471
|
+
specify { expect(sennosidum.chemical_dose).to eq '12.5 mg' }
|
472
|
+
specify { expect(sennosidum.qty).to eq 78.0}
|
473
|
+
specify { expect(sennosidum.unit).to eq 'mg'}
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
440
477
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,195 +1,195 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oddb2xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yasuhiro Asaka, Zeno R.R. Davatz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.1.3
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.1.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: archive-tar-minitar
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.5.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.5.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: mechanize
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.5.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.5.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 1.5.10
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.5.10
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: savon
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 2.4.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 2.4.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: spreadsheet
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 1.0.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.0.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubyXL
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: 3.3.1
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 3.3.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: sax-machine
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: 0.1.0
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 0.1.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: bundler
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rake
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rspec
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :development
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: webmock
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: rdoc
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0'
|
188
188
|
type: :development
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ">="
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
description: oddb2xml creates xml files using swissINDEX, BAG-XML and Swissmedic.
|
@@ -199,9 +199,9 @@ executables:
|
|
199
199
|
extensions: []
|
200
200
|
extra_rdoc_files: []
|
201
201
|
files:
|
202
|
-
- .gitignore
|
203
|
-
- .rspec
|
204
|
-
- .travis.yml
|
202
|
+
- ".gitignore"
|
203
|
+
- ".rspec"
|
204
|
+
- ".travis.yml"
|
205
205
|
- Gemfile
|
206
206
|
- Gemfile.lock
|
207
207
|
- History.txt
|
@@ -290,12 +290,12 @@ require_paths:
|
|
290
290
|
- lib
|
291
291
|
required_ruby_version: !ruby/object:Gem::Requirement
|
292
292
|
requirements:
|
293
|
-
- -
|
293
|
+
- - ">="
|
294
294
|
- !ruby/object:Gem::Version
|
295
295
|
version: '0'
|
296
296
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
297
297
|
requirements:
|
298
|
-
- -
|
298
|
+
- - ">="
|
299
299
|
- !ruby/object:Gem::Version
|
300
300
|
version: '0'
|
301
301
|
requirements: []
|