<< | Index | >>
Problem
Experiment
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> ODDB::Package.find_by_pharmacode('3764933').name_base -> Helixor A 0,01 mg Injektionslösung ch.oddb> ODDB::Package.find_by_pharmacode('3764933').barcode -> 7680562060013 ch.oddb> ODDB::Package.find_by_pharmacode('3764933').active_agents -> ch.oddb> ODDB::Package.find_by_pharmacode('3764933').active_agents.length -> 0 ch.oddb> ODDB::Package.find_by_pharmacode('3764933').sequence.active_agents -> Viscum Album (Abietis) Recens 0.01 mg/ml ch.oddb> ODDB::Package.find_by_pharmacode('3764933').sequence.active_agents.length -> 1 ch.oddb> ODDB::Package.find_by_pharmacode('3764933').compositions -> ch.oddb> ODDB::Package.find_by_pharmacode('3764933').compositions.length -> 0 ch.oddb> ODDB::Package.find_by_pharmacode('3764933').sequence.compositions -> Heilmittel auf Grundlage anthroposophischer Erkenntnis: Viscum Album (Abietis) Recens 0.01 mg/ml ch.oddb> ODDB::Package.find_by_pharmacode('3764933').sequence.compositions.length -> 1 ch.oddb> exit -> Goodbye
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> ODDB::Package.find_by_pharmacode('2981396').name_base -> Iscador M c. Ag 0,01 mg ch.oddb> ODDB::Package.find_by_pharmacode('2981396').barcode -> 7680568290209 ch.oddb> ODDB::Package.find_by_pharmacode('2981396').active_agents -> Viscum Album (Mali) Recens 0.01mg / 100mgArgenti Carbonas (0,01 ug pro 100 mg Herba Recente) ch.oddb> ODDB::Package.find_by_pharmacode('2981396').active_agents.length -> 2 ch.oddb> ODDB::Package.find_by_pharmacode('2981396').sequence.active_agents -> Viscum Album (Mali) Recens 0.01mg / 100mgArgenti Carbonas (0,01 ug pro 100 mg Herba Recente) ch.oddb> ODDB::Package.find_by_pharmacode('2981396').sequence.active_agents.length -> 2 ch.oddb> ODDB::Package.find_by_pharmacode('2981396').compositions -> Injektionslösung: Viscum Album (Mali) Recens 0.01mg / 100mg, Argenti Carbonas (0,01 ug pro 100 mg Herba Recente) ch.oddb> ODDB::Package.find_by_pharmacode('2981396').compositions.length -> 1 ch.oddb> ODDB::Package.find_by_pharmacode('2981396').sequence.compositions -> Injektionslösung: Viscum Album (Mali) Recens 0.01mg / 100mg, Argenti Carbonas (0,01 ug pro 100 mg Herba Recente) ch.oddb> ODDB::Package.find_by_pharmacode('2981396').sequence.compositions.length -> 1 ch.oddb> exit -> Goodbye
Consideration
Question
Experiment (src/plugin/swissmedic.rb#update_packages)
def fix_packages(opts={}) opts = {:skip => 3}.update opts row = nil tbook = Spreadsheet.open(@latest) tbook.worksheet(0).each(opts[:skip]) { |row| reg = update_registration(row, opts) if row seq = update_sequence(reg, row) if reg if seq comps = update_compositions(seq, row) comps.each_with_index do |comp, idx| update_galenic_form(seq, comp, row, opts) end end update_package(reg, seq, row, {}, opts) if reg } rescue StandardError => err puts "#{err.class} when fixing #{source_row(row).pretty_inspect if row}" puts err.message puts err.backtrace[0,10] end
Run
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> ODDB::SwissmedicPlugin.new(self).fix_packages
Result
Note
Commit
Check src/plugin/swissmedic.rb#update_galenic_form
Experiment (src/plugin/swissmedic.rb#update_packages)
def fix_packages(opts={}) opts = {:skip => 3, :fix_galenic_form => true}.update opts row = nil tbook = Spreadsheet.open(@latest) tbook.worksheet(0).each(opts[:skip]) { |row| reg = update_registration(row, opts) if row seq = update_sequence(reg, row) if reg if seq comps = update_compositions(seq, row) comps.each_with_index do |comp, idx| update_galenic_form(seq, comp, row, opts) end end update_package(reg, seq, row, {}, opts) if reg } rescue StandardError => err puts "#{err.class} when fixing #{source_row(row).pretty_inspect if row}" puts err.message puts err.backtrace[0,10] end
Run
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> ODDB::SwissmedicPlugin.new(self).fix_packages
Result
NoMethodError when fixing {:seqnr=>"03", :indication_sequence=>nil, :ikscat=>"E", :unit=>"g", :sequence_date=>Wed, 28 Oct 1998, :import_date=>Tue, 07 Jun 2011, :production_science=>"Phytotherapeutika", :composition=> "specierum pectoralium extractum 25 mg, levomentholum 2.4 mg, acesulfamum kalicum, aspartamum, color.: E 150, aromatica, excipiens pro pastillo.", :name_base=>"Ricola Kr\303\244uter, Kr\303\244uterbonbons ohne Zucker, 2,5 g", :substances=>"specierum pectoralium extractum, levomentholum", :atc_class=>"R05FB01", :iksnr=>"49498", :expiry_date=>Sun, 28 Oct 2012, :index_therapeuticus=>"12.03.9.", :size=>"50", :ikscd=>"055", :registration_date=>Mon, 05 Sep 1988, :indication_registration=>"Bei Husten, Heiserkeit und Rachenkatarrh", :company=>"Ricola AG"} undefined method `strip' for nil:NilClass /home/masa/ywesee/oddb.org/src/plugin/swissmedic.rb:526:in `_update_galenic_form' /home/masa/ywesee/oddb.org/src/plugin/swissmedic.rb:516:in `update_galenic_form' /home/masa/ywesee/oddb.org/src/plugin/swissmedic.rb:142:in `fix_packages' /home/masa/ywesee/oddb.org/src/model/dose.rb:117:in `each_with_index' /home/masa/ywesee/oddb.org/src/plugin/swissmedic.rb:141:in `each' /home/masa/ywesee/oddb.org/src/plugin/swissmedic.rb:141:in `each_with_index' /home/masa/ywesee/oddb.org/src/plugin/swissmedic.rb:141:in `fix_packages' /usr/lib64/ruby/gems/1.8/gems/spreadsheet-0.6.5.0/lib/spreadsheet/worksheet.rb:112:in `call' /usr/lib64/ruby/gems/1.8/gems/spreadsheet-0.6.5.0/lib/spreadsheet/worksheet.rb:112:in `each' /usr/lib64/ruby/gems/1.8/gems/spreadsheet-0.6.5.0/lib/spreadsheet/worksheet.rb:111:in `upto'
Experiment
def fix_packages(opts={}) opts = {:skip => 3, :fix_galenic_form => true}.update opts row = nil tbook = Spreadsheet.open(@latest) tbook.worksheet(0).each(opts[:skip]) { |row| reg = update_registration(row, opts) if row seq = update_sequence(reg, row) if reg if seq comps = update_compositions(seq, row) comps.each_with_index do |comp, idx| update_galenic_form(seq, comp, row, opts) end end update_package(reg, seq, row, {}, opts) if reg } rescue StandardError => err puts "#{err.class} when fixing #{source_row(row).pretty_inspect if row}" puts err.message puts err.backtrace[0,10] end