view · edit · sidebar · attach · print · history

20130416-update-swissregd-patent-updater

<< | Index | >>


Summary

  • Update swissregd patent updater
    • search with iksnr (SwissmedicNo5)

Commits

Index


Update swissregd

Update/Change swissreg news importer to use iksnr for seach, instead of Substance-Name.
And update swissregd Request handler.

Job.

    def update_news
      substances = []
      if((group = @app.log_group(:swissmedic)) && (log = group.latest))
        log.change_flags.each_key { |ptr| 
          if(reg = ptr.resolve(@app))
            update_registrations(reg.iksnr)
          end
        }
      end 
    end 

This is report Email.

Found       14 Patents
of which    14 had a Swissmedic-Number.
            16 Registrations were successfully updated;
for these    0 Swissmedic-Numbers no Registration was found:

Then enable Jobs in import_daily.

commit

Encoding Error on production.

Plugin: ODDB::SwissregPlugin
Error: ArgumentError
Message: invalid byte sequence in US-ASCII
Backtrace:
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/builder.rb:9:in `gsub'
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/builder.rb:9:in `uxs'
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/traverse.rb:820:in `get_attribute'
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/elements.rb:481:in `block in <module:Traverse>'
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/elements.rb:495:in `[]'
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/elements.rb:495:in `block (3 levels) in <module:Traverse>'
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/elements.rb:310:in `block in filter'
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/elements.rb:308:in `each'
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/elements.rb:308:in `find_all'
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/elements.rb:308:in `filter'
(druby://localhost:10007) /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.8.4/lib/hpricot/traverse.rb:327:in `search'
(druby://localhost:10007) /var/www/oddb.org/ext/swissreg/src/session.rb:31:in `extract_result_links'
(druby://localhost:10007) /var/www/oddb.org/ext/swissreg/src/session.rb:191:in `get_result_list'
(druby://localhost:10007) /var/www/oddb.org/ext/swissreg/src/swissreg.rb:11:in `search'
...

Add this Open-Class for error in Hpricot on production.

src/util/hpricot.rb
module Hpricot
  def self.uxs(str)
    str.to_s.force_encoding('utf-8').
        gsub(/\&(\w+);/) { [NamedCharacters[$1] || 63].pack("U*") }. # 63 = ?? (query char)
        gsub(/\&\#(\d+);/) { [$1.to_i].pack("U*") }
  end 
  class Text
    def to_s
      str = content.force_encoding('utf-8')
      Hpricot.uxs(str)
    end 
  end 
end
commit
view · edit · sidebar · attach · print · history
Page last modified on April 16, 2013, at 09:29 AM