oddb2xml 3.0.34 → 3.0.35
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 +2 -2
- data/CLAUDE.md +3 -1
- data/Gemfile.lock +2 -30
- data/History.txt +6 -1
- data/README.md +3 -2
- data/bin/oddb2xml +3 -0
- data/lib/oddb2xml/builder.rb +7 -2
- data/lib/oddb2xml/downloader.rb +0 -2
- data/lib/oddb2xml/util.rb +8 -0
- data/lib/oddb2xml/version.rb +1 -1
- data/oddb2xml.gemspec +1 -3
- data/spec/builder_spec.rb +13 -5
- data/spec/cli_spec.rb +3 -1
- data/spec/data/transfer.dat +1 -1
- data/spec/spec_helper.rb +9 -0
- metadata +2 -30
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 99321f1703f8ab1645b7cdb4049433c355330f95db7e45d8510c31cd15cf5bc7
|
|
4
|
+
data.tar.gz: 1c5c50119b700ac8591dc087b452cdcf06be4a35382e1b5e2280a7913cd6f5d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 98e7a7a8445bdad56f3d4d722c2243a068167d8242e874d37c4d0e4ad10c2ac14588a84c031e1c279948898602d416ba91be6e59c532e9637de80818a3bc4b06
|
|
7
|
+
data.tar.gz: 993e517ee499b12d448efb16a36f3dd72b4b1d758c7685a33b7cab6ae3b4f72bb0fd1f1ac9eb0aa2f58b7a3493432118e1221734a7b00b2976a3cc6be9ba2d1f
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -22,12 +22,12 @@ jobs:
|
|
|
22
22
|
fail-fast: false
|
|
23
23
|
matrix:
|
|
24
24
|
os: [ubuntu]
|
|
25
|
-
ruby: ["3.
|
|
25
|
+
ruby: ["3.2", "3.3"]
|
|
26
26
|
env:
|
|
27
27
|
BUNDLE_PATH: ".bundle/gems"
|
|
28
28
|
BUNDLE_WITHOUT: "debugger"
|
|
29
29
|
steps:
|
|
30
|
-
- uses: actions/checkout@
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
31
|
- uses: ruby/setup-ruby@v1
|
|
32
32
|
with:
|
|
33
33
|
ruby-version: ${{ matrix.ruby }}
|
data/CLAUDE.md
CHANGED
|
@@ -63,4 +63,6 @@ Only the scripts are git-tracked; the generated `index.html`/`logo.svg` and the
|
|
|
63
63
|
- Framework: RSpec with flexmock (mocking), webmock + VCR (HTTP recording/playback)
|
|
64
64
|
- Test fixtures: `spec/data/` (sample files), `spec/fixtures/vcr_cassettes/` (recorded HTTP responses)
|
|
65
65
|
- `spec/spec_helper.rb` defines test constants (GTINs) and configures VCR to avoid real HTTP calls during tests
|
|
66
|
-
- CI runs on Ruby 3.
|
|
66
|
+
- CI runs on Ruby 3.2 and 3.3 (`.github/workflows/ruby.yml`); 3.0/3.1 cannot resolve the lockfile since `public_suffix` 7 (Feb 2026) and are EOL
|
|
67
|
+
- **Never call `Kernel#exit` inside `lib/`.** Until 02.09.2026 `Builder#prepare_substances` did (`exit 2` when an `-e`/`--artikelstamm` build had no substances). Under rspec that killed the *process* mid-run: the summary still printed, reading e.g. `1193 examples, 0 failures`, but the count was a random fraction of the ~1640 examples and the exit status was 2 — CI had been red on every run for over a year while local runs looked green to anyone reading the summary line instead of `$?`. The trigger was the June-2026 FHIR default: `-e` implies `--fhir`, `epl.bag.admin.ch` was never stubbed, `FhirExtractor added 0 items`, empty substances, exit. Builder now raises `Oddb2xml::NoSubstancesError` (`util.rb`) and only `bin/oddb2xml` turns that into exit status 2, so production keeps its contract and rspec sees an ordinary failure. `mock_downloads` stubs the three NDJSON URLs with `spec/data/fhir/cyramza.ndjson` (one bundle — enough to stay non-empty, not enough for price assertions), and the four CLI specs that assert on SL prices run with `--no-fhir` against the stubbed `Preparations.xml`, which is what they were written for. **When judging a run, read the exit status and the example count, not the failure count.**
|
|
68
|
+
- **Dependabot security jobs (fixed 02.09.2026, `b9e1f09`):** the "bundler in /. for savon/json" runs had failed for months. Two lessons. (a) Dependabot resolves the lockfile against the **lowest** Ruby the gemspec allows — with `required_ruby_version >= 2.5.0` it could not pick json ≥ 2.8 (needs 2.7), so a stale floor silently blocks every security update; the floor is `>= 3.2.0` now. (b) A gem that is only `require`d but never called still carries its advisories: `savon` (two HIGH, GHSA Savon::Model evaluates WSDL operation names) had been dead since the SwissReg migration `4c65a9c` (March 2026), pinned `~> 2.12.0` so the fix 2.17.2 was unreachable. Removing it also removed akami/gyoku/nori/wasabi/httpi/socksify — and exposed that `HTTPI.log = false` in `Downloader#initialize` was loaded only through savon (305 NameErrors), so that line and `httpi` went too. Before bumping a pinned gem, `grep -rn "Savon::"`-style for actual use first. **The published 3.0.34 gem still declares `savon` and `httpi`**, so every `gem install oddb2xml` — including the nightly's step 1 — pulls the vulnerable savon 2.12.1 until 3.0.35 is released. `rubyntlm`, `multi_json` and the two `net/ntlm` requires in `downloader.rb` are the same kind of SOAP-era leftover (zero references), not yet removed.
|
data/Gemfile.lock
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
oddb2xml (3.0.
|
|
4
|
+
oddb2xml (3.0.35)
|
|
5
5
|
csv
|
|
6
6
|
htmlentities
|
|
7
|
-
httpi
|
|
8
7
|
mechanize (>= 2.8.5)
|
|
9
8
|
minitar
|
|
10
9
|
multi_json
|
|
@@ -17,7 +16,6 @@ PATH
|
|
|
17
16
|
rubyXL (~> 3.4.0)
|
|
18
17
|
rubyntlm (>= 0.6.3)
|
|
19
18
|
rubyzip (~> 3.0.1)
|
|
20
|
-
savon (~> 2.12.0)
|
|
21
19
|
sax-machine
|
|
22
20
|
spreadsheet
|
|
23
21
|
standardrb
|
|
@@ -29,14 +27,9 @@ GEM
|
|
|
29
27
|
specs:
|
|
30
28
|
addressable (2.9.0)
|
|
31
29
|
public_suffix (>= 2.0.2, < 8.0)
|
|
32
|
-
akami (1.3.3)
|
|
33
|
-
base64
|
|
34
|
-
gyoku (>= 0.4.0)
|
|
35
|
-
nokogiri
|
|
36
30
|
ast (2.4.3)
|
|
37
31
|
base64 (0.3.0)
|
|
38
32
|
bigdecimal (4.0.1)
|
|
39
|
-
builder (3.3.0)
|
|
40
33
|
byebug (13.0.0)
|
|
41
34
|
reline (>= 0.6.0)
|
|
42
35
|
coderay (1.1.3)
|
|
@@ -48,18 +41,12 @@ GEM
|
|
|
48
41
|
diff-lcs (1.6.2)
|
|
49
42
|
domain_name (0.6.20240107)
|
|
50
43
|
flexmock (3.0.2)
|
|
51
|
-
gyoku (1.4.0)
|
|
52
|
-
builder (>= 2.1.2)
|
|
53
|
-
rexml (~> 3.0)
|
|
54
44
|
hashdiff (1.2.1)
|
|
55
45
|
htmlentities (4.4.2)
|
|
56
46
|
http-cookie (1.1.0)
|
|
57
47
|
domain_name (~> 0.5)
|
|
58
|
-
httpi (2.5.0)
|
|
59
|
-
rack
|
|
60
|
-
socksify
|
|
61
48
|
io-console (0.8.2)
|
|
62
|
-
json (2.
|
|
49
|
+
json (2.21.2)
|
|
63
50
|
language_server-protocol (3.17.0.5)
|
|
64
51
|
lint_roller (1.1.0)
|
|
65
52
|
logger (1.7.0)
|
|
@@ -94,8 +81,6 @@ GEM
|
|
|
94
81
|
racc (~> 1.4)
|
|
95
82
|
nokogiri (1.19.4-arm64-darwin)
|
|
96
83
|
racc (~> 1.4)
|
|
97
|
-
nori (2.7.1)
|
|
98
|
-
bigdecimal
|
|
99
84
|
optimist (3.2.1)
|
|
100
85
|
ox (2.14.23)
|
|
101
86
|
bigdecimal (>= 3.0)
|
|
@@ -165,16 +150,7 @@ GEM
|
|
|
165
150
|
rubyntlm (0.6.5)
|
|
166
151
|
base64
|
|
167
152
|
rubyzip (3.0.2)
|
|
168
|
-
savon (2.12.1)
|
|
169
|
-
akami (~> 1.2)
|
|
170
|
-
builder (>= 2.1.2)
|
|
171
|
-
gyoku (~> 1.2)
|
|
172
|
-
httpi (~> 2.3)
|
|
173
|
-
nokogiri (>= 1.8.1)
|
|
174
|
-
nori (~> 2.4)
|
|
175
|
-
wasabi (~> 3.4)
|
|
176
153
|
sax-machine (1.3.2)
|
|
177
|
-
socksify (1.8.1)
|
|
178
154
|
spreadsheet (1.3.4)
|
|
179
155
|
bigdecimal
|
|
180
156
|
logger
|
|
@@ -198,10 +174,6 @@ GEM
|
|
|
198
174
|
unicode-emoji (~> 4.1)
|
|
199
175
|
unicode-emoji (4.2.0)
|
|
200
176
|
vcr (6.4.0)
|
|
201
|
-
wasabi (3.7.0)
|
|
202
|
-
addressable
|
|
203
|
-
httpi (~> 2.0)
|
|
204
|
-
nokogiri (>= 1.4.2)
|
|
205
177
|
webmock (3.26.1)
|
|
206
178
|
addressable (>= 2.8.0)
|
|
207
179
|
crack (>= 0.3.2)
|
data/History.txt
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
=== 3.0.35 / 02.09.2026
|
|
2
|
+
* Security: drop the savon dependency (two HIGH advisories, GHSA "Savon::Model evaluates WSDL operation names as Ruby source"). It had not been used since the SwissReg migration in 3.0.19 (commit 4c65a9c, March 2026) -- only a require remained -- but the gemspec pin ~> 2.12.0 kept every installer on the vulnerable 2.12.1 and blocked Dependabot's fix to 2.17.2. Removing it also drops akami, gyoku, nori, wasabi, httpi and socksify from the dependency tree; the one leftover reference, HTTPI.log = false in Downloader#initialize, had only ever been loaded through savon and is gone too. json is raised to 2.21.2 (LOW advisory: generator heap buffer overflow when streaming to an IO). 3.0.34 and earlier still declare savon and httpi, so `gem install oddb2xml` on those versions pulls savon 2.12.1 -- upgrade.
|
|
3
|
+
* required_ruby_version is now >= 3.2 (was >= 2.5.0). Ruby 3.0 and 3.1 are end-of-life and have not been able to resolve the lockfile since public_suffix 7 (February 2026); the stale floor also made Dependabot resolve against Ruby 2.5, which is why its json update could never succeed. CI runs on 3.2 and 3.3.
|
|
4
|
+
* Builder no longer calls Kernel#exit when an -e/--extended or --artikelstamm build ends up with no substances; it raises Oddb2xml::NoSubstancesError and bin/oddb2xml turns that into exit status 2 with a message on stderr. The observable behaviour of the command line is unchanged. Inside the spec suite the exit used to kill the rspec process at a random point with a summary line reading "0 failures", which is why the 3.0.34 note claimed a green suite at 1193 examples: that run had been cut short. The suite now runs to completion -- 1639 examples, 0 failures, exit 0 -- on both CI Rubies. The FHIR NDJSON URLs are stubbed in the specs, the four CLI specs asserting on SL prices run with --no-fhir against the BAG Preparations.xml fixture, and the Weleda Kapitel-70 record in spec/data/transfer.dat carries a valid VAT code (2, not 4).
|
|
5
|
+
|
|
1
6
|
=== 3.0.34 / 02.09.2026
|
|
2
7
|
* Bugfix (WeledaSL): pin the encoding of the three runtime CSVs so the Kapitel-70 SL recovery cannot disappear without a trace. WeledaSL.source passed the downloaded content on in whatever encoding the downloader produced; when that is ASCII-8BIT -- any response served without a charset -- the first comparison against a UTF-8 literal raises Encoding::CompatibilityError, and WeledaSL.load rescues every error into an empty Hash. The whole Weleda/WALA recovery (~835 SL products, issue #121) then vanished silently: no <SL_ENTRY>, no BAG group price, and a build that still reported success. All three lists carry non-ASCII (umlauts in the product names, the "-" in the group-price table), so the live path was one charset-less response away from this; it has not happened yet only because raw.githubusercontent.com serves UTF-8. The encoding is now forced in source, as RoggerNames#parse already did, and the bundled fallback is read with an explicit encoding.
|
|
3
|
-
* This was also the last failing spec: artikelstamm_spec.rb:86, the issue #121 regression test, failed because @weleda_sl was empty under webmock and the item was emitted as PHARMATYPE="N" without SL_ENTRY/PPUB.
|
|
8
|
+
* This was also the last failing spec: artikelstamm_spec.rb:86, the issue #121 regression test, failed because @weleda_sl was empty under webmock and the item was emitted as PHARMATYPE="N" without SL_ENTRY/PPUB. That example passes now. (This entry originally claimed the whole suite was green at "1193 examples, 0 failures" -- it was not: the count was a truncated run, killed by a Kernel#exit in Builder with exit status 2, see 3.0.35. GitHub issue #104 was closed on that basis and corrected.)
|
|
4
9
|
|
|
5
10
|
=== 3.0.33 / 26.08.2026
|
|
6
11
|
* Bugfix (Refdata): skip PHARMA articles that carry no barcode instead of losing every single one of them. Refdata started publishing a handful of PHARMA articles without a <DataCarrierIdentifier> in August 2026 -- the Swiss Red Cross blood products under the collective registration 99999 (Erythrozytenkonzentrat & co), which have no GTIN at all. RefdataExtractor#to_hash called .size on that nil, and Cli#download_as rescues the resulting NoMethodError into an Oddb2xml.log call that prints nothing unless --log is given, so all 16'093 Refdata PHARMA articles silently vanished from the feeds while the build still reported success. On mediupdatexml.oddb.org the <SMNO> count in oddb_article.xml fell from ~15'300 to exactly 10'210 and stayed frozen there for twelve days -- the remainder came from the BAG FHIR SL feed -- and then to 50 once the BAG url move (3.0.32) took the FHIR feed away too. Refdata NONPHARMA was never affected, because the product-type check runs before the barcode is read. See GitHub issue #122.
|
data/README.md
CHANGED
|
@@ -136,8 +136,9 @@ FR
|
|
|
136
136
|
|
|
137
137
|
## Supported ruby version
|
|
138
138
|
|
|
139
|
-
You will need
|
|
140
|
-
CI runs on Ruby 3.
|
|
139
|
+
You will need Ruby >= 3.2. Current development happens on Ruby 3.3 (`.ruby-version`).
|
|
140
|
+
CI runs on Ruby 3.2 and 3.3 via GitHub Actions — see the badge above for the latest spec results.
|
|
141
|
+
Ruby 3.0 and 3.1 dropped out with the dependency update of February 2026 (`public_suffix` 7 needs 3.2), and both are end-of-life.
|
|
141
142
|
|
|
142
143
|
|
|
143
144
|
## XSD files
|
data/bin/oddb2xml
CHANGED
data/lib/oddb2xml/builder.rb
CHANGED
|
@@ -277,7 +277,10 @@ module Oddb2xml
|
|
|
277
277
|
@substances.uniq!
|
|
278
278
|
@substances.sort!
|
|
279
279
|
Oddb2xml.log("prepare_substances done. Total #{@substances.size} from #{@items.size} items")
|
|
280
|
-
|
|
280
|
+
if (@options[:extended] || @options[:artikelstamm]) && @substances.empty?
|
|
281
|
+
raise NoSubstancesError, "prepare_substances: no substances from #{@items.size} items -- " \
|
|
282
|
+
"the SL source (FHIR NDJSON or BAG Preparations.xml) yielded nothing, refusing to write an empty feed"
|
|
283
|
+
end
|
|
281
284
|
end
|
|
282
285
|
end
|
|
283
286
|
|
|
@@ -417,7 +420,9 @@ module Oddb2xml
|
|
|
417
420
|
XML_OPTIONS
|
|
418
421
|
) {
|
|
419
422
|
Oddb2xml.log "build_substance #{@substances.size} substances"
|
|
420
|
-
|
|
423
|
+
if (@options[:extended] || @options[:artikelstamm]) && @substances.empty?
|
|
424
|
+
raise NoSubstancesError, "build_substance: no substances to write"
|
|
425
|
+
end
|
|
421
426
|
nbr_records = 0
|
|
422
427
|
@substances.each_with_index do |sub_name, i|
|
|
423
428
|
xml.SB("DT" => "") do
|
data/lib/oddb2xml/downloader.rb
CHANGED
|
@@ -2,7 +2,6 @@ require "net/ntlm/version" # needed to avoid error: uninitialized constant Net::
|
|
|
2
2
|
require "rubyntlm"
|
|
3
3
|
require "mechanize"
|
|
4
4
|
require "zip"
|
|
5
|
-
require "savon"
|
|
6
5
|
require "open-uri"
|
|
7
6
|
|
|
8
7
|
SKIP_MIGEL_DOWNLOADER = true # https://github.com/zdavatz/oddb2xml_files/raw/master/NON-Pharma.xls
|
|
@@ -49,7 +48,6 @@ module Oddb2xml
|
|
|
49
48
|
@options = options
|
|
50
49
|
@url = url
|
|
51
50
|
@retry_times = 3
|
|
52
|
-
HTTPI.log = false # disable httpi warning
|
|
53
51
|
Oddb2xml.log "Downloader from #{@url} for #{self.class}"
|
|
54
52
|
init
|
|
55
53
|
end
|
data/lib/oddb2xml/util.rb
CHANGED
|
@@ -7,6 +7,14 @@ module Oddb2xml
|
|
|
7
7
|
# Raised when a downloaded archive (zip/xlsx) is empty or truncated, so the
|
|
8
8
|
# caller can retry the download instead of crashing later in the parser.
|
|
9
9
|
class IncompleteDownloadError < StandardError; end
|
|
10
|
+
# Raised by Builder when an -e/--extended or --artikelstamm build ends up with
|
|
11
|
+
# no substances at all: the SL source (FHIR NDJSON or BAG Preparations.xml)
|
|
12
|
+
# came back empty, so the feed would be useless. bin/oddb2xml turns it into
|
|
13
|
+
# exit status 2; under RSpec it is an ordinary exception. Builder used to call
|
|
14
|
+
# Kernel#exit here, which killed the host process -- inside rspec that ended
|
|
15
|
+
# the run after a random number of examples with a summary line reading
|
|
16
|
+
# "0 failures", so the suite looked green for months while exiting 2.
|
|
17
|
+
class NoSubstancesError < StandardError; end
|
|
10
18
|
|
|
11
19
|
def self.gen_prodno(iksnr, seqnr)
|
|
12
20
|
sprintf("%05d", iksnr) + sprintf("%02d", seqnr)
|
data/lib/oddb2xml/version.rb
CHANGED
data/oddb2xml.gemspec
CHANGED
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
|
15
15
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
16
16
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
17
17
|
spec.require_paths = ["lib"]
|
|
18
|
-
spec.required_ruby_version = ">= 2.
|
|
18
|
+
spec.required_ruby_version = ">= 3.2.0"
|
|
19
19
|
|
|
20
20
|
# We fix the version of the spec to newer versions only in the third position
|
|
21
21
|
# hoping that these version fix only security/severe bugs
|
|
@@ -28,14 +28,12 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
# while Ruby 3.1 (EOL but still in production) can install 1.18.10, the newest 3.1-compatible
|
|
29
29
|
# release. oddb2xml uses no nokogiri 1.19-only API and no CSS/XSLT/C14N on untrusted input.
|
|
30
30
|
spec.add_dependency "nokogiri", ">= 1.18.10"
|
|
31
|
-
spec.add_dependency "savon" , '~> 2.12.0'
|
|
32
31
|
spec.add_dependency "spreadsheet" # , '~> 1.0.0'
|
|
33
32
|
spec.add_dependency "rubyXL", "~> 3.4.0"
|
|
34
33
|
spec.add_dependency "sax-machine" # , '~> 0.1.0'
|
|
35
34
|
spec.add_dependency "parslet" # , '~> 1.7.0'
|
|
36
35
|
spec.add_dependency "rubyntlm", ">= 0.6.3"
|
|
37
36
|
spec.add_dependency "multi_json" # , '>= 0.3.2'
|
|
38
|
-
spec.add_dependency "httpi" # , '>= 2.4.1'
|
|
39
37
|
spec.add_dependency "optimist"
|
|
40
38
|
spec.add_dependency "xml-simple"
|
|
41
39
|
spec.add_dependency "ox"
|
data/spec/builder_spec.rb
CHANGED
|
@@ -451,7 +451,9 @@ def checkProductXml(nbr_record = -1)
|
|
|
451
451
|
expect(hirudoid.elements["ATC"].text).to eq("C05BA01") # modified by atc.csv!
|
|
452
452
|
end
|
|
453
453
|
|
|
454
|
-
|
|
454
|
+
# 81 since 3.0.21: spec/data/transfer.dat gained the Weleda Kapitel-70 record
|
|
455
|
+
# 7611916162404 (issue #121), which -e emits as a ZurRose-only article.
|
|
456
|
+
NR_EXTENDED_ARTICLES = 81
|
|
455
457
|
NR_SUBSTANCES = 28
|
|
456
458
|
NR_LIMITATIONS = 15
|
|
457
459
|
|
|
@@ -685,7 +687,9 @@ describe Oddb2xml::Builder do
|
|
|
685
687
|
context "when --append -I 80 -e is given" do
|
|
686
688
|
before(:all) do
|
|
687
689
|
common_run_init
|
|
688
|
-
|
|
690
|
+
# --no-fhir: the assertions below come from the stubbed BAG Preparations.xml;
|
|
691
|
+
# the FHIR stub in mock_downloads is a single bundle (see spec_helper).
|
|
692
|
+
options = Oddb2xml::Options.parse("--append -I 80 -e --no-fhir")
|
|
689
693
|
Oddb2xml::Cli.new(options).run
|
|
690
694
|
# @res = buildr_capture(:stdout){ Oddb2xml::Cli.new(options).run }
|
|
691
695
|
end
|
|
@@ -734,7 +738,9 @@ describe Oddb2xml::Builder do
|
|
|
734
738
|
context "when option -e is given" do
|
|
735
739
|
before(:all) do
|
|
736
740
|
common_run_init
|
|
737
|
-
|
|
741
|
+
# --no-fhir: the assertions below come from the stubbed BAG Preparations.xml;
|
|
742
|
+
# the FHIR stub in mock_downloads is a single bundle (see spec_helper).
|
|
743
|
+
options = Oddb2xml::Options.parse("-e --no-fhir")
|
|
738
744
|
puts options
|
|
739
745
|
@cli = Oddb2xml::Cli.new(options)
|
|
740
746
|
if RUN_ALL
|
|
@@ -853,7 +859,7 @@ describe Oddb2xml::Builder do
|
|
|
853
859
|
dscrds = REXML::XPath.match(doc, "//ART")
|
|
854
860
|
expect(dscrds.size).to eq(NR_EXTENDED_ARTICLES)
|
|
855
861
|
expect(REXML::XPath.match(doc, "//PHAR").count { |x| x.text.match("0000000") }).to eq(0) # 0 is not a valid pharmacode
|
|
856
|
-
expect(REXML::XPath.match(doc, "//PHAR").count { |x| x.text.match(/\d+/) }).to eq 66
|
|
862
|
+
expect(REXML::XPath.match(doc, "//PHAR").count { |x| x.text.match(/\d+/) }).to eq 67 # 66 + the Weleda record
|
|
857
863
|
end
|
|
858
864
|
|
|
859
865
|
it "should have a correct NBR_RECORD in oddb_limitation.xml" do
|
|
@@ -912,7 +918,9 @@ describe Oddb2xml::Builder do
|
|
|
912
918
|
context "testing -e -I 80 option" do
|
|
913
919
|
before(:all) do
|
|
914
920
|
common_run_init
|
|
915
|
-
|
|
921
|
+
# --no-fhir: the assertions below come from the stubbed BAG Preparations.xml;
|
|
922
|
+
# the FHIR stub in mock_downloads is a single bundle (see spec_helper).
|
|
923
|
+
options = Oddb2xml::Options.parse("-e -I 80 --log --no-fhir")
|
|
916
924
|
# @res = buildr_capture(:stdout){ Oddb2xml::Cli.new(options).run }
|
|
917
925
|
@res = Oddb2xml::Cli.new(options).run
|
|
918
926
|
end
|
data/spec/cli_spec.rb
CHANGED
|
@@ -184,7 +184,9 @@ describe Oddb2xml::Cli do
|
|
|
184
184
|
context "when -e and -f dat option is given" do
|
|
185
185
|
before(:all) do
|
|
186
186
|
cleanup_directories_before_run
|
|
187
|
-
|
|
187
|
+
# --no-fhir: the assertions below come from the stubbed BAG Preparations.xml;
|
|
188
|
+
# the FHIR stub in mock_downloads is a single bundle (see spec_helper).
|
|
189
|
+
options = Oddb2xml::Options.parse("-e -f dat --no-fhir")
|
|
188
190
|
@cli = Oddb2xml::Cli.new(options)
|
|
189
191
|
@cli_output = buildr_capture(:stdout) { @cli.run }
|
|
190
192
|
end
|
data/spec/data/transfer.dat
CHANGED
|
@@ -72,4 +72,4 @@
|
|
|
72
72
|
1130361821SEROCYTOL Kolon Supp 3 Stk 002275003960401B080700076800027800132
|
|
73
73
|
1131770177VARILRIX Trockensub c Solv (alt) Fertspr 0.5 ml 004768006650101B080800076800058500102
|
|
74
74
|
1127766692VARILRIX Trockensub c Solv Fertspr 0.5 ml 004767006650101B080800076800058500342
|
|
75
|
-
1111019849Absinthium ethanol Infusum D1 Tropfen 50 ml
|
|
75
|
+
1111019849Absinthium ethanol Infusum D1 Tropfen 50 ml 002000000000300B080160076119161624042
|
data/spec/spec_helper.rb
CHANGED
|
@@ -260,6 +260,15 @@ def mock_downloads
|
|
|
260
260
|
"https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/weleda_arzneimittel.csv" => "weleda_arzneimittel.csv",
|
|
261
261
|
"https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/wala_arzneimittel.csv" => "wala_arzneimittel.csv",
|
|
262
262
|
"https://raw.githubusercontent.com/zdavatz/oddb2xml_files/master/bag_sl_group_prices.csv" => "bag_sl_group_prices.csv",
|
|
263
|
+
# The FHIR NDJSON, default SL source for -e/-b since June 2026. It was never
|
|
264
|
+
# stubbed: webmock refused epl.bag.admin.ch, FhirExtractor added 0 items and
|
|
265
|
+
# Builder called Kernel#exit 2, which killed rspec mid-run with a summary
|
|
266
|
+
# line reading "0 failures". One real bundle keeps the extractor non-empty;
|
|
267
|
+
# specs asserting on SL prices/limitations pass --no-fhir and use
|
|
268
|
+
# Preparations.xml instead.
|
|
269
|
+
"https://epl.bag.admin.ch/static/sl/publication/fhir/foph-sl-publication-latest-de.ndjson" => "fhir/cyramza.ndjson",
|
|
270
|
+
"https://epl.bag.admin.ch/static/sl/publication/fhir/foph-sl-publication-latest-fr.ndjson" => "fhir/cyramza.ndjson",
|
|
271
|
+
"https://epl.bag.admin.ch/static/sl/publication/fhir/foph-sl-publication-latest-it.ndjson" => "fhir/cyramza.ndjson",
|
|
263
272
|
"http://www.xn--spezialittenliste-yqb.ch/File.axd?file=XMLPublications.zip" => "XMLPublications.zip",
|
|
264
273
|
"https://www.spezialitaetenliste.ch/File.axd?file=XMLPublications.zip" => "XMLPublications.zip",
|
|
265
274
|
"https://files.refdata.ch/simis-public-prod/Articles/1.0/Refdata.Articles.zip" => "Refdata.Articles.zip",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: oddb2xml
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.35
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger
|
|
@@ -65,20 +65,6 @@ dependencies:
|
|
|
65
65
|
- - ">="
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: 1.18.10
|
|
68
|
-
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: savon
|
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - "~>"
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: 2.12.0
|
|
75
|
-
type: :runtime
|
|
76
|
-
prerelease: false
|
|
77
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - "~>"
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: 2.12.0
|
|
82
68
|
- !ruby/object:Gem::Dependency
|
|
83
69
|
name: spreadsheet
|
|
84
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -163,20 +149,6 @@ dependencies:
|
|
|
163
149
|
- - ">="
|
|
164
150
|
- !ruby/object:Gem::Version
|
|
165
151
|
version: '0'
|
|
166
|
-
- !ruby/object:Gem::Dependency
|
|
167
|
-
name: httpi
|
|
168
|
-
requirement: !ruby/object:Gem::Requirement
|
|
169
|
-
requirements:
|
|
170
|
-
- - ">="
|
|
171
|
-
- !ruby/object:Gem::Version
|
|
172
|
-
version: '0'
|
|
173
|
-
type: :runtime
|
|
174
|
-
prerelease: false
|
|
175
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
176
|
-
requirements:
|
|
177
|
-
- - ">="
|
|
178
|
-
- !ruby/object:Gem::Version
|
|
179
|
-
version: '0'
|
|
180
152
|
- !ruby/object:Gem::Dependency
|
|
181
153
|
name: optimist
|
|
182
154
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -604,7 +576,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
604
576
|
requirements:
|
|
605
577
|
- - ">="
|
|
606
578
|
- !ruby/object:Gem::Version
|
|
607
|
-
version: 2.
|
|
579
|
+
version: 3.2.0
|
|
608
580
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
609
581
|
requirements:
|
|
610
582
|
- - ">="
|