view · edit · sidebar · attach · print · history

<< | Index | >>

20131202-import-pubPrice-zurRose

Summary

  • Import public price zur Rose in oddb2xml

Commits

Index

---

oddb2xml does not work with spreadsheet 0.9.5

oddb2xml does not work with spreadsheet 0.9.5. Gemfile.lock of oddb2xml specifies 0.7.5 but when building the gem this is not taken into account.

spreadsheet gem is missing tags since 0.8.9. Did somebody forgot to push his tags?

After running bundle update the command bundle exec rake spec shows three errors.

  1) Oddb2xml::Cli when -a nonpharma option is given should create xml files
     Failure/Error: Unable to find matching line from backtrace
     TypeError:
       can't convert nil into Integer
     # ./lib/oddb2xml/extractor.rb:294:in `each_with_index'
     # ./lib/oddb2xml/extractor.rb:294:in `to_hash'
     # ./lib/oddb2xml/cli.rb:196:in `block (2 levels) in download'
     # <internal:prelude>:10:in `synchronize'
     # ./lib/oddb2xml/cli.rb:195:in `block in download'

  2) Oddb2xml::Cli when -a nonpharma option is given should not create any compressed file
     Failure/Error: Unable to find matching line from backtrace
     TypeError:
       can't convert nil into Integer
     # ./lib/oddb2xml/extractor.rb:294:in `each_with_index'
     # ./lib/oddb2xml/extractor.rb:294:in `to_hash'
     # ./lib/oddb2xml/cli.rb:196:in `block (2 levels) in download'
     # <internal:prelude>:10:in `synchronize'
     # ./lib/oddb2xml/cli.rb:195:in `block in download'

  3) Oddb2xml::Cli when -a nonpharma option is given behaves like any interface for product should run successfully
     Failure/Error: Unable to find matching line from backtrace
     TypeError:
       can't convert nil into Integer
     Shared Example Group: "any interface for product" called from ./spec/cli_spec.rb:127
     # ./lib/oddb2xml/extractor.rb:294:in `each_with_index'
     # ./lib/oddb2xml/extractor.rb:294:in `to_hash'
     # ./lib/oddb2xml/cli.rb:196:in `block (2 levels) in download'
     # <internal:prelude>:10:in `synchronize'
     # ./lib/oddb2xml/cli.rb:195:in `block in download'

It might be a good idea to have somewhere a cron-job laying around which would daily check whether each of our gems still works after calling bundle update!

Reverting the following patch fixes the problem:

diff --git a/lib/spreadsheet/excel/reader.rb b/lib/spreadsheet/excel/reader.rb
old mode 100644
new mode 100755
index f35b533..2710e1d
--- a/lib/spreadsheet/excel/reader.rb
+++ b/lib/spreadsheet/excel/reader.rb
@@ -1145,10 +1145,10 @@ class Reader
     if (_objAuthLenFmt == 0)
        #puts "Picking compressed charset"
        #Skip to offset due to 'v5C' used above
-       _objAuth = work.unpack('@11C*')
+       _objAuth = work.unpack('@11C' + (_objAuthLen-1).to_s + 'C')
     elsif (_objAuthLenFmt == 1)
        #puts "Picking uncompressed charset"
-       _objAuth = work.unpack('@11S*')
+       _objAuth = work.unpack('@11S' + (_objAuthLen-1).to_s + 'S')
     end
     _objAuth = _objAuth.pack('C*')
     @note = Note.new

In travis.yml we should change ruby -w ./test/suite.rb to bundle exec ruby -w ./test/suite.rb, as e.g. on my machine ruby -w ./test/suite.rb fails but running it with the bundle works!

In the mean time Zeno merged the patch from https://github.com/narcolepsy which fixes this problem.

I pushed commit Updated Gemfile and Gemfile.lock as I think it is an error that the Gemfile of spreadsheed requires itself.

Pushed update spec/downloader to silence rspec warnings and Silence rspec warning in spec/compressor.rb

integrate a simple interface to display the interaction from EPHA

Continue work. Example is still interaction is between Marcoumar and Aspirin.

Running the import resulted today with the following error

Backtrace:
/usr/local/lib64/ruby/gems/1.9.1/gems/dbd-pg-0.3.9/lib/dbd/pg/statement.rb:62:in `rescue in execute'
/usr/local/lib64/ruby/gems/1.9.1/gems/dbd-pg-0.3.9/lib/dbd/pg/statement.rb:37:in `execute'
/var/www/.gem/ruby/1.9.1/bundler/gems/ruby-dbi-dcd6239fd5f8/lib/dbi/handles/statement.rb:116:in `execute'
/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/storage.rb:263:in `block in ensure_object_connections'
/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/storage.rb:262:in `each'
/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/storage.rb:262:in `ensure_object_connections'
/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:553:in `store_object_connections'
/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:512:in `store'
/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:274:in `odba_isolated_store'
/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:395:in `block in odba_store_unsaved'
/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:392:in `each'
/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:392:in `odba_store_unsaved'
/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/persistable.rb:380:in `odba_store'
/var/www/oddb.org/src/plugin/epha_interactions.rb:60:in `update'
/var/www/oddb.org/src/util/updater.rb:519:in `block in update_notify_simple'
/var/www/oddb.org/src/util/updater.rb:495:in `call'
/var/www/oddb.org/src/util/updater.rb:495:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:513:in `update_notify_simple'
/var/www/oddb.org/src/util/updater.rb:334:in `update_epha_interactions'
jobs/import_epha_interactions: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/import_epha_interactions:12:in `<module:Util>'
jobs/import_epha_interactions:11:in `<module:ODDB>'
jobs/import_epha_interactions:10:in `<main>'

Reloading the DB and running the import twice to see whether this was the result, that I had once interrupt manually an import. But got the error on my first import and import gets stuck.

Analysing the code I stumbled over the LEGACY_INTERFACE and I think it is not used anywhere inside oddb.org. Therefore pushed a commit Remove LEGACY_INTERFACE. If accepted this would allow us to get rid the many statements LEGACY_INTERFAC = false.

Import public price zur Rose in oddb2xml

Calling oddb2xml -a nonpharma -p zurrose imports all Ex-factory prices. Now we should import also the public price (where available) for the Non-SL products. SL-products already get the pub-price from the BAG-XML.e.g. it should create a tag like

 <ARTPRI>
      <VDAT>27.11.2013</VDAT>
      <PTYP>ZURROSEPUB</PTYP>
      <PRICE>22.02</PRICE>
 </ARTPRI>

The public price can be found in the IGM-11 Format ZurRose at 067-072. Details see IGM-11 Format, Seite 5 (Recordart 11) http://dev.ywesee.com/uploads/att/IGM.pdf

Pushed a small commit Add pub_price from Zur Rose. This added the zurrosepub for each article regardless whether it is a SL or non-SL product. If Zeno wants this distinction it is more work.

view · edit · sidebar · attach · print · history
Page last modified on December 03, 2013, at 09:30 AM