Skip to content

Commit

Permalink
Support (only) the new swissmedi package format
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Nov 22, 2013
1 parent 254becc commit 7270ab1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/oddb2xml/extractor.rb
Expand Up @@ -235,13 +235,14 @@ def to_hash # Packungen.xls
eht = 12 # :einheit_swissmedic
sub = 14 # :substance_swissmedic
@sheet.each_with_index do |row, i|
next if (i== 0)
no8 = extract_number(row, i_5).to_s + extract_number(row, i_3, /^\d{3}$/).to_s
next if (i <= 1)
no8 = sprintf('%05d',row[i_5].to_i) + sprintf('%03d',row[i_3].to_i)
prodno = sprintf('%05d',row[i_5].to_i) + row[p_1_2].to_i.to_s
unless no8.empty?
ean_base12 = "7680#{no8}"
data[no8.intern] = {
:ean => (ean_base12.ljust(12, '0') + calc_checksum(ean_base12)),
:prodno => row[p_5].to_s + row[p_1_2].to_i.to_s,
:prodno => prodno,
:ith_swissmedic => row[ith].to_s,
:swissmedic_category => row[cat].to_s,
:atc_code => row[atc].to_s,
Expand Down

0 comments on commit 7270ab1

Please sign in to comment.