view · edit · sidebar · attach · print · history

< Niklaus.20170815-fix-interaction | Index | Niklaus.20170809-medwin-refdata >>

20170814-mail-fachinfo

Summary

  • Fix UTF-8 Error in Mail Fachinfo
  • Medwin Company Updater must use data from Refdata
  • Keep in Mind

Commits

Index

Fix UTF-8 Error in Mail Fachinfo

Must fix the following error

Error: ArgumentError
Message: invalid byte sequence in UTF-8
Backtrace:
/var/www/oddb.org/vendor/ruby/2.4.0/gems/activesupport-3.1.0/lib/active_support/core_ext/object/blank.rb:96:in `=~'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/activesupport-3.1.0/lib/active_support/core_ext/object/blank.rb:96:in `!~'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/activesupport-3.1.0/lib/active_support/core_ext/object/blank.rb:96:in `blank?'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/mail-2.2.7/lib/mail/body.rb:36:in `initialize'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/mail-2.2.7/lib/mail/message.rb:1801:in `new'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/mail-2.2.7/lib/mail/message.rb:1801:in `process_body_raw'
/var/www/oddb.org/vendor/ruby/2.4.0/gems/mail-2.2.7/lib/mail/message.rb:1115:in `body'
/var/www/oddb.org/src/util/mail.rb:176:in `log_and_deliver_mail'
/var/www/oddb.org/src/util/mail.rb:100:in `send_mail'
/var/www/oddb.org/src/util/log.rb:53:in `notify'
/var/www/oddb.org/src/plugin/invoicer.rb:60:in `rescue in send_invoice'
/var/www/oddb.org/src/plugin/invoicer.rb:44:in `send_invoice'
/var/www/oddb.org/src/plugin/info_invoicer.rb:274:in `block in send_annual_invoices'
/var/www/oddb.org/src/plugin/info_invoicer.rb:237:in `each'
/var/www/oddb.org/src/plugin/info_invoicer.rb:237:in `send_annual_invoices'
/var/www/oddb.org/src/plugin/info_invoicer.rb:23:in `run'
/var/www/oddb.org/src/plugin/fachinfo_invoicer.rb:26:in `run'
/var/www/oddb.org/src/util/exporter.rb:261:in `block in mail_fachinfo_log'
/var/www/oddb.org/src/util/exporter.rb:343:in `safe_export'
/var/www/oddb.org/src/util/exporter.rb:259:in `mail_fachinfo_log'
/var/www/oddb.org/src/util/exporter.rb:56:in `run'
jobs/export_daily:13:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/export_daily:12:in `<module:Util>'
jobs/export_daily:11:in `<module:ODDB>'
jobs/export_daily:10:in `<main>'

Running sudo -u apache /usr/local/bin/bundle-240 exec ruby-240 jobs/export_daily on oddb-ci2 did not reproduce the problem here. Loading db-dump from thinpower and trying again. Did not work. Is it because I already made some changes to the companies?

Pushed commit Deactivate pat/fi invoices as decided by Zeno. Fixed tests with Deactivate pat/fi invoices. Update tests

Medwin Company Updater must use data from Refdata

Added code to parse correctly the address of a pharma company. Chasing some error when running update. After fixing some problems, the update starts parsing a lot of companies. Waiting for import to finish.

Must fix errors like

[...]
RuntimeError: can't modify frozen String when updating index 'atc_index_company' with a ODDB::Company
["/var/www/oddb.org/src/util/searchterms.rb:79:in `force_encoding'", "/var/www/oddb.org/src/util/searchterms.rb:79:in `search_term'", "/var/www/oddb.org/src/util/searchterms.rb:98:in `block in search_terms'", "/var/www/oddb.org/src/util/searchterms.rb:87:in `each'"]
[...]
2017-08-14 12:17:43 +0200:  RefdataPartnerPlugin store_company updated 7601001004610 oid 32659867  update in database. pointer nil ba_type ba_public_pharmacy. Have now 4941 partners.
2017-08-14 12:17:43 +0200:  RefdataPartnerPlugin Searching for company with GLN 7601001008274. Skipped 14342, created 817 updated 154 of 0).
2017-08-14 12:17:43 +0200:  RefdataPartnerPlugin {:ean13=>"7601001008274", :name=>"Rathaus Apotheke St.Gallen AG", :plz=>"9000", :location=>"St. Gallen", :address=>"Poststrasse 30", :ba_type=>"öffentliche Apotheke", :narcotics=>"6026 Verzeichnis a/b/c/f BetmVV-EDI", :addresses=>[#<ODDB::Address2:0x0055fff1dc9dc0 @revision=2017-08-14 12:17:43 +0200, @odba_id=36117672, @oid=36117672, @additional_lines=[], @fon=[], @fax=[], @name="Rathaus Apotheke St.Gallen AG", @address="Poststrasse 30", @location="9000 St. Gallen">]}
RuntimeError: can't modify frozen String when updating index 'company_index' with a ODDB::Company
["/var/www/oddb.org/src/util/searchterms.rb:79:in `force_encoding'", "/var/www/oddb.org/src/util/searchterms.rb:79:in `search_term'", "/var/www/oddb.org/src/util/searchterms.rb:98:in `block in search_terms'", "/var/www/oddb.org/src/util/searchterms.rb:87:in `each'"]
[...]

Added code code to detect correctly removed companies. I do not know what I should do with the 1403 inactive companies, as we have no field to mark them as inactive.

Had to use <=> to compare correctly the adresses and to determine whether I have to update the company info.

Pushed commit Using refdata to import pharma and pharmacies

Updating the address was a little bit convoluted. Afterwards I replace term.force_encoding('UTF-8') by term.force_encoding('UTF-8') unless term.frozen? in src/util/searchterms.rb. Restarting the import after reimporting the database.

Pushed commit

view · edit · sidebar · attach · print · history
Page last modified on August 14, 2017, at 09:31 PM