oddb2xml 1.4.6 → 1.4.7
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/README.md +26 -22
- data/lib/oddb2xml/builder.rb +4 -3
- data/lib/oddb2xml/extractor.rb +9 -7
- data/lib/oddb2xml/version.rb +1 -1
- metadata +26 -26
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -4,11 +4,11 @@
|
|
4
4
|
|
5
5
|
creates the following xml files:
|
6
6
|
|
7
|
-
* oddb_substance.xml
|
8
|
-
* oddb_limitation.xml
|
9
|
-
* oddb_interaction.xml
|
10
|
-
* oddb_code.xml
|
11
|
-
* oddb_product.xml
|
7
|
+
* oddb_substance.xml
|
8
|
+
* oddb_limitation.xml
|
9
|
+
* oddb_interaction.xml
|
10
|
+
* oddb_code.xml
|
11
|
+
* oddb_product.xml
|
12
12
|
* oddb_article.xml
|
13
13
|
* oddb_fi.xml
|
14
14
|
* oddb_fi_product.xml
|
@@ -91,11 +91,11 @@ i.e.:
|
|
91
91
|
|
92
92
|
xml files generated are:
|
93
93
|
|
94
|
-
* oddb_substance.xml
|
95
|
-
* oddb_limitation.xml
|
96
|
-
* oddb_interaction.xml
|
97
|
-
* oddb_code.xml
|
98
|
-
* oddb_product.xml
|
94
|
+
* oddb_substance.xml
|
95
|
+
* oddb_limitation.xml
|
96
|
+
* oddb_interaction.xml
|
97
|
+
* oddb_code.xml
|
98
|
+
* oddb_product.xml
|
99
99
|
* oddb_article.xml
|
100
100
|
* oddb_fi.xml
|
101
101
|
* oddb_fi_product.xml
|
@@ -156,30 +156,34 @@ For example, if `-t _swiss` is given then oddb2xml creates product.xml as swiss_
|
|
156
156
|
<?xml version="1.0" encoding="utf-8"?>
|
157
157
|
<PRODUCT_SWISS xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://wiki.oddb.org/wiki.php?pagename=Swissmedic.Datendeklaration" CREATION_DATETIME="2012-11-21T13:01:29.5903756+0900" PROD_DATE="2012-11-21T13:01:29.5903756+0900" VALID_DATE="2012-11-21T13:01:29.5903756+0900">
|
158
158
|
<PRD_SWISS DT="">
|
159
|
-
<
|
160
|
-
<
|
161
|
-
<
|
162
|
-
<
|
163
|
-
<
|
159
|
+
<GTIN_SWISS>7680353660163</GTIN_SWISS>
|
160
|
+
<PRODNO_SWISS>353661</PRODNO_SWISS>
|
161
|
+
<DSCRD_SWISS>Kendural Depottabl </DSCRD_SWISS>
|
162
|
+
<DSCRF_SWISS>Kendural cpr dépôt </DSCRF_SWISS>
|
163
|
+
<ATC_SWISS>B03AE10</ATC_SWISS>
|
164
|
+
<IT_SWISS>06.07.1.</IT_SWISS>
|
164
165
|
<CPT_SWISS>
|
165
166
|
<CPTCMP_SWISS>
|
166
167
|
<LINE_SWISS>0</LINE_SWISS>
|
167
|
-
<SUBNO_SWISS>
|
168
|
-
<QTY_SWISS>
|
169
|
-
<QTYU_SWISS>
|
168
|
+
<SUBNO_SWISS>507</SUBNO_SWISS>
|
169
|
+
<QTY_SWISS>105</QTY_SWISS>
|
170
|
+
<QTYU_SWISS>mg</QTYU_SWISS>
|
170
171
|
</CPTCMP_SWISS>
|
171
172
|
<CPTCMP_SWISS>
|
172
173
|
<LINE_SWISS>1</LINE_SWISS>
|
173
|
-
<SUBNO_SWISS>
|
174
|
-
<QTY_SWISS>
|
175
|
-
<QTYU_SWISS>
|
174
|
+
<SUBNO_SWISS>23</SUBNO_SWISS>
|
175
|
+
<QTY_SWISS>500</QTY_SWISS>
|
176
|
+
<QTYU_SWISS>mg</QTYU_SWISS>
|
176
177
|
</CPTCMP_SWISS>
|
177
178
|
</CPT_SWISS>
|
179
|
+
<PackGrSwissmedic_SWISS>30</PackGrSwissmedic_SWISS>
|
180
|
+
<EinheitSwissmedic_SWISS>Tablette(n)</EinheitSwissmedic_SWISS>
|
181
|
+
<SubstanceSwissmedic_SWISS>ferrum(II), acidum ascorbicum</SubstanceSwissmedic_SWISS>
|
178
182
|
</PRD_SWISS>
|
179
183
|
...
|
180
184
|
<RESULT_SWISS>
|
181
185
|
<OK_ERROR_SWISS>OK</OK_ERROR_SWISS>
|
182
|
-
<NBR_RECORD_SWISS>
|
186
|
+
<NBR_RECORD_SWISS>14336</NBR_RECORD_SWISS>
|
183
187
|
<ERROR_CODE_SWISS/>
|
184
188
|
<MESSAGE_SWISS/>
|
185
189
|
</RESULT_SWISS>
|
data/lib/oddb2xml/builder.rb
CHANGED
@@ -389,6 +389,8 @@ module Oddb2xml
|
|
389
389
|
length += 1
|
390
390
|
xml.PRD('DT' => '') {
|
391
391
|
xml.GTIN obj[:ean].to_s
|
392
|
+
ppac = ((_ppac = @packs[obj[:ean].to_s[4..11].intern] and !_ppac[:is_tier]) ? _ppac : {})
|
393
|
+
xml.PRODNO ppac[:prodno] if ppac[:prodno] and !ppac[:prodno].empty?
|
392
394
|
if seq
|
393
395
|
%w[de fr].each do |l|
|
394
396
|
name = "name_#{l}".intern
|
@@ -544,9 +546,8 @@ module Oddb2xml
|
|
544
546
|
#xml.GRPCD
|
545
547
|
#xml.CDS01
|
546
548
|
#xml.CDS02
|
547
|
-
|
548
|
-
|
549
|
-
xml.SMCAT ppac[:swissmedic_category]
|
549
|
+
if ppac
|
550
|
+
xml.SMCAT ppac[:swissmedic_category] unless ppac[:swissmedic_category].empty?
|
550
551
|
end
|
551
552
|
if no8
|
552
553
|
xml.SMNO no8.to_s unless no8.to_s.empty?
|
data/lib/oddb2xml/extractor.rb
CHANGED
@@ -216,13 +216,14 @@ module Oddb2xml
|
|
216
216
|
case @type
|
217
217
|
when :package
|
218
218
|
typ = 6 # Heilmittelcode
|
219
|
-
i_5,i_3
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
219
|
+
i_5,i_3 = 0,10 # :swissmedic_numbers
|
220
|
+
p_5,p_1_2 = 0,1 # :prodno
|
221
|
+
cat = 13 # :swissmedic_category
|
222
|
+
ith = 4 # :ith_swissmedic IT-Code (swissmedic-diff)
|
223
|
+
atc = 5 # :atc_code
|
224
|
+
siz = 11 # :package_size
|
225
|
+
eht = 12 # :einheit_swissmedic
|
226
|
+
sub = 14 # :substance_swissmedic
|
226
227
|
@sheet.each_with_index do |row, i|
|
227
228
|
next if (i== 0)
|
228
229
|
no8 = extract_number(row, i_5).to_s + extract_number(row, i_3, /^\d{3}$/).to_s
|
@@ -230,6 +231,7 @@ module Oddb2xml
|
|
230
231
|
ean_base12 = "7680#{no8}"
|
231
232
|
data[no8.intern] = {
|
232
233
|
:ean => (ean_base12.ljust(12, '0') + calc_checksum(ean_base12)),
|
234
|
+
:prodno => row[p_5].to_s + row[p_1_2].to_i.to_s,
|
233
235
|
:ith_swissmedic => row[ith].to_s,
|
234
236
|
:swissmedic_category => row[cat].to_s,
|
235
237
|
:atc_code => row[atc].to_s,
|
data/lib/oddb2xml/version.rb
CHANGED
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.4.
|
4
|
+
version: 1.4.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rubyzip
|
16
|
-
requirement: &
|
16
|
+
requirement: &16490580 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *16490580
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: archive-tar-minitar
|
27
|
-
requirement: &
|
27
|
+
requirement: &16486880 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *16486880
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mechanize
|
38
|
-
requirement: &
|
38
|
+
requirement: &16485740 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 2.5.1
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *16485740
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: nokogiri
|
49
|
-
requirement: &
|
49
|
+
requirement: &16482320 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *16482320
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: savon
|
60
|
-
requirement: &
|
60
|
+
requirement: &16479200 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '2.0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *16479200
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: spreadsheet
|
71
|
-
requirement: &
|
71
|
+
requirement: &16478320 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *16478320
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &16477600 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *16477600
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: webmock
|
93
|
-
requirement: &
|
93
|
+
requirement: &16476920 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *16476920
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: hoe
|
104
|
-
requirement: &
|
104
|
+
requirement: &16476180 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '3.4'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *16476180
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: rdoc
|
115
|
-
requirement: &
|
115
|
+
requirement: &16475520 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *16475520
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: rdoc
|
126
|
-
requirement: &
|
126
|
+
requirement: &16474880 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '3.10'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *16474880
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: hoe
|
137
|
-
requirement: &
|
137
|
+
requirement: &16474380 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ~>
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
version: '2.13'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *16474380
|
146
146
|
description: oddb2xml creates xml files using swissINDEX, BAG-XML and Swissmedic.
|
147
147
|
email: yasaka@ywesee.com, zdavatz@ywesee.com
|
148
148
|
executables:
|