view · edit · sidebar · attach · print · history

20120302-export-oddb-csv-improved-daily-cost-multi-drb-process

<< | Index | >>


summary

  • checked exported oddb.csv file by export_oddb_csv.
    • no error.
  • updated Package#ddd_price, fixed errors.
    • corrected invalid price. fixed ZeroDivisionError, FloatDomainError.
    • corrected daily cost of Keppra, Minirin (etc.)
    • If We have some invalid data, to check amount and unit.
  • fixed model validation of Package class.
    • allowed save nil-value at editing via admin form
  • learned How to separate drbprocess by lookandfeel.
    • tried 2 ways. (way to create 2 hosts and to parse parameter)

commit

index


checked export_oddb_csv

Updater (export)job.

ch.oddb> Updater.new(self).export_oddb_csv
-> ["yasaka@ywesee.com"]

CsvExportPlugin#export_drugs

oddb2tdat

$ oddb2tdat oddb.csv(input) oddb.dat(output)

checked oddb.dat file for broken "double quotation marks".
but no error.

refs

exported file and received mail.


improved ddd_price calculation

z.B.
error in SBSM::Session#http_headers: /fr/gcc/search/search_query/Minirin,+Nasaltropfen/currency/EUR
FloatDomainError
Infinity
/var/www/oddb.org/src/util/money.rb:19:in `round'
/var/www/oddb.org/src/util/money.rb:19:in `amount='
/var/www/oddb.org/src/util/money.rb:12:in `initialize'
/var/www/oddb.org/src/util/money.rb:47:in `new'
/var/www/oddb.org/src/util/money.rb:47:in `/'
z.B.

atc_code A06, c10a

ZeroDivisionError
divided by 0
/var/www/oddb.org/src/util/quanty/main.rb:134:in `/'
/var/www/oddb.org/src/util/quanty/main.rb:134:in `/'
/var/www/oddb.org/src/model/dose.rb:113:in `/'
/var/www/oddb.org/src/model/package.rb:239:in `ddd_price'
/usr/local/lib/ruby/gems/1.9.1/gems/odba-1.0.8/lib/odba/stub.rb:112:in `method_missing'
NOTE
  • FloatDomainError < RangeError < StandardError
  • FloatDomainError < StandardError

elements for calculation.

ch.oddb> registration('53699').package('030').size
-> 100 ml
ch.oddb> registration('53699').package('030').ddd.dose
-> 1 g
ch.oddb> registration('53699').package('030').dose
-> 10 g
ch.oddb> registration('53699').package('030').price_public
-> 99.40
ch.oddb> registration('47338').package('018').dose
-> 350 mg
ch.oddb> registration('53699').package('030').dose
-> 10 g
ch.oddb> registration('53699').package('030').size
-> 100 ml
ch.oddb> registration('53699').package('030').ddd.dose
-> 1 g

fixed commit.

http://scm.ywesee.com/?p=oddb.org/.git;a=commit;h=a9b33dd6b3722202cd433ea3a87a72e909cf2aae

  • no output if could not calculate daily cost, correctly.
  • if daily cost are unexpected value, return price(ddd_price) as nil.

fixed package validation

updated to save unit values from admin form.

  • generic_group_factor
  • photo_link

commit

http://scm.ywesee.com/?p=oddb.org/.git;a=commit;h=f4ceefe40dd19d9b67c1afe54b803c28d93541ba


learned how to separate drbprocess by lookandfeel

1. connect to drbprocess(es) for multi hosts

  • update oddbconfig.rb
    • change SERVER_URI (for application drbprocess)
  • make virtualhost of Apache
    • update path to new app.
  • add new host to /etc/hosts

2. connect to drbprocess(es) with request parameter parsing.

  • update index.rbx (use SBSM::Request#unparsed_uri)
  • define SERVER_URIs
z.B.
begin
  request = SBSM::Request.new(ODDB::SERVER_URI)
  if request.unparsed_uri =~ /gcc/
    request.process
  else
    SBSM::Request.new('druby://localhost:22222').process
  end 
rescue Exception => e
  $stderr << "ODDB-Client-Error: " << e.message << "\n"
  $stderr << e.class << "\n"
  $stderr << e.backtrace.join("\n") << "\n"
end
NOTE
  • don't store(write) from multi processes. (each processes has another odba_id)
    • to close web-admin forms for editing (without main gcc lookandfeel)
    • run updater and binadmin in only default oddbd process.
    • TO CHECK using of SERVER_URI IN APPLICATION SRC
  • to check multi oddbd process, use ODDB::Session#process (extends SBSM::Session, in src/util/session.rb)
view · edit · sidebar · attach · print · history
Page last modified on March 02, 2012, at 07:38 PM