view · edit · sidebar · attach · print · history

Index>

20140709-Fix-export-generics

Summary

  • Fix export-generics undefined method `sequences' for "format_type":String]]
  • Printing a prescription must work. Also must add a watir test for it
  • Fix instant search to avoid entering Return twice. Also must add a watir test for it

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 instant search to avoid entering Return twice. Also must add a watir test for it

InstantSearch requires entering RETURN twice to add a drug. This is reflected by the comment (in spec/rezept_and_instantsearch_spec.rb)

  it "should have a working instant search" do
    <..>
    @browser.send_keys("\n") # this is different to add_one_drug_to_rezept
    @browser.send_keys("\n") # this is different to add_one_drug_to_rezept

Adapting the watir-tests to the desired behaviour, made it a lot shorter and better lisible!

After (temporarily) adding some console output I found out that

  1. the popup.style.overflowX matches sometimes /hidden/ and
  2. the javascript acccessed an invalid value progressbar

Fixed with commit Fix instant search. Looking back, I think it might have taken less time to fix this bug, than to create the work-around in the watir tests.

Pulling changes to thinpower and restarting ch-oddbd

Printing a prescription must work. Also must add a watir test for it

When trying to display print a drugs prescription under http://oddb-ci2.dyndns.org/de/gcc/rezept/ean/7680551970071 I get the error on bin/oddbd state.global.print prescription #<SBSM::InvalidDataError: e_invalid_boolean prescription > ean13 nil pack nil.

Looked via HttpFox at the POST-data for this event and I see

prescription_first_name	
prescription_family_name	
prescription_birth_day	
prescription_sex	1
prescription_timing[0]	1
prescription_term[0]	1
prescription_comment[0]	Bemerkungen
atc_code	N02BA01
searchbar	Medikament hinzufügen
flavor	gcc
language	de
event	print
state_id	70042739355220
zone	drugs
prescription	

But the problem is, that when I enter the first <Return> no event is posted. Banging my head why I see also the error state.global.print prescription2: #<SBSM::InvalidDataError: e_invalid_boolean prescription > ean13 nil pack nil in the bin/oddbd output. I cannot explain where this error does come from. Patching the gem to emit a stack trace when hitting the error.

Links to compare output of fachinfo

How the links should be presented for the prescription

Changing state/global.rb to display use the PrescriptionPrint if @session.user_input(:ean) is not nil. Now it opens a copy of the window (http://oddb-ci2.dyndns.org/de/gcc/rezept/ean/7680576730049,7680390530474) but with the wrong URL (http://oddb-ci2.dyndns.org/de/gcc). Therefore I must correct the URL.

Now I begin to debug the class PrescriptionPrint in src/view/prescription.rb. But debugging is slow, as I always have to launch bin/oddb again and running the minimal watir test takes a bit less than two minutes.

Still having the problem that the displayed URL and the announced URL do not match. See

.

Will continue next monday. Patch saved in Attach:patch_print_prescription.txt.

Fix export-generics undefined method `sequences' for "format_type":String

Analysing the error

