Found the following error in my local import_daily
Plugin: ODDB::BsvXmlPlugin Error: NoMethodError Message: undefined method `values' for "name":String @report: {:name_base=>"Bexin", :name_descr=>"Sirup 25 mg/10ml ", :swissmedic_no5_bag=>"39639", :deductible=>:deductible_g, :generic_type=>:unknown, :swissmedic_no5_oddb=>"39639", :swissmedic_no8_bag=>"39639025"} Backtrace: /var/www/oddb.org/src/model/registration.rb:241:in `block in packages' /var/www/oddb.org/src/model/registration.rb:240:in `each' /var/www/oddb.org/src/model/registration.rb:240:in `inject' /var/www/oddb.org/src/model/registration.rb:240:in `packages' /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing' /var/www/oddb.org/src/plugin/bsv_xml.rb:406:in `tag_end' /usr/local/lib/ruby/1.9.1/rexml/parsers/streamparser.rb:26:in `parse' /usr/local/lib/ruby/1.9.1/rexml/document.rb:205:in `parse_stream' /var/www/oddb.org/src/plugin/bsv_xml.rb:915:in `update_preparations' /var/www/oddb.org/src/plugin/bsv_xml.rb:601:in `block (2 levels) in _update' /usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/entry.rb:500:in `get_input_stream' /var/www/oddb.org/src/plugin/bsv_xml.rb:601:in `block in _update' /usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/entry_set.rb:42:in `call' /usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/entry_set.rb:42:in `block in each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/entry_set.rb:41:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/entry_set.rb:41:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/central_directory.rb:182:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/file.rb:139:in `block in foreach' /usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/file.rb:99:in `open' /usr/local/lib/ruby/gems/1.9.1/gems/rubyzip-1.1.6/lib/zip/file.rb:138:in `foreach' /var/www/oddb.org/src/plugin/bsv_xml.rb:596:in `_update' /var/www/oddb.org/src/plugin/bsv_xml.rb:591:in `update' /var/www/oddb.org/src/util/updater.rb:285:in `block in update_bsv' /var/www/oddb.org/src/util/updater.rb:539:in `call' /var/www/oddb.org/src/util/updater.rb:539:in `wrap_update' /var/www/oddb.org/src/util/updater.rb:283:in `update_bsv' /var/www/oddb.org/src/util/updater.rb:205:in `run' jobs/import_daily: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_daily:12:in `<module:Util>' jobs/import_daily:11:in `<module:ODDB>' jobs/import_daily:10:in `<main>'
My problems stemmed from the fact that I naively assumed that the size of the UTF-8 encoded HTML size is equal to the file size.
Having even more code common for analysing FI and PI.
Had the same problem with the UTF-8 size when comparing the xml files in data/details.
Added 56079_pi_de.xml to test/data/xml/Aips_test.xml. Not test/test_plugin/text_info.rb begins to really check what is going on. Updating the statistics does not yet work correctly.
Comparing the content of the XML files seems not to work for some FIs with problematic names. Mail for FI arrives after 20 minutes. PI arrived even faster. Suspecting an error. Removing all files containing Tramal or 43788 in their names under data to force some reparsing.
Needed to improve stubbing to allow creating FI/PIs. Removing the details_dir before each run, allows me to check the statistics.
Now the counters seem to be okay. I am quite satisfied that finally test/test_plugin/text_info.rb does stress plugin/textinfo.rb in a correct way. Must fix some errors in test/test_plugin/text_info_swissmedicinfo.rb
Pushed commit Removed obsolete textinfo_news. Fix import_daily to read newest only
But something is still very slow. Therefore trying to profile the whole import using https://github.com/tmm1/perftools.rb. Added the lines to jobs/import_daily
require 'perftools' PerfTools::CpuProfiler.start("/tmp/import_daily_profile") <..> PerfTools::CpuProfiler.stop
Added gem 'perftools.rb'
to the Gemfile. After running bundle install
I am able to bundle exec jobs/import_daily
. Looking the results is done using sudo -u apache bundle exec pprof.rb --text /tmp/import_daily_profile