view · edit · sidebar · attach · print · history

Index>

20141202-fix-bag-import

Summary

  • Fix export
  • Fix bag import
  • Fix search pharamacies
  • compare xls from medreg and xml from refdata

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!

---

Fix searching pharmacies

Investigation why searching pharmacies does not work. Bin/admin shows that search_pharmacies('Basel') is returning [Zollweiden-Apotheke] which is only one of many pharmacies in Basel. More test via bin/admin

 companies.keys.max
-> 32672126
ch.oddb> company(32672126)
-> Pharmacie Coop Vitality
ch.oddb> company(32672126).business_area
-> ba_public_pharmacy
company(32672126).search_terms
-> ["Pharmacie", "Coop", "Vitality", "Pharmacie Coop Vitality", "7610840000059", "Rue de Saugy 1", "1023 Crissier", "Crissier", "1023"]
search_pharmacies('Crissier')
-> []
 search_pharmacies('Vitality')
-> []

But running jobs/rebuild_indices company_index fails with

/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require': iconv will be deprecated in the future, use String#encode instead.
could not find htmlgrid.so, falling back to pure-ruby class
Attention: monkey-patching CSV::Cell
/usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require': cannot load such file -- racc/info (LoadError)
        from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
        from racc/parser.rb:14:in `<top (required)>'
        from /var/www/oddb.org/src/util/quanty/parse.rb:11:in `module_eval'
        from /var/www/oddb.org/src/util/quanty/parse.rb:11:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
        from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:126:in `require'
        from /var/www/oddb.org/src/util/quanty.rb:2:in `<top (required)>'
<..>

Installing missing gem as root via /usr/local/bin/gem install racc --version=1.4.11. Now the rebuild_index is running.

Now searching the pharmacies works as expected, e.g. http://ch.oddb.org/de/gcc/search/zone/pharmacies/search_query/Glarus returns 3 pharmacies.

Fix export

Got the following error

