<< | Index | >>
Point
Experiment (confirm bin/admin)
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> registrations.values.select{|r| r.iksnr == '56833'}[0].sequences.values.select{|s| s.seqnr == '23'}[0].active_agents.join(",") -> Extractum Aquosum Liquidum Fermentatum 0.05 mg,Natrii Chloridum,Argenti Carbonas 0.1 ug,Ex Viscum Album (Quercus) Recens 0.01 mg
Experiment (src/util/updater.rb)
def update_swissmedic_fix_compositions(*args) logs_pointer = Persistence::Pointer.new([:log_group, :swissmedic]) logs = @app.create(logs_pointer) klass = SwissmedicPlugin plug = klass.new(@app) return_value_plug_update = nil wrap_update(klass, "swissmedic") { if(plug.fix_compositions(*args)) month = @@today << 1 pointer = logs.pointer + [:log, Date.new(month.year, month.month)] log = @app.update(pointer.creator, log_info(plug)) log.notify('Swissmedic XLS fix compositions') end } end
Run
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> Updater.new(self).update_swissmedic_fix_compositions
Result
Plugin: ODDB::SwissmedicPlugin Error: NoMethodError Message: undefined method `news' for nil:NilClass Backtrace: /home/masa/ywesee/oddb.org/src/plugin/swissmedic.rb:294:in `report' /home/masa/ywesee/oddb.org/src/plugin/plugin.rb:51:in `send' /home/masa/ywesee/oddb.org/src/plugin/plugin.rb:51:in `log_info' /usr/lib64/ruby/site_ruby/1.8/odba/cache_entry.rb:33:in `inject' /home/masa/ywesee/oddb.org/src/plugin/plugin.rb:50:in `each' /home/masa/ywesee/oddb.org/src/plugin/plugin.rb:50:in `inject' /home/masa/ywesee/oddb.org/src/plugin/plugin.rb:50:in `log_info' /home/masa/ywesee/oddb.org/src/util/updater.rb:131:in `send' /home/masa/ywesee/oddb.org/src/util/updater.rb:131:in `log_info' /home/masa/ywesee/oddb.org/src/util/updater.rb:365:in `update_swissmedic_fix_compositions' /home/masa/ywesee/oddb.org/src/util/updater.rb:488:in `call' /home/masa/ywesee/oddb.org/src/util/updater.rb:488:in `wrap_update' /home/masa/ywesee/oddb.org/src/util/updater.rb:361:in `update_swissmedic_fix_compositions' (eval):1:in `_admin' /home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `call' /home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `failsafe' /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1426:in `_admin' /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1424:in `initialize' /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1424:in `new' /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1424:in `_admin' /usr/lib64/ruby/1.8/drb/drb.rb:1555:in `__send__' /usr/lib64/ruby/1.8/drb/drb.rb:1555:in `perform_without_block' /usr/lib64/ruby/1.8/drb/drb.rb:1515:in `perform' /usr/lib64/ruby/1.8/drb/drb.rb:1589:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1585:in `loop' /usr/lib64/ruby/1.8/drb/drb.rb:1585:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1581:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1581:in `main_loop' /usr/lib64/ruby/1.8/drb/drb.rb:1430:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1427:in `start' /usr/lib64/ruby/1.8/drb/drb.rb:1427:in `run' /usr/lib64/ruby/1.8/drb/drb.rb:1347:in `initialize' /usr/lib64/ruby/1.8/drb/drb.rb:1627:in `new' /usr/lib64/ruby/1.8/drb/drb.rb:1627:in `start_service' bin/oddbd:38
Note
"Zulassungs-Nummer";"Sequenz";"Sequenzname";...;"Wirkstoff";"Zusammensetzung";... "56833";1;"Iscador Qu 0,0001 mg, Injektionslösung, anthroposophisches Arzneimittel";...;"viscum album (quercus) recens";"extractum aquosum liquidum fermentatum 0.0005 mg ex viscum album (quercus) recens 0.0001 mg, natrii chloridum, aqua q.s. ad solutionem pro 1 ml.";...
Check the part of updating sequence name (src/plugin/swissmedic.rb#update_sequence)
def update_sequence(registration, row, opts={:create_only => false}) ... ## some names use commas for dosage parts = cell(row, column(:name_base)).split(/\s*,(?!\d|[^(]+\))\s*/u) descr = parts.pop ## some names have dosage data after the galenic form if /[\d\s][m]?[glL]\b/.match(descr) && parts.size > 1 descr = parts.pop << ', ' << descr end base = parts.join(', ') base, descr = descr, nil if base.empty?
Experiment
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> ODDB::SwissmedicPlugin.new(self).fix_compositions
Result
Commit