Instead of adding a square 'C' (with background color #dd1cf) products found when searching for iscador have the name_base with the wrong background color #dd1cf. Looks like the complementary does not create a separate row as it should.
Zeno would like to have a (unit or watir) test to catch this kind of error.
In watir you may do this like this
it "should display the correct color for iscador U" do login @browser.goto OddbUrl @browser.select_list(:name, "search_type").select("Markenname") @browser.text_field(:name, "search_query").set('iscador U') sleep(0.1) @browser.button(:name, "search").click (@browser.link(:text => /Iscador/i).style 'background-color').should match /0, 0, 0, 0/ @browser.link(:text => 'FI').exists?.should eq true @browser.link(:text => 'PI').exists?.should eq true @browser.td(:text => 'A').exists?.should eq true @browser.td(:text => 'C').exists?.should eq true @browser.link(:text => 'FB').exists?.should eq true end
Looking via bin/admin I see that we have here two atc classes found, e.g.
ch.oddb> search_exact_sequence('Iscador').atc_facades.size -> 2 ch.oddb> search_exact_sequence('Hustentropfen Doron').atc_facades.size -> 1
We have 1688 substance with two or more atc_codes. E.g.
ch.oddb> $nr = 0; substances.each{|s| if s.atc_classes.size > 1; $stdout.puts "s #{s} #{s.pointer} has #{s.atc_classes.size} atc_classes"; $nr+=1; end}; $nr -> 1688 ch.oddb> substance('Diosminum') -> Diosminum ch.oddb> substance('Diosminum').atc_classes.size -> 2 ch.oddb> substance('Diosminum').atc_classes.first -> Diosmin, Kombinationen ch.oddb> substance('Diosminum').atc_classes.last -> Diosmin ch.oddb> substance('Diosminum').atc_classes.last.code -> C05CA03 ch.oddb> substance('Diosminum').atc_classes.first.code -> C05CA53 ch.oddb> $res = search_exact_sequence('Kaletra') -> #<ODDB::SearchResult:0x007f3548279e88> ch.oddb> $res.atc_facades.size -> 2 ch.oddb> $res.atc_facades.collect{|x| x.code} -> ["J05AR10", "J05AE06"] ch.oddb> $res.atc_facades.collect{|x| x.description('de')} -> ["Lopinavir and Ritonavir", "Lopinavir"]
Some examples
s Glucosum Anhydricum :!substance,3891. has 17 atc_classes s Thymolum :!substance,3900. has 13 atc_classes s Dextromethorphanum :!substance,5929. has 5 atc_classes s Hepar Sulfuris D6 :!substance,752203. has 2 atc_classes s Anetholum :!substance,3885. has 3 atc_classes s Lidocainum :!substance,5940. has 26 atc_classes s Spiraeae Ulmariae Flos :!substance,3888. has 4 atc_classes s Tetracaini Hydrochloridum :!substance,3876. has 7 atc_classes s Allii Sativi Maceratum Oleosum :!substance,797. has 3 atc_classes s Cephaelis Ipecacuanha :!substance,1825. has 3 atc_classes
It looks for me, as we have a big disorder in the relation substance -> atc_codes. E.g.
substance('Lidocainum').atc_classes.each{|atc| $stdout.puts "Lidocainum #{atc.code}: #{atc}"} -> Array # outputs Lidocainum D11AF: Warzenmittel und Keratolytika Lidocainum N01BB02: Lidocain Lidocainum C05AD01: Lidocain Lidocainum C05AA09: Dexamethason Lidocainum R02AA06: Cetylpyridinium Lidocainum R02AD02: Lidocain Lidocainum R02AB02: Tyrothricin Lidocainum G03CA03: Estradiol Lidocainum D03AX99: Sonstige Mittel zur Förderung der Wundheilung (Diverse) Lidocainum D04AB01: Lidocain Lidocainum R02AA05: Chlorhexidin Lidocainum C01BB01: Lidocain Lidocainum A01AD11: Verschiedene Lidocainum N01BB52: Lidocain, Kombinationen Lidocainum R05FA02: Opium-Derivate und Expektoranzien Lidocainum N01BB20: Kombinationen Lidocainum R02AA20: Sonstige Antiseptika innerhalb der Gruppe Laryngologika Lidocainum N02BA55: Salicylamid, Kombinationen exkl. Psycholeptika Lidocainum M01BA: Antiphlogistika/Antirheumatika in Kombination mit Corticosteroiden Lidocainum H02AA03: Desoxycorton Lidocainum H02AB02: Dexamethason Lidocainum A01AB11: Verschiedene Lidocainum N02BE51: Paracetamol, Kombinationen exkl. Psycholeptika Lidocainum N02BA51: Acetylsalicylsäure, Kombinationen exkl. Psycholeptika Lidocainum D04AB: Lokalanästhetika Lidocainum M01AE01: Ibuprofen
I still have no idea, why this displays so badly inside ch.oddb.org.
Running jobs/update_textinfo_swissmedicinfo --target=both --reparse 63242 65065 58943 65330 65512
to see whether this fixes the problem analysed yesterday in 20150914-layout-evidentia#search-error
Got the following error
Util.log_and_deliver_mail to=["ngiger@ywesee.com"] subject ch.ODDB.org Report - Error: Fach- und Patienteninfo Updates (swissmedicinfo.ch) - 09/2015 size 1151 with 0 attachments. Plugin: ODDB::TextInfoPlugin Error: NoMethodError Message: undefined method `iksnr' for nil:NilClass Backtrace: /var/www/oddb.org/src/plugin/text_info.rb:566:in `create_registration' /var/www/oddb.org/src/plugin/text_info.rb:1356:in `block in import_swissmedicinfo_by_iksnrs' /var/www/oddb.org/src/plugin/text_info.rb:1353:in `each' /var/www/oddb.org/src/plugin/text_info.rb:1353:in `import_swissmedicinfo_by_iksnrs' /var/www/oddb.org/src/plugin/text_info.rb:1399:in `import_swissmedicinfo' /var/www/oddb.org/src/util/updater.rb:573:in `block in update_notify_simple' /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:567:in `update_notify_simple' /var/www/oddb.org/src/util/updater.rb:344:in `update_textinfo_swissmedicinfo' jobs/update_textinfo_swissmedicinfo:39: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/update_textinfo_swissmedicinfo:12:in `<module:Util>' jobs/update_textinfo_swissmedicinfo:11:in `<module:ODDB>' jobs/update_textinfo_swissmedicinfo:10:in `<main>' /var/www/oddb.org/log/job.pid is deleted
Fixed.
But bin/admin now does show, that something went wrong as we have now
ch.oddb> $res2 = search_exact_sequence('Ofev') -> #<ODDB::SearchResult:0x007fb0745fe7c8> $res2.atc_facades.first.packages.collect{|p| [p.iksnr,p.seqnr,p.ikscd]} -> [["65330", "01", "001"], ["65330", "02", "002"], ["65330", "00", "000"]]
The import added a sequence '00' and a package '000' even when there was no need.
I think the best thing is to rework all used import plugins and to extract updating registrations, sequences, packages, active_agents into a common class PluginBase, which would use plugin/vaccines and it classes ParsedSequence, ParsedSequence, ParsedActiveAgent, ParsedPackage. I just believe, that the various modification I made in the various plugins are not consistent. And I like Hannes's approach using Parsed-<Class> for the import. This looks easy for me to extend to new fields, like inactive_agents.
Current situation is that with 3 or less active agent we show only the names (no doses). With 4 or more we display the number and the mouseOver shows each name with the dose. This is consistent with the rest of oddb.ch. Waiting whether the customer is willing to pay further modification.
In any case I must suppress displaying the dose if it is 0, eg. searching for "Strophantus" where the product from Phytomed displays various time '0 ,' for each active agent. Will correct this in the model and return only a dose if it is not 0. Adding a unit test for it, first. Done with commit Suppress dose, when 0