Must fix problem shown by unit-test to discover chemical and units with '%'. Made additional unit-test pass under oddb2xml --calc. Looking now again at the unit-tests of oddb.org. Here I must make pass in test/test_plugin/swissmedic.rb the test_update_composition__chemical_form
. This proved to be easy.
Now I must check why we run the update often, even when there are now changes. Running jobs/import_swissmedic_only update_compositions
on oddb-ci2.
Pushed the following commits to oddb2xml
Waiting for import to finish. But log looks better and only makes an update if necessary. Log looks a lot better, but I rerun it again to see why I still got 286 deletions and 5351 creations. Report-Mail was
ODDB::SwissmedicPlugin - Report 24.03.2015 Total time to update: 130.00 [m] Updated compositions: 21502 Deleted compositions: 228 Updated agents: 2775 New agents: 5351
Analysing what is happening with IKSNR 47657 seq 01 Nanocoll, Markierungsbesteck
2015-03-24 16:25:19 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:582 update_active_agent update 47657/01 from creator ptr :!create,:!registration,47657!sequence,01!composition,33022254!active_agent,Albuminum Humanum Colloidale 0%.5 Mg%, Stanni(ii) Chloridum Dihydricum.. label nil 2 args {:substance=>"Albuminum Humanum Colloidale 0.5 Mg, Stanni(ii) Chloridum Dihydricum", :dose=>Quanty(0.2,'mg')} 2015-03-24 16:25:19 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:582 update_active_agent update 47657/01 from creator ptr :!create,:!registration,47657!sequence,01!composition,33022254!active_agent,Poloxamerum.. label nil 2 args {:substance=>"Poloxamerum", :dose=>Quanty(238,'')} 2015-03-24 16:25:20 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:582 update_active_agent update 47657/01 from creator ptr :!create,:!registration,47657!sequence,01!composition,33032907!active_agent,I) Recenter Radioactivatum.. label "II" 4 args {:substance=>"I) Recenter Radioactivatum", :dose=>Quanty(99,''), :chemical_substance=>"Natrii Pertechnetas.", :chemical_dose=>nil} 2015-03-24 16:25:21 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:633 update_compositions delete1 1 atc_idx 0 :!registration,47657!sequence,01!composition,33022254!active_agent,Albuminum Humanum Colloidale 0%.5 Mg%, Stanni(ii) Chloridum Dihydricum. 0.2 mg 2015-03-24 16:25:21 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:633 update_compositions delete1 1 atc_idx 1 :!registration,47657!sequence,01!composition,33022254!active_agent,Poloxamerum. Poloxamerum 238 2015-03-24 16:25:21 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:647 iksnr 47657 seqnr 01 comp_idx 2 delete :!registration,47657!sequence,01!composition,33032907. 99 2015-03-24 16:36:31 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:582 update_active_agent update 53889/01 from active_agent ptr :!registration,53889!sequence,01!composition,9476577!active_agent,222849. label nil 0 args {}
via bin/admin
ch.oddb> registration('47657').sequence('01').compositions.last -> Markierungsbesteck: ch.oddb> registration('47657').sequence('01').compositions.last.oid -> 33022254 ch.oddb> registration('47657').sequence('01').compositions.first.oid -> 9464580 ch.oddb> registration('47657').sequence('01').compositions.first -> Markierungsbesteck: ch.oddb> registration('47657').sequence('01').compositions.first.substances.size -> 0 ch.oddb> registration('47657').sequence('01').compositions.first.active_agents.size -> 0 ch.oddb> registration('47657').sequence('01').compositions.last.active_agents.size -> 0 ch.oddb> registration('47657').sequence('01').compositions.last.substances.size -> 0 -> I): albuminum humanum colloidale 0.5 mg, stanni(II) chloridum dihydricum 0.2 mg, glucosum anhydricum, dinatrii phosphas monohydricus, natrii fytas (9:1), poloxamerum 238, q.s. ad pulverem pro vitro. ch.oddb> registration('47657').sequence('01').compositions.last.source -> I): albuminum humanum colloidale 0.5 mg, stanni(II) chloridum dihydricum 0.2 mg, glucosum anhydricum, dinatrii phosphas monohydricus, natrii fytas (9:1), poloxamerum 238, q.s. ad pulverem pro vitro.
May be I should use the method create_active_agent
in model/composition. Does not work as expected. http://ch.oddb.org/de/gcc/drug/reg/47657/seq/01 shows the expected result whereas http://oddb-ci2.dyndns.org/de/gcc/drug/reg/47657/seq/01 still show two compositions without a galenic_form and without any substance.
IKSNR 00274 sequence 01 is getting upgraded each time, but it looks alright when visiting it via http://oddb-ci2.dyndns.org/de/gcc/drug/reg/00274/seq/01 and has the new "E 216" and "E 218" substances. Found the culprit. Comparision fails because sometimes of mixed case in substance name.