<< | Index | >>
Link
Note
Design
Update
def company if (oid = @session.user_input(:oid) and model = @session.app.company(oid)) \ or (ean = @session.user_input(:ean) and model = @session.search_companies(ean).sort_by{|c| c.oid.to_i}.last) State::Companies::Company.new(@session, model) end end
def company if (oid = @session.user_input(:oid) and model = @session.app.company(oid)) \ or (ean = @session.user_input(:ean) and model = @session.search_companies(ean).sort_by{|c| c.oid.to_i}.last) State::Companies::RootCompany.new(@session, model) end end
def init if((pointer = @session.user_input(:pointer))) @model = pointer.resolve(@session.app) # elsif oid = @session.user_input(:oid) and company = @session.app.company(oid) # @model = company # else # @model = nil end end
def name(model, session=@session) link = View::PointerLink.new(:name, model, @session, self)if(model.ean13 and !model.ean13.strip.empty?)
link.set_attribute('title', @lookandfeel.lookup(:ean_code, model.ean13))link.href = @lookandfeel._event_url(:company, {:ean => model.ean13})
end link end
Commit
Link
Design
Commit
Update
class PatinfoStatsCommon < State::Admin::Global def init model = {} patinfo_slate = @session.slate(:patinfo) patinfo_slate.items.each_value { |item| if(item.type == :annual_fee&& (sequence = item.sequence || @session.app.resolve(item.item_pointer)))
class PatinfoStats < State::Admin::PatinfoStatsCommon def init supercompany = if oid_or_ean = @session.user_input(:company)
@session.app.company(oid_or_ean) || @session.search_companies(oid_or_ean).sort_by{|c| c.oid.to_i}.last
elsif pointer = @session.user_input(:pointer)
pointer.resolve(@session.app)
end
class InvoiceItem < AbstractInvoiceItem
attr_accessor :sequence
Note
ch.oddb> slates[:patinfo].items.values.each{|i| seq = i.item_pointer.resolve(self); update(i.pointer, {:sequence, seq})}
Commit
Note
Main functions
Note
src/model/part.rb:require 'rockit/rockit' src/plugin/vaccines.rb:require 'rockit/rockit' src/util/persistence.rb:require 'rockit/rockit'
Update
module ODDB module PersistenceMethods def issue_update(hook, values, origin = nil) diffs = diff(values, hook) unless diffs.empty? update_values(diffs, origin) odba_store end self end def update(app, values={}, origin=nil) app.update(self, values, origin) end
Experiment
ch.oddb> registration('31706').sequence('01').name_base -> Inderal 10 mg ch.oddb> registration('31706').sequence('01').update(self, {:name_base, 'hogehoge'}) -> hogehoge, Tabletten ch.oddb> registration('31706').sequence('01').name_base -> hogehoge (reboot) ch.oddb> registration('31706').sequence('01').name_base -> hogehoge
Result
Note
when 'Preparation' if !@deferred_packages.empty? && seq = identify_sequence(@registration, @name, @substances) @deferred_packages.each do |info| ptr = seq.pointer + [:package, info[:ikscd]] @app.update seq.pointer, info[:sequence] @app.update ptr.creator, info[:package] pptr = ptr + [:part]size = info[:size].sub(/(^| )[^\d.,]+(?= )/, '')
@app.update pptr.creator, :size => size, :composition => seq.compositions.first
Experiment
def size=(size) p "getin ODDB::Part#size=" p size
def parse_size(size) multi, addition, count, measure, scale, dose, comform = nil begin ast = @@parser.parse(size) multi, addition, count, measure, scale, dose, comform = ast.flatten p multi + " " + addition + " " + count + " " + measure + " " + scale + " " + dose + " " + comform
def tag_end name ... when 'Preparation' ... size = info[:size].sub(/(^| )[^\d.,]+(?= )/, '') p "size = " p size @app.update pptr.creator, :size => size, :composition => seq.compositions.first
bin/admin
ch.oddb> ODDB::Package.find_by_pharmacode('223332').parts.first.size = '50 Tablette(n)'
Result
"getin ODDB::Part#size=" "50 Tablette(n)" 0 Quanty(1,'') 50 Quanty(1,'') Quanty(1,'') "Tablette(n)"
bin/admin
ch.oddb> Updater.new(self).update_bsv
Result
Note
masa@masa ~/ywesee/oddb.org $ grep -r rockit ../sbsm ../sbsm/lib/sbsm/flavored_uri_parser.rb:require 'rockit/rockit' ../sbsm/lib/sbsm/trans_handler.rb:require 'rockit/rockit' ../sbsm/lib/sbsm/uri_parser.rb:require 'rockit/rockit' ../sbsm/lib/sbsm/zone_uri_parser.rb:require 'rockit/rockit'
Reference