view · edit · sidebar · attach · print · history

20120229-sbsm-htmlgrid-odba-mock-application-2

<< | Index | >>


summary

  • tried to fix bind(2) error of Apache to DRbServer
    • suspend
  • learned
    • Model validation in oddb.org
    • How to use values of testenviconment.rb
    • When(from Where) send E-mail updater job.
    • How to access object via bin/admin
    • Checked drug data structure of oddb.rg

index


bind(2) Error

I tried @sessions force clear by myself in loop of followings session cleaner.
But, Nothing happend.

suspend


understand_model_validation

Problem

Updating ATC-Klassierung at Admin form is faild

We can validate user input via check_accessor_list at model (This case, sequence.rb)
check is_a? in ODDB::AccessorCherkMethod::define_check_class_methods (src/util/perisitence.rb)

NOTE

We can not search drugs that do not have an atc-code.
(search with keyword atcless to list all atcless products)

refs

Old pointer link

http://mobile.oddb.org/de/mobile/resolve/pointer/%3A%21registration%2C62084%21sequence%2C01.

testenvironment.rb

testenviornment.rb changed to 2 files.

  • src/test/testenvironment1.rb
  • src/test/testenvironment2.rb

paths of these files are in etc/oddb.yml, are loaded in config.rb.

How to use

...
      mail = Mail.new
      mail.content_type('text/plain; charset=UTF-8')
      if File.exist?(ODDB.config.testenvironment1)
        mail.to = ODDB::State::Admin::Sequence::RECIPIENTS
      else
        mail.to = [addr]
      end 
...

Email from Import job

import_bsv > Updater#update_bsv_followers run followings tasks.

  update_package_trade_status_by_swissindex
  update_lppv
  update_price_feeds
  export_oddb_csv
  export_oddb2_csv
  export_ouwerkerk
  export_generics_xls
  export_competition_xlss

each updater are executed in these private metods

  • log_notify_bsv
  • notify_error
  • update_immediate (use wrap_update)
  • update_notify_simple (use wrap_update)
  • update_simple (use wrap_update)

All updaters can send result emails via ODDB::Log#notify

  • Log#notify
  • Log#notify_attachment

(Don't use Log#send_mail, directly)

each update methods send update_method (at Updater#wrap_update)to each plugin.
Finaly, Plugin save updated values with ODBA#odba_isolated_store via ODDB::App

After updating, Updater send E-mail.


Learn bin/admin and odba

test target

http://oddb.yasuhiro.org/de/gcc/drug/reg/62084 (zytinga)

  • specify drug wint registration Nr. and Sequence Nr.
ch.oddb> registration('62084').sequences["01"]
-> Zytiga, Tabletten
  • update value (cache)
ch.oddb> registration('62084').company
-> Janssen-Cilag AG
ch.oddb> registration('62084').company = 'yasaka AG'
-> yasaka AG
ch.oddb> registration('62084').company
-> yasaka AG

Then Browser outputs error NoMethodError undefined method `name' for "yasaka AG":String
This is just to update cache of ODBA. (After oddbd restart, can get previous correct value "")

  • check influence of relations
ch.oddb> registration('62084').sequences["01"].name
-> Zytiga, Tabletten
ch.oddb> registration('62084').sequences["01"].active_packages.first.name
-> Zytiga, Tabletten
ch.oddb> registration('62084').sequences["01"].name = 'Yasaka, Mann'
-> Yasaka, Mann
ch.oddb> registration('62084').sequences["01"].name
-> Yasaka, Mann
ch.oddb> registration('62084').sequences["01"].active_packages.first.name
-> Yasaka, Mann
  • access cache, directry with ODBA.cache
ch.oddb> registration('62084').odba_id
-> 27423387
ch.oddb> ODBA.cache.fetch("27423387")
-> #<ODDB::Registration:0xecaa130>
ch.oddb> ODBA.cache.fetch("27423387").sequences["01"].name
-> Yasaka, Mann
ch.oddb>

This is also storing to cache.

ch.oddb> ODBA.cache.store(ODBA.cache.fetch("27423387"))
-> #<ODDB::Registration:0xff88b6c>

ODBA.cache.clear (not ODBA.cache.clean)

ch.oddb> ODBA.cache.clear
-> {}
ch.oddb> ODBA.cache.fetch("27423387").sequences["01"] #=> call :to_s as alias :name
-> Zytiga, Tabletten

see updated method in src/util/oddbapp.rb
We can update object of following class with update' method via bin/admin, directly.

  • ODDB::Registration
  • ODDB::Sequence,
  • ODDB::Package
  • ODDB::AtcClass
  • ODDB::LimitationText
  • ODDB::AtcClass::DDD
  • ODDB::Substance

In ODDB::App, these object are store with odba_isolated_store

In ODBA, ODBA::Storage class has SQL.

ODBA.odba_isolated_store
  --> ODBA::Cache#store (ODBA.cache.store
    --> ODBA::Storage#store (ODBA.storage.store)
       --> UPDATE or INSERT with SQL

Package and Sequence

ch.oddb> registration('49742').packages
-> Array
ch.oddb> registration('49742').sequences
-> Hash

test target

http://oddb.yasuhiro.org/de/gcc/drug/reg/49742 (zocor)

structure of drug data.

  • Registration --- 49742 Zocor (reg, :iksnr)
    • Sequence --- 02 20mg (seq, :seqnr)
      • Package --- 037 98 Tabletten (pack, :ikscd)
      • Package --- 045 28 Tabletten (pack, :ikscd)
    • Sequence --- 03 40mg (seq, :seqnr)
      • Package --- 053 28 Tabletten (pack, :ikscd)
      • Package --- 061 98 Tabletten (pack, :ikscd)
    • Sequence --- 04 80mg (seq, :seqnr)
      • Package --- 088 28 Tabletten (pack, :ikscd)
      • Package --- 096 98 Tabletten (pack, :iskcd)

We can access package value via bin/admin like this.

ch.oddb> registration('49742').sequences["02"].package("045").price_public
-> 44.10
ch.oddb> registration('49742').sequences["02"].package("037").price_public
-> 112.80
NOTE

bin/admin can disconnect/reconnect to oddbd application, automatic, after restart oddbd.

ch.oddb> <ctrl-c> is used to kill admin-threads.
Type <quit> or <exit> to exit.

-> # => Enter
ch.oddb> 
view · edit · sidebar · attach · print · history
Page last modified on February 29, 2012, at 06:55 PM