oddb2xml 3.0.6 → 3.0.7

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
  SHA256:
3
- metadata.gz: 8b3a91c4a9ff36983011294c705fd882a5cf2a7f60f972cd1e2de61877e353db
4
- data.tar.gz: 7eb411ee5192d1a1eec417536e62761c5cbb833a075221ae283f1de577f5a4f6
3
+ metadata.gz: 6c01ea6ec31975e297588db6fe417753aed570dc5ddf6123facf03a21224adf5
4
+ data.tar.gz: 74074f93366162137d62bca64833e98564137f80dde6481f567dd844b0d0ae14
5
5
  SHA512:
6
- metadata.gz: 92721b900cb1f754d87463c8a22fd552eabceee1ec12e16aca202084bfd18fa03f4def7ea3c2232ba4598d225c49f165a9c49cf995aae54f9a655d8551cb7267
7
- data.tar.gz: ef7383d72a3535996c70d9d723b12649b09927cff97b9575e49f15553c87c92d142c940eded2fd22d4ef8399bf6f7d2538c72e413623485150837bfa43d0faf1
6
+ metadata.gz: 1ab9e25407b856b59ae06f1ec07ae93cf462ba0dfda587cf7f6e8dd22440e44df22ca67e49d4144ac60e27e7fc9cc8eccd7ee0b5888cec0ee32782a02cf0b48c
7
+ data.tar.gz: da022887409106853d0c8c114a337edcae566d5573f7febc8e34642e923269790192d87519144324e90bf93df78f187b12bcf6f7ca28429781d23ff28dcaff99
data/CLAUDE.md CHANGED
@@ -47,7 +47,7 @@ The system follows a **download → extract → build → compress** pipeline:
47
47
 
48
48
  6. **Compressor** (`lib/oddb2xml/compressor.rb`) — Optional ZIP/TAR.GZ output compression.
49
49
 
