20110708-update-swissmedic-deactivate-process-develop-drb-process
<< | Index | >>
- Update deactivate process swissmedic plugin
- Fix a bug swissmedic plugin
- Separate the update_swissmedic to a different process from oddbd
- Goal/Estimate/Evaluation
-
- Update swissmedic deactivate process / 80% / 90%
- Develop swissmedic updater drb server / 10% / 10%
- Milestones
-
- Summary
-
- Commits
-
Update deactivate process swissmedic plugin
Email
Plugin: ODDB::SwissmedicPlugin
Error: NameError
Message: undefined local variable or method `deletetions' for #<ODDB::SwissmedicPlugin:0x7f8229143e00>
Backtrace:
/var/www/oddb.org/src/plugin/swissmedic.rb:80:in `recheck_deletions'
/var/www/oddb.org/src/plugin/swissmedic.rb:46:in `update'
/var/www/oddb.org/src/util/updater.rb:346:in `update_swissmedic'
...
Summary update_swissmedic process (src/plugin/swissmedic.rb#update)
- initialize_export_registrations: keep the registrations and sequences with export_flag from Praeparateliste.xls
- keep_active_registrations_praeparateliste: keep all the registrations iksnr (5 digits) of Praeparateliste.xls
- diff: detect the differences between old and new Packungen.xls (the registrations, sequences, packages are saved to @diff variable)
- update_registrations: update the registrations, sequences, packages (depending on Packungen.xls)
- set_all_export_flag_false: set all the export_flag of registrations and sequences in the database to false
- update_export_sequences: update the export_flags of sequences (depending on Praeparateliste.xls)
- update_export_registrations: update the export_flags of registrations (depending on Praeparateliste.xls)
- sanity_check_deletions: keep the packages if the registration is deactivated
- delete @diff.package_deletions: delete packages (depending on Packungen.xls)
- recheck_deletions @diff.sequence_deletions: delete the sequences those are still in Praeparateliste.xls from the sequence_deletions that comes from Packungen.xls
- recheck_deletions @diff.registration_deletions: delete the registrations those are still in Praeparteliste.xls from the registration_deletions that comes from Packungen.xls
- deactivate @diff.sequence_deletions: deactivate (set @inactive_date to @@today) sequences
- deactivate @diff.registration_deletions: deactivate (set @inactive_date to @@today) registrations
Note
- @diff date comes from Packungen.xls
- BUT *
There is a case: a registration is NOT in Packungen.xls but it is STILL in Praeparateliste.xls.
- In such a case, then, the registration should NOT be flagged deactivated
In order to realize it
- keep all the registration iksnr from Praeparateliste.xls -> @active_registrations_praeparateliste (by keep_active_registrations_praeparateliste method)
- delete a sequence or registration of @diff if it is included in @active_registrations_praeparateliste (by recheck_deletions method)
- deactivate runs depending on @diff data (@diff.sequence_deletions, @diff.registration_deletions) (by deactivate method)
Note
- export_flag data (@export_registrations, @export_sequences) is not related to @diff deletions data (@diff.sequence_deletions, @diff.registration_deletions) at all
Note
- renewal_flag should also be set to nil(false) at the same time when a registration is deactivated
Summary
The commands executed online
set_inactive_date_nil Date.new(2011,7,8)
set_inactive_date_nil Date.new(2011,6,17)
set_inactive_date_nil Date.new(2011,6,11)
Updater.new(self).update_swissmedic
Commit
Fix a bug swissmedic plugin
Problem
- 'Deactivated registrations' iterates between '418' and '0' when update_swissmedic runs
Email
- ch.ODDB.org Report - Swissmedic XLS - 06/2011 (First)
- ch.ODDB.org Report - Swissmedic XLS - 06/2011 (Second)
First
Deactivated Registrations: 0
Second
Deactivated Registrations: 418
And the third will be 0
Resolved
Separate the update_swissmedic to a different process from oddbd
ext/swissmedic/bin/swissmedicd
#!/usr/bin/env ruby
# Swissmedicd -- oddb.org -- 08.07.2011 -- mhatakeyama@ywesee.com
$: << File.expand_path("../src", File.dirname(__FILE__))
require 'drb/drb'
require 'swissmedic'
uri = ODDB::Swissmedic::URI
DRb.start_service(uri, ODDB::Swissmedic)
DRb.thread.join
ext/swissmedic/src/swissmedic.rb
#!/usr/bin/ruby
# encoding: utf-8
# ODDB::Swissmedic::Updater -- 08.07.2011 -- mhatakeyama@ywesee.com
require 'rubygems'
require 'drb'
module ODDB
module Swissmedic
URI = 'druby://localhost:60001'
def Swissmedic.session
yield(ODDB::Swissmedic::Updater.new)
end
class Updater
include DRb::DRbUndumped
def test
'test'
end
end
end # Swissmedic
end # ODDB
Run
masa@masa ~/ywesee/oddb.org/ext/swissmedic $ bin/swissmedicd
Next