Zeno remarked that for IKSNR 65044 we must replace when displaying http://ch.oddb.org/de/gcc/show/reg/65044/seq/01/pack/001 the two lines Perindopril
and Perindoprilum Tosylatum 5 mg
by a single line perindoprilum tosylatum 5 mg als Salz entspricht perindoprilum 3.4 mg
Downloaded the actual XMLPublications.zip and found for 65044 the followin definition
<Substances> <Substance> <DescriptionLa>Perindoprilum tosylatum</DescriptionLa> <Quantity>5</Quantity> <QuantityUnit>mg</QuantityUnit> </Substance> <Substance> <DescriptionLa>Amlodipinum</DescriptionLa> <Quantity>5</Quantity> <QuantityUnit>mg</QuantityUnit> </Substance> </Substances>
From the actual Zugelassene_Packungen_NEU_31102016.xlsx I find in column R (Zusammensetzung) the following text for 65044
perindoprilum tosylatum 5 mg corresp. perindoprilum 3.4 mg, amlodipinum 5 mg ut amlodipini besilas, excipiens pro compresso.
oddb2xml emits the following lines
<COMPOSITIONS> <COMPOSITION> <EXCIPIENS> <SUBSTANCE_NAME>Excipiens pro compresso</SUBSTANCE_NAME> </EXCIPIENS> <SUBSTANCES> <SUBSTANCE> <SUBSTANCE_NAME>Perindoprilum Tosylatum</SUBSTANCE_NAME> <IS_ACTIVE_AGENT>true</IS_ACTIVE_AGENT> <QTY>5</QTY> <UNIT>mg</UNIT> <CHEMICAL_SUBSTANCE> <SUBSTANCE_NAME>Perindoprilum</SUBSTANCE_NAME> <QTY>3.4</QTY> <UNIT>mg</UNIT> </CHEMICAL_SUBSTANCE> </SUBSTANCE> <SUBSTANCE> <SUBSTANCE_NAME>Amlodipinum</SUBSTANCE_NAME> <IS_ACTIVE_AGENT>true</IS_ACTIVE_AGENT> <QTY>5</QTY> <UNIT>mg</UNIT> <SALTS> <SALT> <SUBSTANCE_NAME>Amlodipini Besilas</SUBSTANCE_NAME> </SALT> </SALTS> </SUBSTANCE> </SUBSTANCES> </COMPOSITION> </COMPOSITIONS>
I think the problem lies only in the visual presentation, that we should span the name Perindoprilum Tosylatum
over more columns to avoid line breaks. Also Zeno would like now that we also display the corresp. information.
Looking via /bin/admin I find
ch.oddb> registration('65044').packages.first.active_agents.collect {|x| [x.to_s, x.chemical_substance, x.is_active_agent, x.dose]} -> [["Perindoprilum", nil, nil, nil], ["Amlodipinum 5 mg", Amlodipini Besilas, true, Quanty(5,'mg')], ["Perindoprilum Tosylatum 5 mg", Perindoprilum, true, Quanty(5,'mg')]]
Contrary to my expectations going to http://oddb-ci2.dyndns.org/de/gcc/show/reg/65044/seq/01/pack/001 (without being logged in) used src/view/admin/sequence.rb. Therefore my first try did not work. Think about adding a new method to src/model/active_agent to display the human readable description. It is a lot easier to add a testable new method to src/model than to src/view. Added new method human_readable and corresponding unit test to src/model/activeagent.rb.
Now content looks better and we have
Wirkstoffe Stärke Amlodipinum 5 mg Entspricht Amlodipini Besilas 5 mg Perindoprilum Tosylatum 5 mg Entspricht Perindoprilum 3.4 mg 5 mg
But we have an empty line, because Perindoprilum has is_active_agent nil and therefore should not be displayed.
But why do we have this element? I think we have inconsitent data and should iterate over all active packages and remove the active_agents which have the field is_active_agent set and where thereis another active_agent with a chemical_substance. And I must also look over the swissmedic plugin, whether we handle this situation correctly.
Looks as if we have in every package a active_agent with nil as as_active_agent. Seen by executing
ch.oddb> active_packages.size -> 17831 ch.oddb> $res = active_packages.collect{|x| x.pointer if x.active_agents.find{|y| y.is_active_agent == nil }} -> $res.size Array ch.oddb> $res.size -> 17831
There must be an error in one of our import/update plugins. Or maybe cleanup_old_active_agent in src/model/composition does not work or is not called correctly. Also src/plugin/swissmedic contains a method remove_active_agents_that_are_nil. But still something went wrong.
Checking whether on thinpower we have the same problem with the last imported package. Found 2016-11-08 08:46:28 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:754:in `update_active_agent': update_active_agent 66371/01 Melaleucae Viridiflorae Aetheroleum true dose 20 mg/g
. Made an error while selecting the concerned package.
Correct is in bin/admin
$res3 = active_packages.collect{|x| x.pointer if x.active_agents.find_all{|y| y.is_active_agent == nil }.size >0}.compact $res3 = active_packages.collect{|x| x.pointer if x.active_agents.find_all{|y| y.is_active_agent == nil }.size >0}.compact ch.oddb> $res4 = $res3.collect{|pack| pack.swissmedic_source && pack.swissmedic_source[:import_date] }.compact -> Array ch.oddb> $res4.size -> 1560 ch.oddb> $res4.sort.last -> 2016-05-12 ch.oddb> $res4.sort.first -> 2013-11-05
Now on thinspower finding the problematic items
ch.oddb> $res3 = active_packages.collect{|x|x if x.active_agents.find_all{|y| y.is_active_agent == nil }.size >0}.compact -> Array ch.oddb> $res3.size -> 1497 ch.oddb> $res4 = $res3.collect{|pack| pack.swissmedic_source && pack.swissmedic_source[:import_date] }.compact -> Array ch.oddb> $res4.size -> 1491 ch.oddb> $res4.sort.first -> 2013-11-05 ch.oddb> $res4.sort.last -> 2016-11-08
We see that the problem persist till today. Counting the number of update_active_agent in the log I get 1653.
Getting update db-dump from thinpower to ease problem.
Fixed the display for correspond. See
Added a space between susbstance name and dose. Fixed some unit tests. Before pushing commit I want to run the spec tests locally again. Looks like the chromium setup for the rspec is broken after my changes for davaz.com and steinwies.ch.
It is mess. Which versions do I have to include again. After copying Gemfile.watir to Gemfile, using ruby 2.3.1, running bundle install bundle exec rspec spec/smoktest.rb started find. Waiting for spec tests to finish. I think it makes sense to upgrade to watir 6.0 on oddb.org too. This will take some work to get the warnings off. This work is postponed for later.
Pushed commits Display corresponding chemical substances and Removed duplicated entries. These duplicated entreis in the lookandfeelbase where found, because Ruby 2.3 signals them nicely as warnings.