view · edit · sidebar · attach · print · history

Index>

20170412-nomarketing

Summary

  • ODDB: Parse Swissmedic nomarketing list
  • ODDB: Problems passing swissmedic_feed
  • Keep in Mind

Commits

Index

ODDB: Parse Swissmedic nomarketing list

Starting work on downloading latest. Must create a single plugin which parses both list, creates a CSV file which contains for each concerned package an entry containing ATC-Code, name of package, link to nomarketing,link to drug_shortage. One of the last two fields may be nil. Adapted plugin to use two different updates and reports. Update did not work, as I had an error calculating the nodelivery_since.

Parsing XLSX file was no problem. Unit-Test pass now well. Running jobs/update_drugshortage to see how everything works.

Todo: Create CSV-File for the update. Generating CSV file works. Adding it to the email. Must lookup the name of the columns via lookandfeel.

When running update had another error, because a package had no ATC-Code attached. Looks like we have found package with wrong gtin. How can this happen? For the moment I will just output the missing GTIN and skip it. I think we must iterate inside a registration only over the active_packages and not all packages.

Creating the CSV file works now, but the mail is not yet generated correctly. Must add a date method in the plugin. Added unit tests for sending email with CSV attachement. Unit test pass, does the import pass now finally? Yes. Running it a second time failed, because I recognized correctly that the latest file was the same, but continued anyway. Also had to change src/util/updater.rb in update_drugshortage to return if the plugin.report returns an empty array. Using reparse is working fine, too.

Pushed commit Added support for Swissmedic NoMarketing with CSV

What is happening with these lines

html
Skipping non existing package 4030539039857
Skipping non existing package 7612682900023
Skipping non existing package 7612682900030
Skipping non existing package 7640126140018
Skipping non existing package 7640161990210
Skipping non existing package 7680240410420
Skipping non existing package 7680400381751
Skipping non existing package 7680566990095
Skipping non existing package 7680584450014
Skipping non existing package 7680605420019

Pushed commit Fix problem when passing nil to ShortagePlugin.new

ODDB: Problems passing swissmedic_feed

With the following patch

iff --git a/src/util/job.rb b/src/util/job.rb
index 7db135c..b4c121a 100644
--- a/src/util/job.rb
+++ b/src/util/job.rb
@@ -39,7 +39,8 @@ module Job
         system.peer_cache ODBA.cache unless opts[:readonly] rescue Errno::ECONNREFUSED
         block.call ODDB::App.new(:auxiliary => true)
       end
-    rescue Interrupt # C-c
+    rescue Interrupt => error # C-c
+      puts error.backtrace.join("\n")
       puts "Interrupted !!"
       puts "Please check #{PID_FILE}."
       puts

I got the following backtrace

2017-04-14 09:45:18 +0200: Latest found /var/www/oddb.org/data/html/drugshortage-2017.04.14.html and same size as latest 405709 bytes.
(offline mode: enter name=value pairs on standard input)
^C/usr/local/ruby-2.4.0/lib/ruby/2.4.0/cgi/core.rb:618:in `readlines'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/cgi/core.rb:618:in `readlines'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/cgi/core.rb:618:in `read_from_cmdline'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/cgi/core.rb:664:in `initialize_query'
/usr/local/ruby-2.4.0/lib/ruby/2.4.0/cgi/core.rb:852:in `initialize'
/var/www/oddb.org/src/plugin/plugin.rb:94:in `new'
/var/www/oddb.org/src/plugin/plugin.rb:94:in `block (2 levels) in update_rss_feeds'
/var/www/oddb.org/src/plugin/plugin.rb:93:in `open'
/var/www/oddb.org/src/plugin/plugin.rb:93:in `block in update_rss_feeds'
/var/www/oddb.org/src/plugin/plugin.rb:52:in `block in l10n_sessions'
/var/www/oddb.org/src/plugin/plugin.rb:49:in `each_key'
/var/www/oddb.org/src/plugin/plugin.rb:49:in `l10n_sessions'
/var/www/oddb.org/src/plugin/plugin.rb:85:in `update_rss_feeds'
/var/www/oddb.org/src/plugin/rss.rb:172:in `update_swissmedic_feed'
/var/www/oddb.org/src/plugin/rss.rb:191:in `update_recall_feed'
/var/www/oddb.org/src/util/updater.rb:568:in `update_immediate_with_error_report'
/var/www/oddb.org/src/util/updater.rb:416:in `update_recall_feed'
/var/www/oddb.org/src/util/updater.rb:412:in `update_swissmedic_feeds'
/var/www/oddb.org/src/util/updater.rb:210:in `run'
jobs/import_daily:13:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/import_daily:12:in `<module:Util>'
jobs/import_daily:11:in `<module:ODDB>'
jobs/import_daily:10:in `<main>'
Interrupted !!
Please check /var/www/oddb.org/log/job.pid.

Working on this problem next week.

view · edit · sidebar · attach · print · history
Page last modified on April 14, 2017, at 09:53 AM