view · edit · sidebar · attach · print · history

Index>

20150817-fix-swissmedic-import-error

Summary

  • Fix error in swissmedic import

Commits

Index

Keep in Mind for work to do
  • 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!
  • creat gem: task: input=file with ean-codes, standard output show ean-codes + atc-code. Source is Swissmedic Packungen.xlsx or XML.
  • Import via data/medreg_companies.yaml
  • Fix problem with radioactivatum 99m-technetio when parsing Wirkstoffe
  • Fix galenic_forms when parsing swissmedic.xlsx
  • Cleanup generic_type. Replace it everywhere by sl_generic_type and adapt code accordingly.
  • Get updated ATC-codes from EPha for oddb.org, too.
  • Display new fields CORRESP for compositions in oddb.org.
  • Use refdatabase for oddb.org, too.
  • Fix running rspec for new packungen.xlsx in oddb2xml

Fix error in swissmedic import

Found the following error while running import-daily

Plugin: ODDB::SwissmedicPlugin
Error: ArgumentError
Message: wrong number of arguments (2 for 1)
Backtrace:
/var/www/oddb.org/src/model/composition.rb:61:in `delete_active_agent'
/var/www/oddb.org/src/util/persistence.rb:265:in `issue_delete'
/var/www/oddb.org/src/util/oddbapp.rb:127:in `block in delete'
/var/www/oddb.org/src/util/failsafe.rb:10:in `call'
/var/www/oddb.org/src/util/failsafe.rb:10:in `failsafe'
/var/www/oddb.org/src/util/oddbapp.rb:123:in `delete'
/var/www/oddb.org/src/command/delete.rb:11:in `execute'
/var/www/oddb.org/src/util/oddbapp.rb:743:in `execute_command'
/var/www/oddb.org/src/util/oddbapp.rb:1592:in `delete'
/var/www/oddb.org/src/plugin/swissmedic.rb:649:in `block in remove_active_agents_that_are_nil'
/var/www/oddb.org/src/plugin/swissmedic.rb:647:in `each'
/var/www/oddb.org/src/plugin/swissmedic.rb:647:in `remove_active_agents_that_are_nil'
/var/www/oddb.org/src/plugin/swissmedic.rb:710:in `block in update_compositions'
/var/www/oddb.org/src/plugin/swissmedic.rb:710:in `each'docker install file
/var/www/oddb.org/src/plugin/swissmedic.rb:710:in `update_compositions'
/var/www/oddb.org/src/plugin/swissmedic.rb:1024:in `update_all_sequence_info'
/var/www/oddb.org/src/plugin/swissmedic.rb:1048:in `block in update_registrations'
/var/www/oddb.org/src/plugin/swissmedic.rb:1035:in `each'
/var/www/oddb.org/src/plugin/swissmedic.rb:1035:in `update_registrations'
/var/www/oddb.org/src/plugin/swissmedic.rb:169: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>'

Found the following entry in oddb/debug/2015/08.log 2015-08-14 07:32:34 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:648 remove_active_agents_that_are_nil 46111/01 composition.oid 9479306 7 active_agents. substance.oid 34114709 substance.pointer :!registration,46111!sequence,01!composition,9479306!active_agent,-hydricum,false. bin/admin allows me to find out whether the substances in questions are present and/or deleted.

ch.oddb> registration('46111').sequence('01').compositions.first.active_agents.collect{|x| x.oid}
-> [34114707, 26748102, 26748103, 26748104, 26748105, 34114711]
ch.oddb> substances.find{|x| x.oid == 34114707}.class
-> NilClass
ch.oddb> 
ch.oddb> substances.find{|x| x.oid == 26748105}.class
-> NilClass
ch.oddb> substances.find{|x| x.oid == 34114709}.class
-> NilClass
ch.oddb> substances.find{|x| x.oid == 34114711}.class
-> NilClass
ch.oddb> registration('46111').sequence('01').compositions.first.source[200..350]
-> osphas 50 mg et magnesii orotas dihydricus 100 mg et magnesii aspartas dihydricus 150 mg corresp. magnesium 30.55 mg, color.: E 132, excipiens pro caps
ch.oddb> substance('E 132').oid
-> 34114710
ch.oddb> substance('excipiens pro capsula').oid
-> 34114720
ch.oddb> substance('magnesii chloridum 4.5-hydricum').oid
-> 1663975

I see clearly, that it is okay that we wanted to delete active_agents which were not correctly created as they did not containe a valid substance.

Looking in the logs of oddb-ci2 I did not find a problem with 46111, but unde http://oddb-ci2.dyndns.org/de/gcc/drug/reg/46111/seq/01 the E 132 does not show up. Edit running jobs/import_swissmedic_only 46111 with some more debug info and a break into pry to try to see the problem.

There seems to be a similar problem with IKSNR 51931. Both show at the end an agent with has no substance name, but a dose. And the substance contains one or more occurrences of " et ". Looks like we don't handle correctly this case. Also it updates way too many update_compositions, as it does not honor limiting it to the IKSNR. This must be fixed, too. Done.

Cannot reproduce the problem on oddb-ci2. Getting the database dump from August 13 to test with it. Remarked that the method set_all_export_flag_false takes over half an hour to complete. Did not work, as I had an error in my changes. Restarting again. Bad luck, now my ruby crashes. Reimporting the database. Why does the import suddenly hang after emitting

2015-08-17 16:38:14 +0200: /var/www/oddb.org/src/plugin/text_info.rb:179:in `block in update_fachinfo': update_fachinfo Emadine®/- SE iksnr 54881 store_fachinfo {} or

