view · edit · sidebar · attach · print · history

20130724-fi-space-problem

<< | Index | >>


Summary

  • fix space problem in fachinfo
  • running Exporter.new(self).export_doc_csv leads to connect(2)> error

Commits

Index


why does export_daily not work on my vm

  • service export_daily had been disabled by me on Monday. Restarted it using svc -u /var/lib/service/ch.oddb-export
  • Modified crontab to restart it at 8:40

fix space problem in fachinfo

We have (compared to the AmiKo problems in:

The following simple fix makes all unit tests pass.

diff --git a/ext/fiparse/src/textinfo_hpricot.rb b/ext/fiparse/src/textinfo_hpricot.rb
index f9cbd4d..e0a3629 100644
--- a/ext/fiparse/src/textinfo_hpricot.rb
+++ b/ext/fiparse/src/textinfo_hpricot.rb
@@ -120,8 +120,8 @@ class TextinfoHpricot
     text
   end
   def handle_element(child, ptr, isParagraph=false)
-#    puts "handle_element #{child.class} #{child.name} isParagraph #{isParagraph}"
-    ptr.target << ' ' if isParagraph and  !/^Zulassungsnummer[n]?|^Num.ro\s*d.autorisation/.match(ptr.chapter.to_s)   
+    ptr.target << ' ' if self.class.eql?(ODDB::FiParse::PatinfoHpricot) and isParagraph and  !/^Zulassungsnummer[n]?|^Num.ro\s*d.autorisation/.match(ptr.chapter.to_s)    
+    ptr.target.gsub!(/$/, ' ') if isParagraph and /Wirkstoffe|Hilfsstoffe|Klinische Wirksamkeit/.match(ptr.target.to_s)
     case child
     when Hpricot::Text
       if ptr.target.is_a? Text::Table

Examining the data via bin/admin

-> ODDB::Text::Chapter
ch.oddb> registration("62184").fachinfo.description("de").name
-> Cipralex® Filmtabletten/Tropfen 10 mg/ml, 20 mg/mlCipralex MELTZ® Schmelztabletten
ch.oddb> registration("62184").fachinfo.description("de").iksnrs
-> Zulassungsnummer
55961, 56366, 62184 (Swissmedic).
ch.oddb> registration("62184").fachinfo.description("de").composition
-> ODDB::Text::Chapter
ch.oddb> registration("62184").fachinfo.description("de").galenic_form
-> ODDB::Text::Chapter

Only the following parts are defined iksnrs, date, name. This is only partly consistent with my new test case, where I only the name defined, all other fields return nil.

When comparing the HTML of Cypralex with that of Zyloric we see that the section are named differently, e.g

  • Zyloric <p class="s5" id="section2"><span class="s6"><span>Zusammensetzung</span></span></p>
  • Cipralex
<div class="paragraph" id="Section7800">
 <div class="absTitle">Packungen</div>
 <p class="spacing1">Cipralex Filmtabl 10 mg 14 (teilbar). (B)</p>
 ...

Comparing the layout of the first section "Zusammensetzung"

NameiksnrXPathHTML-Code for Zusammensetzung
Zyloric32917p[ @id^='section']<p class="s5" id="section2"><span class="s6"><span>Zusammensetzung</span></span></p>
Cipralex62184div[ @id^='Section']<div class="paragraph" id="Section7000"> <div class="absTitle">Zusammensetzung</div>
Isentres58267div[ @id^='Section']<div class="paragraph" id="Section7000"><div class="absTitle">Zusammensetzung</div>

textinfot_hapricot.rb distingueshes the XPATH for

  • title: div.absTitle or h2

Also the isentres HTML is old. We can recognize it because we find also tags like <div class="paragraph" id="Section7000"> I will try to flag is also as non-conformant.

  • running Exporter.new(self).export_doc_csv leads to connect(2)> error

To reproduce the error the following steps are needed

  • Launch bin/oddbd in one screen and wait for system initialized
  • Launch jobs/export_daily in another screen and wait for system init
  • Wait some time, then launch another screen with bin/admin and enter Exporter.new(self).export_doc_csv

Then I received the following error message

Error: DRb::DRbConnError
Message: druby://localhost:10005 - #<Errno::ECONNREFUSED: Connection refused - connect(2)>
Backtrace:
/usr/lib64/ruby/1.9.1/drb/drb.rb:736:in `rescue in block in open'
/usr/lib64/ruby/1.9.1/drb/drb.rb:730:in `block in open'
/usr/lib64/ruby/1.9.1/drb/drb.rb:729:in `each'
/usr/lib64/ruby/1.9.1/drb/drb.rb:729:in `open'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1191:in `initialize'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1171:in `new'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1171:in `open'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1087:in `block in method_missing'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1105:in `with_friend'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1086:in `method_missing'
/var/www/oddb.org/src/plugin/csv_export.rb:25:in `export_doctors'
/var/www/oddb.org/src/util/exporter.rb:104:in `block in export_doc_csv'
/var/www/oddb.org/src/util/exporter.rb:435:in `call'
/var/www/oddb.org/src/util/exporter.rb:435:in `safe_export'
/var/www/oddb.org/src/util/exporter.rb:102:in `export_doc_csv'
(eval):1:in `block (2 levels) in _admin'
/var/www/oddb.org/src/util/oddbapp.rb:1551:in `instance_eval'
/var/www/oddb.org/src/util/oddbapp.rb:1551:in `block (2 levels) in _admin'
/var/www/oddb.org/src/util/failsafe.rb:10:in `call'
/var/www/oddb.org/src/util/failsafe.rb:10:in `failsafe'
/var/www/oddb.org/src/util/oddbapp.rb:1550:in `block in _admin'

The same callstack appears in the bin/oddb screen after sending the message. Has this a connection that I entered 3 e-mail addresses in etc/oddb.yaml?

Looking at errno.h you find #define ENOENT 2 /* No such file or directory */, which means that the service is not running

Therefore my interpretation is that the connection is refused because the port is not available. What I see, is that after running Exporter.new(self).export_doc_csv in bin/admin that a manually launched ext/export/bin/exportd had terminated (about 30 seconds) earlier. Therefore the question is, why does running export_doc_csv stop the exportd daemon? (which gets restarted usually via the daemontools).

view · edit · sidebar · attach · print · history
Page last modified on July 26, 2013, at 08:41 PM