view · edit · sidebar · attach · print · history

20130329-debug-swissmedicinfo-pi-updater

<< | Index | >>


Summary

  • Debug parsing for swissmedicinfo PI.

Commits

Index


Debug Swissmedicinfo updater and fiparsed

Improve iksnr detection

Update iksnr detection to match all unexpected Iksnr text in swissmedicinfo.

      match = @doc.xpath(path, Class.new do
        def match(node_set, iksnr)
          found_node = catch(:found) do
            node_set.find_all do |node|
              html = Nokogiri::HTML(node.text)
              pos = (html.text =~ /Zulassungsnummer|Num.ro\s*d.autorisation/).to_i
              unless pos == 0
                src = html.text[pos..-1]
                throw :found, node if src =~ /#{iksnr[0..1]}(.|\s)?#{iksnr[2..4]}\s?/o
              end
              false
            end
            nil
          end
          found_node ? [found_node] : []
        end
      end.new).first

single quotation problem.

Plugin: ODDB::TextInfoPlugin
Error: Nokogiri::XML::XPath::SyntaxError
Message: Invalid expression: //medicalInformation[@type='pi' and @lang='fr']/title[match(., 'Alpinamed, gouttes homéopathiques pour l'estomac')]
Backtrace:
/path/to/ruby/1.9.1/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:159:in `evaluate'
/path/to/ruby/1.9.1/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:159:in `block in xpath'
/path/to/ruby/1.9.1/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:150:in `map'
/path/to/ruby/1.9.1/gems/nokogiri-1.5.2/lib/nokogiri/xml/node.rb:150:in `xpath'
commit

Improve image extraction

z.B.

  • Neupro® - 57417 (Swissmedic)

image path was wrong. (This is patinfo. but it was /fachinfo/).

