view · edit · sidebar · attach · print · history

Index>

20170815-fix-interaction

Summary

  • Set fax/fon from log file
  • Fix creating rezept for two drugs
  • Change history for PI/FI
  • Keep in Mind

Commits

Index

Set fax/fon from log file

Must set the fax/fon numbers from log via bin/admin. Will extract first the GLN, fax, fon into csv file. Then make a small bin/admin script.

Extracting from Attach:wrong_fax_fon.txt can be done using the ruby script Attach:get_fax_fon.txt.

This file can be read via bin/admin using the following steps

# bin/admin
$infos = CSV.read("company_fax_fon.csv", :headers => true)
$stderr.sync = true
$infos.each do |info| $stderr.puts info; company = company_by_gln(info['gln']); company.addresses.first.fax = info['fax']; company.addresses.first.fon = info['fon']; company.odba_store; end
# $stderr is seen in /var/www/oddb.org/log/2017/08/15/user_log

This worked find. An example is http://ch.oddb.org/de/gcc/company/ean/7601001242166 which has again a fax and a fon number.

Fix creating rezept for two drugs

Visiting http://i.ch.oddb.org/de/mobile/rezept/ean/7680317060176,7680353520153 (Inderal, ponstan) does not work.

I see tons of lines ODBA::Stub was unable to replace Array#36022779 from Hash:#35990969 in /var/www/oddb.org/log/2017/08/15/user_log. Must place a breakpoint there (lib/odba/stub.rb:58). And I land there some seconds after entering the second drub. Backtrace is

Backtrace:
--
/var/www/oddb.org/vendor/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:115:in `block in resume_pry'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:28:in `block in run'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:27:in `catch'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:27:in `run'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:111:in `resume_pry'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/pry-byebug-3.4.2/lib/byebug/processors/pry_processor.rb:70:in `at_return'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/byebug-9.0.6/lib/byebug/context.rb:128:in `at_return'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/stub.rb:61:in `odba_receiver'
(eval):2:in `hash'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/persistable.rb:583:in `block in odba_restore'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/persistable.rb:582:in `each'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/persistable.rb:582:in `odba_restore'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:634:in `restore'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:319:in `block in fetch_or_restore'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:318:in `fetch_or_restore'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:641:in `restore_object'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:606:in `load_object'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:227:in `block in fetch'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:314:in `fetch_or_do'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:226:in `fetch'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/stub.rb:49:in `odba_receiver'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/stub.rb:113:in `method_missing'
/var/www/oddb.org/src/model/epha_interaction.rb:45:in `get_epha_interaction'
/var/www/oddb.org/src/model/epha_interaction.rb:60:in `block in get_interactions'
/var/www/oddb.org/src/model/epha_interaction.rb:58:in `each'
/var/www/oddb.org/src/model/epha_interaction.rb:58:in `get_interactions'
/var/www/oddb.org/src/view/interactions/interaction_chooser.rb:125:in `init'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
/var/www/oddb.org/src/view/drugs/prescription.rb:41:in `new'
/var/www/oddb.org/src/view/drugs/prescription.rb:41:in `init'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
/var/www/oddb.org/src/view/drugs/prescription.rb:147:in `new'
/var/www/oddb.org/src/view/drugs/prescription.rb:147:in `interactions'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:83:in `create'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
/var/www/oddb.org/src/view/drugs/prescription.rb:144:in `init'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
/var/www/oddb.org/src/view/drugs/prescription.rb:176:in `new'
/var/www/oddb.org/src/view/drugs/prescription.rb:176:in `block in init'
/var/www/oddb.org/src/view/drugs/prescription.rb:175:in `each'
/var/www/oddb.org/src/view/drugs/prescription.rb:175:in `init'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:76:in `new'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:76:in `create'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
/var/www/oddb.org/src/view/publictemplate.rb:71:in `new'
/var/www/oddb.org/src/view/publictemplate.rb:71:in `content'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:83:in `create'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
/var/www/oddb.org/src/view/publictemplate.rb:68:in `init'
/var/www/oddb.org/src/view/privatetemplate.rb:17:in `init'
/var/www/oddb.org/src/view/drugs/prescription.rb:573:in `init'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/state.rb:240:in `new'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/state.rb:240:in `view'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/state.rb:173:in `to_html'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/session.rb:548:in `to_html'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/session.rb:280:in `block in process_rack'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/session.rb:209:in `synchronize'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/session.rb:209:in `process_rack'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/sbsm-1.5.8/lib/sbsm/app.rb:127:in `call'

