<< | Index | >>
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.
But, if Patinfo dosen't have any text,
there are some case that Patinfo has PDF file.
then I improved previous commit.
http://scm.ywesee.com/?p=oddb.org/.git;a=commit;h=5b23a6d1d046db13f5c717ec6fd80a12076ec859
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)
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
1. upload patinfo pdf(html) file.
2. run invoicer script
PatinfoInvoicer.new(self).run
> 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.
## 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)
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
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.
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).