view · edit · sidebar · attach · print · history

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

20170117-oddb-org-ruby-240

Summary

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

Commits

Index

Fix Error Export: index_therapeuticus

Got the following error message

Error: DRb::DRbUnknownError
Message: ODDB::OdbaExporter
Backtrace:
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1149:in `method_missing'
/var/www/oddb.org/src/plugin/csv_export.rb:165:in `export_index_therapeuticus'
/var/www/oddb.org/src/util/exporter.rb:168:in `block in export_index_therapeuticus_csv'
/var/www/oddb.org/src/util/exporter.rb:343:in `safe_export'
/var/www/oddb.org/src/util/exporter.rb:166:in `export_index_therapeuticus_csv'
/var/www/oddb.org/src/util/exporter.rb:73:in `run'
jobs/export_daily:13:in `block in <module:Util>'
/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>'

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
Backtrace:
/var/www/oddb.org/src/util/log.rb:41:in `block in notify'
/var/www/oddb.org/src/util/log.rb:37:in `each'
/var/www/oddb.org/src/util/log.rb:37:in `notify'
/var/www/oddb.org/src/util/updater.rb:91:in `block in export_index_therapeuticus_csv'
/var/www/oddb.org/src/util/updater.rb:517:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:86:in `export_index_therapeuticus_csv'
jobs/mail_index_therapeuticus_csv:13:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `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>)> Unit.new('1000') > Unit.new('1 mg')
ArgumentError: Incompatible Units ('' not compatible with 'mg')
from /home/niklaus/git/oddb.org/vendor/ruby240/ruby/2.4.0/gems/ruby-units-2.1.0/lib/ruby_units/unit.rb:733:in `<=>'

where as we expected until now Dose.new('1000') > Dose.new('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  = RubyUnits::Unit.new(1)
  i_e.aliases      = %w(I.E.)
end

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 = ODDB::Dose.new(*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)
  end

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