Generating a unit test for this problem.
Got the following error while running import-daily
Plugin: ODDB::SwissmedicPlugin Error: TypeError Message: can't dup NilClass Backtrace: /var/www/oddb.org/src/plugin/swissmedic.rb:799:in `dup' /var/www/oddb.org/src/plugin/swissmedic.rb:799:in `block in update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:741:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:741:in `each_with_index' /var/www/oddb.org/src/plugin/swissmedic.rb:741:in `update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:1047:in `update_all_sequence_info' /var/www/oddb.org/src/plugin/swissmedic.rb:1071:in `block in update_registrations' /var/www/oddb.org/src/plugin/swissmedic.rb:1058:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:1058:in `update_registrations' /var/www/oddb.org/src/plugin/swissmedic.rb:170:in `update' /var/www/oddb.org/src/util/updater.rb:444:in `block in update_swissmedic' /var/www/oddb.org/src/util/updater.rb:549:in `call' /var/www/oddb.org/src/util/updater.rb:549:in `wrap_update' /var/www/oddb.org/src/util/updater.rb:442:in `update_swissmedic' /var/www/oddb.org/src/util/updater.rb:201: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>'
This error does not occur while running test/test_plugin/swissmedic.rb. Looking at log/oddb/debug/2015/09.log
I find
2015-09-02 07:54:29 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:613 update_active_agent 46337/02 Pinaverii Bromidum true dose 50 mg 2015-09-02 07:54:30 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:1031 46337 02 excipiens ODDB::Substance excipiens.oid 9885145 for Excipiens pro compresso Obducto 2015-09-02 07:54:30 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:1037 46337 02 update_excipiens_in_composition idx 0: excipiens Excipiens pro Compresso Obducto. from #<ParseSubstance:0x0000010c711c60> 2015-09-02 07:54:30 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:1065 update iksnr 46351 seqnr 01 true opts {} 2015-09-02 07:54:31 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:745 update_compositions iksnr 46351 seqnr 01 comp_idx 0 parsed_comp #<ParseComposition:0x00000164e26818> 2015-09-02 07:54:31 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 755 46351/01 using oid 9447296 source paracetamolum 80 mg, excipiens pro suppositorio. 2015-09-02 07:54:31 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:613 update_active_agent 46351/01 Paracetamolum true dose 80 mg 2015-09-02 07:54:31 CESTlog notify Error: swissmedic: start outgoing process ["log"]. Must attach 0 files and 0 parts.
Trying to reproduce the problem with sudo -u apache /usr/local/bin/ruby jobs/import_swissmedic_only
. Fixed with Avoid nil error in swissmedic
Got a second error on thinpower
Plugin: ODDB::SwissmedicPlugin Error: NoMethodError Message: undefined method `replace' for nil:NilClass Backtrace: /var/www/oddb.org/src/plugin/swissmedic.rb:806:in `block in update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:741:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:741:in `each_with_index' /var/www/oddb.org/src/plugin/swissmedic.rb:741:in `update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:1047:in `update_all_sequence_info' /var/www/oddb.org/src/plugin/swissmedic.rb:1071:in `block in update_registrations' /var/www/oddb.org/src/plugin/swissmedic.rb:1058:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:1058:in `update_registrations' /var/www/oddb.org/src/plugin/swissmedic.rb:170:in `update' /var/www/oddb.org/src/util/updater.rb:444:in `block in update_swissmedic' /var/www/oddb.org/src/util/updater.rb:549:in `call' /var/www/oddb.org/src/util/updater.rb:549:in `wrap_update' /var/www/oddb.org/src/util/updater.rb:442:in `update_swissmedic' jobs/import_swissmedic:14: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_swissmedic:12:in `<module:Util>' jobs/import_swissmedic:11:in `<module:ODDB>' jobs/import_swissmedic:10:in `<main>'
Looks as it comes from the same sequence
2015-09-02 12:15:06 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:745 update_compositions iksnr 46351 seqnr 01 comp_idx 0 parsed_comp #<ParseComposition:0x0000008c7e59a0> 2015-09-02 12:15:06 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 755 46351/01 using oid 9447296 source paracetamolum 80 mg, excipiens pro suppositorio. 2015-09-02 12:15:06 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:613 update_active_agent 46351/01 Paracetamolum true dose 80 mg 2015-09-02 12:15:07 CESTlog notify Error: swissmedic: start outgoing process ["log"]. Must attach 0 files and 0 parts. 2015-09-02 12:15:07 CESTUtil.send_mail list_and_recipients ["log"] 2015-09-02 12:15:07 CEST /var/www/oddb.org/src/util/mail.rb: Configured email using /var/www/oddb.org/etc/oddb.yml @cfg is now "smtp.gmail.com" 587 "admin@ywesee.com"
This is an inactive registration as shown by bin/admin
ch.oddb> registration('46351').sequence('01').compositions.first.inactive_agents.class -> NilClass ch.oddb> registration('46351').sequence('01').active? -> false
Why is it inactive when it appears in the Packungen.xlsx? bin/admin find a manual_inactive_date
ch.oddb> registration('46351').manual_inactive_date -> 2008-08-25 # outputtting all manually outdated registrations $manual = registrations.find_all{|key, reg| reg.manual_inactive_date != nil} File.open('manual.txt', 'w+') {|f| $manual.each{|x| f.puts "#{x[1].iksnr} #{x[1].name_base} #{x[1].manual_inactive_date.to_s}"} }
See Attach:manually_outdated.txt
Zeno explained me that the meaning of manual_inactive_date marks the drug in question to not be shown anymore on oddb.org (for non-admin users). This was introduced because some companies do not want these drugs to be displayed anymore.
Did run swissmedic, but could not find any line containing update iksnr 46351 seqnr 01 true opts
in log/oddb/debug/2015/09.log
. Running jobs/update_active_agents fixed registration 46351. Reloading thinpowers database to run import_swissmedic again.
This problem should be fixed with Fix handling inactive_agents in update and swissmedic
I am looking at the following needs of evidentia. (eg. when looking on oddb-ci2 at Keppra)
I suspect, that evidentia should include a few definitions of our css to fix these problems, eg. entries with name like fachinfo, list, td.bold, span.bold.
Will continue with this task next monday