Investigating the problem.
In log/oddb/debug/2015/07.log I finde the following lines
2015-07-29 02:09:35 +0200: /var/www/oddb.org/src/plugin/text_info.rb:564:in `create_sequence_and_package_if_necessary': Could not find a registration for 65452 nil ISKNR 65452: Cefepim Labatec® 1 g i.v./i.m./2 g i.v.
The IKSNR 65452 cannot be found in Packungen.xlsx (as per 07. July 2015).
In bin/admin I get nil returned for egistration('65452')
. Therefore I must examine why the import did not create a registration.
Running sudo -u apache /usr/local/bin/ruby jobs/update_textinfo_swissmedicinfo --target=both --reparse 65452
to examine the problem. It think I found the solution. We simply returned when we could not find the FI or PI in Packungen.xlsx. With my first fix a registration and a sequence '00' is created but the packages field is an array not a hash. Why? Creating package/sequence is still flawed. Shouldn't we add proper support for create|delete_registration/sequence/package in oddb_app.rb?
A client reported the following situation
Ich wählte zuerst den ATC-Browser, Laxanzien (A06), danach Laxanzien (A06A) und Kontaktlaxantien (A06AB). Ich wählte daraus Bisacodyl, worauf der Screen mit den Handelspräoaraten geöffnet wird: In der ersten Zeile steht Amavita Bisacodyl (in blau) dieses im Namen antippen und nun folgt die Fehlermeldung.
Could reproduce the error on ch.oddb.org. On oddb-ci2.dyndns.org there was no error, but the name of the 4 drugs found was not displayed. Why?
Looking at /service/ch.oddb/log/main/current
I found
@4000000055c85515194e6a9c error in SBSM::Session#http_headers: /dt/generika/compare/ean13/7680574810040 @4000000055c85515194e6e84 ArgumentError @4000000055c85515194e726c wrong number of arguments (0 for 1) @4000000055c85515194e726c /usr/local/lib/ruby/gems/1.9.1/gems/parslet-1.7.0/lib/parslet.rb:261:in `sequence' @4000000055c85515194e7654 /var/www/oddb.org/src/view/dataformat.rb:150:in `formatted_price' @4000000055c85515194e7654 /var/www/oddb.org/src/view/dataformat.rb:129:in `price_public' @4000000055c85515194e7a3c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' @4000000055c85515194ec85c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' @4000000055c85515194ecc44 error in SBSM::Session#to_html: /de/gcc/compare/ean13/7680612360018 @4000000055c855151b9ac7b4 wrong number of arguments (0 for 1) @4000000055c855151b9ac7b4 /usr/local/lib/ruby/gems/1.9.1/gems/parslet-1.7.0/lib/parslet.rb:261:in `sequence' @4000000055c855151b9acf84 /var/www/oddb.org/src/view/dataformat.rb:150:in `formatted_price' @4000000055c855151b9acf84 /var/www/oddb.org/src/view/dataformat.rb:129:in `price_public' @4000000055c855151b9ad36c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' @4000000055c855151b9ad36c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' @4000000055c855151b9aeadc /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' @4000000055c855151b9aeec4 /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each' @4000000055c855151b9af2ac /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `compose' @4000000055c855151b9af2ac /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/list.rb:67:in `block in compose_list' @4000000055c855151b9afa7c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/list.rb:65:in `each' @4000000055c855151b9afe64 /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/list.rb:65:in `each_with_index' @4000000055c855151b9afe64 /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/list.rb:65:in `compose_list' @4000000055c855151b9b024c /var/www/oddb.org/src/view/drugs/compare.rb:94:in `compose_list' @4000000055c855151b9b0634 /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/list.rb:54:in `compose' @4000000055c855151b9b0a1c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:57:in `init' @4000000055c855151b9b0a1c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/list.rb:129:in `init' @4000000055c855151b9b1da4 /var/www/oddb.org/src/view/drugs/compare.rb:67:in `init' @4000000055c855151b9b1da4 /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/component.rb:139:in `initialize' @4000000055c855151b9b218c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:61:in `new' @4000000055c855151b9b218c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:61:in `create' @4000000055c855151b9b295c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' @4000000055c855151b9b295c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' @4000000055c855151b9b2d44 /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each' @4000000055c855151b9b312c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `compose' @4000000055c855151b9b871c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:57:in `init' @4000000055c855151b9b871c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/component.rb:139:in `initialize' @4000000055c855151b9b8b04 /var/www/oddb.org/src/view/publictemplate.rb:62:in `new' @4000000055c855151b9b8b04 /var/www/oddb.org/src/view/publictemplate.rb:62:in `content' @4000000055c855151b9ba274 /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' @4000000055c855151b9ba65c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' @4000000055c855151b9ba65c /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' @4000000055c855151b9baa44 /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each' @4000000055c855151b9bb214 /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `compose' @4000000055c855151b9bb5fc /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:57:in `init' @4000000055c855151b9bb5fc /var/www/oddb.org/src/view/publictemplate.rb:59:in `init' @4000000055c855151b9bb9e4 /var/www/oddb.org/src/view/privatetemplate.rb:17:in `init' @4000000055c855151b9bc1b4 /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/component.rb:139:in `initialize' @4000000055c855151b9bc1b4 /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/state.rb:245:in `new' @4000000055c855151b9bc59c /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/state.rb:245:in `view' @4000000055c855151b9bc59c /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/state.rb:181:in `to_html' @4000000055c855151b9be4dc /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/session.rb:447:in `to_html' @4000000055c855151b9be8c4 /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/session.rb:173:in `block in drb_process' @4000000055c855151b9be8c4 <internal:prelude>:10:in `synchronize' @4000000055c855151b9becac /usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.2.3/lib/sbsm/session.rb:171:in `drb_process' @4000000055c855151b9bf47c /usr/local/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block' @4000000055c855151b9bf47c /usr/local/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform' @4000000055c855151b9bf47c /usr/local/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop' @4000000055c855151b9bf864 /usr/local/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop' @4000000055c855151b9bf864 /usr/local/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop' @4000000055c855151b9c041c ODDB::View::Drugs::CompareList::COMPONENTS[[7, 0]] in create(price_public) @4000000055c855151b9c041c ODDB::View::Drugs::CompareComposite::COMPONENTS[[0, 0]] in create(ODDB::View::Drugs::CompareList) @4000000055c855151b9c0804 ODDB::View::Drugs::Compare::COMPONENTS[[0, 3]] in create(content)
Looks as if somehow we get a confusion whether sequence is a method of parslet of a registration. How can we confuse these things?
The most intersting line contains src/view/drugs/compare.rb:94:in `compose_list'
, which might explain another (pending) problem, that the price comparision does not work correctly.
Getting db_dump of oddb.ch to try to reproduce the error on oddb-ci2. Looks as if the import of swissreg did not update correctly all package of the registration 38076 Prontolax. But looking at it via bin/admin I get
ch.oddb> registration('38076').odba_id -> 22509 ch.oddb> registration('38076').sequences.first[1].package('019').registration.odba_id -> 22509 ch.oddb> registration('38076').sequences.first[1] -> Prontolax, Dragées ch.oddb> registration('38076').sequences.first[1].odba_id -> 73319 ch.oddb> registration('38076').sequences.first[1].package('019').sequence -> Prontolax, Dragées ch.oddb> registration('38076').sequences.first[1].package('019').sequence.odba_id -> 73319 ch.oddb> registration('38076').sequences.first[1].package('019').sequence.odba_oid -> undefined method `odba_oid' for Prontolax, Dragées:ODDB::Sequence
Okay. The backtrace to the package is okay and also the on to the sequence. Verifying via bin/admin
$missing = {}; registrations.each{|id, reg| reg.sequences.each{|seq_id, seq| seq.packages.each{|pack_id, pack| $missing["#{id}/#{seq_id}/#{pack_id}"] = pack if pack.sequence and not pack.sequence.respond_to?(:odba_id)}}}
Finally I was able to avoid this error by simply delaying the inclusion of parslet till really running the swissmedic-import. See commit Ugly hack to fix price comparision. Pulled changes in thinpower and restarted ch.oddb.
Got the following UTF-8 error in Mail Fachinfo-Invoices
Error: ArgumentError Message: invalid byte sequence in UTF-8 Backtrace: /var/www/oddb.org/src/util/mail.rb:172:in `gsub' /var/www/oddb.org/src/util/mail.rb:172:in `debug_msg' /var/www/oddb.org/src/util/mail.rb:103:in `rescue in send_mail' /var/www/oddb.org/src/util/mail.rb:91:in `send_mail' /var/www/oddb.org/src/util/log.rb:56:in `notify' /var/www/oddb.org/src/plugin/invoicer.rb:60:in `rescue in send_invoice' /var/www/oddb.org/src/plugin/invoicer.rb:44:in `send_invoice' /var/www/oddb.org/src/plugin/info_invoicer.rb:274:in `block in send_annual_invoices' /var/www/oddb.org/src/plugin/info_invoicer.rb:237:in `each' /var/www/oddb.org/src/plugin/info_invoicer.rb:237:in `send_annual_invoices' /var/www/oddb.org/src/plugin/info_invoicer.rb:23:in `run' /var/www/oddb.org/src/plugin/fachinfo_invoicer.rb:27:in `run' /var/www/oddb.org/src/util/exporter.rb:257:in `block in mail_fachinfo_log' /var/www/oddb.org/src/util/exporter.rb:343:in `call' /var/www/oddb.org/src/util/exporter.rb:343:in `safe_export' /var/www/oddb.org/src/util/exporter.rb:255:in `mail_fachinfo_log' /var/www/oddb.org/src/util/exporter.rb:56:in `run' jobs/export_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/export_daily:12:in `<module:Util>' jobs/export_daily:11:in `<module:ODDB>' jobs/export_daily:10:in `<main>'
This error can be fixed by simply removing the line, which calls the system logging facilities. The mesage is reported anyway in oddb/debug/log file. Done with commit Avoid UTF-8 error
Found the following error in yesterdays log
Errno::ENOENT No such file or directory - /var/www/oddb.org/log/feedback/2015/08.log /var/www/oddb.org/src/util/exporter.rb:327:in `read' /var/www/oddb.org/src/util/exporter.rb:327:in `mail_stats' /var/www/oddb.org/src/util/exporter.rb:268:in `block in mail_feedback_stats' /var/www/oddb.org/src/util/exporter.rb:343:in `call' /var/www/oddb.org/src/util/exporter.rb:343:in `safe_export' /var/www/oddb.org/src/util/exporter.rb:267:in `mail_feedback_stats' /var/www/oddb.org/src/util/exporter.rb:65:in `block in run' /var/www/oddb.org/src/util/schedule.rb:15:in `call' /var/www/oddb.org/src/util/schedule.rb:15:in `run_on_weekday' /var/www/oddb.org/src/util/exporter.rb:63:in `run' jobs/export_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/export_daily:12:in `<module:Util>' jobs/export_daily:11:in `<module:ODDB>' jobs/export_daily:10:in `<main>'
Should be fixed with commit Avoid error if no log file