view · edit · sidebar · attach · print · history

20120719-debug-swissreg-plugin-teilbarkeit-importer

<< | Index | >>


Summary

  • Debug swissreg plugin
  • Create Teilbarkeit csv exporter

Commits

Index


Debug swissreg plugin

ch.oddb> Updater.new(self).update_swissreg_news
->
Plugin: ODDB::SwissregPlugin
Error: NoMethodError
Message: undefined method `values' for nil:NilClass
Backtrace:
/var/www/oddb.org/src/model/registration.rb:151:in `each_sequence'
/var/www/oddb.org/src/plugin/swissreg.rb:60:in `block in update_news'
/var/www/oddb.org/src/plugin/swissreg.rb:58:in `each_key'
/var/www/oddb.org/src/plugin/swissreg.rb:58:in `update_news'
/var/www/oddb.org/src/util/updater.rb:427:in `update_immediate'
/var/www/oddb.org/src/util/updater.rb:341:in `update_swissreg_news'
/var/www/oddb.org/src/util/updater.rb:329:in `update_swissmedic_followers'
jobs/import_swissmedic:15:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:18:in `call'
/var/www/oddb.org/src/util/job.rb:18:in `run'
jobs/import_swissmedic:12:in `<module:Util>'
jobs/import_swissmedic:11:in `<module:ODDB>'
jobs/import_swissmedic:10:in `<main>'
Problem

Registration#sequence must be Hash.
But in Database, Some Registration have as nil.

Commit

Create Teilbarkeit exporter

EAN-Code (Package#barcode)
Pharmacode (Package#pharmacode)
Product-Name (Package#name_base)
Teilbar (Sequence#division['divisable'])
Auflösbar oder suspendierbar (Sequence#division['dissolvable'])
Zermörsebar (Sequence#division['crunshable'])
Öffnen von Kapseln (Sequence#division['openable'])
Bemerkungen / Alternativen (Sequence#division['notes'])
Quellen (Sequence#division['source'])
NOTE
ch.oddb> registration('55297').sequence('05').division.divisable
-> Ja
in csv_result.rb

I created read methods to attributes only for csv exporting.
(Package model does not have access directly)

+  def self.define_division_attributes keys
+    keys.each do |attribute|
+      define_method(attribute) { |pack|
+        if seq = pack.sequence and
+           div = seq.division and
+           !div.empty?
+          value = div.send(attribute)
+          if value
+            @counts[attribute.to_s] += 1
+          end
+          value
+        end
+      }
+    end
+  define_division_attributes [
+    :divisable, :dissolvable, :crushable, :openable, :notes,
+    :source
+  
require
  • bin/oddbd
  • ext/export/bin/exportd
flow
* Job/export_teilbarkeit (jobs/export_teilbarkeit)
  * export_teilbarkeit_csv (src/util/exporter.rb)
    * export_teilbarkeit (src/plugin/csv_export.rb)
      * _export_drugs (src/plugin/csv_export.rb)
        * View::Drugs::CsvResult (src/view/drugs/csv_result.rb)
        * compress (ext/extport/src/odba_exporter.rb)
commits

updated csv format and report.

total:                             709
crushable:                         706
dissolvable:                       709
divisable:                         709
has_notes:                         552
can be opened:                     705
have a source:                     183
commits
view · edit · sidebar · attach · print · history
Page last modified on July 19, 2012, at 03:14 PM