[3] 1.9.3-p194(#<ODDB::View::Chapter>)> paragraph.src
=> "/resources/images/fachinfo/de/Neupro__files/1.png"
[4] 1.9.3-p194(#<ODDB::View::Chapter>)> paragraph.attributes
=> {"src"=>"/resources/images/fachinfo/de/Neupro__files/1.png"}
commit (fiparse)

Error Objects on production.

ODBA got strange errors by broken Objects on Production.

Plugin: ODDB::TextInfoPlugin
Error: TypeError
Message: can't dump MatchData
Backtrace:
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/marshal.rb:10:in `dump'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/marshal.rb:10:in `dump'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:540:in `block in store_collection_elements'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:538:in `collect'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:538:in `store_collection_elements'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:508:in `store'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:274:in `odba_isolated_store'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:395:in `block in odba_store_unsaved'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:392:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:392:in `odba_store_unsaved'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:380:in `odba_store'
/var/www/oddb.org/src/model/patinfo.rb:49:in `odba_store'
...
Plugin: ODDB::TextInfoPlugin
Error: TypeError
Message: no _dump_data is defined for class Proc
Backtrace:
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/marshal.rb:10:in `dump'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/marshal.rb:10:in `dump'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:540:in `block in store_collection_elements'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:538:in `collect'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:538:in `store_collection_elements'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:508:in `store'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:274:in `odba_isolated_store'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:395:in `block in odba_store_unsaved'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:392:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:392:in `odba_store_unsaved'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:380:in `odba_store'
/var/www/oddb.org/src/model/patinfo.rb:49:in `odba_store'
/var/www/oddb.org/src/util/persistence.rb:261:in `issue_update'
...
Plugin: ODDB::TextInfoPlugin
Error: NoMethodError
Message: undefined method `text' for "fr":String
Backtrace:
/var/www/oddb.org/src/plugin/text_info.rb:933:in `block (2 levels) in match'
/var/www/oddb.org/src/util/language.rb:30:in `[]'
/var/www/oddb.org/src/util/language.rb:30:in `description'
/var/www/oddb.org/src/util/language.rb:48:in `method_missing'
/var/www/oddb.org/src/util/persistence.rb:59:in `block in diff'
/var/www/oddb.org/src/util/persistence.rb:57:in `each'
/var/www/oddb.org/src/util/persistence.rb:57:in `diff'
/var/www/oddb.org/src/util/persistence.rb:258:in `issue_update'
/var/www/oddb.org/src/util/oddbapp.rb:125:in `block in update'
Plugin: ODDB::TextInfoPlugin
Error: NotImplementedError
Message: method `method_missing' called on terminated object (0x0000000be33590 flags=0x0 klass=0x0)
Backtrace:
/var/www/oddb.org/src/util/language.rb:30:in `description'
/var/www/oddb.org/src/util/language.rb:48:in `method_missing'
/var/www/oddb.org/src/util/persistence.rb:59:in `block in diff'
/var/www/oddb.org/src/util/persistence.rb:57:in `each'
/var/www/oddb.org/src/util/persistence.rb:57:in `diff'
/var/www/oddb.org/src/util/persistence.rb:258:in `issue_update'
...

On Production, something unexpected Object is in patinfos.

ch.oddb> patinfos.values.select{|pi| pi.descriptions.nil? }.length
@400000005155e786344ab60c failsafe rescued NoMethodError < StandardError
@400000005155e786344ac994 undefined method `[]' for nil:NilClass
@400000005155e786344ac994 /var/www/oddb.org/src/util/oddbapp.rb:1549:in `instance_eval'
@400000005155e786344ac994 /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:131:in `[]'
@400000005155e786344acd7c /var/www/oddb.org/src/util/language.rb:30:in `description'
@400000005155e786344acd7c /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing'
@400000005155e786344ad934 (eval):1:in `block (3 levels) in _admin'
@400000005155e786344ad934 (eval):1:in `select'
@400000005155e786344add1c (eval):1:in `block (2 levels) in _admin'
@400000005155e786344add1c /var/www/oddb.org/src/util/oddbapp.rb:1549:in `instance_eval'
@400000005155e786344add1c /var/www/oddb.org/src/util/oddbapp.rb:1549:in `block (2 levels) in _admin'
@400000005155e786344ae104 /var/www/oddb.org/src/util/failsafe.rb:10:in `call'
@400000005155e786344aecbc /var/www/oddb.org/src/util/failsafe.rb:10:in `failsafe'
@400000005155e786344aecbc /var/www/oddb.org/src/util/oddbapp.rb:1548:in `block in _admin'
@400000005155e7a62a8a2cc4 ODBA::Stub was unable to replace #28427454 from ODDB::Patinfo:#23699560
@400000005155e7a62a9f2bc4 ODBA::Stub was unable to replace #28427454 from ODDB::Patinfo:#23699560
...

I found a unexcpected broken object.

ch.oddb> patinfos.values.select{|pi| !pi.descriptions.is_a?(ODDB::SimpleLanguage::Descriptions) }.length
-> 1
ch.oddb> patinfos.values.select{|pi| !pi.descriptions.is_a?(ODDB::SimpleLanguage::Descriptions) }.first.odba_delete
commits

Then got same error in other point in ODBA.

/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:456:in `block in odba_unsaved_neighbors': method `method_missing' called on terminated object (0x0000003e8e0ec0 flags=0x0 klass=0x0) (NotImplementedError)
        from /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:454:in `each'
        from /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:454:in `odba_unsaved_neighbors'
        from /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:394:in `block in odba_store_unsaved'
        from /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:392:in `each'
        from /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:392:in `odba_store_unsaved'
        from /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:380:in `odba_store'
        from /var/www/oddb.org/src/model/patinfo.rb:50:in `odba_store'
        from /var/www/oddb.org/src/util/persistence.rb:261:in `issue_update'
        from /var/www/oddb.org/src/util/oddbapp.rb:125:in `block in update'
        from /var/www/oddb.org/src/util/failsafe.rb:10:in `call'
        from /var/www/oddb.org/src/util/failsafe.rb:10:in `failsafe'
        from /var/www/oddb.org/src/util/oddbapp.rb:124:in `update'
        from /var/www/oddb.org/src/util/oddbapp.rb:1530:in `update'
...
Plugin: ODDB::TextInfoPlugin
Error: NotImplementedError
Message: method `method_missing' called on unexpected T_NODE object (0x0000003f43e830 flags=0x21c klass=0x0)
Backtrace:
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:588:in `block in odba_unsaved?'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:587:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:587:in `any?'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:587:in `odba_unsaved?'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache_entry.rb:37:in `object_id2ref'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache_entry.rb:72:in `_odba_object'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:309:in `fetch_or_do'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:225:in `fetch'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:49:in `odba_receiver'
commit
view · edit · sidebar · attach · print · history
Page last modified on March 29, 2013, at 09:28 PM