50
- 7. **FHIR support** (`lib/oddb2xml/fhir_support.rb`) — Self-contained module providing `FhirDownloader` and FHIR NDJSON parsing. Activated via `--fhir` (or `--fhir-url=<URL>`). Downloads per-language NDJSON files (`foph-sl-export-latest-{de,fr,it}.ndjson`) from `epl.bag.admin.ch` to populate French and Italian product names/descriptions. Maps legal status codes `756005022007` and `756005022008` to Swissmedic category D.
50
+ 7. **FHIR support** (`lib/oddb2xml/fhir_support.rb`) — Self-contained module providing `FhirDownloader` and FHIR NDJSON parsing. Activated via `--fhir` (or `--fhir-url=<URL>`). Downloads per-language NDJSON files (`foph-sl-export-latest-{de,fr,it}.ndjson`) from `epl.bag.admin.ch` to populate French and Italian product names/descriptions. Maps legal status codes `756005022007` and `756005022008` to Swissmedic category D. Parses `ClinicalUseDefinition` resources and combines each indication's `.NN` id-suffix with the reimbursement RA's `FOPHDossierNumber` to construct the BAG **Indikationscode** (`XXXXX.NN`); exposed as `item[:indication_codes]` and per-package `:indication_codes` (each entry a `{code:, cud_id:, text:}` hash). From 3.0.7 onwards, `Builder#build_product` emits one `<INDICATION_CODE code="XXXXX.NN" cud_id="DRUG.NN">limitation text</INDICATION_CODE>` child per indication on every `<PRD>` in `oddb_product.xml`; live feed numbers: 539 products / 1,293 codes / 100 % with non-empty indication text. Mandatory on prescriptions/invoices for SL price-model drugs from 2026-07-01 — see issue [#113](https://github.com/zdavatz/oddb2xml/issues/113).
51
51
 
52
52
  8. **Refdata cleanup** (`lib/oddb2xml/refdata_cleanup.rb`) — Compensates for known data-quality issues in upstream Refdata.Articles.xml before they reach the output. Each fix is guarded by a Swissmedic-side heuristic (e.g. comma in `substance_swissmedic` to distinguish mono products from real combinations). Currently fixes the doubled-dose template bug (`X mg / X mg / Stk`). Called from `Builder#apply_refdata_description_cleanups!` at the start of `prepare_articles`. See GitHub issue #112 for the catalogue.
53
53
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- oddb2xml (3.0.6)
4
+ oddb2xml (3.0.7)
5
5
  csv
6
6
  htmlentities
7
7
  httpi
@@ -27,7 +27,7 @@ PATH
27
27
  GEM
28
28
  remote: https://rubygems.org/
29
29
  specs:
30
- addressable (2.8.8)
30
+ addressable (2.9.0)
31
31
  public_suffix (>= 2.0.2, < 8.0)
32
32
  akami (1.3.3)
33
33
  base64
@@ -59,7 +59,7 @@ GEM
59
59
  rack
60
60
  socksify
61
61
  io-console (0.8.2)
62
- json (2.18.1)
62
+ json (2.19.5)
63
63
  language_server-protocol (3.17.0.5)
64
64
  lint_roller (1.1.0)
65
65
  logger (1.7.0)
@@ -116,7 +116,7 @@ GEM
116
116
  pry (~> 0.11)
117
117
  yard (~> 0.9.21)
118
118
  psych (3.3.4)
119
- public_suffix (7.0.2)
119
+ public_suffix (7.0.5)
120
120
  racc (1.8.1)
121
121
  rack (3.2.6)
122
122
  rainbow (3.1.1)
@@ -210,7 +210,7 @@ GEM
210
210
  webrobots (0.1.2)
211
211
  xml-simple (1.1.9)
212
212
  rexml
213
- yard (0.9.38)
213
+ yard (0.9.43)
214
214
 
215
215
  PLATFORMS
216
216
  arm64-darwin-25
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ === 3.0.7 / 06.05.2026
2
+ * oddb_product.xml: emit one <INDICATION_CODE code="XXXXX.NN" cud_id="DRUG.NN">limitation text</INDICATION_CODE> child per indication on each <PRD>. Source: FHIR ClinicalUseDefinition resources joined with the reimbursement RegulatedAuthorization's FOPHDossierNumber. Counted on the live FOPH feed: 539 products carry a total of 1,293 codes; all have non-empty indication text. Resolves the missing wiring between FhirExtractor and Builder noted in 3.0.6 (issue #113).
3
+
1
4
  === 3.0.6 / 06.05.2026
2
5
  * FHIR: extract Indikationscode (XXXXX.NN) from ClinicalUseDefinition resources by combining FOPHDossierNumber with each CUD's .NN id-suffix; expose as item[:indication_codes] (and per package) so downstream builders can include it on prescriptions and invoices as required by BAG from 2026-07-01 (issue #113)
3
6
  * Declare csv as a runtime dependency in the gemspec (csv was removed from Ruby's default gems in 3.4)
data/README.md CHANGED
@@ -51,7 +51,7 @@ HIN (http://hin.ch) creates daily the actual file. They can be downloaded from `
51
51
  see `--help`.
52
52
 
53
53
  ```
54
- /opt/src/oddb2xml/bin/oddb2xml version 3.0.5
54
+ /opt/src/oddb2xml/bin/oddb2xml version 3.0.7
55
55
  Usage:
56
56
  oddb2xml [option]
57
57
  produced files are found under data
@@ -292,6 +292,43 @@ We use the following files:
292
292
  * https://epl.bag.admin.ch/static/fhir/foph-sl-export-latest-{de,fr,it}.ndjson (FHIR NDJSON, used with `--fhir`)
293
293
  * https://id.gs1.ch/01/07612345000961 (GS1 Switzerland firstbase CSV — full barcode registry, used with `-b`/`--firstbase`)
294
294
 
295
+ ## Indikationscode (BAG XXXXX.NN)
296
+
297
+ In `--fhir` mode, oddb2xml extracts the BAG **Indikationscode** for SL
298
+ price-model drugs and emits one repeated `<INDICATION_CODE>` child per
299
+ indication on each `<PRD>` in `oddb_product.xml`:
300
+
301
+ ```xml
302
+ <PRD DT="...">
303
+ <GTIN>7680123456789</GTIN>
304
+ ...
305
+ <INDICATION_CODE code="20403.01" cud_id="CYRAMZA.01">In Kombination mit Paclitaxel für die Behandlung ...</INDICATION_CODE>
306
+ <INDICATION_CODE code="20403.02" cud_id="CYRAMZA.02">In Kombination mit FOLFIRI ...</INDICATION_CODE>
307
+ <PackGrSwissmedic>...</PackGrSwissmedic>
308
+ </PRD>
309
+ ```
310
+
311
+ The code is built per FHIR bundle by combining the
312
+ `FOPHDossierNumber` from the reimbursement `RegulatedAuthorization`
313
+ (`XXXXX`) with the `.NN` suffix of each sibling
314
+ `ClinicalUseDefinition` whose `type == "indication"` (e.g.
315
+ `CYRAMZA.01` / `CYRAMZA.02` → `20403.01` / `20403.02`). The element
316
+ body carries the human-readable indication text from
317
+ `indication.diseaseSymptomProcedure.concept.text`.
318
+
319
+ The same data is also exposed in-memory on each item and package as
320
+ `item[:indication_codes]` (an array of `{code:, cud_id:, text:}`
321
+ hashes) for downstream consumers that build their own emitters.
322
+
323
+ Counted on the live FOPH feed (`foph-sl-export-latest-de.ndjson`,
324
+ 6'775 bundles): **539** products carry a total of **1'293** codes.
325
+
326
+ Per BAG Rundschreiben vom 19. Februar 2026, the Indikationscode must
327
+ be transmitted with every prescription and invoice for SL price-model
328
+ drugs from **2026-07-01**; from **2027-01-01** insurers may reject
329
+ invoices without it. See issue
330
+ [#113](https://github.com/zdavatz/oddb2xml/issues/113).
331
+
295
332
  ## Refdata data-quality compensation
296
333
 
297
334
  Refdata.Articles.xml from `files.refdata.ch` ships with a number of recurring
@@ -780,6 +780,14 @@ module Oddb2xml
780
780
  # xml.REMD
781
781
  # xml.REMF
782
782
  # }
783
+ # BAG Indikationscode (XXXXX.NN) for SL price-model drugs.
784
+ # Mandatory on prescriptions/invoices from 2026-07-01 — see
785
+ # GitHub issue #113.
786
+ if seq && seq[:indication_codes].is_a?(Array)
787
+ seq[:indication_codes].each do |ic|
788
+ xml.INDICATION_CODE ic[:text].to_s, code: ic[:code], cud_id: ic[:cud_id]
789
+ end
790
+ end
783
791
  xml.PackGrSwissmedic obj[:siz] unless obj[:siz].empty?
784
792
  xml.EinheitSwissmedic obj[:eht] unless obj[:eht].empty?
785
793
  xml.SubstanceSwissmedic obj[:sub] unless obj[:sub].empty?
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "3.0.6"
2
+ VERSION = "3.0.7"
3
3
  end
data/spec/fhir_spec.rb CHANGED
@@ -2,6 +2,7 @@ require "spec_helper"
2
2
  require "oddb2xml/downloader"
3
3
  require "oddb2xml/extractor"
4
4
  require "oddb2xml/fhir_support"
5
+ require "oddb2xml/builder"
5
6
 
6
7
  describe "FHIR Indikationscode support" do
7
8
  let(:cyramza_fixture) { File.join(Oddb2xml::SpecData, "fhir", "cyramza.ndjson") }
@@ -50,4 +51,35 @@ describe "FHIR Indikationscode support" do
50
51
  expect(pkg[:indication_codes]).to eq(item[:indication_codes])
51
52
  end
52
53
  end
54
+
55
+ describe Oddb2xml::Builder, "PRD INDICATION_CODE emission" do
56
+ it "emits one <INDICATION_CODE> child per indication on the PRD" do
57
+ items = Oddb2xml::FhirExtractor.new(cyramza_fixture).to_hash
58
+ builder = described_class.new
59
+ builder.instance_variable_set(:@items, items)
60
+ builder.instance_variable_set(:@refdata, {})
61
+ builder.instance_variable_set(:@packs, {})
62
+ builder.instance_variable_set(:@migel, {})
63
+ builder.instance_variable_set(:@interactions, [])
64
+ builder.instance_variable_set(:@flags, {})
65
+ builder.instance_variable_set(:@orphan, [])
66
+ builder.instance_variable_set(:@firstbase, {})
67
+ builder.instance_variable_set(:@substances, [])
68
+ builder.instance_variable_set(:@codes, {})
69
+ builder.instance_variable_set(:@missing, [])
70
+ builder.instance_variable_set(:@tag_suffix, nil)
71
+
72
+ xml = builder.send(:build_product)
73
+ expect(xml).to include("<INDICATION_CODE")
74
+ expect(xml).to include('code="20403.01"')
75
+ expect(xml).to include('code="20403.02"')
76
+ expect(xml).to include('cud_id="CYRAMZA.01"')
77
+ expect(xml).to include('cud_id="CYRAMZA.02"')
78
+ # The CUD's indication text travels into the element body so
79
+ # downstream consumers can show the human-readable indication
80
+ # next to the code.
81
+ expect(xml).to include("In Kombination mit Paclitaxel")
82
+ expect(xml).to include("In Kombination mit FOLFIRI")
83
+ end
84
+ end
53
85
  end
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.6
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger