view · edit · sidebar · attach · print · history

Index>

20140910-avoid-nil-error-in-import-daily

Summary

  • Avoid nil error in ODDB::TextInfoPlugin when running import-daily
  • Avoid "Message: undefined method `values' for "<":String" when running import-daily
  • Fix AJAX search

Commits

Index

Keep in Mind
  • Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • One unit-test for searchbar fails and might be a clue why searching does not work correctly.
  • Added two skip in test/test_plugin/rss.rb. Why does the mocking not work there anymore? Fixed with Fixed tests for plugin/rs
  • Refactor src/util/log.rb to use proper Mail attachements instead of parts.

---

update_bsv no longer attaches error logs

It looks as if my changes in the mail handling of last june resulted in not attaching the error files when running import_bsv.

Added a unit tests for the problem (src/util/mail.rb ignored parts) in test/test_util/zlog.rb. Fixed the problem. Updating latest and running import_bsv again on oddb-ci2.

Analysing why I got this problem is that I did not remove the unused accessor :parts in src/util/log.rb. It would have been better to refactor all useage of parts to something like attachement also to avoid confusion with the part in package.

Received now the message, but now the normal body is missing and only the attachments are shown.

Avoid "Message: undefined method `values' for "<":String" when running import-daily

When running import-daily on oddb-ci2 I got the following error message

Plugin: ODDB::BsvXmlPlugin
Error: NoMethodError
Message: undefined method `values' for "&lt;":String
@report: {:name_base=>"Ebixa Starterpack", :name_descr=>"Filmtabl 7x5,7x10,7x15,7x20mg", :swissmedic_no5_bag=>"55828", :deductible=>:deductible_g, :generic_type=>:original, :atc_class=>"N06DX01", :pharmacode_bag=>"5291605", :swissmedic_no5_oddb=>"55828", :swissmedic_no8_bag=>"55828019", :pharmacode_oddb=>"5291605"}
Backtrace:
/var/www/oddb.org/src/model/registration.rb:235:in `block in packages'
/var/www/oddb.org/src/model/registration.rb:234:in `each'
/var/www/oddb.org/src/model/registration.rb:234:in `inject'
/var/www/oddb.org/src/model/registration.rb:234:in `packages'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing'
/var/www/oddb.org/src/plugin/bsv_xml.rb:463:in `tag_end'
/usr/local/lib/ruby/1.9.1/rexml/parsers/streamparser.rb:26:in `parse'
/usr/local/lib/ruby/1.9.1/rexml/document.rb:205:in `parse_stream'
/var/www/oddb.org/src/plugin/bsv_xml.rb:1008:in `update_preparations'
/var/www/oddb.org/src/plugin/bsv_xml.rb:663:in `block (2 levels) in _update'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/entry.rb:500:in `get_input_stream'
/var/www/oddb.org/src/plugin/bsv_xml.rb:663:in `block in _update'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/entry_set.rb:42:in `call'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/entry_set.rb:42:in `block in each'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/entry_set.rb:41:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/entry_set.rb:41:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/central_directory.rb:182:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/file.rb:139:in `block in foreach'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/file.rb:99:in `open'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/file.rb:138:in `foreach'
/var/www/oddb.org/src/plugin/bsv_xml.rb:658:in `_update'
/var/www/oddb.org/src/plugin/bsv_xml.rb:653:in `update'
/var/www/oddb.org/src/util/updater.rb:246:in `block in update_bsv'
/var/www/oddb.org/src/util/updater.rb:496:in `call'
/var/www/oddb.org/src/util/updater.rb:496:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:244:in `update_bsv'
/var/www/oddb.org/src/util/updater.rb:198:in `run'
jobs/import_daily:13:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `call'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/import_daily:12:in `<module:Util>'
jobs/import_daily:11:in `<module:ODDB>'
jobs/import_daily:10:in `<main>'

