oddb2xml 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e34415925083cd7afcbb59f160b901d355f22faf
4
- data.tar.gz: 8f3ba8afe9838a9595a4018323ad6ac0719c90ce
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjA0ZDE5ZTQ1MGZhNDZiYTQ5YTY2ZTEyYTBiOTMwMWJmODQ1ODdjYw==
5
+ data.tar.gz: !binary |-
6
+ OWVlNWVkNzJiYmNkNDk5NWNlOTAyNGRjODBiM2Y1ZjEwZWM1MTIyNg==
5
7
  SHA512:
6
- metadata.gz: 65db04ccb0593a0eac016ed2c7ea9ec5ebaf9131315ef2d95acdc2d8af58223aa21f5f95c4c787ccd4a6c3642cbd5e6659d412936e95a67221fcc4cea64361bf
7
- data.tar.gz: 1c5f35d25a0fe3032df867d891cd3d019071b5a069b7515c272c05a2af166a1edcc48169f28b11591dcf024b26a107e41e940ddb90a6bb9407a458545cc84891
8
+ metadata.gz: !binary |-
9
+ OGNhZWJkMjNhMjBhYmE3NTAyNTcxYzczYTc4NGYzZDcwMGNhYzA2M2QwZThk
10
+ N2IyZmMyNTZlMWU5NDkxOTQ4YmVkNGRjMmYwNjQ3OTZhY2I5NDM3ZTQ2OWYw
11
+ NTFhMmIzZTg3YWYwZTIwNmZlM2VlOTc2YzIzMDg3YjNiZjg3OTg=
12
+ data.tar.gz: !binary |-
13
+ YzQ4NjJjOTU1ZTMzZjRjZmY4OTc3NzM4ZGNlZTdjNDA1NGU0YmU2MDRjMjc4
14
+ NjQ2MjVkNjk1Mzk1MmY2ZjBhNTNmMGVmMjhiNjMyMGRlMWQxMTAxOWE0MGVl
15
+ ZGYwMzhiMzk1Y2U0MWZlZmE3MmZmZmQ0ZDZiZDY4MTJkMWE0NjU=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oddb2xml (2.0.3)
4
+ oddb2xml (2.0.4)
5
5
  archive-tar-minitar (~> 0.5.2)
6
6
  mechanize (~> 2.5.1)
7
7
  nokogiri (~> 1.5.10)
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 2.0.4 / 30.03.2015
2
+
3
+ * --calc now recognizes correct labels, like 'A):' and stops when seeing first ':' in label-description
4
+
1
5
  === 2.0.3 / 25.03.2015
2
6
 
3
7
  * Option -e implies --calc, too.
@@ -20,7 +20,7 @@ module ParseUtil
20
20
  rep_3 = '------'; to_3 = ','
21
21
 
22
22
  comps = []
23
- label_pattern = /^(?<label>A|I|B|II|C|III|D|IV|E|V|F|VI)[)]\s*(?<description>[^)]+):/
23
+ label_pattern = /^(?<label>A|I|B|II|C|III|D|IV|E|V|F|VI)(\):|\))\s*(?<description>[^:]+)/
24
24
  composition_text = composition.gsub(/\r\n?/u, "\n")
25
25
  puts "composition_text for #{name}: #{composition_text}" if composition_text.split(/\n/u).size > 1 and $VERBOSE
26
26
  lines = composition_text.split(/\n/u)
@@ -34,7 +34,8 @@ module ParseUtil
34
34
  label_description = nil
35
35
  end
36
36
  idx += 1
37
- next if idx > 1 and not label # avoid lines like 'I) et II)'
37
+ next if idx > 1 and /^(?<label>A|I|B|II|C|III|D|IV|E|V|F|VI)[)]\s*(et)/.match(line) # avoid lines like 'I) et II)'
38
+ next if idx > 1 and /^Corresp\./i.match(line) # avoid lines like 'Corresp. mineralia: '
38
39
  substances = []
39
40
  filler = line.split(',')[-1].sub(/\.$/, '')
40
41
  filler_match = /^(?<name>[^,\d]+)\s*(?<dose>[\d\-.]+(\s*(?:(Mio\.?\s*)?(U\.\s*Ph\.\s*Eur\.|[^\s,]+))))/.match(filler)
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "2.0.3"
2
+ VERSION = "2.0.4"
3
3
  end
data/spec/calc_spec.rb CHANGED
@@ -315,6 +315,7 @@ Corresp. 5300 kJ.",
315
315
  XPath.match( doc, "//ARTICLE[GTIN='7680458820202']/NAME").last.text.should eq 'Magnesiumchlorid 0,5 molar B. Braun, Zusatzampulle für Infusionslösungen'
