oddb2xml 2.4.0 → 2.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ee7a2f5a9b16cb824676ba720cfc37bf14f293d
4
- data.tar.gz: 3e75b9996fe29533d5479899630fa5b3e48a05f4
3
+ metadata.gz: 3e9bbe51b5e926b39ac2d60f3131cf854703eac9
4
+ data.tar.gz: 27cd61843652cc26ce542615055bd39cd41a0cb3
5
5
  SHA512:
6
- metadata.gz: 2f8d17701b4cd24180ceb9ad11350ffe23b821e39bab8cde731f1e008a49eb52face6cc760c6dfcb76dbdc003260cb5eefbc0557ec68b0cd93b8b9d2443d54a6
7
- data.tar.gz: 6157bec8affd1492a2858368bf454dca7e247cfa7bf157e6236a863eba3dcb342968c2376eb1e9f6ff2d1efcd4359c018e61a1b103e94ee584db99d3fb358ffa
6
+ metadata.gz: 2b0b479e5d411f4606bb6ce812d08fa772c35b768c1917cccc1eb2efb00eddb5ab1e8cb00757793bf7a1eb1ca9327810185b2a5d13cdfb422783e6ad8693889e
7
+ data.tar.gz: 4e98bd8c9dac033feca963ce14a9259d4cddde04952a69ff600262ebde59f6583862f44b8c2bf152af0508c814adbbf77b2a1eee218b7bbfc23ac46eb5f8cc5e
@@ -68,18 +68,21 @@ module ParseUtil
68
68
  active_agents = active_agents_string ? active_agents_string.downcase.split(/,\s+/) : []
69
69
  comps = []
70
70
  lines = composition_text.gsub(/\r\n?/u, "\n").split(/\n/u)
71
- lines.select {
71
+ lines.select do
72
72
  |line|
73
73
  composition = ParseComposition.from_string(line)
74
74
  if composition.is_a?(ParseComposition)
75
- composition.substances.each {
75
+ composition.substances.each do
76
76
  |substance_item|
77
77
  substance_item.is_active_agent = (active_agents.find {|x| x.downcase.eql?(substance_item.name.downcase) } != nil)
78
78
  substance_item.is_active_agent = true if substance_item.chemical_substance and active_agents.find {|x| x.downcase.eql?(substance_item.chemical_substance.name.downcase) }
79
- }
79
+ # next line is an ugly hack for 24 entries with names containing commas between brackets, eg.
80
+ # globulina equina (immunisé avec coeur, tissu pulmonaire, reins de porcins)
81
+ substance_item.is_active_agent = true if /globulina equina/.match(substance_item.name.downcase)
82
+ end
80
83
  comps << composition
81
84
  end
82
- }
85
+ end
83
86
  comps << ParseComposition.new(composition_text.split(/,|:|\(/)[0]) if comps.size == 0
84
87
  comps
85
88
  end
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "2.4.0"
2
+ VERSION = "2.4.1"
3
3
  end
data/oddb2xml.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.description = "oddb2xml creates xml files using swissINDEX, BAG-XML and Swissmedic."
12
12
  spec.summary = "oddb2xml creates xml files."
13
13
  spec.homepage = "https://github.com/zdavatz/oddb2xml"
14
- spec.license = "GPL-v2"
14
+ spec.license = "GPL-3.0"
15
15
  spec.files = `git ls-files -z`.split("\x0")
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
@@ -558,12 +558,10 @@ describe Oddb2xml::MedregbmDownloader do
558
558
  @downloader.download
559
559
  }
560
560
  it 'should return valid String' do
561
- pending 'Should handle SSL issues'
562
561
  expect(txt).to be_a String
563
562
  expect(txt.bytes).not_to be nil
564
563
  end
565
564
  it 'should clean up current directory' do
566
- pending 'Should handle SSL issues'
567
565
  expect { txt }.not_to raise_error
568
566
  expect(File.exist?('oddb_person.xls')).to eq(false)
569
567
  end
data/spec/parslet_spec.rb CHANGED
@@ -709,11 +709,24 @@ describe ParseComposition do
709
709
 
710
710
  context "should parse a complex composition" do
711
711
  string = 'globulina equina (immunisé avec coeur) 8 mg'
712
+ composition = ParseUtil.parse_compositions(string).first
713
+ specify { expect(composition.substances.size).to eq 1 }
714
+ globulina = composition.substances.find{ |x| /globulina/i.match(x.name) }
715
+ specify { expect(globulina.name).to eq 'Globulina Equina (immunisé Avec Coeur)' }
716
+ specify { expect(globulina.is_active_agent).to eq true }
717
+ specify { expect(globulina.qty).to eq 8 }
718
+ specify { expect(globulina.unit).to eq 'mg' }
719
+ end
720
+
721
+ context "should parse globulina equina (immunise" do
712
722
  string = 'globulina equina (immunisé avec coeur, tissu pulmonaire, reins de porcins) 8 mg'
713
- composition = ParseComposition.from_string(string)
723
+ composition = ParseUtil.parse_compositions(string).first
714
724
  specify { expect(composition.substances.size).to eq 1 }
715
725
  globulina = composition.substances.find{ |x| /globulina/i.match(x.name) }
716
726
  specify { expect(globulina.name).to eq 'Globulina Equina (immunisé Avec Coeur, Tissu Pulmonaire, Reins De Porcins)' }
727
+ specify { expect(globulina.is_active_agent).to eq true }
728
+ specify { expect(globulina.qty).to eq 8 }
729
+ specify { expect(globulina.unit).to eq 'mg' }
717
730
  end
718
731
 
719
732
  context "should return correct composition for containing '(acarus siro)" 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.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-25 00:00:00.000000000 Z
11
+ date: 2016-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -368,7 +368,7 @@ files:
368
368
  - tools/win_fetch_cacerts.rb
369
369
  homepage: https://github.com/zdavatz/oddb2xml
370
370
  licenses:
371
- - GPL-v2
371
+ - GPL-3.0
372
372
  metadata: {}
373
373
  post_install_message:
374
374
  rdoc_options: []