view · edit · sidebar · attach · print · history

Index>

20170829-error-pricehistory

Summary

  • Fix ArgumentError: comparison of Time with nil failed
  • Some patinfo links do not work correctly
  • Webalizer must work again
  • Fix interacion problem
  • Keep in Mind

Commits

Index

Fix ArgumentError: comparison of Time with nil failed

Must fix the following problem. ArgumentError: comparison of Time with nil failed when visiting http://generika.cc/de/generika/price_history/reg/54845/seq/02/pack/022

The newly created test case is not sufficient when we really have several prices as in http://ch.oddb.org/de/gcc/price_history/reg/55717/seq/01/pack/02. Adding a second unit test for this case.

At the moment I avoid the error, but not the correct price/date is displayed.

The prices are as follow (from a pry session)

=> {:public=>
  [#<ODDB::Util::Money:0x007f1af1ad8988 @amount=40.7, @authority=:sl, @country="CH", @credits=4070, @mutation_code="SLAUFNAHME", @origin="http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip (01.10.2015)", @type="public", @valid_from=2015-10-01 00:00:00 +0200>,
   #<ODDB::Util::Money:0x007f1af1ad8438 @amount=62.85, @authority=nil, @country="CH", @credits=6285, @origin=nil, @type="public", @valid_from=nil>],
 :exfactory=>
  [#<ODDB::Util::Money:0x007f1af1ad8258 @amount=21.15, @authority=:sl, @country="CH", @credits=2115, @mutation_code="SLAUFNAHME", @origin="http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip (01.10.2015)", @type="exfactory", @valid_from=2015-10-01 00:00:00 +0200>]}

Fixed this problem by returning only the values where the valid_from is != nil. Now both URL http://generika.oddb-ci2.dyndns.org/de/generika/price_history/reg/54845/seq/02/pack/022 and http://generika.oddb-ci2.dyndns.org/de/generika/price_history/reg/55717/seq/01/pack/02 display the correct information.

Pushed commit Handle nil values for valid_from in price-history

Some patinfo links do not work correctly

E.g. are

These packages do not display, even if the contain a valid change_log, as seen by the following bin/admin snippet

ch.oddb> registration('50141').package('055').patinfo.de.to_s[0..120]
-> Accupro® 5/10/20
Was ist Accupro und wann wird es angewendet?
Accupro ist ein Arzneimittel, das auf Verschreibung des Arz
ch.oddb> registration('63042').package('002').patinfo.de.to_s[0..120]
-> Giotrif®
Was ist Giotrif® und wann wird es angewendet?
Giotrif enthält den Wirkstoff Afatinib. Dieser hemmt die Aktivität
ch.oddb> registration('63042').package('002').patinfo.de.change_log.size
-> 1
ch.oddb> registration('50141').package('055').patinfo.de.change_log.size
-> 1

Why?

The sequence number of the package used to find is wrong, it should be '02' and not '01' as suggested by the URL, as seen by this bin/admin snippet

ch.oddb> registration('50141').package('055').seqnr
-> 02
ch.oddb> registration('50141').sequence('01').package('055')
-> 

Must fix using a wrong sequence number, when generating the links for patinfo. Waiting for my import_daily to finish importing the patinfos.

Fixed the problem. Adding a watir test for it. Pushed the commits

Webalizer must work again

We have two problems:

  1. We produce at the moment only an access_log, eg./var/www/oddb.org/log/oddb/2017/08/28/access_log, whereas we had an access and an error_log. The distinction between error and access log does not make sense for webrick and the links I did see for rack based web applications always spoke of a single file. We do hover have different logging levels like info, warn, debug, error inside each log file. The SBSM logs got to

files like /var/www/oddb.org/log/2017/08/29/user_log (for oddb) or /var/www/oddb.org/log/2017/08/29/evidentia_log

  1. We do not emit the access log in the same format as apache Which is shown by the following example lines

In /var/www/oddb.org/log/oddb/2017/06/28/error_log we find

[Wed Jun 28 12:34:44 2017] [error] [client 66.249.64.213] File does not exist: /var/www/oddb.org/doc/resources/captchas

In/var/www/oddb.org/log/oddb/2017/06/28/access_log we find

80.218.53.88 - - [28/Jun/2017:12:03:47 +0200] "GET /de/gcc/rss/channel/sl_introduction.rss HTTP/1.1" 200 430613 "-" "Akregator/5.2.3; syndication"

Whereas in /var/www/oddb.org/log/oddb/2017/08/28/access_log we find

95.108.181.70 - - [27/Aug/2017:23:59:59 +0200] "GET /en/gcc/show/reg/57593/seq/04/pack/007/currency/USD HTTP/1.1" 200 23040 "-" "Mozilla/5.0 (compatible; YandexBot/3.0; +http://yandex.com/bots)"

In /var/www/oddb.org/log/2017/08/29/user_log we find

131.253.27.102 - - [29/Aug/2017 00:00:00] "GET http://ch.oddb.org/resources/dojo/dojox/main.js HTTP/1.1" 200 114 0.0007 "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 BingPreview/1.0b"

I think it might make sense to use the output of the logs produced by the services as error_log and the log produced by the SBSM.logger as access_log.

Changed locally on oddb-ci2 the log_pattern. Now I get the following content

 cat /var/www/oddb.org/log/oddb/2017/08/29/access_log 
/var/www/oddb.org/vendor/ruby/2.4.0/gems/activesupport-3.1.0/lib/active_support/values/time_zone.rb:268: warning: circular argument reference - now
racc/parser.rb:189: warning: already initialized constant Racc::Parser::Racc_Runtime_Version
/var/www/oddb.org/vendor/ruby/2.4.0/gems/racc-1.4.14/lib/racc/parser.rb:189: warning: previous definition of Racc_Runtime_Version was here
racc/parser.rb:190: warning: already initialized constant Racc::Parser::Racc_Runtime_Revision
/var/www/oddb.org/vendor/ruby/2.4.0/gems/racc-1.4.14/lib/racc/parser.rb:190: warning: previous definition of Racc_Runtime_Revision was here
racc/parser.rb:192: warning: already initialized constant Racc::Parser::Racc_Runtime_Core_Version_R
/var/www/oddb.org/vendor/ruby/2.4.0/gems/racc-1.4.14/lib/racc/parser.rb:192: warning: previous definition of Racc_Runtime_Core_Version_R was here
racc/parser.rb:193: warning: already initialized constant Racc::Parser::Racc_Runtime_Core_Revision_R
/var/www/oddb.org/vendor/ruby/2.4.0/gems/racc-1.4.14/lib/racc/parser.rb:193: warning: previous definition of Racc_Runtime_Core_Revision_R was here
racc/parser.rb:197: warning: already initialized constant Racc::Parser::Racc_Runtime_Core_Revision_C
/var/www/oddb.org/vendor/ruby/2.4.0/gems/racc-1.4.14/lib/racc/parser.rb:202: warning: previous definition of Racc_Runtime_Core_Revision_C was here
racc/parser.rb:205: warning: already initialized constant Racc::Parser::Racc_Main_Parsing_Routine
/var/www/oddb.org/vendor/ruby/2.4.0/gems/racc-1.4.14/lib/racc/parser.rb:210: warning: previous definition of Racc_Main_Parsing_Routine was here
racc/parser.rb:206: warning: already initialized constant Racc::Parser::Racc_YY_Parse_Method
/var/www/oddb.org/vendor/ruby/2.4.0/gems/racc-1.4.14/lib/racc/parser.rb:211: warning: previous definition of Racc_YY_Parse_Method was here
racc/parser.rb:207: warning: already initialized constant Racc::Parser::Racc_Runtime_Core_Version
/var/www/oddb.org/vendor/ruby/2.4.0/gems/racc-1.4.14/lib/racc/parser.rb:212: warning: previous definition of Racc_Runtime_Core_Version was here
racc/parser.rb:208: warning: already initialized constant Racc::Parser::Racc_Runtime_Core_Revision
/var/www/oddb.org/vendor/ruby/2.4.0/gems/racc-1.4.14/lib/racc/parser.rb:213: warning: previous definition of Racc_Runtime_Core_Revision was here
racc/parser.rb:209: warning: already initialized constant Racc::Parser::Racc_Runtime_Type
/var/www/oddb.org/vendor/ruby/2.4.0/gems/racc-1.4.14/lib/racc/parser.rb:214: warning: previous definition of Racc_Runtime_Type was here
[DEPRECATED] By requiring 'spreadsheet/excel' you are loading a Compatibility
             layer which provides a drop-in replacement for Spreadsheet::Excel
             versions <= 0.3.5.1. This code will be removed in Spreadsheet
             version 1.0.0
/var/www/oddb.org/src/view/drugs/resultlist.rb:25: warning: already initialized constant HtmlGrid::List::BACKGROUND_SUFFIX
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/list.rb:34: warning: previous definition of BACKGROUND_SUFFIX was here
W, [2017-08-29T14:21:45.866867 #7251]  WARN -- : config.ru:84:in `block in <main>' Starting Rack::Server with log_pattern /var/www/oddb.org/log/oddb/%Y/%m/%d/access_log
[2017-08-29 14:21:57] INFO  WEBrick 1.3.1
[2017-08-29 14:21:57] INFO  ruby 2.4.0 (2016-12-24) [x86_64-linux]
[2017-08-29 14:21:57] INFO  WEBrick::HTTPServer#start: pid=7251 port=8012
192.168.0.75 - - [29/Aug/2017 14:22:01] "GET http://oddb-ci2.dyndns.org/de/gcc/home/ HTTP/1.1" 200 21132 0.5287  "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36"
192.168.0.75 - - [29/Aug/2017 14:22:10] "GET http://oddb-ci2.dyndns.org/de/gcc/fachinfo/reg/62960 HTTP/1.1" 200 106829 7.7392  "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36"
W, [2017-08-29T14:22:27.243064 #7251]  WARN -- : session_store.rb:115:in `clean' Cleaned 0 sessions. Took 0 seconds
W, [2017-08-29T14:22:57.243261 #7251]  WARN -- : session_store.rb:115:in `clean' Cleaned 0 sessions. Took 0 seconds

and

tail/service/ch.oddb/log/main/current 
@4000000059a55c620cbf8eb4 Attention: monkey-patching CSV::Cell
@4000000059a55c632b7deb34 
@4000000059a55c632b7def1c loading testenvironment
@4000000059a55c632b7def1c 
@4000000059a55c632b7def1c DEVELOPER_HOST = ch.oddb.apache.org
@4000000059a55c632b7def1c DEVELOPER_MAIL = ngiger@ywesee.com
@4000000059a55c632b7df304 
@4000000059a55c6333bb56ec process: /var/www/oddb.org/vendor/ruby/2.4.0/bin/rackup server_uri druby://localhost:10000  auxiliary  
@4000000059a55c6333dfa3e4 init system starting after 0.002398399 seconds
@4000000059a55c6a182e9ed4 Took 2 seconds to load /var/www/oddb.org/data/csv/interactions_de_utf8.csv
@4000000059a55c6f0e69991c initialized: 11.37392353
@4000000059a55c730e4dd3bc ::1 - - [29/Aug/2017:14:22:01 +0200] "GET http://oddb-ci2.dyndns.org/de/gcc/home/ HTTP/1.1" 200 21132
@4000000059a55c7c387acf14 ::1 - - [29/Aug/2017:14:22:10 +0200] "GET http://oddb-ci2.dyndns.org/de/gcc/fachinfo/reg/62960 HTTP/1.1" 200 106829

It took 3 commits till Zeno and I were satisfied with the path for the log files produced by the Rack process, as they cannot go into the same log directories as the chronolog access/error_logs, as these files and directories belong to root, whereas the rack process runs as apache

Pushed the commits

Now I must see why the Apache logging works fine for flavors like generika, but not for oddb.org. This proved to be easy. I was sufficient to move the log statement to near the beginning of VirtualHost section. Also deactived the RewriteLog as we have no longer problems with rewriting.

Also I must add the SSL lines added by Zeno a few days ago.

Pushed commits:

Fix interaction problem

Found the following error in /var/www/oddb.org/log/2017/08/29/oddb_log when visiting http://oddb-ci2.dyndns.org/de/gcc/interaction_detail/atc_code/C07AB02,G04BE03

TypeError: no implicit conversion from nil to integer
        /var/www/oddb.org/src/state/interactions/interaction_detail.rb:24:in `[]'
        /var/www/oddb.org/src/state/interactions/interaction_detail.rb:24:in `block in init'
        /var/www/oddb.org/src/state/interactions/interaction_detail.rb:22:in `each'
        /var/www/oddb.org/src/state/interactions/interaction_detail.rb:22:in `init'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/session.rb:264:in `block in process_rack'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/session.rb:209:in `synchronize'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/session.rb:209:in `process_rack'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/app.rb:127:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/static.rb:149:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/tempfile_reaper.rb:15:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/tempfile_reaper.rb:15:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/tempfile_reaper.rb:15:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:49:in `_call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:37:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/show_exceptions.rb:23:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/chunked.rb:54:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/content_length.rb:15:in `call'
        /var/www/oddb.org/vendor/ruby/2.4.0/gems/rack-2.0.3/lib/rack/handler/webrick.rb:86:in `service'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run'
        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread'
192.168.0.75 - - [29/Aug/2017 16:25:03] "GET http://oddb-ci2.dyndns.org/de/gcc/interaction_detail/atc_code/C07AB02,G04BE03 HTTP/1.1" 500 83068 0.0121  "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36"

Fixed with commit Fix :interaction_detail and avoid NPE

view · edit · sidebar · attach · print · history
Page last modified on August 29, 2017, at 05:02 PM