oddb2xml 1.8.4 → 1.8.5
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.
- data/Gemfile.lock +1 -1
- data/History.txt +4 -0
- data/lib/oddb2xml/builder.rb +4 -6
- data/lib/oddb2xml/extractor.rb +4 -3
- data/lib/oddb2xml/version.rb +1 -1
- data/oddb2xml.xsd +9 -0
- data/spec/builder_spec.rb +25 -3
- data/spec/data/zurrose_transfer.dat +2 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/History.txt
CHANGED
data/lib/oddb2xml/builder.rb
CHANGED
|
@@ -337,9 +337,6 @@ module Oddb2xml
|
|
|
337
337
|
end
|
|
338
338
|
_builder.to_xml
|
|
339
339
|
end
|
|
340
|
-
def xml_and_comment(xml, *args, &block)
|
|
341
|
-
$stderr.puts "xml_and_comment #{args[0]}"
|
|
342
|
-
end
|
|
343
340
|
def build_interaction
|
|
344
341
|
prepare_interactions
|
|
345
342
|
prepare_codes
|
|
@@ -612,9 +609,10 @@ module Oddb2xml
|
|
|
612
609
|
if !@prices.empty? && ean && @prices[ean]
|
|
613
610
|
price = @prices[ean] # zurrose
|
|
614
611
|
end
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
612
|
+
xml.ART('DT' => '') {
|
|
613
|
+
xml.REF_DATA (de_idx[:refdata] || @migel[pharma_code]) ? '1' : '0'
|
|
614
|
+
xml.PHAR de_idx[:pharmacode] unless de_idx[:pharmacode].empty?
|
|
615
|
+
#xml.GRPCD
|
|
618
616
|
#xml.CDS01
|
|
619
617
|
#xml.CDS02
|
|
620
618
|
if ppac
|
data/lib/oddb2xml/extractor.rb
CHANGED
|
@@ -49,6 +49,7 @@ module Oddb2xml
|
|
|
49
49
|
result = PreparationsEntry.parse(@xml.sub(Strip_For_Sax_Machine, ''), :lazy => true)
|
|
50
50
|
result.Preparations.Preparation.each do |seq|
|
|
51
51
|
item = {}
|
|
52
|
+
item[:refdata] = true
|
|
52
53
|
item[:product_key] = seq.ProductCommercial
|
|
53
54
|
item[:desc_de] = (desc = seq.DescriptionDe) ? desc : ''
|
|
54
55
|
item[:desc_fr] = (desc = seq.DescriptionFr) ? desc : ''
|
|
@@ -188,6 +189,7 @@ module Oddb2xml
|
|
|
188
189
|
items = result.PHARMA.ITEM
|
|
189
190
|
items.each do |pac|
|
|
190
191
|
item = {}
|
|
192
|
+
item[:refdata] = true
|
|
191
193
|
item[:_type] = @type.downcase.intern
|
|
192
194
|
item[:ean] = (gtin = pac.GTIN) ? gtin: ''
|
|
193
195
|
item[:pharmacode] = (phar = pac.PHAR) ? phar: ''
|
|
@@ -333,6 +335,7 @@ module Oddb2xml
|
|
|
333
335
|
next if i.zero?
|
|
334
336
|
phar = correct_code(row[1].to_s.gsub(/[^0-9]/, ''), 7)
|
|
335
337
|
data[phar] = {
|
|
338
|
+
:refdata => true,
|
|
336
339
|
:ean => row[0].to_i.to_s,
|
|
337
340
|
:pharmacode => phar,
|
|
338
341
|
:desc_de => row[3],
|
|
@@ -355,6 +358,7 @@ module Oddb2xml
|
|
|
355
358
|
lang = pac.lang.to_s
|
|
356
359
|
next unless lang =~ /de|fr/
|
|
357
360
|
item = {}
|
|
361
|
+
item[:refdata] = true,
|
|
358
362
|
item[:name] = (name = pac.title) ? name : ''
|
|
359
363
|
item[:owner] = (ownr = pac.authHolder) ? ownr : ''
|
|
360
364
|
if content = /cdata/.match(pac.content)
|
|
@@ -500,9 +504,6 @@ module Oddb2xml
|
|
|
500
504
|
:pub_price => sprintf("%.2f", line[66,6].gsub(/(\d{2})$/, '.\1').to_f),
|
|
501
505
|
:type => :nonpharma,
|
|
502
506
|
}
|
|
503
|
-
if /5366964/.match(ean13) then
|
|
504
|
-
Oddb2xml.log "found 5366964 data is now #{data[ean13].inspect}"
|
|
505
|
-
end
|
|
506
507
|
@@zur_rose_items += 1
|
|
507
508
|
end if @io
|
|
508
509
|
data
|
data/lib/oddb2xml/version.rb
CHANGED
data/oddb2xml.xsd
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
PEXF Price Ex-Factory (exkl. VAT): Taken from the ZurRose.dat characters 60..65
|
|
43
43
|
PPUB Public Price (inkl. VAT): Taken from the ZurRose.dat characters 66..71
|
|
44
44
|
SLOPLUS Selbsbehalt/deductilbe, where 1 => 20%, 2 => 10%, '' => not known
|
|
45
|
+
REF_DATA 1 in oddb_article if coming from a refdata source (migel, bag, swissmedic), else 0
|
|
45
46
|
|
|
46
47
|
FIRST import all data from swissINDEX
|
|
47
48
|
* GTIN
|
|
@@ -94,6 +95,14 @@
|
|
|
94
95
|
<xs:element name="ART">
|
|
95
96
|
<xs:complexType>
|
|
96
97
|
<xs:sequence>
|
|
98
|
+
<xs:element name="REF_DATA">
|
|
99
|
+
<xs:simpleType>
|
|
100
|
+
<xs:restriction base="xs:byte">
|
|
101
|
+
<xs:enumeration value="1" />
|
|
102
|
+
<xs:enumeration value="0" />
|
|
103
|
+
</xs:restriction>
|
|
104
|
+
</xs:simpleType>
|
|
105
|
+
</xs:element>
|
|
97
106
|
<xs:element ref="ns1:PHAR"/>
|
|
98
107
|
<xs:element minOccurs="0" ref="ns1:SMCAT"/>
|
|
99
108
|
<xs:element minOccurs="0" ref="ns1:SMNO"/>
|
data/spec/builder_spec.rb
CHANGED
|
@@ -31,7 +31,7 @@ def check_validation_via_xsd
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
describe Oddb2xml::Builder do
|
|
34
|
-
NrExtendedArticles =
|
|
34
|
+
NrExtendedArticles = 70
|
|
35
35
|
NrPharmaAndNonPharmaArticles = 61
|
|
36
36
|
NrPharmaArticles = 4
|
|
37
37
|
include ServerMockHelper
|
|
@@ -45,7 +45,6 @@ describe Oddb2xml::Builder do
|
|
|
45
45
|
after(:each) do
|
|
46
46
|
Dir.chdir @savedDir if @savedDir and File.directory?(@savedDir)
|
|
47
47
|
end
|
|
48
|
-
|
|
49
48
|
context 'XSD-generation: ' do
|
|
50
49
|
let(:cli) do
|
|
51
50
|
opts = {}
|
|
@@ -140,7 +139,6 @@ describe Oddb2xml::Builder do
|
|
|
140
139
|
end
|
|
141
140
|
it "pending should match EAN of Desitin. returns 0 at the moment"
|
|
142
141
|
end
|
|
143
|
-
|
|
144
142
|
context 'when option -e is given' do
|
|
145
143
|
let(:cli) do
|
|
146
144
|
opts = {
|
|
@@ -153,6 +151,30 @@ describe Oddb2xml::Builder do
|
|
|
153
151
|
Oddb2xml::Cli.new(opts)
|
|
154
152
|
end
|
|
155
153
|
|
|
154
|
+
def checkItemForRefdata(doc, pharmacode, isRefdata)
|
|
155
|
+
article = XPath.match( doc, "//ART[PHAR=#{pharmacode.to_s}]").first
|
|
156
|
+
name = article.elements['DSCRD'].text
|
|
157
|
+
refdata = article.elements['REF_DATA'].text
|
|
158
|
+
smno = article.elements['SMNO'] ? article.elements['SMNO'].text : 'nil'
|
|
159
|
+
puts "checking doc for pharmacode #{pharmacode} isRefdata #{isRefdata} == #{refdata}. SMNO: #{smno} #{name}" if $VERBOSE
|
|
160
|
+
article.elements['REF_DATA'].text.should == isRefdata.to_s
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
it 'should generate the flag non-refdata' do
|
|
164
|
+
res = buildr_capture(:stdout){ cli.run }
|
|
165
|
+
@article_xml = File.expand_path(File.join(Oddb2xml::WorkDir, 'oddb_article.xml'))
|
|
166
|
+
puts @article_xml
|
|
167
|
+
File.exists?(@article_xml).should be_true
|
|
168
|
+
FileUtils.cp(@article_xml, '/opt/src/oddb2xml/tst.xml', :verbose => true)
|
|
169
|
+
article_xml = IO.read(@article_xml)
|
|
170
|
+
doc = REXML::Document.new File.new(@article_xml)
|
|
171
|
+
XPath.match( doc, "//REF_DATA" ).size.should > 0
|
|
172
|
+
checkItemForRefdata(doc, "1699947", 1) # 3TC Filmtabl 150 mg SMNO 53662013 IKSNR 53‘662, 53‘663
|
|
173
|
+
checkItemForRefdata(doc, "0028470", 0) # Complamin
|
|
174
|
+
checkItemForRefdata(doc, "3036984", 1) # NovoPen 4 Injektionsgerät blue In NonPharma (a MiGel product)
|
|
175
|
+
checkItemForRefdata(doc, "5366964", 1) # 1-DAY ACUVUE moist jour
|
|
176
|
+
end
|
|
177
|
+
|
|
156
178
|
it 'should pass validating via oddb2xml.xsd' do
|
|
157
179
|
check_validation_via_xsd
|
|
158
180
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
1122465312ZYVOXID Filmtabl 600 mg 10 Stk 096114108275100A080190076805555800542
|
|
2
2
|
1120020209ERYTRHOCIN I.V. Trockensub Fl 1g 001518002010300B080160000000000000002
|
|
3
3
|
1120020244FERRO-GRADUMET Depottabl 30 Stk 000895001090300C060710076803164401152
|
|
4
|
-
1120020273KENDURAL Depottabl 30 Stk 000492000840100C060710076803536601632
|
|
5
4
|
1130020646SELSUN Shampoo Susp 60 ml 000911001650300D100400076801723304142
|
|
6
5
|
1120020652SELSUN Shampoo Susp 120 ml 001576002520300D100400076801723306812
|
|
7
6
|
1130021806EAU PRECIEUSE D?pensier L?s 375 ml 001220001870300D100600000000000000002
|
|
@@ -14,3 +13,5 @@
|
|
|
14
13
|
1122871443CANIPHEDRIN Tabl 20 mg ad us vet. 500 Stk 004872006910400C000000000000000000002
|
|
15
14
|
1122871466CANIPHEDRIN Tabl 50 mg ad us vet. 100 Stk 001424001750400C000000076804706604282
|
|
16
15
|
1122871472CANIPHEDRIN Tabl 50 mg ad us vet. 500 Stk 005443007580400C000000000000000000002
|
|
16
|
+
1132867163TOTALIN Plv ad us. vet. 5 kg 000535000900400C000000000000000000002
|
|
17
|
+
1138110429Forthyron 400 mcg 50 Tabl (vet) 0081120015800000000000000000000000002
|
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: 1.8.
|
|
4
|
+
version: 1.8.5
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2014-
|
|
12
|
+
date: 2014-06-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rubyzip
|