view · edit · sidebar · attach · print · history

Index>

20140702-Fix-import-fi-for-non-existing-iksnr

Summary

  • Fix import fachinfo for non existing iksnr
  • Create integration test

Commits

Index

Keep in Mind
  • Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • One unit-test for searchbar fails and might be a clue why searching does not work correctly.
  • Added two skip in test/test_plugin/rss.rb. Why does the mocking not work there anymore?
  • Make ext/swissindex/test/test_swissindex.rb and skipping tests in migel-gem pass.

---

Fix import fachinfo for non existing iksnr

Remarked that after calling in bin/admin delete_registration('17233') and reimporting using jobs/update_textinfo_swissmedicinfo --no-download --target=both 17233 --reparse that the fachinfo got not updated correctly. Reworking src/plugin/textinfo.rb to ensure that after each app.update we have also a corresponding odba_store call.

But when trying to see info for 17233 via the web I get in bin/oddbd the following error

NoMethodError
undefined method `gsub' for nil:NilClass
/var/www/oddb.org/src/view/drugs/package.rb:234:in `name'
<...>

To be able to undestand what is really going on, I would like to create a oddb.org database from scratch, which is an idea which Zeno and I had discussed before. Will invest two hours to see whether this is feasible or not.

Start oddb.org with an empty database

Steps were:

  • sudo -u postgres createdb -E UTF8 -T template0 oddb.org.ruby21x
  • Changed connection in etc/db_connection.rb to ODBA.storage.dbi = ODBA::ConnectionPool.new('DBI:Pg:oddb.org.ruby21x', 'postgres', '')
  • Don't raise an exception in src/util/oddbapp.rb:1425 if group.oid (of GalenicGroup) != 1
  • Appended if model.fachinfo_news to line 412 in src/view/drugs/centeredsearchform.rb
  • Started bin/oddbd
  • Dump of new database using sudo -u postgres pg_dump oddb.org.ruby21x > ~/dump.sql

Stared bin/oddbd. Now I get the following error when searching for the

error in SBSM::Session#process: /de/gcc/search/zone/drugs/search_query/Aspirin/search_type/st_oddb
KeyError
key not found: "atc_index"
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:457:in `fetch'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/cache.rb:457:in `retrieve_from_index'
/var/www/oddb.org/src/util/oddbapp.rb:106:in `retrieve_from_index'
/var/www/oddb.org/src/util/oddbapp.rb:1006:in `search_by_atc'
/var/www/oddb.org/src/util/oddbapp.rb:944:in `search_oddb'

This error vanishes after rebuilding the indices and restarting bin/oddbd.

Then I have this error in the output of bin/oddbd

FEHLER:  Textsuchekonfiguration »default_german« existiert nicht

ODBA::Storage.retrieve_from_fulltext_index rescued a DBI::ProgrammingError(FEHLER:  Textsuchekonfiguration »default_german« existiert nicht
). Query:
self.dbi.select_all(                            SELECT target_id, 
                                        max(ts_rank(search_term, to_tsquery(?, ?))) AS relevance
                                FROM interactions_index_de 
                                WHERE search_term @@ to_tsquery(?, ?) 
                                GROUP BY target_id
                                ORDER BY relevance DESC
, default_german, merfen, default_german, merfen)
returning empty result

Correct sequences to start with an empty database is therefore (after applying the commit xxx)

  • sudo -u postgres dropb oddb.org.ruby21x
  • sudo -u postgres createdb -E UTF8 -T template0 oddb.org.ruby21x
  • Changed connection in etc/db_connection.rb to ODBA.storage.dbi = ODBA::ConnectionPool.new('DBI:Pg:oddb.org.ruby21x', 'postgres', '')
  • sudo -u apache jobs/rebuild_indices
  • sudo svc -h /service/ch.oddb* (or at least sudo -u apache bin/oddbd)

Ignoring this error for the moment being and trying to import iksnr 17233. This starts be creating all registrations found in AipsDownload_latest.xml. Stopped it manually after a few imports and looked at the dump, where I could see in cleartext the created information like company_name, etc

As I achieved running with an empty database in less than an hour I will invest some more time to create a real integration test.

create integration test

The integration test should to the following.

  • start with an empty database
  • import fi/pi for some iksnr
  • use fake latest (last month) files and run import_daily. Compare against reference db_dump
  • use fake latest (current month) files and run import_daily. Compare against reference db_dump
  • run export_daily and verify results
  • run watir tests

The set of used iksnr should be easily changeable and contain

  • some difficult FI/PI (e.g. some or all IKSNR mentioned in test/test_plugin/text_info_swissmedicinfo.rb)
  • present in last month, absent in current month
  • absent in last month, prsent in current month
  • new (sequence|package|part) in current month (compared to last month)
  • dropped (sequence|package|part) in current month (compared to last month)

Now I will create a small helper (test/data/integration/gen_aips_xml.rb) to extract all FI/PIs from AipsDownload_latest.xml for a some iksnr and saving it to a new file under test/data/integration.

Create the helper scripts

  • test/data/integration/gen_aips_xml.rb
  • test/data/integration/prepare_integration_test.rb
  • test/data/integration/restore_after_integration_test.rb

To fix the dictionary took a look at http://dev.ywesee.com/Yasu/20130314-repair-fulltext-index-dictonary-of-postgresql and added a script to add the dictionaries. Not bin/oddbd does not complain anymore about missing _french|_german. On the other hand I get the error

error in SBSM::Session#process: /de/gcc/home/
NoMethodError
undefined method `[]' for #<DRb::DRbUnknown:0x00000002a8dbd8>
/var/www/.gem/ruby/1.9.1/gems/sbsm-1.2.5/lib/sbsm/session.rb:208:in `import_cookies'
/var/www/.gem/ruby/1.9.1/gems/sbsm-1.2.5/lib/sbsm/session.rb:360:in `process'
/var/www/oddb.org/src/util/session.rb:125:in `process'
/var/www/.gem/ruby/1.9.1/gems/sbsm-1.2.5/lib/sbsm/session.rb:172:in `block in drb_process'
<internal:prelude>:10:in `synchronize'

when accessing http://oddb-ci2.dyndns.org/de/gcc/home/

Trying to run jobs/import_daily --xml_file=test/data/integration/AipsDownload_latest.xml. But we have the problem, that we should be able to skip download and use different filenames, e.g XMLPublications-current.zip, XMLPublications-previous.zip instead of XMLPublications-latest.zip. Therefore I will honor an environment variable ODDB_ORG_LATEST_NAME (if present). Must have a look at these files

  1. ext/swissindex/src/swissindex.rb
  2. src/plugin/vaccines.rb
  3. src/plugin/swissreg.rb
  4. src/plugin/analysis.rb
  5. src/plugin/bsv_xml.rb
  6. src/plugin/swissmedic.rb
  7. src/plugin/epha_interactions.rb
  8. src/plugin/text_info.rb
  9. src/plugin/swissmedicjournal.rb
  10. src/plugin/ouwerkerk.rb

Now import_daily starts to complete with an email. But it fails as seen in log/oddb/debug/2014/07.log

import_swissmedicinfo_by_iksnrs iksnr "57435" {}
2014-07-02 16:31:09 +0200: /var/www/oddb.org/src/plugin/text_info.rb:565:in `create_sequence_and_package_if_necessary': Could not find a registration for 57435 nil                