@40000000547d68dd2894929c /var/www/oddb.org/src/model/ba_type.rb:24:in
`<module:ODDB>': uninitialized constant ODDB::Set (NameError)

Fixed with commit Add require 'set' for exporter

Fix BAG XML import

Got the following error on thinpower

Plugin: ODDB::BsvXmlPlugin
Error: NoMethodError
Message: undefined method `pointer' for "":String
@report: {:name_base=>"EpiPen", :name_descr=>"Inj Lös 0.300 mg Auto", :swissmedic_no5_bag=>"53836", :deductible=>:deductible_g, :generic_type=>:unknown, :atc_class=>"C01CA24", :pharmacode_bag=>"1891722", :swissmedic_no5_oddb=>"53836", :swissmedic_no8_bag=>"53836011", :pharmacode_oddb=>"1891722"}
Backtrace:
/var/www/oddb.org/src/plugin/bsv_xml.rb:337: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:1008:in `update_preparations'
/var/www/oddb.org/src/plugin/bsv_xml.rb:663: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:663: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:658:in `_update'
/var/www/oddb.org/src/plugin/bsv_xml.rb:653:in `update'
/var/www/oddb.org/src/util/updater.rb:276:in `block in update_bsv'
/var/www/oddb.org/src/util/updater.rb:526:in `call'
/var/www/oddb.org/src/util/updater.rb:526:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:274:in `update_bsv'
/var/www/oddb.org/src/util/updater.rb:200: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 `

Bag 53836011 has two sequences 53836 01 011 Epipen and 53836 02 038 Epipen Junior. NameBase seems to have changed form Epipen to EpiPen. Code is inside a rarely used path to resolve a conflict, where it should point to a correct package, which it evidently is not.

Pushed a fix to make travis-ci running our tests Added quanty to avoid problem with US-ASCII and allowing running test on travis-ci

Good news is that running test/test_plugin/bsv_xml.rb hits the failing source code. Bad news is that it is using a mock instead of real instance. There are just way to many mocks used in our unit tests where we should work with real objects to expose their real failures. Sometimes I think getting a good coverage was a higher goal than stress testing the real code!

Comparing EpiPen from 2014.11.01 with 2014.12.01

MEDA Pharma GmbH		1891722	16897	53836011	B	15.03.1998	EpiPen, Inj Lös 0.300 mg Auto, Injektor 1 Stk	52.15	76.25			02.05.20.	Adrenalinum	3711	N
MEDA Pharma GmbH		1891722	16897	53836011	B	15.03.1998	EpiPen, Inj Lös 0.300 mg Auto, Injektor 1 Stk	52.15	76.25			02.05.20.	Adrenalinum	3711	N	7680538360116

Okay. We found that now we have a new column Q named GTIN in the publications.xls file. Comparing the productkey 8681 between the extracted Preparations.xml I did not find any difference. Also the code in question should only be executed if the AtcCode has changed.

Created a work around and start jobs/import_bsv on oddb-ci2. The work-around shows that the ATC-Code is updated for every package. Trying to avoid this useless update. Restarted import again. My new code did not catch when seq.atc_class was nil. Refined the code and restarted the import again.

Import completed. But there are still (at least in my opinion) way to many warnings like

Could not create: :!registration,51164!sequence,01!016!sl_entry., reason: :!registration,51164!sequence,01!016!sl_entry. -> ODDB::Sequence::package(016) returned nil
Could not create: :!registration,51164!sequence,01!024!sl_entry., reason: :!registration,51164!sequence,01!024!sl_entry. -> ODDB::Sequence::package(024) returned nil
ODBA::Stub was unable to replace ODDB::SlEntry#705477 from ODDB::Package:#226260
<..>
ODBA::Stub was unable to replace ODDB::SlEntry#4299192 from ODDB::Package:#3035094
failsafe rescued TypeError < StandardError
0 is not a symbol
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:122:in `respond_to?'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:122:in `respond_to?'
/var/www/oddb.org/src/util/persistence.rb:302:in `block in resolve'
<..>

in the standard output of the importer.

But does updating the ATC-Code really work? Found in the log entries like

2014-12-02 12:09:34 CET bsv_xml: update_conflict 4672340 001 seq is Agnus castus-Mepha, Lactab atc Andere Gynaekologika code G02CX99 pointer? true @seq_data is {:atc_class=>"G02CX03"}
<..>
2014-12-02 15:47:38 CET bsv_xml: update_conflict 5249709 022 seq is #<ODBA::Stub:352542780#28705408 @odba_class=ODDB::Sequence @odba_container=302238560#28705420> pointer? true @seq_data is {:atc_class=>"B01AF01"}

But even after restarting oddbd http://oddb-ci2.dyndns.org/de/gcc/search/zone/drugs/search_query/5249709/search_type/st_pharmacode?#best_result shows as ATC-Klassierung B01AX06. (In the FI one finds the correct ATC-Code B01AF01). But in this case I cannot find a valid atc_class for B01AF01.

ch.oddb> atc_class('B01AF01').class
-> NilClass
ch.oddb> atc_class('C01CA24')
-> Epinephrin
ch.oddb> atc_class('C01CA24').code
-> C01CA24

We should probably be re-import an actual dump of the ATC-classes. Pushed the following commits

Started sudo -u apache jobs/import_bsv on thinpower.

Index

compare xls from medreg and xml from refdata

In the XML for companies (from https://index.ws.e-mediat.net/Swissindex/Company/ws_Company_V101.asmx?WSDL) you find 13922 entries which belong to 25 different "TYPE" attributes, listed here (with number of occurrences {"ONursOrg"=>1603, "Indus"=>1031, "SpecPra"=>457, "Pharm"=>2553, "HeaTec"=>508, "SWFirm"=>59, "VetGrpPra"=>7, "Whole"=>273, "NursHom"=>2105, "NonHealthCare"=>21, "GrpPra"=>1243, "Hosp"=>1503, "SerFirm"=>268, "DruSto"=>975, "HeaIns"=>263, "Lab"=>586, "DentGrpPra"=>40, "PubHea"=>73, "AccIns"=>161, "IntOrg"=>14, "SocSec"=>30, "HeaProd"=>62, "Assoc"=>41, "PrivPra"=>58, "HeaEmpl"=>2}

Medreg also lists over 107'000 persons (including nurses) classified as

  • Chiro
  • CompTherapist
  • Dent
  • DiabAdv
  • DoctMed
  • Drugg
  • Ergo
  • HeaEmpl
  • HeaProv
  • LabLeader
  • MedPracAss
  • MedSecr
  • Midw
  • Naturopath
  • Nurse
  • NutrAdv
  • PharmAss
  • Pharmst
  • Physio
  • Psycho
  • SpeeTher
  • Veter
view · edit · sidebar · attach · print · history
Page last modified on December 02, 2014, at 05:30 PM