316
316
  XPath.match( doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL").first.text.should eq 'I'
317
317
  XPath.match( doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL_DESCRIPTION").first.text.should eq 'Glucoselösung'
318
+ XPath.match( doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL").each{ |x| puts x.text }
318
319
  XPath.match( doc, "//ARTICLE[GTIN='7680555940018']/COMPOSITIONS/COMPOSITION/LABEL").last.text.should eq 'III'
319
320
  end
320
321
  end
@@ -433,7 +434,7 @@ Corresp. 5300 kJ.",
433
434
  specify { expect(glucosum.unit).to eq 'g/500 ml'}
434
435
  specify { expect(result.compositions.size).to eq 3}
435
436
  specify { expect(result.compositions[0].substances.size).to eq 3}
436
- specify { expect(result.compositions[1].substances.size).to eq 3}
437
+ specify { expect(result.compositions[1].substances.size).to eq 3} # should have glycerolum, natrii oleas, aqua
437
438
  specify { expect(result.compositions[2].substances.size).to eq 4}
438
439
  specify { expect(result.compositions[1].source).to eq Line_2}
439
440
  specify { expect(result.compositions[2].source).to eq Line_3}
@@ -509,4 +510,47 @@ Corresp. 5300 kJ.",
509
510
  specify { expect(procainum.qty).to eq 10.0 }
510
511
  specify { expect(procainum.unit).to eq 'mg/g' }
511
512
  end
513
+
514
+ context 'find correct result compositions for 00613 Pentavac' do
515
+ line_1 = "I) DTPa-IPV-Komponente (Suspension): toxoidum diphtheriae 30 U.I., toxoidum tetani 40 U.I., toxoidum pertussis 25 µg et haemagglutininum filamentosum 25 µg, virus poliomyelitis typus 1 inactivatum (D-Antigen) 40 U., virus poliomyelitis typus 2 inactivatum (D-Antigen) 8 U., virus poliomyelitis typus 3 inactivatum (D-Antigen) 32 U., aluminium ut aluminii hydroxidum hydricum ad adsorptionem, formaldehydum 10 µg, conserv.: phenoxyethanolum 2.5 µl, residui: neomycinum, streptomycinum, polymyxini B sulfas, medium199, aqua q.s. ad suspensionem pro 0.5 ml."
516
+ line_2 = "II) Hib-Komponente (Lyophilisat): haemophilus influenzae Typ B polysaccharida T-conjugatum 10 µg, trometamolum, saccharum, pro praeparatione."
517
+ txt = "#{line_1}\n#{line_2}"
518
+ info = ParseUtil.parse_compositions(txt)
519
+ specify { expect(info.first.label).to eq 'I' }
520
+ specify { expect(info.size).to eq 2 }
521
+ specify { expect(info.first.substances.size).to eq 6 }
522
+ toxoidum = info.first.substances.find{ |x| x.name.match(/Toxoidum Diphtheriae/i) }
523
+ specify { expect(toxoidum.name).to eq 'Toxoidum Diphtheriae' }
524
+ specify { expect(toxoidum.qty).to eq 30.0 }
525
+ specify { expect(toxoidum.unit).to eq 'U.I./ml' }
526
+ end
527
+
528
+ context 'find correct result compositions for poloxamerum' do
529
+ line_1 = "I): albuminum humanum colloidale 0.5 mg, stanni(II) chloridum dihydricum 0.2 mg, glucosum anhydricum, dinatrii phosphas monohydricus, natrii fytas (9:1), poloxamerum 238, q.s. ad pulverem pro vitro."
530
+ line_2 = "II): pro usu: I) recenter radioactivatum 99m-technetio ut natrii pertechnetas."
531
+ text = "#{line_1}\n#{line_2}"
532
+ info = Calc.new('Nanocoll, Markierungsbesteck', nil, nil,
533
+ 'albuminum humanum colloidale, stanni(II) chloridum dihydricum',
534
+ text
535
+ )
536
+ # pp info; binding.pry
537
+ specify { expect(info.compositions.size).to eq 2 }
538
+ specify { expect(info.compositions.first.substances.size).to eq 2 }
539
+ poloxamerum = info.compositions.first.substances.find{ |x| x.name.match(/poloxamerum/i) }
540
+ skip { expect(poloxamerum.name).to eq 'Poloxamerum 238' }
541
+ skip { expect(poloxamerum.qty).to eq "" }
542
+ specify { expect(poloxamerum.unit).to eq "" }
543
+ end
544
+
545
+ context 'find correct result for 61676 Phostal 3-Bäume A): ' do
546
+ text = "A): pollinis allergeni extractum 0.01 U.: betula pendula Roth 25 % et alnus glutinosa 25 % et corylus avellana 25 % et fraxinus excelsior 25 %, natrii chloridum, glycerolum, tricalcii phosphas, conserv.: phenolum 4.0 mg, aqua q.s. ad suspensionem pro 1 ml"
547
+ info = Calc.new('Phostal 3-Bäume', nil, nil,
548
+ 'pollinis allergeni extractum',
549
+ text
550
+ )
551
+ # pp info; binding.pry
552
+ specify { expect(info.compositions.size).to eq 1 }
553
+ specify { expect(info.compositions.first.label).to eq 'A' }
554
+ end
555
+
512
556
  end
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: 2.0.3
4
+ version: 2.0.4
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-25 00:00:00.000000000 Z
11
+ date: 2015-03-31 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
@@ -291,17 +291,17 @@ require_paths:
291
291
  - lib
292
292
  required_ruby_version: !ruby/object:Gem::Requirement
293
293
  requirements:
294
- - - ">="
294
+ - - ! '>='
295
295
  - !ruby/object:Gem::Version
296
296
  version: '0'
297
297
  required_rubygems_version: !ruby/object:Gem::Requirement
298
298
  requirements:
299
- - - ">="
299
+ - - ! '>='
300
300
  - !ruby/object:Gem::Version
301
301
  version: '0'
302
302
  requirements: []
303
303
  rubyforge_project:
304
- rubygems_version: 2.4.5
304
+ rubygems_version: 2.3.0
305
305
  signing_key:
306
306
  specification_version: 4
307
307
  summary: oddb2xml creates xml files.