Pushed commits to sbsm Fix sbsm when being called from oddbd and Revert "Tried migrating to ruby 2.1.2" to fix problem with DRbUnknown.

When running after removing all files under data/xml and data/xls I get the following errors on bin/oddbd output

Could not create: :!1!galenic_form., reason: :!1!galenic_form. -> OddbPrevalence::galenic_group(1) returned nil

and in log/oddb/debug/2014/07.log

2014-07-02 17:36:49 +0200: /var/www/oddb.org/src/plugin/text_info.rb:1345:in `import_swissmedicinfo_by_index': import_swissmedicinfo_by_index @new_iksnrs {"57435"=>"Baraclude®", "57436"=>"Baraclude®", "17233"=>"Selsun®", "32917"=>"Zyloric®"} 
2014-07-02 17:36:49 +0200: /var/www/oddb.org/src/plugin/text_info.rb:1351:in `import_swissmedicinfo_by_iksnrs': import_swissmedicinfo_by_iksnrs ["57435", "57436", "17233", "32917"] target fi
2014-07-02 17:36:49 +0200: /var/www/oddb.org/src/plugin/text_info.rb:1357:in `block in import_swissmedicinfo_by_iksnrs': import_swissmedicinfo_by_iksnrs iksnr "57435" {}
2014-07-02 17:36:49 +0200: /var/www/oddb.org/src/plugin/text_info.rb:565:in `create_sequence_and_package_if_necessary': Could not find a registration for 57435 nil
<..>
2014-07-02 17:37:00 CESTlog notify Fach- und Patienteninfo Updates (swissmedicinfo.ch): sent mail
2014-07-02 17:37:02 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 276 updated download.size is 2672682.
2014-07-02 17:37:02 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 53 update target "/var/www/oddb.org/data/xls/Packungen-2014.07.02.xlsx" 2672682 bytes. 
2014-07-02 17:37:03 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 276 updated download.size is 2215823.
2014-07-02 17:37:03 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 288 cp /var/www/oddb.org/data/xls/Präparateliste-2014.07.02.xlsx /var/www/oddb.org/data/xls/Präparateliste-latest.xlsx
2014-07-02 17:37:37 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 67 Found 17360 news, 0 updates, 0 replacements and 0 package_deletions
2014-07-02 17:37:37 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 68 changes: 
<..>
2014-07-02 17:37:38 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 831: res Cardio-Pulmo-Rénal Sérocytol, suppositoire == ? seqnr nil
2014-07-02 17:37:39 +0200: update_compositions: row[0] 00274 iksnr 274 01 seq Cardio-Pulmo-Rénal Sérocytol, suppositoire opts {:create_only=>true, :date=>#<Date: 2014-07-02 ((2456841j,0s,0n),+0s,2299161j)>} cell_content globulina equina (immunisé avec coeur, tissu pulmonaire, reins de porcins) 8 mg, propylenglycolum, conserv.: E 216, E 218, excipiens pro suppositorio.
<..>

Therefore Packungen-2014.07.02.xls and Präparateliste-2014.07.02.xlsx are not yet correct. Must patch src/plugin/swissmedic.rb, too. But this will be next monday. Not yet pushing patch as it contains a 2.3 MB file. See Attach:Added-support-for-integration_test.txt

view · edit · sidebar · attach · print · history
Page last modified on July 02, 2014, at 06:24 PM