oddb2xml 2.7.1 → 2.7.2
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 +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.standard.yml +2 -0
- data/Gemfile +3 -3
- data/History.txt +8 -0
- data/README.md +1 -1
- 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 +1070 -1038
- data/lib/oddb2xml/calc.rb +232 -233
- data/lib/oddb2xml/chapter_70_hack.rb +38 -32
- data/lib/oddb2xml/cli.rb +252 -236
- 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 +153 -127
- data/lib/oddb2xml/extractor.rb +302 -289
- data/lib/oddb2xml/options.rb +34 -35
- data/lib/oddb2xml/parslet_compositions.rb +263 -269
- data/lib/oddb2xml/semantic_check.rb +39 -33
- data/lib/oddb2xml/util.rb +163 -163
- data/lib/oddb2xml/version.rb +1 -1
- data/lib/oddb2xml/xml_definitions.rb +32 -33
- data/oddb2xml.gemspec +31 -32
- data/spec/artikelstamm_spec.rb +111 -110
- data/spec/builder_spec.rb +489 -505
- data/spec/calc_spec.rb +552 -593
- data/spec/check_artikelstamm_spec.rb +26 -26
- data/spec/cli_spec.rb +173 -174
- 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/transfer.dat +1 -0
- data/spec/data_helper.rb +47 -49
- data/spec/downloader_spec.rb +247 -260
- data/spec/extractor_spec.rb +171 -159
- 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 +19 -3
data/lib/oddb2xml/calc.rb
CHANGED
@@ -1,111 +1,109 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require 'oddb2xml/parslet_compositions'
|
5
|
-
require 'yaml'
|
1
|
+
require "oddb2xml/util"
|
2
|
+
require "oddb2xml/parslet_compositions"
|
3
|
+
require "yaml"
|
6
4
|
|
7
5
|
module Oddb2xml
|
8
|
-
|
9
|
-
|
10
|
-
GalenicGroup
|
11
|
-
GalenicForm
|
6
|
+
# Calc is responsible for analysing the columns "Packungsgrösse" and "Einheit"
|
7
|
+
#
|
8
|
+
GalenicGroup = Struct.new("GalenicGroup", :oid, :descriptions)
|
9
|
+
GalenicForm = Struct.new("GalenicForm", :oid, :descriptions, :galenic_group)
|
12
10
|
|
13
11
|
class GalenicGroup
|
14
|
-
def description(lang =
|
12
|
+
def description(lang = "de")
|
15
13
|
descriptions[lang]
|
16
14
|
end
|
17
15
|
end
|
18
16
|
|
19
17
|
class GalenicForm
|
20
|
-
def description(lang =
|
18
|
+
def description(lang = "de")
|
21
19
|
descriptions[lang]
|
22
20
|
end
|
23
21
|
end
|
24
22
|
|
25
23
|
class Calc
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
24
|
+
FLUIDFORMS = [
|
25
|
+
"Ampulle(n)",
|
26
|
+
"Beutel",
|
27
|
+
"Bolus/Boli",
|
28
|
+
"Bq",
|
29
|
+
"Dose(n)",
|
30
|
+
"Durchstechflasche(n)",
|
31
|
+
"Einmaldosenbehälter",
|
32
|
+
"Einzeldose(n)",
|
33
|
+
"Fertigspritze",
|
34
|
+
"Fertigspritze(n)",
|
35
|
+
"Flasche(n)",
|
36
|
+
"I.E.",
|
37
|
+
"Infusionskonzentrat",
|
38
|
+
"Infusionslösung",
|
39
|
+
"Infusionsemulsion",
|
40
|
+
"Inhalationen",
|
41
|
+
"Inhalator",
|
42
|
+
"Injektions-Set",
|
43
|
+
"Injektions-Sets",
|
44
|
+
"Injektor(en), vorgefüllt/Pen",
|
45
|
+
"Klistier(e)",
|
46
|
+
"MBq",
|
47
|
+
"Pipetten",
|
48
|
+
"Sachet(s)",
|
49
|
+
"Spritze(n)",
|
50
|
+
"Sprühstösse",
|
51
|
+
"Stechampulle (Lyophilisat) und Ampulle (Solvens)",
|
52
|
+
"Stechampulle",
|
53
|
+
"Suspension",
|
54
|
+
"Zylinderampulle(n)",
|
55
|
+
"cartouches",
|
56
|
+
"dose(s)",
|
57
|
+
"flacon perforable",
|
58
|
+
"sacchetto",
|
59
|
+
"vorgefüllter Injektor"
|
60
|
+
]
|
61
|
+
FESTE_FORMEN = [
|
62
|
+
"Depotabs",
|
63
|
+
"Dragée(s)",
|
64
|
+
"Generator mit folgenden Aktivitäten:",
|
65
|
+
"Filmtabletten",
|
66
|
+
"Gerät",
|
67
|
+
"Kapsel(n)",
|
68
|
+
"Kautabletten",
|
69
|
+
"Lutschtabletten",
|
70
|
+
"Kugeln",
|
71
|
+
"Ovulum",
|
72
|
+
"Packung(en)",
|
73
|
+
"Pflaster",
|
74
|
+
"Schmelzfilme",
|
75
|
+
"Set",
|
76
|
+
"Strips",
|
77
|
+
"Stück",
|
78
|
+
"Suppositorien",
|
79
|
+
"Tablette(n)",
|
80
|
+
"Tüchlein",
|
81
|
+
"Urethrastab",
|
82
|
+
"Vaginalzäpfchen",
|
83
|
+
"comprimé",
|
84
|
+
"comprimé pelliculé",
|
85
|
+
"comprimés",
|
86
|
+
"comprimés à libération modifiée",
|
87
|
+
"comprimés à croquer sécables",
|
88
|
+
"imprägnierter Verband",
|
89
|
+
"magensaftresistente Filmtabletten",
|
90
|
+
"ovale Körper",
|
91
|
+
"tube(s)"
|
94
92
|
]
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
@@galenic_groups
|
101
|
-
@@galenic_forms
|
93
|
+
MEASUREMENTS = ["g", "kg", "l", "mg", "ml", "cm", "GBq"]
|
94
|
+
OTHERS = ["Kombipackung", "emballage combiné"]
|
95
|
+
UNKNOWN_GALENIC_FORM = 140
|
96
|
+
UNKNOWN_GALENIC_GROUP = 1
|
97
|
+
DATA_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "data"))
|
98
|
+
@@galenic_groups = YAML.load_file(File.join(DATA_DIR, "gal_groups.yaml"))
|
99
|
+
@@galenic_forms = YAML.load_file(File.join(DATA_DIR, "gal_forms.yaml"))
|
102
100
|
@@new_galenic_forms = []
|
103
101
|
@@names_without_galenic_forms = []
|
104
102
|
@@rules_counter = {}
|
105
|
-
attr_accessor
|
106
|
-
attr_reader
|
107
|
-
attr_reader
|
108
|
-
def self.get_galenic_group(name, lang =
|
103
|
+
attr_accessor :galenic_form, :unit, :pkg_size
|
104
|
+
attr_reader :name, :substances, :composition, :compositions, :column_c
|
105
|
+
attr_reader :selling_units, :count, :multi, :measure, :addition, :scale # s.a. commercial_form in oddb.org/src/model/part.rb
|
106
|
+
def self.get_galenic_group(name, lang = "de")
|
109
107
|
@@galenic_groups.values.collect { |galenic_group|
|
110
108
|
return galenic_group if galenic_group.descriptions[lang].eql?(name)
|
111
109
|
}
|
@@ -113,80 +111,84 @@ module Oddb2xml
|
|
113
111
|
end
|
114
112
|
|
115
113
|
def self.report_conversion
|
116
|
-
lines = [
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
| key, value|
|
123
|
-
lines << "#{key}: #{value} occurrences"
|
114
|
+
lines = ["", "",
|
115
|
+
"Report of used conversion rules",
|
116
|
+
"-------------------------------",
|
117
|
+
""]
|
118
|
+
@@rules_counter.each { |key, value|
|
119
|
+
lines << "#{key}: #{value} occurrences"
|
124
120
|
}
|
125
|
-
lines <<
|
126
|
-
lines <<
|
121
|
+
lines << ""
|
122
|
+
lines << ""
|
127
123
|
lines
|
128
124
|
end
|
129
125
|
|
130
|
-
def self.get_galenic_form(name, lang =
|
126
|
+
def self.get_galenic_form(name, lang = "de")
|
131
127
|
@@galenic_forms.values.collect { |galenic_form|
|
132
128
|
return galenic_form if galenic_form.descriptions[lang].eql?(name)
|
133
|
-
if name
|
129
|
+
if name && galenic_form.descriptions[lang].eql?(name.sub(" / ", "/"))
|
134
130
|
return galenic_form
|
135
131
|
end
|
136
132
|
}
|
137
|
-
@@galenic_forms[
|
133
|
+
@@galenic_forms[UNKNOWN_GALENIC_FORM]
|
138
134
|
end
|
139
135
|
|
140
136
|
def self.dump_new_galenic_forms
|
141
137
|
if @@new_galenic_forms.size > 0
|
142
|
-
"\n\n\nAdded the following galenic_forms\n"+ @@new_galenic_forms.uniq.join("\n")
|
138
|
+
"\n\n\nAdded the following galenic_forms\n" + @@new_galenic_forms.uniq.join("\n")
|
143
139
|
else
|
144
140
|
"\n\n\nNo new galenic forms added"
|
145
141
|
end
|
146
142
|
end
|
143
|
+
|
147
144
|
def self.dump_names_without_galenic_forms
|
148
145
|
if @@names_without_galenic_forms.size > 0
|
149
|
-
"\n\n\nThe following products did not have a galenic form in column Präparateliste\n"+ @@names_without_galenic_forms.sort.uniq.join("\n")
|
146
|
+
"\n\n\nThe following products did not have a galenic form in column Präparateliste\n" + @@names_without_galenic_forms.sort.uniq.join("\n")
|
150
147
|
else
|
151
148
|
"\n\n\nColumn Präparateliste has everywhere a name\n"
|
152
149
|
end
|
153
150
|
end
|
154
|
-
|
151
|
+
|
152
|
+
private
|
153
|
+
|
155
154
|
def remove_duplicated_spaces(string)
|
156
|
-
string ? string.to_s.gsub(/\s\s+/,
|
155
|
+
string ? string.to_s.gsub(/\s\s+/, " ") : nil
|
157
156
|
end
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
157
|
+
|
158
|
+
public
|
159
|
+
|
160
|
+
def initialize(column_c = nil, size = nil, unit = nil, active_substance = nil, composition = nil)
|
161
|
+
@column_c = column_c ? column_c.gsub(/\s\s+/, " ") : nil
|
162
|
+
@name, gal_form = ParseGalenicForm.from_string(column_c)
|
163
|
+
gal_form = gal_form.gsub(/\s\s+/, " ").sub(" / ", "/") if gal_form
|
163
164
|
@galenic_form = search_galenic_info(gal_form)
|
164
165
|
@pkg_size = remove_duplicated_spaces(size)
|
165
166
|
@unit = unit
|
166
|
-
@selling_units =
|
167
|
+
@selling_units = getSellingUnits(@name, @pkg_size, @unit)
|
167
168
|
@composition = composition
|
168
|
-
@measure = unit if unit
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|part|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
if @measure and not @galenic_form
|
180
|
-
@galenic_form ||= search_exact_galform(@measure)
|
181
|
-
@galenic_form ||= search_exact_galform(@measure.sub('(n)', 'n'))
|
169
|
+
@measure = unit if unit && !@measure
|
170
|
+
if column_c
|
171
|
+
unless @galenic_form
|
172
|
+
parts = column_c.split(/\s+|,|-/)
|
173
|
+
parts.each { |part|
|
174
|
+
if (idx = searchExactGalform(part))
|
175
|
+
@galenic_form = idx
|
176
|
+
break
|
177
|
+
end
|
178
|
+
}
|
179
|
+
end
|
182
180
|
end
|
183
|
-
|
184
|
-
|
181
|
+
if @measure && !@galenic_form
|
182
|
+
@galenic_form ||= searchExactGalform(@measure)
|
183
|
+
@galenic_form ||= searchExactGalform(@measure.sub("(n)", "n"))
|
184
|
+
end
|
185
|
+
handleUnknownGalform(gal_form)
|
186
|
+
@measure = @galenic_form.description if @galenic_form && !@measure
|
185
187
|
|
186
|
-
|
187
|
-
|
188
|
+
@compositions = if composition
|
189
|
+
ParseUtil.parse_compositions(composition, active_substance)
|
188
190
|
else
|
189
|
-
|
191
|
+
[]
|
190
192
|
end
|
191
193
|
end
|
192
194
|
|
@@ -196,157 +198,154 @@ public
|
|
196
198
|
|
197
199
|
# helper for generating csv
|
198
200
|
def headers
|
199
|
-
[
|
201
|
+
["name", "pkg_size", "selling_units", "measure",
|
200
202
|
# "count", "multi", "addition", "scale", "unit",
|
201
203
|
"galenic_form",
|
202
|
-
"galenic_group"
|
203
|
-
]
|
204
|
+
"galenic_group"]
|
204
205
|
end
|
206
|
+
|
205
207
|
def to_array
|
206
|
-
[
|
208
|
+
[@name, @pkg_size, @selling_units, @measure,
|
207
209
|
# @count, @multi, @addition, @scale, @unit,
|
208
|
-
galenic_form
|
209
|
-
galenic_group ? galenic_group.description :
|
210
|
-
]
|
210
|
+
galenic_form ? galenic_form.description : "",
|
211
|
+
galenic_group ? galenic_group.description : ""]
|
211
212
|
end
|
212
|
-
|
213
|
+
|
214
|
+
private
|
213
215
|
|
214
216
|
def update_rule(rulename)
|
215
217
|
@@rules_counter[rulename] ||= 0
|
216
218
|
@@rules_counter[rulename] += 1
|
217
219
|
end
|
218
220
|
|
219
|
-
def
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
return 'error'
|
288
|
-
end
|
221
|
+
def getSellingUnits(part_from_name_c, pkg_size_l, einheit_m)
|
222
|
+
# break_condition = (defined?(Pry) && false) # /5 x 2500 ml/.match(pkg_size_l))
|
223
|
+
return pkgSizeToInt(pkg_size_l) unless part_from_name_c
|
224
|
+
part_from_name_c = part_from_name_c.gsub(/[()]/, "_")
|
225
|
+
MEASUREMENTS.each { |x|
|
226
|
+
if einheit_m && /^#{x}$/i.match(einheit_m)
|
227
|
+
puts "measurement in einheit_m #{einheit_m} matched: #{x}" if $VERBOSE
|
228
|
+
update_rule("measurement einheit_m")
|
229
|
+
@measure = x
|
230
|
+
# binding.pry if break_condition
|
231
|
+
return pkgSizeToInt(pkg_size_l, true)
|
232
|
+
end
|
233
|
+
}
|
234
|
+
FESTE_FORMEN.each { |x|
|
235
|
+
if part_from_name_c && (x.gsub(/[()]/, "_")).match(part_from_name_c)
|
236
|
+
puts "feste_form in #{part_from_name_c} matched: #{x}" if $VERBOSE
|
237
|
+
update_rule("feste_form name_C")
|
238
|
+
@measure = x
|
239
|
+
# binding.pry if break_condition
|
240
|
+
return pkgSizeToInt(pkg_size_l)
|
241
|
+
end
|
242
|
+
if einheit_m && x.eql?(einheit_m)
|
243
|
+
puts "feste_form in einheit_m #{einheit_m} matched: #{x}" if $VERBOSE
|
244
|
+
update_rule("feste_form einheit_m")
|
245
|
+
@measure = x
|
246
|
+
# binding.pry if break_condition
|
247
|
+
return pkgSizeToInt(pkg_size_l)
|
248
|
+
end
|
249
|
+
}
|
250
|
+
FLUIDFORMS.each { |x|
|
251
|
+
if part_from_name_c && x.match(part_from_name_c)
|
252
|
+
puts "liquid_form in #{part_from_name_c} matched: #{x}" if $VERBOSE
|
253
|
+
update_rule("liquid_form name_C")
|
254
|
+
@measure = x
|
255
|
+
# binding.pry if break_condition
|
256
|
+
return pkgSizeToInt(pkg_size_l, true)
|
257
|
+
end
|
258
|
+
if part_from_name_c && x.match(part_from_name_c.split(" ")[0])
|
259
|
+
puts "liquid_form in #{part_from_name_c} matched: #{x}" if $VERBOSE
|
260
|
+
update_rule("liquid_form first_part")
|
261
|
+
# binding.pry if break_condition
|
262
|
+
return pkgSizeToInt(pkg_size_l, true)
|
263
|
+
end
|
264
|
+
if einheit_m && x.eql?(einheit_m)
|
265
|
+
puts "liquid_form in einheit_m #{einheit_m} matched: #{x}" if $VERBOSE
|
266
|
+
update_rule("liquid_form einheit_m")
|
267
|
+
@measure = x
|
268
|
+
# binding.pry if break_condition
|
269
|
+
return pkgSizeToInt(pkg_size_l, MEASUREMENTS.find { |x| pkg_size_l.index(" #{x}") })
|
270
|
+
end
|
271
|
+
}
|
272
|
+
MEASUREMENTS.each { |x|
|
273
|
+
if pkg_size_l&.split(" ")&.index(x)
|
274
|
+
puts "measurement in pkg_size_l #{pkg_size_l} matched: #{x}" if $VERBOSE
|
275
|
+
update_rule("measurement pkg_size_l")
|
276
|
+
@measure = x
|
277
|
+
# binding.pry if break_condition
|
278
|
+
return pkgSizeToInt(pkg_size_l, true)
|
279
|
+
end
|
280
|
+
}
|
281
|
+
# binding.pry if break_condition
|
282
|
+
puts "Could not find anything for name_C #{part_from_name_c} pkg_size_l: #{pkg_size_l} einheit_m #{einheit_m}" if $VERBOSE
|
283
|
+
update_rule("unbekannt")
|
284
|
+
"unbekannt"
|
285
|
+
rescue RegexpError
|
286
|
+
puts "RegexpError for M: #{einheit_m} pkg_size_l #{pkg_size_l} C: #{part_from_name_c}"
|
287
|
+
update_rule("RegexpError")
|
288
|
+
"error"
|
289
289
|
end
|
290
290
|
|
291
|
-
def
|
291
|
+
def pkgSizeToInt(pkg_size, skip_last_part = false)
|
292
292
|
return pkg_size if pkg_size.is_a?(Integer)
|
293
293
|
return 1 unless pkg_size
|
294
294
|
parts = pkg_size.split(/\s*x\s*/i)
|
295
|
-
parts = parts[0..-2] if skip_last_part
|
295
|
+
parts = parts[0..-2] if skip_last_part && (parts.size > 1)
|
296
296
|
last_multiplier = parts[-1].to_i > 0 ? parts[-1].to_i : 1
|
297
297
|
if parts.size == 3
|
298
|
-
|
298
|
+
parts[0].to_i * parts[1].to_i * last_multiplier
|
299
299
|
elsif parts.size == 2
|
300
|
-
|
300
|
+
parts[0].to_i * last_multiplier
|
301
301
|
elsif parts.size == 1
|
302
|
-
|
302
|
+
last_multiplier
|
303
303
|
else
|
304
|
-
|
304
|
+
1
|
305
305
|
end
|
306
306
|
end
|
307
307
|
|
308
|
-
def
|
308
|
+
def searchExactGalform(name)
|
309
309
|
return nil unless name
|
310
|
-
if idx = @@galenic_forms.values.find{|x| x.descriptions[
|
311
|
-
|
312
|
-
|
310
|
+
if (idx = @@galenic_forms.values.find { |x| x.descriptions["de"] && x.descriptions["de"].downcase.eql?(name.downcase) }) ||
|
311
|
+
(idx = @@galenic_forms.values.find { |x| x.descriptions["fr"] && x.descriptions["fr"].downcase.eql?(name.downcase) }) ||
|
312
|
+
(idx = @@galenic_forms.values.find { |x| x.descriptions["en"] && x.descriptions["en"].downcase.eql?(name.downcase) })
|
313
313
|
return idx
|
314
314
|
end
|
315
|
-
|
315
|
+
nil
|
316
316
|
end
|
317
317
|
|
318
|
-
def
|
318
|
+
def handleUnknownGalform(gal_form)
|
319
319
|
return if @galenic_form
|
320
320
|
if gal_form
|
321
|
-
@galenic_form =
|
321
|
+
@galenic_form = GalenicForm.new(0, {"de" => remove_duplicated_spaces(gal_form.gsub(" +", " "))}, @@galenic_forms[UNKNOWN_GALENIC_FORM])
|
322
322
|
@@new_galenic_forms << gal_form
|
323
323
|
else
|
324
|
-
@galenic_form = @@galenic_forms[
|
324
|
+
@galenic_form = @@galenic_forms[UNKNOWN_GALENIC_FORM]
|
325
325
|
end
|
326
326
|
end
|
327
327
|
|
328
328
|
def search_galenic_info(gal_form)
|
329
|
-
if idx =
|
329
|
+
if (idx = searchExactGalform(gal_form))
|
330
330
|
return idx
|
331
331
|
end
|
332
|
-
if gal_form
|
332
|
+
if gal_form&.index(",")
|
333
333
|
parts = gal_form.split(/\s+|,/)
|
334
|
-
parts.each{
|
335
|
-
|
336
|
-
if idx = search_exact_galform(part)
|
334
|
+
parts.each { |part|
|
335
|
+
if (idx = searchExactGalform(part))
|
337
336
|
return idx
|
338
337
|
end
|
339
338
|
}
|
340
339
|
elsif gal_form
|
341
|
-
if gal_form.eql?(
|
342
|
-
idx =
|
340
|
+
if gal_form.eql?("capsule")
|
341
|
+
idx = searchExactGalform("capsules")
|
343
342
|
return idx
|
344
343
|
end
|
345
|
-
if idx =
|
344
|
+
if (idx = searchExactGalform(gal_form))
|
346
345
|
return idx
|
347
346
|
end
|
348
347
|
end
|
349
|
-
|
348
|
+
nil
|
350
349
|
end
|
351
350
|
end
|
352
351
|
end
|