When looking at http://evidentia.oddb-ci2.dyndns.org/de/evidentia/search/zone/drugs/search_query/keppra/search_type/st_oddb?#best_result then IKNSR 62616 evetiracetam Desitin 500 mg/5 mL Levetiracetamum Infusionskonzentrat 500mg / 5ml 10 Durchstechflasche(n)
must be after all SL entries. Why is it before Levetiracetam Desitin 250 mg Levetiracetamum Minipacks mit Mini-Filmtabletten 250 mg 30 Tablette(n) 13.49 27.80 10% Desitin Pharma GmbH B / SL
(IKSNR 62069)
Neither spec/evidentia_spec.rb nor test/test_util/resultsort.rb catch this error. Why?
Used gem transpec to transform all rspec2 tests to rspec3. Added a new test for evidentia Avoid NoMethodError for active agents after Using new rspec3 expect
Added another test in test/test_util/resultsort.rb.
But it looks as if the database is not consistent. E.g bin/admin reports
ch.oddb> registration('61848').packages.collect{|x| [x.sl_generic_type,x.generic_type,x.sl_entry.class]}[0..3] -> [[nil, :generic, NilClass], [:generic, :generic, ODDB::SlEntry]] ch.oddb> registration('62616').packages.collect{|x| [x.sl_generic_type,x.generic_type,x.sl_entry.class]}[0..3] -> [[:generic, nil, NilClass], [nil, nil, NilClass]] ch.oddb> registration('62069').packages.collect{|x| [x.sl_generic_type,x.generic_type,x.sl_entry.class]}[0..3] -> [[nil, :unknown, ODDB::SlEntry], [nil, :unknown, ODDB::SlEntry], [nil, :unknown, ODDB::SlEntry], [nil, :unknown, ODDB::SlEntry]] ch.oddb> registration('62069').packages.collect{|x| [x.sl_generic_type,x.generic_type,x.sl_entry.class]}[4..7] -> [[nil, :unknown, ODDB::SlEntry], [nil, :unknown, ODDB::SlEntry], [nil, :unknown, ODDB::SlEntry]]
Looks like the BSV-Import did not update correctly all packages. Trying a fix locally, as the code analysis showed that the XML-Tag OrgGenCode comes from the registration, but is not updated in each package. Will think about whether we should not better move the sl_generic_type to the registration and update the packages correspondingly. However I don't know exactly how I can migrate the database.
Must fix the following error when running swissimport
Plugin: ODDB::SwissmedicPlugin Error: NoMethodError Message: undefined method `find' for nil:NilClass Backtrace: /var/www/oddb.org/src/model/composition.rb:48:in `inactive_agent' /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/swissmedic.rb:623:in `update_active_agent' /var/www/oddb.org/src/plugin/swissmedic.rb:769:in `block (2 levels) in update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:746:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:746:in `each_with_index' /var/www/oddb.org/src/plugin/swissmedic.rb:746:in `block in update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:739:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:739:in `each_with_index' /var/www/oddb.org/src/plugin/swissmedic.rb:739:in `update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:1049:in `update_all_sequence_info' /var/www/oddb.org/src/plugin/swissmedic.rb:1073:in `block in update_registrations' /var/www/oddb.org/src/plugin/swissmedic.rb:1060:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:1060:in `update_registrations' /var/www/oddb.org/src/plugin/swissmedic.rb:167: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>'
Looking at log/debug/oddb/2015/10.log I find it concerns the registration 57514
2015-10-19 07:33:47 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:1067 update iksnr 57514 seqnr 01 true opts {} 2015-10-19 07:33:48 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:743 update_compositions iksnr 57514 seqnr 01 comp_idx 0 parsed_comp #<ParseComposition:0x000001503446e8> 2015-10-19 07:33:48 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 753 57514/01 using oid 9435288 source ginseng extractum ethanolicum siccum 220 mg corresp 2015-10-19 07:33:48 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:611 update_active_agent 57514/01 Ginseng Extractum Ethanolicum Siccum true dose 220 mg 2015-10-19 07:33:48 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 753 57514/01 using oid 9435288 source ginseng extractum ethanolicum siccum 220 mg corresp 2015-10-19 07:33:48 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:611 update_active_agent 57514/01 DER: 10-15:1 false dose 0
With my DB I get the following error in bin/admin
ch.oddb> registration('57514').compositions.first.cleanup_old_active_agent -> undefined local variable or method `reg' for Kapseln: Ginseng Extractum Ethanolicum Siccum 220 mg:ODDB::Composition
After fixing this problem with a commit I was able to run the bin/admin command and did see on oddbd output cleanup_old_active_agent. Skipping inactive registration 57514 expiration #<Date: 2015-06-27 ((2457201j,0s,0n),+0s,2299161j)>
.
Running now import_daily. Got errors import patinfo, swissmedic and sl-update. But not the same as on thinpower. Dropping and reloading database of thinpower.
Got now another error with registration 57514.
Plugin: ODDB::SwissmedicPlugin Error: NoMethodError Message: undefined method `oid' for #<NoMethodError: undefined method `push' for nil:NilClass> Backtrace: /var/www/oddb.org/src/plugin/swissmedic.rb:646:in `update_active_agent' /var/www/oddb.org/src/plugin/swissmedic.rb:769:in `block (2 levels) in update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:746:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:746:in `each_with_index' /var/www/oddb.org/src/plugin/swissmedic.rb:746:in `block in update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:739:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:739:in `each_with_index' /var/www/oddb.org/src/plugin/swissmedic.rb:739:in `update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:1049:in `update_all_sequence_info' /var/www/oddb.org/src/plugin/swissmedic.rb:1073:in `block in update_registrations' /var/www/oddb.org/src/plugin/swissmedic.rb:1060:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:1060:in `update_registrations' /var/www/oddb.org/src/plugin/swissmedic.rb:167: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>'
log/debug/oddb/2015/10.log contains
2015-10-19 10:46:25 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:1067 update iksnr 57514 seqnr 01 true opts {} 2015-10-19 10:46:26 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:743 update_compositions iksnr 57514 seqnr 01 comp_idx 0 parsed_comp #<ParseComposition:0x000000937f9d40> 2015-10-19 10:46:26 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 753 57514/01 using oid 9435288 source ginseng extractum ethanolicum siccum 220 mg corresp 2015-10-19 10:46:26 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:611 update_active_agent 57514/01 Ginseng Extractum Ethanolicum Siccum true dose 220 mg 2015-10-19 10:46:26 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 753 57514/01 using oid 9435288 source ginseng extractum ethanolicum siccum 220 mg corresp 2015-10-19 10:46:27 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:611 update_active_agent 57514/01 DER: 10-15:1 false dose 0
Okay it looks as we cannot parse correctly the substance for 57514. Its name is nil. Why. Parsing ginseng extractum ethanolicum siccum 220 mg
seems to work in oddb2xml. No the problem is caused by wrong debug message. Removing it and the import swissmedic continues.
Pushed commits