view · edit · sidebar · attach · print · history

20130623-Wrong-expression

<< | Index | >>


Summary

  • Problem "Invalid expression" when parsing patinfo
  • Fachinfo is italic

Commits

Index

Problem "Invalid expression" when parsing fachinfo

Task: Fix following error

Plugin: ODDB::TextInfoPlugin
Error: Nokogiri::XML::XPath::SyntaxError
Message: Invalid expression: //medicalInformation[@type='pi' and @lang='fr']/title[match(., "Capsules PASSIFLORE "Künzle"")]
Backtrace:
/usr/local/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xml/node.rb:159:in `evaluate'
/usr/local/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xml/node.rb:159:in `block in xpath'
/usr/local/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xml/node.rb:150:in `map'
/usr/local/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0/lib/nokogiri/xml/node.rb:150:in `xpath'
/var/www/oddb.org/src/plugin/text_info.rb:996:in `extract_matched_content'
/var/www/oddb.org/src/plugin/text_info.rb:1081:in `block in parse_and_update'
/var/www/oddb.org/src/plugin/text_info.rb:1078:in `each'
/var/www/oddb.org/src/plugin/text_info.rb:1078:in `parse_and_update'
/var/www/oddb.org/src/plugin/text_info.rb:1129:in `block (3 levels) in import_info'
/var/www/oddb.org/src/plugin/text_info.rb:1128:in `each'
/var/www/oddb.org/src/plugin/text_info.rb:1128:in `block (2 levels) in import_info'
/var/www/oddb.org/src/plugin/text_info.rb:1127:in `each_pair'
/var/www/oddb.org/src/plugin/text_info.rb:1127:in `block in import_info'
/var/www/oddb.org/src/plugin/text_info.rb:1124:in `each_pair'
/var/www/oddb.org/src/plugin/text_info.rb:1124:in `import_info'
/var/www/oddb.org/src/plugin/text_info.rb:1185:in `block in import_swissmedicinfo_by_index'
/var/www/oddb.org/src/plugin/text_info.rb:1184:in `each_pair'
/var/www/oddb.org/src/plugin/text_info.rb:1184:in `import_swissmedicinfo_by_index'
/var/www/oddb.org/src/plugin/text_info.rb:1230:in `import_swissmedicinfo'
/var/www/oddb.org/src/util/updater.rb:500:in `block in update_notify_simple'
/var/www/oddb.org/src/util/updater.rb:476:in `call'
/var/www/oddb.org/src/util/updater.rb:476:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:494:in `update_notify_simple'
/var/www/oddb.org/src/util/updater.rb:303:in `update_textinfo_swissmedicinfo'
/var/www/oddb.org/src/util/updater.rb:192:in `run'
/var/www/oddb.org/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'
/var/www/oddb.org/jobs/import_daily:12:in `<module:Util>'
/var/www/oddb.org/jobs/import_daily:11:in `<module:ODDB>'
/var/www/oddb.org/jobs/import_daily:10:in `<main>'
  • Status of test/test_plugin/text_info.rb is 27 tests, 47 assertions, 11 failures, 1 errors, 0 skips
  • The error comes when parsing 45928 in french. Saved the HTML file as test/data/html/text_info/45928.de/fi.html
  • Now I get the following result
 13) Failure:
test_update_product_parse_expression(ODDB::TestTextInfoPlugin) [/usr/local/rvm/gems/ruby-1.9.3-p392/gems/flexmock-1.3.1/lib/flexmock/test_unit_integration.rb:53]:
in mock 'parser (simulates ext/fiparse)': no matching handler found for parse_fachinfo_html("/opt/src/oddb.org/test/data/html/text_info/45928.de.html", :documed, "")

28 tests, 47 assertions, 12 failures, 1 errors, 0 skips

Problem fachinfo is italic

make unit tests parse at lease some swissmedicinfo

Problem is:

  • We have unit tests for import from documed, which are becoming more and more irrelevant
  • We have no unit tests for the XML-import from swissmedicinfo.ch
  • Idea: create test/plugins/text_info_swissmedicinfo.rb. Main test parses a stripped down XML file as received from Swissmedicinfo containing the problematic XML-parts as of today.
    • I must make the XML to be parsed an optional part of the options passed to the importer
    • Adding a new field to options allows me to read a specific (small) XML instead of the 500MB full XML.
    def swissmedicinfo_xml(xml_file = File.join(ODDB.config.data_dir, 'xml', 'AipsDownload_latest.xml'))
      if @options[:xml_file]
        xml_file = @options[:xml_file]
      end
      Nokogiri::XML(File.open(xml_file,'r').read)
    end
view · edit · sidebar · attach · print · history
Page last modified on June 25, 2013, at 09:00 AM