<< | Index | >>
Note
... 389 / 571 Estimate total: 17.79 [h] It will be done in: 5.67 [h] 390 / 571 Estimate total: 17.77 [h] It will be done in: 5.63 [h] 391 / 571 Estimate total: 17.74 [h] It will be done in: 5.59 [h] 392 / 571 Estimate total: 17.70 [h] It will be done in: 5.55 [h] 393 / 571 Estimate total: 17.66 [h] It will be done in: 5.51 [h]
Check code
masa@masa ~/ywesee/de.oddb.org $ grep -r DRb lib/ lib/oddb/html/state/drugs/global.rb: block.call DRbObject.new(nil, uri) lib/oddb/html/state/drugs/global.rb: remote.remote_comparables(ODBA::DRbWrapper.new(package)) lib/oddb/html/state/drugs/global.rb: if(pac = DRbObject._load(Marshal.dump([uri, ref]))) masa@masa ~/ywesee/de.oddb.org $ grep -r remote lib/ lib/oddb/remote/object.rb: def initialize(source, remote) lib/oddb/remote/object.rb: @remote = remote lib/oddb/config.rb: 'remote_databases' => [], lib/oddb/export/server.rb: if uri = ODDB.config.remote_databases.first ...
DRb experiment
def masa 'masa' end
require 'drb' URI = 'druby://localhost:10000' # oddbd server = DRbObject.new_with_uri(URI) p server.masa
Run
Result
$ ruby test.rb "masa"
Experiment
def masa ODBA::DRbWrapper.new(ODDB::Package.find_by_pharmacode('223332')) end
require 'drb' URI = 'druby://localhost:10000' # oddbd server = DRbObject.new_with_uri(URI) p server.masa.pharmacode p server.masa.name
Result
$ ruby test.rb DRb::DRbObject "223332" "Inderal 10 mg, Tabletten"
Experiment
def group ODBA::DRbWrapper.new(Migel::Model::Group) end def subgroup ODBA::DRbWrapper.new(Migel::Model::Subgroup) end def migelid ODBA::DRbWrapper.new(Migel::Model::Migelid) end def product ODBA::DRbWrapper.new(Migel::Model::Product) end
require 'drb' URI = 'druby://localhost:33000' # migeld migel = DRbObject.new_with_uri(URI) p migel.group.all.length p migel.group.find_by_code('01').subgroups[0].migelids[0].products[0].article_name p migel.group.find_by_code('01').subgroups[0].migelids[0].products[0].pharmacode p migel.product.find_by_pharmacode('1624501').article_name
Run
Result
$ ruby test.rb 20 "AMEDA Einhandmilchpumpe mit Flexishield" "1624501" "AMEDA Einhandmilchpumpe mit Flexishield"
Experiment
require 'drb' module ODDB module Migel MIGEL_URI = 'druby://localhost:33000' REMOTE = DRbObject.new_with_uri(MIGEL_URI) class Group ... def migel_code @code REMOTE.group.find_by_code(@code).code end
Run
Result
ch.oddb> migel_groups.values[0].migel_code -> 99
Next
Note
Replace migel methods in oddbapp.rb
MIGEL_URI = 'druby://localhost:33000'
class OddbPrevalence # def migel_count # @migel_count ||= migel_products.size # end end module ODDB class App < SBSM::DRbServer ... MIGEL_SERVER = DRb::DRbObject.new(nil, MIGEL_URI) ... def migel_count MIGEL_SERVER.migelid.all.length end
Run
Result
ch.oddb> migel_count -> 571
ToDo Next: (except for create_ and delete_ methods) replace methods in oddbapp.rb
require 'remote/multilingual' .. def search_migel_products(query, lang) migel_code = query.split(/(\d\d)/).select{|s| !s.empty?}.join('.') MIGEL_SERVER.migelid.search_by_migel_code(migel_code) end
# This is necessary for a drb client connection from ch.oddb.org # because ODDB::Migel::Product@items is a Hash, not an Array. class Array def values self end end module Migel module Model class Migelid < Migel::ModelSuper .. multilingual :unit ..
def update_migelid(id, subgroup, row, language) ... multilingual_data = { :name => name, :migelid_text => (migelid_text unless migelid_text.empty?), :limitation_text => (limitation_text unless limitation_text.empty?), :unit => (unit unless unit.empty?), } ...
Result
Note
Next
Note
def respond_to?(m, include_private = false) return true if super if self.__getobj__.is_a?(DRb::DRbObject) return self.__getobj__.send(m) else return self.__getobj__.respond_to?(m, include_private) end end