view · edit · sidebar · attach · print · history

20120312-update-patinfo-exporter

<< | Index | >>


summary

  • updated pi mark shown for empty patinfo.
  • fixed pi mark for pdf patinfo.
  • updated patinfo exporter.
    • to skip case that Patinfo object has no descriptions.
    • to skip case that Patinfo object has no sequence relation.

commits

index


update has_patinfo

Problem

http://oddb.yasuhiro.org/de/swissmedinfo/search/search_query/Cetallerg+Sandoz

NoMethodError
undefined method `description' for nil:NilClass

some Patinfo object ware nil (NilClass).
updated Sequence#has_patinfo? method.

Skipped these cases.

  • Patinfo Object doesn't have any descriptions.
  • NilClass (no Patinfo)

But, if Patinfo dosen't have any text,
there are some case that Patinfo has PDF file.

then I improved previous commit.

Commit

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

Check

checked count of export target

created simple counter script.

"total: 4092" (all patinfos)
"de   : 75" (no "de" description text)
"fr   : 79" (no "fr" description text)
"nil  : 2"  (blank Patinfo object)
"empty: 75" (empty descriptions("de", "fr"  both))
"seq  : 109" (has no rerated sequences patinfo)

Attach:pi_checker.rb


update patinfo exporter

  • to skip Patinfos don't have description text(de, fr both).
  • to skip Patinfos have PDF at exporting to yaml (in case that Patinfo object doesn't have sequence relation)

updated ODDB:YamlExporter#check_info

export target count

in src/plugin/yaml.rb

def export_patinfos(name='patinfo.yaml')
  valid_patinfos = check_infos(name, "Sequence") do |no_descr, valid_infos|
  ...
  end
  p valid_patinfo.length  
  #export_array(name, valid_patinfos)
end 
ch.oddb> Exporter.new(self).export_patinfo_yaml
-> 3908

4092 - (109 +75) = 3908 (correct)

This is warning mail.
This warn 4 Patinfo doesn't have 'fr' descirpiton.
79 - 75 = 4(correct)

Message:
YamlExporter#export_patinfos method is still running,
but I found some missing Patinfo document data.
This may cause an error in export ebooks process of ebps.

There is no 'fr' description of Patinfo of the following
Swissmedic Sequence (Company, Product, Numbers):
[" 1. Dermapharm AG, Multilind, 42675, 01\n", " 2. Sidroga AG, Sidroga Gallen- und Lebertee, 29653, 02\n", " 3. Sanofi-Aventis (Suisse) SA, Acomplia, 57608, 01\n", " 4. Boehringer Ingelheim (Schweiz) GmbH, Dulcolax Bisacodyl, 23390, 03\n"]

I found Fachinfo2001 Object in patinfos array.
deleted it via bin/admin.
(and updated exporter to skip this record, if this data comes again)

checked exported patinfo.yaml with search function of vim >>>/descriptions:\ $<<< => no match.
It's OK.

This is PDF Patinfo. Some case, one Patinfo belongs to some sequences.

ch.oddb> registration('60145').sequence('01').patinfo
-> 
ch.oddb> registration('60145').sequence('01').pdf_patinfo
-> 60145_03_1254139790.9379.pdf
ch.oddb> registration('60145').sequence('02').pdf_patinfo
-> 60145_03_1254139790.9379.pdf
ch.oddb> registration('60145').sequence('03').pdf_patinfo
-> 60145_03_1254139790.9379.pdf

learn invoicer flow

try invoicer job

1. upload patinfo pdf(html) file.

2. run invoicer script

PatinfoInvoicer.new(self).run
  • Plugin -> Invoicer -> InfoInvoicer -> PatinfoInvoicer
  • InfoInvoicer#send_daily_invoices

learn from recent error log.

> Error: ArgumentError
> Message: invalid byte sequence in UTF-8
> Backtrace:
> /var/www/oddb.org/src/plugin/patinfo_invoicer.rb:70:in `match'
> /var/www/oddb.org/src/plugin/patinfo_invoicer.rb:70:in `unique_name'
> /var/www/oddb.org/src/plugin/info_invoicer.rb:124:in `block (2 levels)
> in filter_paid'
> /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.0.8/lib/odba/stub.rb:112:in
> `each_value'
> /usr/local/lib/ruby/gems/1.9.1/gems/odba-1.0.8/lib/odba/stub.rb:112:in
> `method_missing'

"neighborhood_unique_names" method is called for check whether other sequences has target patinfo.

comments
  ## as patinfos/fachinfos can be assigned to other sequences, check at
  #  least all sequences in the current registration for non-expired
  #  invoices

From Ruby reference. We could rescue these invailid error (Encoding::InvalidByteSequenceError exception)

invalid

If the value is :replace, encode replaces invalid byte sequences in str with the replacement character. The default is to raise the Encoding::InvalidByteSequenceError exception

undef

If the value is :replace, encode replaces characters which are undefined in the destination encoding with the replacement character. The default is to raise the Encoding::UndefinedConversionError.

replace

Sets the replacement string to the given value. The default replacement string is uFFFD for Unicode encoding forms, and ? otherwise. <-

I thought to prevent this error with String#encode specified {:invalid => :replace} option.
(or Encoding::Converter#convert).

refs

view · edit · sidebar · attach · print · history
Page last modified on March 12, 2012, at 06:12 PM