oddb2xml 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/History.txt +6 -0
- data/lib/oddb2xml/builder.rb +6 -4
- data/lib/oddb2xml/compositions_syntax.rb +20 -3
- data/lib/oddb2xml/parslet_compositions.rb +1 -0
- data/lib/oddb2xml/version.rb +1 -1
- data/spec/calc_spec.rb +11 -1
- data/spec/composition_syntax_spec.rb +4 -4
- data/spec/data/swissmedic_package-galenic.xlsx +0 -0
- data/spec/parslet_spec.rb +0 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c23ad09144021304d4c843e68e223d7071fa6f45
|
4
|
+
data.tar.gz: 28469d65080b256c22ddece82312e8a580144dfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1741fd3f64f4b735062b4e456e4643b673cb5bf9a31ce4fad59737b95ac3102d35c13d804796947fbc2602f8940d2aa3fe5b46dcb6d886cfb349dc3279f5dc4f
|
7
|
+
data.tar.gz: 6e75c9e2f02ef5811e2f6227bf5c82da6111b5d030aaa2bdbaeda1fd36220b4882d128075070670a7493cc444a60e8f2b39d72c285f11de51f7b69c7352898a5
|
data/Gemfile.lock
CHANGED
data/History.txt
CHANGED
data/lib/oddb2xml/builder.rb
CHANGED
@@ -713,12 +713,14 @@ module Oddb2xml
|
|
713
713
|
info.compositions.each { |composition|
|
714
714
|
xml.COMPOSITION {
|
715
715
|
xml.EXCIPIENS { emit_substance(xml, composition.excipiens) } if composition.excipiens
|
716
|
-
xml.CORRESP composition.corresp if composition.corresp
|
717
716
|
xml.LABEL composition.label if composition.label
|
718
717
|
xml.LABEL_DESCRIPTION composition.label_description if composition.label_description
|
719
|
-
xml.
|
720
|
-
|
721
|
-
|
718
|
+
xml.CORRESP composition.corresp if composition.corresp
|
719
|
+
if composition.substances and composition.substances.size > 0
|
720
|
+
xml.SUBSTANCES {
|
721
|
+
composition.substances.each { |substance| xml.SUBSTANCE { emit_substance(xml, substance, true) }}
|
722
|
+
}
|
723
|
+
end
|
722
724
|
}
|
723
725
|
}
|
724
726
|
}
|
@@ -399,9 +399,6 @@ class CompositionParser < Parslet::Parser
|
|
399
399
|
str('doses ') |
|
400
400
|
str('Pulver: ') |
|
401
401
|
str('Diluens: ') |
|
402
|
-
str('Solvens (i.v.): ') |
|
403
|
-
str('Solvens (i.m.): ') |
|
404
|
-
str('Solvens: ') |
|
405
402
|
str('Solutio reconstituta:') |
|
406
403
|
str('Corresp., ') |
|
407
404
|
str('Corresp. ') |
|
@@ -412,6 +409,13 @@ class CompositionParser < Parslet::Parser
|
|
412
409
|
}
|
413
410
|
rule(:corresp_line_neu) { corresp_label >> any.repeat(1).as(:corresp) }
|
414
411
|
|
412
|
+
rule(:solvens_label) {
|
413
|
+
str('Solvens (i.v.)') |
|
414
|
+
str('Solvens (i.m.)') |
|
415
|
+
str('Solvens')
|
416
|
+
}
|
417
|
+
rule(:solvens_line) { solvens_label.as(:label) >> (str(': ') >> composition.repeat(1).as(:composition) | any.repeat(1).as(:corresp))}
|
418
|
+
|
415
419
|
rule(:multiple_et_line) {
|
416
420
|
((label_id >> label_separator >> space? >> (str('pro usu') |str('et '))).repeat(1) >> any.repeat(1)).as(:corresp)
|
417
421
|
}
|
@@ -425,6 +429,7 @@ class CompositionParser < Parslet::Parser
|
|
425
429
|
composition.as(:composition) }
|
426
430
|
|
427
431
|
rule(:expression_comp) {
|
432
|
+
solvens_line |
|
428
433
|
multiple_et_line |
|
429
434
|
label_id_composition |
|
430
435
|
corresp_line_neu |
|
@@ -435,6 +440,18 @@ class CompositionParser < Parslet::Parser
|
|
435
440
|
space.repeat(3)
|
436
441
|
}
|
437
442
|
|
443
|
+
rule(:expression_compD) {
|
444
|
+
solvens_line |
|
445
|
+
multiple_et_line.as('multiple_et_line') |
|
446
|
+
label_id_composition.as('label_id_composition') |
|
447
|
+
corresp_line_neu.as('corresp_line_neu') |
|
448
|
+
leading_label.maybe >> space? >> composition.as(:composition) >> space? >> str('.').maybe >> space? |
|
449
|
+
polvac.as('polvac') |
|
450
|
+
label_comment_excipiens.as('label_comment_excipiens') |
|
451
|
+
excipiens.as(:composition) |
|
452
|
+
space.repeat(3)
|
453
|
+
}
|
454
|
+
|
438
455
|
root :expression_comp
|
439
456
|
end
|
440
457
|
|
@@ -441,6 +441,7 @@ class ParseComposition
|
|
441
441
|
end
|
442
442
|
result.label_description = label_description.gsub(/:+$/, '').strip if label_description
|
443
443
|
end
|
444
|
+
result.corresp = ast[:corresp].to_s.sub(/:\s+/, '') if not result.corresp and ast.is_a?(Hash) and ast[:corresp]
|
444
445
|
return result
|
445
446
|
end
|
446
447
|
end
|
data/lib/oddb2xml/version.rb
CHANGED
data/spec/calc_spec.rb
CHANGED
@@ -142,6 +142,16 @@ Corresp. 5300 kJ.",
|
|
142
142
|
)
|
143
143
|
|
144
144
|
if RunAllTests
|
145
|
+
context 'should parse Solvens:' do
|
146
|
+
text = 'Solvens: conserv.: alcohol benzylicus 18 mg, aqua ad iniectabilia q.s. ad solutionem pro 2 ml.'
|
147
|
+
info = Calc.new('Solu-Cortef 100 mg, Injektions-/Infusionspräparat', nil, nil,
|
148
|
+
'hydrocortisonum',
|
149
|
+
text
|
150
|
+
)
|
151
|
+
specify { expect(info.compositions.first.substances.first.name).to eq "Alcohol Benzylicus" }
|
152
|
+
specify { expect(info.compositions.first.substances.size).to eq 1 }
|
153
|
+
end
|
154
|
+
|
145
155
|
context "adapt ATC for epha 16105 C05BA" do
|
146
156
|
specify { expect(Oddb2xml.add_epha_changes_for_ATC(16105, 'C05BA')).to eq 'C05BA01' }
|
147
157
|
end
|
@@ -311,9 +321,9 @@ if RunAllTests
|
|
311
321
|
File.exists?(oddb_calc_xsd).should eq true
|
312
322
|
xsd = Nokogiri::XML::Schema(File.read(oddb_calc_xsd))
|
313
323
|
doc = Nokogiri::XML(File.read(xml_file_name))
|
324
|
+
# puts xml; binding.pry
|
314
325
|
xsd.validate(doc).each do |error| expect(error).to be_nil end
|
315
326
|
doc = REXML::Document.new xml
|
316
|
-
# puts xml; binding.pry
|
317
327
|
gtin = '7680540151009'
|
318
328
|
ean12 = '7680' + sprintf('%05d',tst_naropin.iksnr_A) + sprintf('%03d',tst_naropin.pack_K)
|
319
329
|
ean13 = (ean12 + Oddb2xml.calc_checksum(ean12))
|
@@ -23,12 +23,12 @@ let(:parser) { CompositionParser.new }
|
|
23
23
|
let(:substance_name_parser) { parser.substance_name }
|
24
24
|
let(:number_parser) { parser.number }
|
25
25
|
let(:excipiens_parser) { parser.excipiens }
|
26
|
-
let(:composition_parser) { parser
|
26
|
+
let(:composition_parser) { parser }
|
27
27
|
|
28
28
|
it "parses identifier" do
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
text = 'Solvens: conserv.: alcohol benzylicus 18 mg, aqua ad iniectabilia q.s. ad solutionem pro 2 ml.'
|
30
|
+
res1 = composition_parser.parse_with_debug(text)
|
31
|
+
pp res1; binding.pry
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
Binary file
|
data/spec/parslet_spec.rb
CHANGED
@@ -24,23 +24,9 @@ to_add = %(
|
|
24
24
|
pp composition; binding.pry
|
25
25
|
)
|
26
26
|
|
27
|
-
context "should handle failed" do
|
28
|
-
strings = [
|
29
|
-
]
|
30
|
-
strings.each{ |string|
|
31
|
-
composition = ParseComposition.from_string(string)
|
32
|
-
binding.pry if composition.substances.size == 0
|
33
|
-
specify { expect( composition.substances.size).not_to eq 0 }
|
34
|
-
}
|
35
|
-
end
|
36
|
-
|
37
27
|
end
|
38
28
|
|
39
29
|
if RunFailingSpec
|
40
|
-
describe ParseComposition do
|
41
|
-
|
42
|
-
end
|
43
|
-
|
44
30
|
end
|
45
31
|
|
46
32
|
describe ParseComposition do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oddb2xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
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-06-
|
11
|
+
date: 2015-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|