Non US-ASCII detected and no charset defined.
Defaulting to UTF-8, set your own if this is incorrect.
(druby://localhost:10005) /var/www/oddb.org/src/model/sequence.rb:119:in `comparables': undefined method `sequences' for "format_type":String (NoMethodError)
	from (druby://localhost:10005) /var/www/oddb.org/src/model/package.rb:214:in `comparables'
	from (druby://localhost:10005) /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing'
	from (druby://localhost:10005) /var/www/oddb.org/ext/export/src/generics_xls.rb:96:in `block in export_generics'
	from (druby://localhost:10005) /var/www/oddb.org/src/model/sequence.rb:175:in `each'
	from (druby://localhost:10005) /var/www/oddb.org/src/model/sequence.rb:175:in `each_package'
	from (druby://localhost:10005) /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing'
	from (druby://localhost:10005) /var/www/oddb.org/src/model/registration.rb:149:in `block in each_package'
	from (druby://localhost:10005) /var/www/oddb.org/src/model/registration.rb:148:in `each_value'
	from (druby://localhost:10005) /var/www/oddb.org/src/model/registration.rb:148:in `each_package'
	from (druby://localhost:10005) /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing'
	from (druby://localhost:10005) /var/www/oddb.org/src/util/oddbapp.rb:664:in `block in each_package'
	from (druby://localhost:10005) /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `each_value'
	from (druby://localhost:10005) /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing'
	from (druby://localhost:10005) /var/www/oddb.org/src/util/oddbapp.rb:663:in `each_package'
	from (druby://localhost:10005) /var/www/oddb.org/ext/export/src/generics_xls.rb:94:in `export_generics'
	from (druby://localhost:10005) /var/www/oddb.org/ext/export/src/odba_exporter.rb:113:in `block in export_generics_xls'
	from (druby://localhost:10005) /var/www/oddb.org/ext/export/src/odba_exporter.rb:286:in `call'
	from (druby://localhost:10005) /var/www/oddb.org/ext/export/src/odba_exporter.rb:286:in `block in safe_export'
	from (druby://localhost:10005) /usr/local/lib/ruby/1.9.1/tempfile.rb:316:in `open'
	from (druby://localhost:10005) /var/www/oddb.org/ext/export/src/odba_exporter.rb:285:in `safe_export'
	from (druby://localhost:10005) /var/www/oddb.org/ext/export/src/odba_exporter.rb:111:in `export_generics_xls'
	from (druby://localhost:10005) /usr/local/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
	from (druby://localhost:10005) /usr/local/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
	from (druby://localhost:10005) /usr/local/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
	from (druby://localhost:10005) /usr/local/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
	from (druby://localhost:10005) /usr/local/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
	from /var/www/oddb.org/src/plugin/xls_export.rb:22:in `export_generics'
	from /var/www/oddb.org/src/util/exporter.rb:154:in `export_generics_xls'
	from /var/www/oddb.org/src/util/updater.rb:416:in `update_swissmedic_followers'
	from /var/www/oddb.org/src/util/updater.rb:198:in `run'
	from jobs/import_daily:13:in `block in <module:Util>'
	from /var/www/oddb.org/src/util/job.rb:40:in `call'
	from /var/www/oddb.org/src/util/job.rb:40:in `run'
	from jobs/import_daily:12:in `<module:Util>'
	from jobs/import_daily:11:in `<module:ODDB>'
	from jobs/import_daily:10:in `<main>'
/var/www/oddb.org/log/job.pid is deleted

Add debug output to see which registration/sequence causes this problem. See http://dev.ywesee.com/Niklaus/20140701-Fix-invalid-byte-sequence-in-import-daily Fachinfo displays correctly http://ch.oddb.org/de/gcc/fachinfo/swissmedicnr/17233, but not the patinfo. http://ch.oddb.org/de/gcc/patinfo/reg/17233/seq/00

Verifying amount of damage on thinpower via bin/admin

ch.oddb> registration('17233').sequence('02').package('001').atc_class
-> format_type
ch.oddb> registration('17233').sequence('02').package('068').atc_class
-> format_type
ch.oddb> $all = []; packages.collect {|x| $all << x if x.atc_class.is_a?(String)}; $all.size
->2

Will run on oddb-ci2 in bin/admin packages.collect {|x| if x.atc_class.is_a?(String) then x.atc_class = nil; x.odba_isolated_store; end }, restart all services and run export_daily again.

This did not work, as the atc_class belongs to the sequence and not the package. Therefore changed it to

ch.oddb> registration('17233').sequence('02').atc_class
-> format_type
ch.oddb> registration('17233').sequence('02').atc_class = nil; registration('17233').sequence('02').odba_isolated_store
-> Selsun, Suspension
ch.oddb> registration('17233').sequence('02').atc_class
-> 

Display for http://oddb-ci2.dyndns.org/de/gcc/drug/reg/17233 and http://oddb-ci2.dyndns.org/de/gcc/drug/reg/17233/seq/02 work fine.

Waiting to complete import_bsv_followers before applying the same change on thinpower. Generated Generikaliste without a problem. Running bin/admin statement on ch.oddb.org. Now http://ch.oddb.org/de/gcc/search/zone/drugs/search_query/17233/search_type/st_registration#best_result works fine.

Now running jobs/import_swissmedic_followers on oddb-ci2 to ensure that Zenos original problem is solved, too. Yes it did.

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