I must rethink how the epha_interaction are stored. Probably it would be the easiest to just load them at startup time from the downloaded CSV file and not saving anything in the ODDB database.

This means that we must get rid of include ODBA::Persistable and include Persistence from the ODDB::EphaInteraction class and delete all the existing DB-data. Now I found the reason for my problems. When src/util/oddbapp.rb tries to read @epha_interactions_hash we get the error ODBA::Stub was unable to replace Array#36020838 from Hash:#35990969.

Loading the EPHA-Interactions at startup time add about 3 seconds to the startup time. But it is now again possible to add interactions. Running the spec tests for interactions.

While running the spec test, I see quite often the errr

DRb::DRbRemoteError at /de/gcc
no connection to the server (DBI::ProgrammingError)

Why? Got the following errors

rspec ./spec/rezept_and_instantsearch_spec.rb:420 # ch.oddb.org should print the fachinfo when opening the fachinfo from a prescription
rspec ./spec/rezept_and_instantsearch_spec.rb:452 # ch.oddb.org should not loose existing comment after adding a new prescription
rspec ./spec/rezept_and_instantsearch_spec.rb:464 # ch.oddb.org should show the interaction between different drugs
rspec ./spec/rezept_and_instantsearch_spec.rb:482 # ch.oddb.org should with four medicaments
rspec ./spec/rezept_and_instantsearch_spec.rb:539 # ch.oddb.org should have a working instant search
rspec ./spec/rezept_and_instantsearch_spec.rb:571 # ch.oddb.org should be possible to print a presciption with 10 drugs

These were all tests needing a login. After restarting yus I was able to login again.

But I still have some errors because the field of the firstname does not correspond to the logged in user. Why?

This stems from the fact that the new Rack-Based SBSM never calls the method http_headers in src/view/drugs/prescription.rb. This must be fixed.

This was clearly a problem and improves the print and CSV of a medication. But first and last name still do not display correctly.

Also when entering a new new in first name the field get cleared as soon as we had another drug. But it gets displays when printing or downloading as CSV. Pushed commit Load epha-interaction from CSV and will fix this problem later.

Change history for PI/FI

Must add patinfo change history and verify that we really can see several entries.

Looking via bin/admin at some recent changes:

ch.oddb> registration('65082').sequence('01').fachinfo[:de].change_log.size
-> 1
ch.oddb> registration('65082').sequence('01').fachinfo[:de].change_log.first.time
-> 2017-08-12
ch.oddb> registration('65082').sequence('01').fachinfo[:de].change_log.first.diff.to_s[0..80]
-> -Vor der Abgabe sollte die Patientin über die Vor- und Nachteile der verschiedene
ch.oddb> registration('65082').sequence('01').fachinfo[:de].change_log.first.odba_id
-> 36103266
ch.oddb> registration('65082').sequence('01').fachinfo[:de].change_log.odba_id
-> 36103267
ch.oddb> registration('65082').sequence('01').fachinfo[:de].odba_id
-> 36103245
ch.oddb> $diffs = active_sequences.find_all{ |seq| seq.fachinfo && seq.fachinfo[:de].change_log.size > 0}; $diffs.size
-> 5635
ch.oddb> $more_diffs = active_sequences.find_all{ |seq| seq.fachinfo && seq.fachinfo[:de].change_log.size > 1}; $more_diffs.size
-> 2
ch.oddb> $more_diffs.first.fachinfo[:de].change_log.last.time
-> 2015-11-11
ch.oddb> $more_diffs.last.fachinfo[:de].change_log.last.time
-> 2015-11-10
ch.oddb> $more_diffs.last.fachinfo[:de].change_log.first.time
-> 2015-11-10
ch.oddb> $more_diffs.last.pointer
-> :!registration,65569!sequence,01.
ch.oddb> $more_diffs.first.pointer
-> :!registration,65535!sequence,01.

http://ch.oddb.org/de/gcc/show/fachinfo/65569/diff also cleanly displays two entries. Somehow storing several diffs no longer works. Why?

Why does the class Fachinfo class include Persistence, but the class Patinfo not?

Testing my changes for FI with sudo -u apache bundle-240 exec jobs/update_textinfo_swissmedicinfo --reparse --target=fi 62131

view · edit · sidebar · attach · print · history
Page last modified on August 15, 2017, at 04:46 PM