view · edit · sidebar · attach · print · history

20120702-fix-bsv-plugin-create-tailbarkeit-disconnectin

<< | Index | >>


Summary

  • Fixed problem unexpected LimitationText object(Data-Corruption)
  • Updated display of compositon to use of Sequence#composition, if Package has empty Part object.

Commits

Index


corrupted limitation-text

Plugin: ODDB::BsvXmlPlugin
Error: NoMethodError
Message: undefined method `empty?' for #<ODDB::LimitationText:0x0000000e23cf40>
@report: {:name_base=>"Modasomil", :name_descr=>"Tabl 100 mg ",
:swissmedic_no5_bag=>"55272", :deductible=>:deductible_g,
:generic_type=>:unknown, :atc_class=>"N06BA07",
:pharmacode_bag=>"4701604", :swissmedic_no5_oddb=>"55272",
:swissmedic_no8_bag=>"55272007", :pharmacode_oddb=>"4701604"}

LimitationText includes SimpleLanguage.

in @src/util/language.rb@@

    def to_s
      if descriptions.empty?
        ''  
      else
        descriptions.first.to_s
      end 
    end

Does Atcclass#descriptions has corrupted data ?

Atcclass model das SimpleLanguage::Descriptions as @descriptions.

    check_class_list = { 
      :code => "String",
      :sequences => "Array",
      :descriptions => "ODDB::SimpleLanguage::Descriptions",
    }
ch.oddb> atc_class('N06BA07')
-> Modafinil
ch.oddb> atc_class('N06BA07').descriptions
-> {"de"=>"Modafinil", "en"=>"Modafinil"}
ch.oddb> atc_class('N06BA07').descriptions.class
-> ODDB::SimpleLanguage::Descriptions
ch.oddb> atc_class('N06BA07').descriptions.empty?
-> false

Does Package#sl_entry has corrupted data ?

in src/plugin/bsv_xml.rb

    def tag_end
        ...
        @lim_texts.each do |pac_ptr, lim_data|
            if (pac = pac_ptr.resolve(@app)) && (sl_entry = pac.sl_entry) && (sl_entry.respond_to?(:pointer))
              sl_ptr = sl_entry.pointer
              txt_ptr = sl_ptr + :limitation_text
              if lim_data.empty?
                if sl_entry.limitation_text
                  @deleted_limitation_texts += 1 
                  @app.delete txt_ptr
                end  
              else 
                if sl_entry.limitation_text
                  @updated_limitation_texts += 1 
                else 
                  @created_limitation_texts += 1 
                end  

ch.oddb> packages.values.select{|pack|pack.sl_entry}.length
-> 9361
ch.oddb> packages.values.select{|pack|pack.sl_entry and pack.sl_entry.is_a? ODDB::SlEntry}.length
-> 9361
NOTE

Following problem may be related with this error.

# In order to refresh limitation text old objects in ODBA cache 
# before updating. Otherwise, the link between sl_entry and 
# limitation_text may not produced even if there are both objects 
# in ODBA cache.

I found corrupted data in a SlEntry object.

ch.oddb> registration('55272').sequence('02').packages.values.first.limitation_text
-> undefined method `empty?' for #<ODDB::LimitationText:0x000000120d0540>
ch.oddb> registration('55272').sequence('02').packages.values.last.limitation_text
-> []
ch.oddb>

in src/model/package.rb

    def limitation_text
      @sl_entry.limitation_text if @sl_entry.respond_to?(:limitation_text)
    en

in src/util/language.rb

    def to_s
      p descriptions.class
      p self.class
      if descriptions.nil? || descriptions.empty?
        ''  
      else
        descriptions.first.to_s
      end 
    end
#=>
ODDB::LimitationText
ODDB::Fachinfo

Thin SlEntry object has Fachinfo as limitation_text.

ch.oddb> registration('55272').sequence('02').packages.values.first.sl_entry.odba_id
-> 25444845

Finaly, I deleted this unexpected value.
And updated to prevent this error SimpleLanguace module.

commit
NOTE

Some SlEntry have multi LimitationText as Array.

ch.oddb> packages.values.select{|pack|pack.limitation_text.is_a? Array}.length
-> 2
ch.oddb> packages.values.select{|pack|pack.limitation_text.is_a? Array}.first.odba_id
-> 241387
ch.oddb> packages.values.select{|pack|pack.limitation_text.is_a? Array}.last.odba_id
-> 22749674

This Array data also were unexpected.

via Browser
error in SBSM::Session#http_headers: /de/gcc/limitation_text/reg/55272/seq/02/pack/007
NoMethodError
undefined method `pointer' for []:Array
/path/to/ruby/lib/ruby/gems/1.9.1/gems/odba-1.0.8/lib/odba/stub.rb:112:in `method_missing'
/var/ch.oddb.org/src/view/drugs/limitationtext.rb:37:in `limitation_text_title'

This LimitationText also has strange objects.

ch.oddb> ODBA.cache.fetch('241387').limitation_text.first
-> #<ODDB::Registration:0x000000069fde30>
ch.oddb> ODBA.cache.fetch('22749674').sl_entry.limitation_text
-> []

ODBA ID (package)
  • 22749669
  • 22749674
  • 241387

missing zusammensetzung

http://ch.oddb.yasuhiro.org/de/gcc/search/zone/drugs/search_query/60414/search_type/st_oddb#best_result

problem

in src/view/additional_information.rb

    def compositions
        ...
        lang = @session.language
        parts = model.compositions.collect { |comp|
          part = ''
          if galform = comp.galenic_form and galform.respond_to?(lang.to_sym)
            part << galform.send(lang) << ': '
          end 
          if comp.active_agents.size > 1 
            part << @lookandfeel.lookup(:active_agents, model.active_agents.size)
          else
            part << comp.active_agents.first.to_s
          end 
        }   
        link.value = parts.join('<br/>')
        link
        ...
    end

These Package Objects have empty \@parts.

in src/model/package.rb

    def compositions
      @parts.inject([]) { |comps, part| comps.push part.composition }.compact
    end

Part#compositions is empty.

ch.oddb> registration('60414').sequences.values.first.packages.values.first.parts.first.composition.class
-> NilClass

There are related warnings in exporetr. in src/util/exporter.rb

   def report_dose_missing_list(list)
      log = Log.new(@@today)
      log.report = [ 
        "Warning: Dose data (ODDB::Package.parts, Array of ODDB::Dose instances) is empty.",
        "Message: export_oddbdat succeeded but the following package(s) do not have Dose data.",
        "Package(s):",
        list.collect do |list|
          list[0].to_s + ", " + \ 
          "http://#{SERVER_NAME}/de/gcc/show/reg/" + list[1].to_s + \ 
          "/seq/" + list[2].to_s + "/pack/" + list[3].to_s + ".\n"
        end 
      ].join("\n")
      log.notify("Warning Export: oddbdat")
    end

I updated addition_information view to display Sequence#composition instead of Part#compositions via Package#parts.

commit

Disconnection Tailbarkeit

commit
view · edit · sidebar · attach · print · history
Page last modified on July 03, 2012, at 02:51 AM