view · edit · sidebar · attach · print · history

< Niklaus.20170823-patinfo-changelog | Index | Niklaus.20170821-save-only-latest-evidentia >>

20170822-patinfo-changelog

Summary

Commits

Index

  • Saved only latest file for evidentia_fi_link and interactions

Changelog history for PI/FI

To fix the problem with the persistence of a Diffy::Diff object, I am working on a unit test for it and a fix inside the ODBA-Gem. As it seems to be clear, that the persistence layer should ignore closed files.

It took less than 10 minutes to add the unit test test_marshall_diff_item_with_closed_tempfile in test/test_model/fachinfo.rb. Now working on the needed changes in ODBA.

Zeno wanted to create a gem ydiffy. Released version 0.0.2.

Adding support for saving the patinfo changelog in the model and text_info plugin. Reloaded database from thinpower. Import first test using sudo -u apache bundle-240 exec /usr/local/bin/ruby-240 jobs/update_textinfo_swissmedicinfo --target=pi --reparse 66360

Having a small problem in a Log text. But adding the change_log seems to work, as shown by this bin/admin snippet

ch.oddb> registration('66360').packages.last.patinfo.de.change_log
-> [#<ODBA::Stub:47289687635500#36113085 @odba_class=ODDB::PatinfoDocument::ChangeLogItem @odba_container=47289677380980#36113084>]
ch.oddb> registration('66360').packages.last.patinfo.de.change_log.first.time
-> 2017-08-22
ch.oddb> registration('66360').packages.last.patinfo.de.change_log.first.diff.to_s[0..80]
-> -Was ist ASS Cardio Axapharm und wann wird es angewendet?
-ASS Cardio Axapharm en

Also must correct an error where I used patinfo[lang] instead of patinfo.descriptions[lang].

Could this be fixed in src/util/language with this definition?

def method_missing(symbol, *args, &block)
  language = symbol.to_s
  if symbol == :[] && args.first.is_a?(String) && args.first.length == 2
    description(args.first)
  elsif(language.length == 2)
    description(language)
  else
    super
  end
end

Done, but now I get the following error

Plugin: ODDB::TextInfoPlugin

Error: NoMethodError
Message: undefined method `select_one' for nil:NilClass
Backtrace:
(druby://localhost:10002) /var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/storage.rb:621:in `restore_max_id'
(druby://localhost:10002) /var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/storage.rb:617:in `ensure_next_id_set'
(druby://localhost:10002) /var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/storage.rb:393:in `block in next_id'
(druby://localhost:10002) /var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/storage.rb:392:in `synchronize'
(druby://localhost:10002) /var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/storage.rb:392:in `next_id'
(druby://localhost:10002) /var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/cache.rb:406:in `next_id'
(druby://localhost:10002) /var/www/oddb.org/vendor/ruby/2.4.0/gems/odba-1.1.2/lib/odba/persistable.rb:266:in `odba_id'
(druby://localhost:10002) /var/www/oddb.org/src/util/persistence.rb:120:in `set_oid'
(druby://localhost:10002) /var/www/oddb.org/src/util/persistence.rb:153:in `initialize'
(druby://localhost:10002) /var/www/oddb.org/ext/fiparse/src/patinfo_hpricot.rb:74:in `new'
(druby://localhost:10002) /var/www/oddb.org/ext/fiparse/src/patinfo_hpricot.rb:74:in `to_textinfo'
(druby://localhost:10002) /var/www/oddb.org/ext/fiparse/src/textinfo_hpricot.rb:100:in `extract'
(druby://localhost:10002) /var/www/oddb.org/ext/fiparse/src/fiparse.rb:207:in `parse_patinfo_html'
(druby://localhost:10002) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1624:in `perform_without_block'
(druby://localhost:10002) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1584:in `perform'
(druby://localhost:10002) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1668:in `block (2 levels) in main_loop'
(druby://localhost:10002) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1664:in `loop'
(druby://localhost:10002) /usr/local/ruby-2.4.0/lib/ruby/2.4.0/drb/drb.rb:1664:in `block in main_loop'
/var/www/oddb.org/src/plugin/text_info.rb:1299:in `parse_textinfo'
/var/www/oddb.org/src/plugin/text_info.rb:1494:in `block in import_swissmedicinfo'
/var/www/oddb.org/src/plugin/text_info.rb:1493:in `each'
/var/www/oddb.org/src/plugin/text_info.rb:1493:in `import_swissmedicinfo'
/var/www/oddb.org/src/util/updater.rb:587:in `block in update_notify_simple'
/var/www/oddb.org/src/util/updater.rb:543:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:581:in `update_notify_simple'
/var/www/oddb.org/src/util/updater.rb:350:in `update_textinfo_swissmedicinfo'
jobs/update_textinfo_swissmedicinfo:39:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/update_textinfo_swissmedicinfo:12:in `<module:Util>'
jobs/update_textinfo_swissmedicinfo:11:in `<module:ODDB>'
jobs/update_textinfo_swissmedicinfo:10:in `<main>'

I suspect, that this is the consequence of my interrupting the import. Therefore reloading the database dump and starting the import again.

No, this was not the case. Adding some pry debug statement to be able to track the problem. Must add a pry statement in the fiparse and run it manually.

Looks like the fiparse does not have a valid connnection to the database server

[11] pry(#<ODBA::Storage>)> row = self.dbi.select_one("SELECT odba_id FROM object ORDER BY odba_id DESC LIMIT 1")
NoMethodError: undefined method `select_one' for nil:NilClass
from (pry):11:in `restore_max_id'
[12] pry(#<ODBA::Storage>)> self.dbi
=> nil

Restarting the postgresql server and retrying the import. This did not help. It looks for me that ODBA.storage.dbi is correctly defined when we run a ODDB-Job but that it is not defined when running the fiparse.

Fixed by adding the following two lines to ext/fiparse/bin/fiparsed

$: << File.expand_path("../../..", File.dirname(__FILE__))
require 'etc/db_connection'

Found cases, where we did not update the patinfo, as I updated the content before comparing it.

Tried to push the changes only for saving the fachinfo, but failed, because there I used the wrong diffy.

As the import_daily finished correctly on oddb-ci2 and produced some patinfo changes and multiple fi changes. I pushed the commits

Moved the change_logs into a separate class (in src/view/drugs/change_logs.rb). Fachinfo changes display correctly again. Patinfo changes produce the following error

NameError: undefined local variable or method `next_offset' for #<ODDB::View::Drugs::PiChapterChooser:0x00556361ae0988>
	/home/niklaus/git/oddb.org/src/view/drugs/patinfo.rb:92:in `init'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
	/home/niklaus/git/oddb.org/src/view/drugs/patinfo.rb:212:in `new'
	/home/niklaus/git/oddb.org/src/view/drugs/patinfo.rb:212:in `chapter_chooser'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:83:in `create'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
	/home/niklaus/git/oddb.org/src/view/publictemplate.rb:71:in `new'
	/home/niklaus/git/oddb.org/src/view/publictemplate.rb:71:in `content'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:83:in `create'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:284:in `compose_component'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:213:in `block in compose'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `each'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:209:in `compose'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/composite.rb:72:in `init'
	/home/niklaus/git/oddb.org/src/view/publictemplate.rb:68:in `init'
	/home/niklaus/git/oddb.org/src/view/privatetemplate.rb:17:in `init'
	/home/niklaus/git/oddb.org/vendor/bundle/ruby/2.4.0/gems/htmlgrid-1.1.4/lib/htmlgrid/component.rb:139:in `initialize'
	/home/niklaus/git/sbsm/lib/sbsm/state.rb:243:in `new'
	/home/niklaus/git/sbsm/lib/sbsm/state.rb:243:in `view'
	/home/niklaus/git/sbsm/lib/sbsm/state.rb:176:in `to_html'
	/home/niklaus/git/sbsm/lib/sbsm/session.rb:548:in `to_html'
	/home/niklaus/git/sbsm/lib/sbsm/session.rb:280:in `block in process_rack'
	/home/niklaus/git/sbsm/lib/sbsm/session.rb:209:in `synchronize'
	/home/niklaus/git/sbsm/lib/sbsm/session.rb:209:in `process_rack'
	/home/niklaus/git/sbsm/lib/sbsm/app.rb:127:in `call'

After fixing this missing variable declaration and some other stuff http://localhost:8812/fr/gcc/patinfo/reg/66261/seq/01/pack/001 has the field "Afficher les changement". But the CSS is wrong, as the fields behind have a white background.

When following the link to /fr/gcc/show/patinfo/66261/diff it cannot display the information. We must probably correct the state. Had to correct calculating/using the request_url for patinfo diffs in various places. They are more complicated than the fachinfo, because they (maybe) specific to a package and not to a registration. Now a changelog is shown.

Tomorrow I will fix the CSS issue show below

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