view · edit · sidebar · attach · print · history

20111122-slowsearch-bottleneck-oddb_org

<< Masa.20111123-setup-script-ruby193-oddb_org | 2011 | Masa.20111121-importer-ruby193-slowsearch-bottleneck-oddb_org >>


  1. Find out why the search takes long time
  2. Update ebook meddrugs

Goal/Estimate/Evaluation
  • Find slow search bottleneck oddb.org / 50% /
Milestones
  • Slow search reason
Commit

Find out why the search takes long time

Experiment

  • src/view/drugs/resultlist.rb
  def price_exfactory(model, session)
    'price_exfactory'
  end
  def price_public(model, session)
    'price_public'
  end

Result

  • Show result quickly

Note

  • price_exfactory and price_public take long time

Experiment

  • src/util/oddbapp.rb
  def get_currency_rate(symbol)
    #ODDB::Currency.rate('CHF', symbol)
1.0 
  end

Result

  • much faster

Note

  • The currency server takes long time

Experiment

  • currency/lib/currency.rb
ch.oddb> get_currency_rate('CHF')
-> 1.0
ch.oddb> get_currency_rate('EUR')
-> 
ch.oddb> get_currency_rate('EUR')
-> 
ch.oddb> get_currency_rate('EUR').class
-> NilClass
ch.oddb> get_currency_rate('USD')
-> 
ch.oddb> get_currency_rate('USD')
-> 
ch.oddb> get_currency_rate('USD').class
-> NilClass

Note

  • get_currency_rate does not work

Commit

Update ebook meddrugs

  • bin/decorators/just_medical_de/fr.rb
 module EBPS
 module Decorator
    module JustMedical
      def self.decorate model
        model.chapters.each_with_index do |chap, i|
          if chap.heading =~ /Zulassungsinhaberin/
            if chap.paragraphs.first.to_s =~ /AstraZeneca AG/
              table = Text::Table.new
              table.rows[0][0] = Text::LinkedParagraph.new('http://www.astrazeneca.ch/', 'AstraZeneca AG')
              table.rows[0] << Text::Paragraph.new(chap.paragraphs.first.to_s.gsub(/AstraZeneca AG/,''))
              chap.paragraphs[0] = table
            end
          end
        end

        title = if match = model.title.split.first.match(/(\w+)/)
                  match[1]
                end
        if codes = model.metadata['article_codes']
          size_ean13s = codes.collect do |hash| [hash[:article_size], hash[:article_dose], hash[:article_ean13]] end.compact
          unless size_ean13s.empty?
            chapter = Text::Chapter.new
            chapter.heading << 'Stammdaten'
            size_ean13s.each do |size, dose, ean13|
              reg  = ean13[4,5]
              href = if title
                       "http://www.med-drugs.ch/?main=/de/just-medical/search/zone/drugs/search_query/#{title.to_s}"
                     else
                       "http://www.med-drugs.ch"
                     end
              chapter.add_paragraph Text::LinkedParagraph.new(href, model.title + " " + size.to_s + " " + dose.to_s)
            end
            model.add_chapter chapter
          end
        end
      end
    end
 end
 end
view · edit · sidebar · attach · print · history
Page last modified on April 04, 2012, at 08:59 AM