oddb2xml 2.4.5 → 2.4.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 952fe0868841bf075f3db7cd128326004b2ab2bf
4
- data.tar.gz: c026575530d35d1ef75ff9b3ac4688f647d07427
3
+ metadata.gz: 448b5c708931ad04ad83dc39b7faaaca6103102e
4
+ data.tar.gz: cdba955c266fb2039cdb2ae7d06e94593e61ff16
5
5
  SHA512:
6
- metadata.gz: e4baa838d2b817cfd994882092585e768a4375f82e3bb4843d083ade252666f939628129fa4bfecd709c36f63e81168dd2f996c5dd1f2cae6fbacb05e578a37e
7
- data.tar.gz: c839a38f2739a18c515d5b90b7c64c9dd7f8dff06c17ea0a549a106dbc95faded479ae986bed4575c3780d0492f420b18c99ff568057e99e273454da70bcbf85
6
+ metadata.gz: 384d55410772fbd9f675162865ca257f0f2422aaed8a29b255ee190840b79eddc600382628f584a136b4600e047a46d88fd80d1547fdbee7821b04c4e0f7c09f
7
+ data.tar.gz: 8da57d452ec882381cc551044610e0eaea28cd7697d48f9888a07370946f0695c4e251d24d8b33319a3024f57d40aba63bfe8da5e8e5cf091522d049cda733ad
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 2.4.6 / 25.10.2017
2
+
3
+ * PHAR is optional in oddb2xml.xsd
4
+ * Minimal length of DSCRD is 3. Emit BC/EAN 0 as required by XSD
5
+
1
6
  === 2.4.5 / 25.10.2017
2
7
 
3
8
  * Fix parsing shire products
@@ -798,12 +798,14 @@ module Oddb2xml
798
798
  Oddb2xml.log "build_article #{idx} of #{@articles.size} articles" if idx % 500 == 0
799
799
  item = @items[obj[:ean]]
800
800
  pac,no8 = nil,obj[:ean].to_s[4..11] # BAG-XML(SL/LS)
801
- pack_info = nil
801
+ pack_info = nil
802
802
  pack_info = @packs[no8.intern] if no8 # info from Packungen.xlsx from swissmedic_info
803
803
  ppac = nil # Packungen
804
804
  ean = obj[:ean]
805
805
  next if pack_info and /Tierarzneimittel/.match(pack_info[:list_code])
806
806
  next if obj[:desc_de] and /ad us vet/i.match(obj[:desc_de])
807
+ next if obj[:desc_de] and obj[:desc_de].length < 3
808
+ next if obj[:desc_fr] and obj[:desc_fr].length < 3
807
809
  pharma_code = obj[:pharmacode]
808
810
  ean = 0 if sprintf('%013d', ean).match(/^000000/)
809
811
  if obj[:seq]
@@ -822,7 +824,15 @@ module Oddb2xml
822
824
  xml.ART('DT' => obj[:last_change] ? obj[:last_change] : '') do
823
825
  nbr_records += 1
824
826
  xml.REF_DATA (obj[:refdata] || @migel[pharma_code]) ? '1' : '0'
825
- xml.PHAR sprintf('%07d', obj[:pharmacode]) if obj[:pharmacode]
827
+ if obj[:pharmacode]
828
+ xml.PHAR sprintf('%07d', obj[:pharmacode])
829
+ elsif ean > 0
830
+ xml.PHAR ean
831
+ else
832
+ @@counter_pseudo_ean ||= 0
833
+ @@counter_pseudo_ean += 1
834
+ xml.PHAR sprintf('9999%07d', @@counter_pseudo_ean) # here we must add a pharmacode or validating will fail
835
+ end
826
836
  #xml.GRPCD
827
837
  #xml.CDS01
828
838
  #xml.CDS02
@@ -923,7 +933,7 @@ module Oddb2xml
923
933
  xml.BC /^9999|^0000|^0$/.match(ean.to_s) ? 0 : sprintf('%013d', ean)
924
934
  xml.BCSTAT 'A' # P is alternative
925
935
  #xml.PHAR2
926
- } if ean && ean > 0
936
+ } if ean
927
937
  #xml.ARTCH {
928
938
  #xml.PHAR2
929
939
  #xml.CHTYPE
@@ -167,6 +167,7 @@ module Oddb2xml
167
167
  pts = pac.PointLimitations.PointLimitation.first # only first points
168
168
  item[:packages][ean][:limitation_points] = pts ? pts.Points : ''
169
169
  data[ean] = item
170
+ puts item if /NaCl Bichsel/.match(item[:name_de]) && ean == 7680298002271
170
171
  end
171
172
  end
172
173
  data
@@ -1,3 +1,3 @@
1
1
  module Oddb2xml
2
- VERSION = "2.4.5"
2
+ VERSION = "2.4.6"
3
3
  end
data/oddb2xml.xsd CHANGED
@@ -135,7 +135,7 @@
135
135
  </xs:restriction>
136
136
  </xs:simpleType>
137
137
  </xs:element>
138
- <xs:element ref="ns1:PHAR"/>
138
+ <xs:element minOccurs="0" maxOccurs="1" ref="ns1:PHAR"/>
139
139
  <xs:element minOccurs="0" ref="ns1:SMCAT"/>
140
140
  <xs:element minOccurs="0" name="GEN_PRODUCTION" type="xs:string" />
141
141
  <xs:element minOccurs="0" name="INSULIN_CATEGORY" type="xs:string" />
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: 2.4.5
4
+ version: 2.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhiro Asaka, Zeno R.R. Davatz, Niklaus Giger