oddb2xml 2.7.4 → 2.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -2
- data/History.txt +7 -0
- data/lib/oddb2xml/compositions_syntax.rb +4 -1
- data/lib/oddb2xml/downloader.rb +1 -1
- data/lib/oddb2xml/parslet_compositions.rb +4 -2
- data/lib/oddb2xml/version.rb +1 -1
- data/oddb2xml.gemspec +3 -2
- data/shell.nix +17 -0
- data/spec/builder_spec.rb +2 -1
- data/spec/fixtures/vcr_cassettes/oddb2xml.json +1 -1
- data/spec/parslet_spec.rb +65 -4
- metadata +26 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b92ef261a1ad3ea6a8e2ce6d60302b0acf4c50efe1897ec9379633d31c5cced
|
4
|
+
data.tar.gz: ebaca1d2e02274a59b416e407a1049662564b48abb474f28de50b00f5b250147
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db2fe198ad3ace938014038ab1260c2351113c93b67bceed5148352aac9e8c5c4596fd7beb310869913e2dafcecb93da1abc1836b2296a8bab514e5937a47fce
|
7
|
+
data.tar.gz: 3a41d7685173bc57d9dfd0618f179ac0405140d203b50b2e750a97ebe438d2a285858972e081724d1ab525f4f106b22b7b673d2fa5511790b87287eac8e5609b
|
data/.github/workflows/ruby.yml
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== 2.7.5 / 1.02.2022
|
2
|
+
* Specify old versions of savon and rdoc to avoid importing psych
|
3
|
+
* Added ruby 3.1 to tested ruby versions
|
4
|
+
* Removed ruby 2.5 from supported versions
|
5
|
+
* Force psych to < 4.0 to avoid the error Psych::DisallowedClass: Tried to load unspecified class: Struct::GalenicGroup
|
6
|
+
* Therefor rdoc < 6.4
|
7
|
+
|
1
8
|
=== 2.7.4 / 30.03.2021
|
2
9
|
* Update needed Ruby-Version to 2.5.0 in gemspec
|
3
10
|
* Ensure downloads directory is created at first run
|
@@ -213,7 +213,6 @@ class CompositionParser < Parslet::Parser
|
|
213
213
|
str("et ") |
|
214
214
|
str("excipiens") |
|
215
215
|
str("partes") |
|
216
|
-
str("pro capsula") |
|
217
216
|
str("pro dosi") |
|
218
217
|
str("pro vitroe") |
|
219
218
|
str("q.s. ad ") |
|
@@ -259,6 +258,9 @@ class CompositionParser < Parslet::Parser
|
|
259
258
|
|
260
259
|
rule(:pro_identifiers) {
|
261
260
|
str("ut aqua ad iniectabilia q.s. ad emulsionem pro ") |
|
261
|
+
str("aqua ").maybe >> str("ad iniectabile q.s. ad suspensionem pro ") |
|
262
|
+
str("aqua ").maybe >> str("ad iniectabile q.s. ad solutionem pro ") |
|
263
|
+
str("aqua ").maybe >> str("ad iniectabile ad solutionem pro ") |
|
262
264
|
str("aqua ").maybe >> str("ad iniectabilia q.s. ad solutionem pro ") |
|
263
265
|
str("aqua ").maybe >> str("ad solutionem pro ") |
|
264
266
|
str("aqua ").maybe >> str("q.s. ad emulsionem pro ") |
|
@@ -270,6 +272,7 @@ class CompositionParser < Parslet::Parser
|
|
270
272
|
str("excipiens ad pulverem pro ") |
|
271
273
|
str("excipiens ad solutionem pro ") |
|
272
274
|
str("pro vase ") |
|
275
|
+
str("pro capsula ") |
|
273
276
|
str("q.s. ad pulverem pro ")
|
274
277
|
}
|
275
278
|
rule(:excipiens_dose) {
|
data/lib/oddb2xml/downloader.rb
CHANGED
@@ -243,7 +243,7 @@ module Oddb2xml
|
|
243
243
|
class RefdataDownloader < Downloader
|
244
244
|
def initialize(options = {}, type = :pharma)
|
245
245
|
@type = (type == :pharma ? "Pharma" : "NonPharma")
|
246
|
-
url = "
|
246
|
+
url = "https://refdatabase.refdata.ch/Service/Article.asmx?WSDL"
|
247
247
|
super(options, url)
|
248
248
|
end
|
249
249
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
require "parslet"
|
8
8
|
require "parslet/convenience"
|
9
|
-
|
9
|
+
require_relative "compositions_syntax"
|
10
10
|
VERBOSE_MESSAGES ||= false
|
11
11
|
|
12
12
|
module ParseUtil
|
@@ -101,6 +101,7 @@ module ParseUtil
|
|
101
101
|
rescue => error
|
102
102
|
puts "error #{error}"
|
103
103
|
# binding.pry
|
104
|
+
raise error
|
104
105
|
end
|
105
106
|
end
|
106
107
|
|
@@ -373,6 +374,7 @@ class ParseComposition
|
|
373
374
|
ERRORS_TO_FIX = {
|
374
375
|
/(\d+)\s+-\s*(\d+)/ => '\1-\2',
|
375
376
|
"o.1" => "0.1",
|
377
|
+
/polymerisat(i|um) \d:\d/ => "polymerisatum",
|
376
378
|
/\s+(mg|g) DER:/ => ' \1, DER:',
|
377
379
|
" mind. " => " min. ",
|
378
380
|
" streptococci pyogen. " => " streptococci pyogen ",
|
@@ -384,7 +386,7 @@ class ParseComposition
|
|
384
386
|
/ U\.: (excipiens) / => ' U. \1 ',
|
385
387
|
/ U\.: (alnus|betula|betula|betulae) / => ' U., \1 ',
|
386
388
|
/^(acari allergeni extractum (\(acarus siro\)|).+\s+U\.:)/ => 'A): \1',
|
387
|
-
"Solvens: alprostadilum" => "alprostadilum"
|
389
|
+
"Solvens: alprostadilum" => "alprostadilum",
|
388
390
|
}
|
389
391
|
@@error_handler = ParseUtil::HandleSwissmedicErrors.new(ERRORS_TO_FIX)
|
390
392
|
|
data/lib/oddb2xml/version.rb
CHANGED
data/oddb2xml.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency "minitar" # , '~> 0.5.2'
|
25
25
|
spec.add_dependency "mechanize" # , '~> 2.5.1'
|
26
26
|
spec.add_dependency "nokogiri", ">= 1.8.2"
|
27
|
-
spec.add_dependency "savon"
|
27
|
+
spec.add_dependency "savon" , '~> 2.12.0'
|
28
28
|
spec.add_dependency "spreadsheet" # , '~> 1.0.0'
|
29
29
|
spec.add_dependency "rubyXL", "~> 3.4.0"
|
30
30
|
spec.add_dependency "sax-machine" # , '~> 0.1.0'
|
@@ -44,8 +44,9 @@ Gem::Specification.new do |spec|
|
|
44
44
|
spec.add_development_dependency "rake"
|
45
45
|
spec.add_development_dependency "rspec"
|
46
46
|
spec.add_development_dependency "webmock"
|
47
|
-
spec.add_development_dependency "rdoc"
|
47
|
+
spec.add_development_dependency "rdoc", "~> 6.3.3" # rdoc 6.4 depends on psych 4.0 which breaks savon!
|
48
48
|
spec.add_development_dependency "vcr"
|
49
49
|
spec.add_development_dependency "timecop"
|
50
50
|
spec.add_development_dependency "flexmock"
|
51
|
+
spec.add_development_dependency "psych", "< 4.0.0"
|
51
52
|
end
|
data/shell.nix
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# See https://nixos.wiki/wiki/Packaging/Ruby
|
2
|
+
# A small helper script to get a development version for oddb2xml under NixOS
|
3
|
+
with import <nixpkgs> {};
|
4
|
+
stdenv.mkDerivation {
|
5
|
+
name = "env";
|
6
|
+
buildInputs = [
|
7
|
+
ruby_3_0.devEnv
|
8
|
+
git
|
9
|
+
python
|
10
|
+
libpcap
|
11
|
+
libxml2
|
12
|
+
libxslt
|
13
|
+
pkg-config
|
14
|
+
bundix
|
15
|
+
gnumake
|
16
|
+
];
|
17
|
+
}
|
data/spec/builder_spec.rb
CHANGED
@@ -546,7 +546,8 @@ describe Oddb2xml::Builder do
|
|
546
546
|
it "should flag fridge drugs correctly" do
|
547
547
|
doc = REXML::Document.new IO.read(checkAndGetArticleXmlName)
|
548
548
|
checkAndGetArticleWithGTIN(doc, Oddb2xml::FRIDGE_GTIN)
|
549
|
-
expect(REXML::XPath.match(doc, "//COOL=
|
549
|
+
expect(REXML::XPath.match(doc, "//COOL=").size).to eq 1
|
550
|
+
expect(REXML::XPath.match(doc, "//COOL").first.text).to eq "1"
|
550
551
|
end
|
551
552
|
|
552
553
|
ean_with_drug_index = 7680555610041
|
data/spec/parslet_spec.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
|
-
require "pp"
|
2
1
|
VERBOSE_MESSAGES = false
|
3
|
-
|
4
|
-
|
2
|
+
if File.exists?("#{Dir.pwd}/lib/oddb2xml/parslet_compositions.rb")
|
3
|
+
require_relative "../lib/oddb2xml/parslet_compositions"
|
4
|
+
else
|
5
|
+
puts :ParseFailed
|
6
|
+
require_relative "../src/plugin/parslet_compositions"
|
7
|
+
end
|
8
|
+
|
5
9
|
require "parslet/rig/rspec"
|
10
|
+
require "socket"
|
6
11
|
|
7
12
|
hostname = Socket.gethostbyname(Socket.gethostname).first
|
8
13
|
RUN_ALL_COMPOSITION_TESTS = false # /travis|localhost/i.match(hostname) != nil # takes about five minutes to run!
|
@@ -15,7 +20,6 @@ describe ParseComposition do
|
|
15
20
|
string = "conserv.: E 216, E 218, excipiens pro suppositorio."
|
16
21
|
composition = ParseComposition.from_string(string)
|
17
22
|
# active_agent = ["hynic-[d-phe(1)", "tyr(3)-octeotridum]trifluoroacetum", "acidum ethylendiamini-n,n'-diaceticum"]
|
18
|
-
|
19
23
|
active_substance = "HYNIC-[D-Phe(1)"
|
20
24
|
composition_text = "II) Durchstechflasche 2: acidum ethylendiamini-N,N'-diaceticum 10 mg, dinatrii phosphas dodecahydricus, natrii hydroxidum, pro vitro."
|
21
25
|
composition = ParseUtil.parse_compositions(composition_text, active_substance).first
|
@@ -1290,6 +1294,63 @@ describe ParseComposition do
|
|
1290
1294
|
specify { expect(substance.unit).to eq nil }
|
1291
1295
|
end
|
1292
1296
|
|
1297
|
+
context "should handle 41174" do
|
1298
|
+
string = "triamcinoloni acetonidum 10 mg, carmellosum natricum, natrii chloridum, polysorbatum 80, conserv.: alcohol benzylicus 9.9 mg, aqua ad iniectabile q.s. ad suspensionem pro 1 ml."
|
1299
|
+
composition = ParseComposition.from_string(string)
|
1300
|
+
specify { expect(composition.source).to eq string }
|
1301
|
+
specify { expect(composition.label).to eq nil }
|
1302
|
+
specify { expect(composition.substances.size).to be > 1 }
|
1303
|
+
specify { expect(composition.substances.first.name).to eq "Triamcinoloni Acetonidum" }
|
1304
|
+
specify { expect(composition.substances.last.name).to eq "Alcohol Benzylicus" }
|
1305
|
+
end
|
1306
|
+
|
1307
|
+
context "should handle 67023" do
|
1308
|
+
string = "noradrenalinum 0.06 mg ut noradrenalini tartras, natrii chloridum, acidum hydrochloridum, aqua ad iniectabile q.s. ad solutionem pro 1 ml corresp. natrium 3.308 mg."
|
1309
|
+
composition = ParseComposition.from_string(string)
|
1310
|
+
specify { expect(composition.source).to eq string }
|
1311
|
+
specify { expect(composition.label).to eq nil }
|
1312
|
+
specify { expect(composition.substances.size).to be > 1 }
|
1313
|
+
specify { expect(composition.substances.first.name).to eq "Noradrenalinum" }
|
1314
|
+
specify { expect(composition.substances.last.name).to eq "Acidum Hydrochloridum" }
|
1315
|
+
end
|
1316
|
+
|
1317
|
+
context "should handle 67023" do
|
1318
|
+
string = "noradrenalinum 0.06 mg ut noradrenalini tartras, natrii chloridum, acidum hydrochloridum, aqua ad iniectabile q.s. ad solutionem pro 1 ml corresp. natrium 3.308 mg."
|
1319
|
+
composition = ParseComposition.from_string(string)
|
1320
|
+
specify { expect(composition.source).to eq string }
|
1321
|
+
specify { expect(composition.label).to eq nil }
|
1322
|
+
specify { expect(composition.substances.size).to be > 0 }
|
1323
|
+
specify { expect(composition.substances.first.name).to eq "Noradrenalinum" }
|
1324
|
+
specify { expect(composition.substances.last.name).to eq "Acidum Hydrochloridum" }
|
1325
|
+
end
|
1326
|
+
|
1327
|
+
context "should handle 67689" do
|
1328
|
+
string = "daratumumabum 1800 mg, hyaluronidasum humanum ADNr, histidinum, histidini hydrochloridum monohydricum, sorbitolum 735.1 mg, methioninum, polysorbatum 20, aqua ad iniectabile ad solutionem pro 15 ml"
|
1329
|
+
composition = ParseComposition.from_string(string)
|
1330
|
+
specify { expect(composition.source).to eq string }
|
1331
|
+
specify { expect(composition.label).to eq nil }
|
1332
|
+
specify { expect(composition.substances.size).to be > 0 }
|
1333
|
+
specify { expect(composition.substances.first.name).to eq "Daratumumabum" }
|
1334
|
+
specify { expect(composition.substances.last.name).to eq "Polysorbatum 20" }
|
1335
|
+
end
|
1336
|
+
|
1337
|
+
context "should handle 66097" do
|
1338
|
+
string = "acidum acetylsalicylicum 100 mg, cellulosum microcristallinum, maydis amylum, silica colloidalis anhydrica, acidum stearicum, Überzug: acidi methacrylici et ethylis acrylatis polymerisatum 1:1, polysorbatum 80, natrii laurilsulfas corresp. natrium 2 µg, triethylis citras, talcum pro compresso obducto" # fails
|
1339
|
+
composition = ParseComposition.from_string(string)
|
1340
|
+
specify { expect(composition.source).to eq string }
|
1341
|
+
specify { expect(composition.label).to eq nil }
|
1342
|
+
specify { expect(composition.substances.first.name).to eq "Acidum Acetylsalicylicum" }
|
1343
|
+
specify { expect(composition.substances.last.name).to eq "Talcum pro compresso Obducto" }
|
1344
|
+
end
|
1345
|
+
context "should handle 65828" do
|
1346
|
+
string = " esomeprazolum 20 mg ut esomeprazolum magnesicum dihydricum, acidi methacrylici et ethylis acrylatis polymerisati 1:1 dispersio 30 per centum, natrii laurilsulfas, talcum, triethylis citras, hypromellosum, sacchari sphaerae corresp. saccharum 4.73 mg et maydis amylum, magnesii stearas, hydroxypropylcellulosum, glyceroli monostearas 40-55, polysorbatum 80, cellulosum microcristallinum, povidonum K 29-32, macrogolum 6000, crospovidonum, natrii stearylis fumaras, Überzug: hypromellosum, E 171, macrogolum 400, E 172 (rubrum), E 172 (flavum), pro compresso obducto corresp. natrium 0.01 mg."
|
1347
|
+
composition = ParseComposition.from_string(string)
|
1348
|
+
specify { expect(composition.source).to eq string }
|
1349
|
+
specify { expect(composition.label).to eq nil }
|
1350
|
+
specify { expect(composition.substances.first.name).to eq "Esomeprazolum" }
|
1351
|
+
specify { expect(composition.substances.last.name).to eq "pro compresso Obducto" }
|
1352
|
+
end
|
1353
|
+
|
1293
1354
|
context "should return correct composition for 'minoxidilum excipiens'" do
|
1294
1355
|
string = "minoxidilum 2.5 mg, excipiens pro compresso."
|
1295
1356
|
composition = ParseComposition.from_string(string)
|
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.7.
|
4
|
+
version: 2.7.5
|
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:
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: savon
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 2.12.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
|
-
version:
|
82
|
+
version: 2.12.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: spreadsheet
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -336,16 +336,16 @@ dependencies:
|
|
336
336
|
name: rdoc
|
337
337
|
requirement: !ruby/object:Gem::Requirement
|
338
338
|
requirements:
|
339
|
-
- - "
|
339
|
+
- - "~>"
|
340
340
|
- !ruby/object:Gem::Version
|
341
|
-
version:
|
341
|
+
version: 6.3.3
|
342
342
|
type: :development
|
343
343
|
prerelease: false
|
344
344
|
version_requirements: !ruby/object:Gem::Requirement
|
345
345
|
requirements:
|
346
|
-
- - "
|
346
|
+
- - "~>"
|
347
347
|
- !ruby/object:Gem::Version
|
348
|
-
version:
|
348
|
+
version: 6.3.3
|
349
349
|
- !ruby/object:Gem::Dependency
|
350
350
|
name: vcr
|
351
351
|
requirement: !ruby/object:Gem::Requirement
|
@@ -388,6 +388,20 @@ dependencies:
|
|
388
388
|
- - ">="
|
389
389
|
- !ruby/object:Gem::Version
|
390
390
|
version: '0'
|
391
|
+
- !ruby/object:Gem::Dependency
|
392
|
+
name: psych
|
393
|
+
requirement: !ruby/object:Gem::Requirement
|
394
|
+
requirements:
|
395
|
+
- - "<"
|
396
|
+
- !ruby/object:Gem::Version
|
397
|
+
version: 4.0.0
|
398
|
+
type: :development
|
399
|
+
prerelease: false
|
400
|
+
version_requirements: !ruby/object:Gem::Requirement
|
401
|
+
requirements:
|
402
|
+
- - "<"
|
403
|
+
- !ruby/object:Gem::Version
|
404
|
+
version: 4.0.0
|
391
405
|
description: oddb2xml creates xml files using swissINDEX, BAG-XML and Swissmedic.
|
392
406
|
email: yasaka@ywesee.com, zdavatz@ywesee.com, ngiger@ywesee.com
|
393
407
|
executables:
|
@@ -439,6 +453,7 @@ files:
|
|
439
453
|
- oddb2xml.gemspec
|
440
454
|
- oddb2xml.xsd
|
441
455
|
- oddb_calc.xsd
|
456
|
+
- shell.nix
|
442
457
|
- spec/artikelstamm_spec.rb
|
443
458
|
- spec/builder_spec.rb
|
444
459
|
- spec/calc_spec.rb
|
@@ -529,8 +544,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
529
544
|
- !ruby/object:Gem::Version
|
530
545
|
version: '0'
|
531
546
|
requirements: []
|
532
|
-
|
533
|
-
rubygems_version: 2.7.6.2
|
547
|
+
rubygems_version: 3.3.3
|
534
548
|
signing_key:
|
535
549
|
specification_version: 4
|
536
550
|
summary: oddb2xml creates xml files.
|