view · edit · sidebar · attach · print · history

20110607-fix-active_agents

<< | Index | >>


  1. Problem of seaching result
  2. Search the code of search result view
  3. Testcases ch.oddb
  4. Fix galenic form

Goal/Estimate/Evaluation
  • Fix the search result view / 80% / 50%
Milestones
  • Search the code
Summary
Commits

Problem of seaching result

Email

  1. Iscador, still some Zusammensetzungen are not show
  2. Iscador Search Result
  3. Iscador and Helixor

Problem

  • The active agetns are not shown in the column of 'Zusammensetzung' in the search result view.
  • Even though the active agents are actually shown in the sequence view.

Search the code of search result view

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

  • Mayby, if there is data of Package#active_agents or Package#compositions, the result is shown in the column of Zusammensetzung

Question

  • Where is the code to set the Package#compositions?

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

  • put Packungen-latest.xls in data/xls directory
  • execute fix_packages method
masa@masa ~/ywesee/oddb.org $ bin/admin
ch.oddb> ODDB::SwissmedicPlugin.new(self).fix_packages

Result

Note

  • Looks good

Commit

Testcases ch.oddb

  1. src/view/drugs/resultlimit.rb (coverage: 100%)
  2. src/plugin/analysis.rb (coverage: 100%)

Fix galenic form

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

  • Error
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

Result

  • Fail
view · edit · sidebar · attach · print · history
Page last modified on June 08, 2011, at 07:26 AM