view · edit · sidebar · attach · print · history

< Niklaus.20170118-fix-ddd-calculation | Index | Niklaus.20170116-oddb-org-ruby-240 >>



  • Fix Error Export: index_therapeuticus
  • DDD for Dafalgan Kinder is incorrect
  • Keep in Mind



Fix Error Export: index_therapeuticus

Got the following error message

Error: DRb::DRbUnknownError
Message: ODDB::OdbaExporter
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1149:in `method_missing'
/var/www/ `export_index_therapeuticus'
/var/www/ `block in export_index_therapeuticus_csv'
/var/www/ `safe_export'
/var/www/ `export_index_therapeuticus_csv'
/var/www/ `run'
jobs/export_daily:13:in `block in <module:Util>'
/var/www/ `run'
jobs/export_daily:12:in `<module:Util>'
jobs/export_daily:11:in `<module:ODDB>'
jobs/export_daily:10:in `<main>'

Added a breakpoint and running sudo -u apache bundle-240 exec ruby-240 jobs/mail_index_therapeuticus_csv. The problem lies in the exportd. Running it in a separate thread.

This problem originated in my commit of yesterday Removed unused require archive/tarsimple. But I am unable to find any compress_many routine in the rchive/tarsimple gem. Did I removed it with another commit? No It is found as OdbaExporter.compress_many in ext/export/src/odba_exporter.rb.

Fixed the problem. tar.gz files are only created when export index_therapeuticus and oddbdat files.

But my fix worked only with one files. Must correct it to handle several files. Done, but while sending the confirmation mail I got an Iconv error.

Error: NameError
Message: uninitialized constant ODDB::Log::Iconv
Did you mean?  Kconv
/var/www/ `block in notify'
/var/www/ `each'
/var/www/ `notify'
/var/www/ `block in export_index_therapeuticus_csv'
/var/www/ `wrap_update'
/var/www/ `export_index_therapeuticus_csv'
jobs/mail_index_therapeuticus_csv:13:in `block in <module:Util>'
/var/www/ `run'
jobs/mail_index_therapeuticus_csv:12:in `<module:Util>'
jobs/mail_index_therapeuticus_csv:11:in `<module:ODDB>'
jobs/mail_index_therapeuticus_csv:10:in `<main>'

There is an option :iconv/encoding when generating CSV files. Here I change the code to always generate UTF-8 CSV files. Fixed it. Running

  • jobs/export_teilbarkeit
  • jobs/mail_index_therapeuticus_csv
  • jobs/export_flickr_ean
  • jobs/export_daily

Pushed commits:

DDD for Dafalgan Kinder is incorrect

See yesterday blog for a description of the problem. Must take care to be able to read existing doses via odba from the Postgres database.

Replaced Quanty by Unit and simplified Dose to only methods necessary to be compatible with the old implementation. There are some interesting semantic differences between Unit and Dose. Eg.

[5] pry(#<TestDose>)>'1000') >'1 mg')
ArgumentError: Incompatible Units ('' not compatible with 'mg')
from /home/niklaus/git/ `<=>'

where as we expected until now'1000') >'1', 'mg'). Pondering what decision we take. I think the Unit way of saying that we cannot compare dimensionless units with grams make much more sense. But adoption this view would probably trigger a lot changes/corrections.

Took me a while to add the following definition for 'I.E.' in Unit

RubyUnits::Unit.define('IE') do |i_e|
  i_e.definition  =
  i_e.aliases      = %w(I.E.)

Changed a few expectation as

  • ruby-units normalizes the values, eg. instead of returning '62.5mg / 10g' it returns '6.25 mg/g'. This is an acceptable change for me.
  • You must initialize a value using '1.7 ml' and not '1,7 ml'. (this might be a problem with DE) but for Switzerland this is fine.
  • Some spaces removed, e.g. '1mg / 2ml' => '0.5 mg/ml'
  • Ranges are not handled at the moment

Now most tests pass, but the following still fails

 def test_initialize2
    vals = ['Hametum, Salbe', '62.5', 'mg/g', 'D']
    dose =*vals[1,2])
    assert_equal(62.5, dose.qty)
    assert_equal('mg/g', dose.unit.to_s)
    assert_equal('62.5 mg/g', dose.to_s)

Unit tests for dose and part pass again. Some tests fortest/test_util/resultsort.rb fail. This must be examined in detail. Problems start in model/package. rb and there are many failing corresponding unit tests.

But the unit test fail, because we do not allow any more comparing doses like '10 mg' with '10 ml'. Adapting src/util/result_sort.rb and src/model/package.rb. Now I am left with only two failing tests in test/test_util/resultsort.rb ODDB::TestResultSort#test_sort_result_evidentia_levetiracetam_search_Rivoleve and ODDB::TestResultSort#test_sort_result_evidentia_default_Keppra.

I must also fix two more unit test which exercise the to_g from Dose, but live in test_model/activeagent.rb.

view · edit · sidebar · attach · print · history
Page last modified on January 17, 2017, at 06:25 PM