Trying to find out why I did get a registration('00599').sequence('01').active_agents[3].is_a?(ODDB::Composition) == true
. After dropping and reloading the dump this is not the case. Restarting the import.
To try to work in parallel I issued egistration('54997').sequence('01').compositions.odba_store
in bin/admin after changing its label and corresp. Now jobs/import_swissmedic_only
got stuck. Is this an operation I am not allowed to do?
After killing the process its CPU useage gets up to 200%. After it consumed more time than before the kill I issued a kill -9
. Now the process died. The import was at update_compositions iksnr 00485 seqnr 27 comp_idx 0
. And know I see via bin/admin, that this sequence is no longer consistent.
ch.oddb> registration('00485').sequence('27').active_agents.find{|x| x.is_a?(ODDB::Composition)}.class -> ODDB::ActiveAgent ch.oddb> registration('00485').sequence('27').active_agents.find_all{|x| x.is_a?(ODDB::Composition)}.size -> 1
The joy of ruby! The same object claims to be a representation of two classes. Therefore I learned the hard way
Dropping and reloading database again. Setting label and corresp for 00277/01 via bin/admin and issueing a odba_store, too. Now restarting the import. Waiting till it passes at this first line. No problem and the label/corresp get replaced by the (null) values. Via http://oddb-ci2.dyndns.org/de/gcc/search/zone/drugs/search_query/00277/search_type/st_registration?#best_result the result got updated immediately after the import proceeded to the next line. bin/admin still reported the old result. After a restart of bin/oddbd it displayed the correct value, too.
Got the following error in update_compositions iksnr 19932 seqnr 07
Message: invalid value for Integer(): "08" Backtrace: /var/www/oddb.org/src/plugin/swissmedic.rb:686:in `%' /var/www/oddb.org/src/plugin/swissmedic.rb:686:in `update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:993:in `update_all_sequence_info' /var/www/oddb.org/src/plugin/swissmedic.rb:142:in `block in update' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-3.3.1/lib/rubyXL/worksheet.rb:23:in `block in each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-3.3.1/lib/rubyXL/worksheet.rb:23:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-3.3.1/lib/rubyXL/worksheet.rb:23:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:124: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_only:29: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_only:12:in `<module:Util>' jobs/import_swissmedic_only:11:in `<module:ODDB>'
Looks like we have sometime '01' or 1 as seq_nr. Checking it more thoroughly. Restarting import. This seems to be fixed.
Now we get with IKSNR 00488 sequence 02 the following error
ssmedicPlugin Error: TypeError Message: Accessor substance ''(DBI::ProgrammingError) should be ODDB::Substance or NilClass Backtrace: /var/www/oddb.org/src/util/persistence.rb:139:in `block (2 levels) in define_check_class_methods' /var/www/oddb.org/src/model/activeagent.rb:116:in `substance=' /var/www/oddb.org/src/plugin/swissmedic.rb:997:in `block in update_excipiens_in_composition' /var/www/oddb.org/src/plugin/swissmedic.rb:991:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:991:in `each_with_index' /var/www/oddb.org/src/plugin/swissmedic.rb:991:in `update_excipiens_in_composition' /var/www/oddb.org/src/plugin/swissmedic.rb:1020:in `update_all_sequence_info'
Adding debug output. Now import limited to 00488 passed without any problem. Restarting importing all IKSNR.
But imports gets stuck again at 2015-07-22 15:44:54 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:1004 00613 01 update_excipiens_in_composition idx 1: excipiens Pro Praeparatione from #<ParseSubstance:0x0000004ade68c8>
Working on displaying correctly all composition. Suppressing the header if no active agent or auxilliary substance are found is a little be tricky. Works fine with http://oddb-ci2.dyndns.org/de/gcc/show/reg/00278/seq/01 but leaves a big hole with
My import script is wrong as I have 3 compositions in IKSNR 00615/01 instead of 2. source is twice Solvens: aqua ad iniectabilia 0.5 ml.
Also asking myself why we have to similar, but not identical View CompositionList in view/drugs/package.rb and view/admin/sequence.rb. Shouldn't we merge these two views into a single one?
Idea is that de/gcc/search/zone/drugs/search_query/00615/search_type/st_registration?#best_result
should present the same Packungsbestandteile as de/gcc/show/reg/00615/seq/01
. A quick hack proved to be easy.
Trying to verifying via bin/admin the line @@/var/www/oddb.org/src/plugin/swissmedic.rb:691 update_compositions: iksnr 46489 01 mismatch between false and "46489"
ch.oddb> registration('46489').sequence('01').iksnr -> false
Got the same result on oddb-ci2 and thinpower. This is probably the leftover of bad commit of myself. In any case it looks as we cannot display it via http://ch.oddb.org/de/gcc/search/zone/drugs/search_query/46489/search_type/st_registration?#best_result
Good news is that it looks as if we had only one such item
ch.oddb> sequences.find_all{ |value| value.iksnr == false}.size -> 1 # will try to fix it after my import script has run with registration('46489').sequence('01').registration = registration('46489') registration('46489').sequence('01').odba_store
Import finished during the night. Updating the database via bin/admin worked fine. The problem with duplicate compositions as in 00615/01 is not present for all new compositions. E.g for 63166/01 it is correct.
Found the following entries in the oddb/debug log.
2015-07-22 16:42:01 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:728 update_compositions iksnr 00615 seqnr 01 comp_idx 0 parsed_comp #<ParseComposition:0x00000067e548d8> 2015-07-22 16:42:01 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 736 00615/01 component_in_db #<ODBA::Stub:882012920#33904692 @odba_class=ODDB::Composition @odba_container=882017380#9498959> label "Praeparatio cryodesiccata:" corrsp 2015-07-22 16:42:02 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 736 00615/01 component_in_db #<ODBA::Stub:882012920#33904692 @odba_class=ODDB::Composition @odba_container=882017380#9498959> label "Praeparatio cryodesiccata:" corrsp 2015-07-22 16:42:03 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 736 00615/01 component_in_db #<ODBA::Stub:882012920#33904692 @odba_class=ODDB::Composition @odba_container=882017380#9498959> label "Praeparatio cryodesiccata:" corrsp 2015-07-22 16:42:03 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 736 00615/01 component_in_db #<ODBA::Stub:882012920#33904692 @odba_class=ODDB::Composition @odba_container=882017380#9498959> label "Praeparatio cryodesiccata:" corrsp 2015-07-22 16:42:04 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 736 00615/01 component_in_db #<ODBA::Stub:882012920#33904692 @odba_class=ODDB::Composition @odba_container=882017380#9498959> label "Praeparatio cryodesiccata:" corrsp 2015-07-22 16:42:04 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 736 00615/01 component_in_db #<ODBA::Stub:882012920#33904692 @odba_class=ODDB::Composition @odba_container=882017380#9498959> label "Praeparatio cryodesiccata:" corrsp 2015-07-22 16:42:05 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 736 00615/01 component_in_db #<ODBA::Stub:882012920#33904692 @odba_class=ODDB::Composition @odba_container=882017380#9498959> label "Praeparatio cryodesiccata:" corrsp 2015-07-22 16:42:05 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 736 00615/01 component_in_db #<ODBA::Stub:882012920#33904692 @odba_class=ODDB::Composition @odba_container=882017380#9498959> label "Praeparatio cryodesiccata:" corrsp 2015-07-22 16:42:06 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:728 update_compositions iksnr 00615 seqnr 01 comp_idx 1 parsed_comp #<ParseComposition:0x000000681e7130> 2015-07-22 16:42:07 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:671 create_composition_in_sequence component_in_db.pointer :!registration,00615!sequence,01!composition,33911263. size 3 2015-07-22 16:42:07 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:996 00615 01 substance ODDB::Substance for pro Vitro 2015-07-22 16:42:07 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:1004 00615 01 update_excipiens_in_composition idx 0: excipiens Pro Vitro from #<ParseSubstance:0x000000681e1500>
Import after a drop/recreate the database is working since 30 minutes. Pushed commit Added new fields to import of swissmedic