view · edit · sidebar · attach · print · history

20110530-impfstoff_blutprodukt_flag-testcases-swissindex-chOddb

<< | Index | >>


  1. Confirmation the bug
  2. Trace the code
  3. Check import process
  4. Testcases ch.oddb

Goal/Estimate/Evaluation
  • Debug I/B flag function / 80% / 100%
Milestones
  • Confirmation
  • Trace code
  • Check import process
  • testcases, swissindex
Summary
Commits

Confirmation the bug

Note

  • I got a login problem in the local ch.oddb.
  • I am always logged in the local ch.oddb, but I cannot change the data from the interface.
  • This is the similar login problem that I got before.
  • Probably the yus setting is not appropriate.

Server yus setting

$ yus_show mhatakeyama@ywesee.com
Password for mhatakeyama@ywesee.com: 
["mhatakeyama@ywesee.com",
 ["credit", [["org.oddb.download"]]],
 ["login", [["org.oddb.de.Admin"], ["org.oddb.de.PowerUser"]]],
 ["reset_password", []],
 ["set_password", [["mhatakeyama@ywesee.com"]]],
 ["view", [["org.oddb.de"]]],
 ["RootUser"]]

Local yus setting

masa@masa ~/ywesee/yus $ bin/yus_show mhatakeyama@ywesee.com
Password for mhatakeyama@ywesee.com: 
["mhatakeyama@ywesee.com",
 ["credit", [["org.oddb.download"]]],
 ["login", [["org.oddb.de.Admin"]]],
 ["reset_password", []],
 ["set_password", [["mhatakeyama@ywesee.com"]]]]

Note

  • 'RootUser' grant is not found

Add RootUser grant

masa@masa ~/ywesee/yus $ bin/yus_grant mhatakeyama@ywesee.com login org.oddb.RootUser
Password for mhatakeyama@ywesee.com: 
granted permission to login org.oddb.RootUser for mhatakeyama@ywesee.com until 
masa@masa ~/ywesee/yus $ bin/yus_show mhatakeyama@ywesee.com
Password for mhatakeyama@ywesee.com: 
["mhatakeyama@ywesee.com",
 ["credit", [["org.oddb.download"]]],
 ["login", [["org.oddb.RootUser"], ["org.oddb.de.Admin"]]],
 ["reset_password", []],
 ["rootuser", [["org.oddb"]]],
 ["set_password", [["mhatakeyama@ywesee.com"]]]]

Then it works.

Bug

http://oddb.masa.org/de/gcc/resolve/pointer/%3A!registration%2C00332.

Note

  • I cannot change the 'Impfstoff/Blutprodukt' flag even if I click the 'Speichern' Button
  • After the check-off and clicking 'Speichern', the box will be checked-on again.

Trace the code

src/state/admin/registration.rb#update

class Registration < State::Admin::Global
  VIEW = View::Admin::RootRegistration
  SELECT_STATE = State::Admin::SelectIndication
  include RegistrationMethods
  def update
    keys = [
      :inactive_date, :generic_type, :registration_date,
      :revision_date, :market_date, :expiration_date,
      :complementary_type, :export_flag, :renewal_flag,
      :renewal_flag_swissmedic,
      :parallel_import, :index_therapeuticus, :ignore_patent,
      :ith_swissmedic, :activate_fachinfo, :deactivate_fachinfo, :manual_inactive_date
    ]
    if(@model.is_a? Persistence::CreateItem)
      iksnr = @session.user_input(:iksnr)
      if(error_check_and_store(:iksnr, iksnr, [:iksnr]))
        return self
      elsif(@session.app.registration(iksnr))
        error = create_error('e_duplicate_iksnr', :iksnr, iksnr)
        @errors.store(:iksnr, error)
        return self
      else
        @model.append(iksnr)
      end
    end
    do_update(keys)
  end

Note

  • When the 'Speichern' button is clicked, this method is called

Experiment (src/state/admin/registration.rb#update )

  def update
    keys = [
      :inactive_date, :generic_type, :registration_date,
      :revision_date, :market_date, :expiration_date,
      :complementary_type, :export_flag, :renewal_flag,
      :renewal_flag_swissmedic,
      :parallel_import, :index_therapeuticus, :ignore_patent,
      :ith_swissmedic, :activate_fachinfo, :deactivate_fachinfo, :manual_inactive_date,
      :vaccine
    ]

Result

Note

  • This is also saved after the rebooting

Commit

Check import process

src/plugin/swissmedic.rb#update

Check all the heimittelcode

src/util/oddbapp.rb

  def all_heilmittelcode
    open("/home/masa/work/heilmittelcode.dat", "w") do |out|
      @registrations.values.each do |reg|
        out.print reg.iksnr, ", ", reg.production_science, ", ", reg.name_base, "\n"
      end
    end
  end

check_heilmittelcode.rb

# 20110530 masa
# Compare Impfstoffe/Blutprodukte between xls and oddb

# from csv
list = []
File.readlines('pack.csv').each_with_index do |line, i|
  x = line.split(/;/)
  if x[0] and x[6] and x[0].gsub(/"/,'').to_i > 0
    list << [x[0].gsub(/"/,''), x[6].gsub(/"/,'')]
  end
end
print "total registration (Pack.xls): ", list.uniq.length, "\n"
csv_list = Hash[*(list.uniq.flatten)]
print "Impfstoffe/Blutprodukte      : ", list.uniq.select{|x| x[1] =~ /Impfstoffe/ or  x[1] =~ /Blutprodukte/}.length, "\n"

# from oddb
list = []
File.readlines('heilmittelcode.dat').each do |line|
  x = line.split(/,/)
  list << [x[0], x[1]]
end
print "total registration (ch.oddb) : ", list.uniq.length, "\n"
print "Impfstoffe/Blutprodukte      : ", list.uniq.select{|x| x[1] =~ /Impfstoffe/ or  x[1] =~ /Blutprodukte/}.length, "\n"
oddb_list = Hash[*(list.uniq.flatten)]


diff = {}
csv_list.each do |k,v|
  if v.strip == "Impfstoffe" or v.strip == "Blutprodukte"
    unless oddb_list[k]
      diff[k] = [v, nil]
    else
      if v.strip != oddb_list[k].strip
        #print v, "\t", oddb_list[k], "\n"
        diff[k] = [v, oddb_list[k]]
      end
    end
  end
end
print "different: ",  diff.keys.length, "\n"

Result

total registration (Pack.xls): 7867
Impfstoffe/Blutprodukte      : 163
total registration (ch.oddb) : 10350
Impfstoffe/Blutprodukte      : 172
different: 0

Note

  • All the Impfstoffe/Blutprodukte flag of registration in the latest xls file regarding are same to the flags in ch.oddb

Testcases ch.oddb

The current total coverage: 86.19%

  1. ext/swissindex/src/swissindex.rb (coverage: 100%)
  2. src/plugin/swissindex.rb (coverage: 13.87%)

Commit

view · edit · sidebar · attach · print · history
Page last modified on May 30, 2011, at 05:01 PM