Before sending the email this was the last line in the output of import_daily Could not create: :!registration,55829!!package,014!sl_entry!limitation_text., reason: :!registration,55829!!package,014!sl_entry!limitation_text. -> undefined Method ODDB::Registration::01() This error occurs inside a section protected by GC.disable. Registration 55828 looks normal to me. Bin/admin tells me that registration('55829').sequences is {}. This does not match the info in Packungen.xls where we find two packages['010','014'] for the sequence '01' (Zulassung 28.10.03, Gültigkeit 27.10.18). Therefore something is wrong in our database!

Created a test case for this error and fixed the error. Adding some test output and rerunning import_bsv (after resetting latest) on oddb-ci2.

Fix AJAX search

Must make AJAX search work wherever it used.

I already added some watir tests for most useages. First step is to see why I have 8 failing tests when I run spec/rezept_and_instantsearch_spec.rb with just-medical.oddb.org instead of oddb-ci2.dyndns.org. This will help me find errors where I hard-coded a wrong URL in the code.

Now. There is first an error in my watir tests as I hardcoded gcc instead of jusing the correct flavor. Fixing various occurrences of hard-coded flavor. Excluding about 15 tests which are not applicable for just-medical, e.g. switching languages, changing preferences. Always used expression unless ['just-medical'].index(Flavor). Running tests for oddb-ci2 and just-medical in parallel works fine.

Pushed commit Added tests for searchbar and allow testing just-medical.org

Avoid nil error in ODDB::TextInfoPlugin when running import-daily

Got the following error when running import-daily:

Plugin: ODDB::TextInfoPlugin
Error: NoMethodError
Message: undefined method `each' for nil:NilClass
Backtrace:
/var/www/oddb.org/src/plugin/text_info.rb:218:in `update_patinfo'
/var/www/oddb.org/src/plugin/text_info.rb:1127:in `parse_and_update'
/var/www/oddb.org/src/plugin/text_info.rb:1137:in `block (3 levels) in import_info'
/var/www/oddb.org/src/plugin/text_info.rb:1136:in `each'
/var/www/oddb.org/src/plugin/text_info.rb:1136:in `block (2 levels) in import_info'
/var/www/oddb.org/src/plugin/text_info.rb:1135:in `each_pair'
/var/www/oddb.org/src/plugin/text_info.rb:1135:in `block in import_info'
/var/www/oddb.org/src/plugin/text_info.rb:1132:in `each_pair'
/var/www/oddb.org/src/plugin/text_info.rb:1132:in `import_info'
/var/www/oddb.org/src/plugin/text_info.rb:1340:in `block in import_swissmedicinfo_by_index'
/var/www/oddb.org/src/plugin/text_info.rb:1339:in `each_pair'
/var/www/oddb.org/src/plugin/text_info.rb:1339:in `import_swissmedicinfo_by_index'
/var/www/oddb.org/src/plugin/text_info.rb:1394:in `import_swissmedicinfo'
/var/www/oddb.org/src/util/updater.rb:520:in `block in update_notify_simple'
/var/www/oddb.org/src/util/updater.rb:496:in `call'
/var/www/oddb.org/src/util/updater.rb:496:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:514:in `update_notify_simple'
/var/www/oddb.org/src/util/updater.rb:306:in `update_textinfo_swissmedicinfo'
/var/www/oddb.org/src/util/updater.rb:192:in `run'
jobs/import_daily:13:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `call'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/import_daily:12:in `<module:Util>'
jobs/import_daily:11:in `<module:ODDB>'
jobs/import_daily:10:in `<main>'

It looks like iksnrs_from_xml was nil when calling update_fachinfo. Added two checks for nil in src/plugin/text_info.rb. Running import_daily on oddb-ci2. Nil checks not used as I see 2014-09-10 08:31:50 +0200: parse_and_update: calls parse_fachinfo dist /var/www/oddb.org/data/html/fachinfo/de/Gemzar__swissmedicinfo.html iksnrs_from_xml ["53056"] Gemzar__swissmedicinfo.html, name Gemzar® de title Gemzar® in log/oddb/debug/2014/09.log.

Pushed commit Avoid nil error in plugin/text_info. Pulling changes to thinpower and restarting import_daily in a screen. Import completed without any errors.

view · edit · sidebar · attach · print · history
Page last modified on September 15, 2014, at 08:23 AM