view · edit · sidebar · attach · print · history

20120418-atc-code

<< | Index | >>


Summary

  • Updated export job for oddb.csv
    • fixed count of limitation_text in report mail.
    • Updated atc_code handling (new rule)
  • Updated testcase

Commits

ch.oddb.org
patinfo2csv

Index


limitation_text_count

Updated count up.
If LimitationText Object does not have text, don't count this object.

in src/view/drugs/csv_result.rb

        def limitation_text(pack)
                if((sl = pack.sl_entry) && (txt = sl.limitation_text))
-      @counts['limitation_texts'] += 1
       if txt.respond_to?(@lookandfeel.language) and lim_txt = txt.send(@lookandfeel.language).to_s
+        @counts['limitation_texts'] += 1
         lim_txt.force_encoding('utf-8')
         lim_txt.gsub(/\n/u, '|')
       end

Then works fine.

in mail (ch.ODDB.org Report - oddb.csv - 04/2012)

...
limitation_texts                  1832
limitations                       1882
...

duplicate products line in oddb.csv

  • $ oddb.org/bin/odddbd
  • $ oddb.org/ext/export/bin/exportd
  • $ currencyd
$ bin/admin 
ch.oddb> Updater.new(self).export_oddb_csv

check duplicated package.

ch.oddb> atc_classes.values.last.code
-> S02DA04

search_by_atc('C05CX99').first.packages.length
-> 26

ch.oddb> search_by_atc('C05CX99').first.packages.select{|p| p.ikscd == '041'}.first.atc_class.code
-> M02AC

ch.oddb> search_by_atc('V01AA')
-> [Hausstaub, Allergen-Extrakte, Schimmel- und Hefepilze, Verschiedene, Blüten, Textilien, Tiere, Gräserpollen, Insekten, Nahrungsmittel, Baumpollen, Federn]
NOTE

search/delete by atc
in src/util/oddbapp.rb

...
  def search_by_atc(key)
    ODBA.cache.retrieve_from_index('atc_index', key.dup)
  end  
...
  def delete_atc_class(atccode)
    atc = @atc_classes[atccode]
    @atc_chooser.delete(atccode)
    if(@atc_classes.delete(atccode))
      @atc_classes.odba_isolated_store
    end
    atc
  end
...

update duplicates package handling

See

New Rule http://dev.ywesee.com/Yasu/20120417-Update-generikacc-app-debug-oddbCsvExport#atc_code_that_is_longer_gets_exported about atc_code

Debug with only 2 atc codes

in src/plugin/csv_export.rb

...
      #model = @app.atc_classes.values.sort_by { |atc| atc.code }
      model = [ 
        @app.search_by_atc('V01AA')[1],
        @app.search_by_atc('V01AA11').first,
      ];  
      name = "#{export_name}.csv"
...

updated with atc.code.to_s.length

update_bsv

REXML needs patch for multimyte characters in ruby 1.9.1
solution by force_encoding

see http://dev.ywesee.com/Choddb/Ruby193p0#base_parser_patch

patch links (URL changed)

UPdater.new(self).update_bsv


Updae testcase

Updated class check in each model test.

$ ruby test/test_model/suite.rb

before
661 tests, 1196 assertions, 3 failures, 87 errors, 0 pendings, 0 omissions, 11 notifications
86.3843% passed
after
661 tests, 1396 assertions, 7 failures, 0 errors, 0 pendings, 0 omissions, 11 notifications
98.941% passed

Update patinfo2csv

If chapter does not have subheading, add chapter heading.

...
            heading = unless section['subheading'].empty?
                        section['subheading'].chomp
                      else
                        heading.chomp
                      end 
            text << "<strong>#{heading}</strong><br />"
...

NOTE

error in ajax request.

error in SBSM::Session#to_html: /de/mobile/ajax_ddd_price/reg/41810/seq/02/pack/069/search_query/inderal/search_type/st_oddb
NoMethodError
undefined method `price_public' for nil:NilClass
/var/www/oddb.org/src/view/dataformat.rb:120:in `formatted_price'
/var/www/oddb.org/src/view/dataformat.rb:116:in `price_public'
/var/www/oddb.org/src/view/ajax/ddd_price.rb:78:in `price_public'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:68:in `create'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:286:in `compose_component'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:211:in `block in compose'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:205:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:205:in `compose'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:57:in `init'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/component.rb:139:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:140:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:140:in `create'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/divcomposite.rb:33:in `block in compose'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/divcomposite.rb:13:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/divcomposite.rb:13:in `compose'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:57:in `init'
/var/www/oddb.org/src/view/ajax/ddd_price.rb:95:in `init'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/component.rb:139:in `initialize'
/usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.5/lib/sbsm/state.rb:243:in `new'
/usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.5/lib/sbsm/state.rb:243:in `view'
/usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.5/lib/sbsm/state.rb:179:in `to_html'
/usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.5/lib/sbsm/session.rb:446:in `to_html'
/usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.5/lib/sbsm/session.rb:170:in `block in drb_process'
<internal:prelude>:10:in `synchronize'
/usr/local/lib/ruby/gems/1.9.1/gems/sbsm-1.1.5/lib/sbsm/session.rb:168:in `drb_process'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1508:in `perform'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1582:in `loop'
/usr/local/lib/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
ODDB::View::Ajax::DDDPriceTable::COMPONENTS[[2, 0]] in create(price_public)
ODDB::View::Ajax::DDDPrice::COMPONENTS[[0, 0]] in create(ODDB::View::Ajax::DDDPriceTable)
error in SBSM::Session#http_headers: /de/mobile/ajax_ddd_price/reg/41810/seq/02/pack/069/search_query/inderal/search_type/st_oddb
NoMethodError
undefined method `price_public' for nil:NilClass
/var/www/oddb.org/src/view/dataformat.rb:120:in `formatted_price'
/var/www/oddb.org/src/view/dataformat.rb:116:in `price_public'
/var/www/oddb.org/src/view/ajax/ddd_price.rb:78:in `price_public'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:68:in `create'
/usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.5/lib/htmlgrid/composite.rb:286:in `compose_component'
view · edit · sidebar · attach · print · history
Page last modified on April 18, 2012, at 08:03 PM