2015-08-17 16:57:29 +0200: /var/www/oddb.org/src/plugin/text_info.rb:179:in `block in update_fachinfo': update_fachinfo Ciprofloxacin Sandoz® i.v. iksnr 56906 store_fachinfo {}

Now import fails because I was using an outdated version of swissmedic-diff. Restarting import. Import fails if no latest file present error is

Error: Zip::Error
Message: XLSX file format error: File /var/www/oddb.org/data/xls/Packungen-latest.xlsx not found
Backtrace:
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.7/lib/zip/file.rb:82:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.7/lib/zip/file.rb:96:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.7/lib/zip/file.rb:96:in `open'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-3.3.1/lib/rubyXL/objects/root.rb:64:in `parse_file'
/usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-3.3.1/lib/rubyXL/parser.rb:4:in `parse'
/usr/local/lib/ruby/gems/1.9.1/gems/swissmedic-diff-0.2.1/lib/compatibility.rb:10:in `open'
/usr/local/lib/ruby/gems/1.9.1/gems/swissmedic-diff-0.2.1/lib/swissmedic-diff.rb:151:in `diff'
/var/www/oddb.org/src/plugin/swissmedic.rb:159: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>'

After reinstalling the correct swissmedic-diff running import-daily completed without problem. Why? Will continue tomorrow.

Fix error in swissmedic import opening the wrong Präparateliste.xlsx

Looking at recent mails I found

Plugin: ODDB::SwissmedicPlugin
Error: TypeError
Message: can't convert nil into String
Backtrace:
/usr/local/lib/ruby/gems/1.9.1/gems/swissmedic-diff-0.2.1/lib/compatibility.rb:9:in `extname'
/usr/local/lib/ruby/gems/1.9.1/gems/swissmedic-diff-0.2.1/lib/compatibility.rb:9:in `open'
/var/www/oddb.org/src/plugin/swissmedic.rb:413:in `initialize_export_registrations'
/var/www/oddb.org/src/plugin/swissmedic.rb:156: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 is fixed with commit Open correct xlsx-file in import/swissmedic

view · edit · sidebar · attach · print · history
Page last modified on August 18, 2015, at 07:36 AM