view · edit · sidebar · attach · print · history

20100927-search-link-between_sl_entry_and_limitation_text

<< Masa.20100928-resolve-missing-link-limitation-bug | 2010 | Masa.20100924-check-sl_entry >>


  1. Check sl_entry object
  2. Search the part to create the link between sl_entry and limitation_text
  3. Search the part to delete the link between sl_entry and limitation_text
  4. Solution Test

Goal
  • Find the method to create a link between sl_entry and limitation_text / 70%
Milestones
  1. 7-Confirm the sl_entry objects in the test last week-} 9:00
  2. Search the point to create the link between sl_entry and limitation_text
Summary
Commits
ToDo Tomorrow
Keep in Mind
  • emerge --sync
  1. Dimdi-Import-Error.
Attached Files

Check sl_entry object

Setting test environment
src/util/updater.rb

    def run
      logfile_stats
=begin
      if(update_swissmedic)
        update_swissmedic_followers
      end
      update_swissmedicjournal
      update_vaccines
=end
      if(update_bsv)
#        update_bsv_followers
      end
=begin
      update_narcotics
      run_on_monthday(1) {
        update_interactions 
      }
=end
    end

src/plugin/bsv_xml.rb

    def update
#      path = download_to ARCHIVE_PATH
path = "/home/masa/ywesee/oddb.org/data/xml/XMLPublications-2010.09.27.zip"
=begin
      if File.exist?(@latest) && FileUtils.cmp(@latest, path)
        FileUtils.rm path
        return
      end
=end
      _update path
#      FileUtils.cp path, @latest
      path
    end

Preparing Preparation.xml for test

masa@masa ~/ywesee/oddb.org $ cd data/xml/
masa@masa ~/ywesee/oddb.org/data/xml $ ls
XMLPublications-2010.09.27.zip
masa@masa ~/ywesee/oddb.org/data/xml $ unzip XMLPublications-2010.09.27.zip 
Archive:  XMLPublications-2010.09.27.zip
  inflating: PR100801.txt            
  inflating: Publications.xls        
  inflating: Generics.xml            
  inflating: ItCodes.xml             
  inflating: Preparations.xml        
masa@masa ~/ywesee/oddb.org/data/xml $ vim Preparation.xml

(leave only 55972 and 56107 preparations)

masa@masa ~/ywesee/oddb.org/data/xml $ cp Preparations.xml Preparations.xml.2.2
masa@masa ~/ywesee/oddb.org/data/xml $ vim Preparations.xml 

(delete limitations tag)

masa@masa ~/ywesee/oddb.org/data/xml $ mv Preparations.xml Preparations.xml.2.2.del_lim
masa@masa ~/ywesee/oddb.org/data/xml $ cp Preparations.xml.2.2 Preparations.xml
masa@masa ~/ywesee/oddb.org/data/xml $ mv XMLPublications-2010.09.27.zip XMLPublications-2010.09.27.zip.bak
masa@masa ~/ywesee/oddb.org/data/xml $ zip XMLPublications-2010.09.27.zip Preparations.xml
  adding: Preparations.xml (deflated 90%)
masa@masa ~/ywesee/oddb.org/data/xml $ mv XMLPublications-2010.09.27.zip XMLPublications-2010.09.27.2.2.zip
masa@masa ~/ywesee/oddb.org/data/xml $ cp Preparations.xml.2.2.del_lim Preparations.xml
masa@masa ~/ywesee/oddb.org/data/xml $ zip XMLPublications-2010.09.27.zip Preparations.xml
  adding: Preparations.xml (deflated 90%)
masa@masa ~/ywesee/oddb.org/data/xml $ mv XMLPublications-2010.09.27.zip XMLPublications-2010.09.27.2.2.del_lim.zip
masa@masa ~/ywesee/oddb.org/data/xml $ cp XMLPublications-2010.09.27.2.2.zip XMLPublications-2010.09.27.zip

Attach:XMLPublication-2010.09.27.2.2.zip Attach:XMLPublication-2010.09.27.2.2.del_lim.zip

Run update_bsv

masa@masa ~/ywesee/oddb.org/ $ jobs/import_daily

Confirm a bug on browser
http://oddb.masa.org/en/gcc/search/zone/drugs/search_query/Isotretinoin/

Back up test data

masa@masa ~/ywesee/oddb.org $ pg_dump oddb.org > 2009.09.27.preparation.2.2.sql

Run update_bsv without limitations

masa@masa ~/ywesee/oddb.org/data/xml $ cp XMLPublications-2010.09.27.2.2.del_lim.zip XMLPublications-2010.09.27.zip
masa@masa ~/ywesee/oddb.org $ cd ../..
masa@masa ~/ywesee/oddb.org $ jobs/import_daily

Confirm a bug on browser
http://oddb.masa.org/en/gcc/search/zone/drugs/search_query/Isotretinoin/

Check sl_entry objects
src/plugin/bsv_xml.rb

          @sl_entries.each do |pac_ptr, sl_data|
            pack = pac_ptr.resolve @app
            @known_packages.delete pac_ptr
            unless pack.nil?
              pointer = pac_ptr + :sl_entry
              if sl_data.empty?
                if pack.sl_entry
                  @deleted_sl_entries += 1
                  @app.delete pointer
                end
              else
                if pack.sl_entry
                  @updated_sl_entries += 1
                else
                  @created_sl_entries += 1
                end
                if (lim_data = @lim_texts[pac_ptr]) && !lim_data.empty?
                  sl_data.store :limitation, true
                end
print "pointer="
p pointer
print "========== sl_entries in ODBA cache ==========\n"
sl = pointer.resolve @app
pp sl
                @app.update pointer.creator, sl_data, :bag
              end
            end
          end

Run update_bsv

masa@masa ~/ywesee/oddb.org $ jobs/import_daily > log.dat

Result

pointer=#<ODDB::Persistence::Pointer:0x7f4f857d1938 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry]]>
========== sl_entries in ODBA cache ==========
#<ODDB::SlEntry:0x7f4f857cd1f8
 @bsv_dossier="17846",
 @data_origins=
  {"status"=>:bag,
   "introduction_date"=>:bag,
   "valid_from"=>:bag,
   "limitation_points"=>:bag,
   "limitation"=>:bag,
   "valid_until"=>:bag,
   "bsv_dossier"=>:bag},
 @introduction_date=Sun, 01 Jul 2007,
 @limitation=nil,
 @limitation_points=nil,

 @limitation_text=nil,

 @odba_id=1271980,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=1271980,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f4f857cc9d8
   @directions=
    [[:registration, "55972"],
     [:sequence, "03"],
     [:package, "019"],
     [:sl_entry]]>,
 @revision=Mon Sep 27 08:40:23 +0200 2010,
 @status="0",
 @valid_from=Sun, 01 Jul 2007,
 @valid_until=Fri, 31 Dec 9999>
pointer=#<ODDB::Persistence::Pointer:0x7f4f8579eb50 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "017"], [:sl_entry]]>
========== sl_entries in ODBA cache ==========
#<ODDB::SlEntry:0x7f4f8579ab40
 @bsv_dossier="17846",
 @data_origins=
  {"status"=>:bag,
   "introduction_date"=>:bag,
   "valid_from"=>:bag,
   "limitation_points"=>:bag,
   "limitation"=>:bag,
   "valid_until"=>:bag,
   "bsv_dossier"=>:bag},
 @introduction_date=Sun, 01 Jul 2007,
 @limitation=nil,
 @limitation_points=nil,

 @limitation_text=nil,

 @odba_id=1271979,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=1271979,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f4f8579a078
   @directions=
    [[:registration, "55972"],
     [:sequence, "03"],
     [:package, "017"],
     [:sl_entry]]>,
 @revision=Mon Sep 27 08:40:23 +0200 2010,
 @status="0",
 @valid_from=Sun, 01 Jul 2007,
 @valid_until=Fri, 31 Dec 9999>
pointer=#<ODDB::Persistence::Pointer:0x7f4f85670418 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry]]>
========== sl_entries in ODBA cache ==========
#<ODDB::SlEntry:0x7f4f8566bc60
 @bsv_dossier="17885",
 @data_origins=
  {"status"=>:bag,
   "introduction_date"=>:bag,
   "valid_from"=>:bag,
   "limitation_points"=>:bag,
   "limitation"=>:bag,
   "valid_until"=>:bag,
   "bsv_dossier"=>:bag},
 @introduction_date=Thu, 01 May 2003,
 @limitation=nil,
 @limitation_points=nil,

 @odba_id=24334826,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=24334826,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f4f8566b4e0
   @directions=
    [[:registration, "56107"],
     [:sequence, "01"],
     [:package, "004"],
     [:sl_entry]]>,
 @revision=Mon Sep 27 08:40:23 +0200 2010,
 @status="0",
 @valid_from=Thu, 01 May 2003,
 @valid_until=Fri, 31 Dec 9999>
pointer=#<ODDB::Persistence::Pointer:0x7f4f85643918 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "002"], [:sl_entry]]>
========== sl_entries in ODBA cache ==========
#<ODDB::SlEntry:0x7f4f8563fb10
 @bsv_dossier="17885",
 @data_origins=
  {"status"=>:bag,
   "introduction_date"=>:bag,
   "valid_from"=>:bag,
   "limitation_points"=>:bag,
   "limitation"=>:bag,
   "valid_until"=>:bag,
   "bsv_dossier"=>:bag},
 @introduction_date=Thu, 01 May 2003,
 @limitation=nil,
 @limitation_points=nil,

 @odba_id=24334827,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=24334827,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f4f8563f368
   @directions=
    [[:registration, "56107"],
     [:sequence, "01"],
     [:package, "002"],
     [:sl_entry]]>,
 @revision=Mon Sep 27 08:40:23 +0200 2010,
 @status="0",
 @valid_from=Thu, 01 May 2003,
 @valid_until=Fri, 31 Dec 9999>

Points

  • There is @limitation_text in the case of 55972 Preparations
  • There is NOT @limitation_text in the case of 56107 Preparations

Confirm sl_entry object in ODBA cache with limitations

masa@masa ~/ywesee/oddb.org/data/xml $ cp XMLPublications-2010.09.27.2.2.zip XMLPublications-2010.09.27.zip
masa@masa ~/ywesee/oddb.org $ jobs/import_daily > log.dat
masa@masa ~/ywesee/oddb.org $ jobs/import_daily > log.dat

Result

pointer=#<ODDB::Persistence::Pointer:0x7f519387c080 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry]]>
========== sl_entries in ODBA cache ==========
#<ODDB::SlEntry:0x7f5193878098
 @bsv_dossier="17846",
 @data_origins=
  {"status"=>:bag,
   "introduction_date"=>:bag,
   "valid_from"=>:bag,
   "limitation_points"=>:bag,
   "limitation"=>:bag,
   "valid_until"=>:bag,
   "bsv_dossier"=>:bag},
 @introduction_date=Sun, 01 Jul 2007,
 @limitation=true,
 @limitation_points=nil,

 @limitation_text=
  #<ODDB::LimitationText:0x7f5193876450
   @odba_class=nil,
   @odba_container=nil,
   @odba_id=25062229,
   @receiver=nil,
   @receiver_loaded=nil>,

 @odba_id=1271980,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=1271980,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f5193876ef0
   @directions=
    [[:registration, "55972"],
     [:sequence, "03"],
     [:package, "019"],
     [:sl_entry]]>,
 @revision=Mon Sep 27 08:51:21 +0200 2010,
 @status="0",
 @valid_from=Sun, 01 Jul 2007,
 @valid_until=Fri, 31 Dec 9999>
pointer=#<ODDB::Persistence::Pointer:0x7f51938419a8 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "017"], [:sl_entry]]>
========== sl_entries in ODBA cache ==========
#<ODDB::SlEntry:0x7f519383cb38
 @bsv_dossier="17846",
 @data_origins=
  {"status"=>:bag,
   "introduction_date"=>:bag,
   "valid_from"=>:bag,
   "limitation_points"=>:bag,
   "limitation"=>:bag,
   "valid_until"=>:bag,
   "bsv_dossier"=>:bag},
 @introduction_date=Sun, 01 Jul 2007,
 @limitation=true,
 @limitation_points=nil,

 @limitation_text=
  #<ODDB::LimitationText:0x7f519383bd00
   @odba_class=nil,
   @odba_container=nil,
   @odba_id=25062230,
   @receiver=nil,
   @receiver_loaded=nil>,

 @odba_id=1271979,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=1271979,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f519383c340
   @directions=
    [[:registration, "55972"],
     [:sequence, "03"],
     [:package, "017"],
     [:sl_entry]]>,
 @revision=Mon Sep 27 08:51:21 +0200 2010,
 @status="0",
 @valid_from=Sun, 01 Jul 2007,
 @valid_until=Fri, 31 Dec 9999>
pointer=#<ODDB::Persistence::Pointer:0x7f51936f66c0 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry]]>
========== sl_entries in ODBA cache ==========
#<ODDB::SlEntry:0x7f51936f2a20
 @bsv_dossier="17885",
 @data_origins=
  {"status"=>:bag,
   "introduction_date"=>:bag,
   "valid_from"=>:bag,
   "limitation_points"=>:bag,
   "limitation"=>:bag,
   "valid_until"=>:bag,
   "bsv_dossier"=>:bag},
 @introduction_date=Thu, 01 May 2003,
 @limitation=true,
 @limitation_points=nil,

 @odba_id=24334826,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=24334826,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f51936f2340
   @directions=
    [[:registration, "56107"],
     [:sequence, "01"],
     [:package, "004"],
     [:sl_entry]]>,
 @revision=Mon Sep 27 08:51:21 +0200 2010,
 @status="0",
 @valid_from=Thu, 01 May 2003,
 @valid_until=Fri, 31 Dec 9999>
pointer=#<ODDB::Persistence::Pointer:0x7f51936cb088 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "002"], [:sl_entry]]>
========== sl_entries in ODBA cache ==========
#<ODDB::SlEntry:0x7f51936c7410
 @bsv_dossier="17885",
 @data_origins=
  {"status"=>:bag,
   "introduction_date"=>:bag,
   "valid_from"=>:bag,
   "limitation_points"=>:bag,
   "limitation"=>:bag,
   "valid_until"=>:bag,
   "bsv_dossier"=>:bag},
 @introduction_date=Thu, 01 May 2003,
 @limitation=true,
 @limitation_points=nil,

 @odba_id=24334827,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=24334827,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f51936c6bc8
   @directions=
    [[:registration, "56107"],
     [:sequence, "01"],
     [:package, "002"],
     [:sl_entry]]>,
 @revision=Mon Sep 27 08:51:21 +0200 2010,
 @status="0",
 @valid_from=Thu, 01 May 2003,
 @valid_until=Fri, 31 Dec 9999>

Points

  • There is @limitation_text in the case of 55972 Preparations
  • There is NOT @limitation_text in the case of 56107 Preparations

Namely

  • @limitation_text in sl_entry is necessary in order to show the limitation text data

Search the point to create the link between sl_entry and limitation_text

Question

  • The object_id variable of @limitation_text is the same but the actual object id of the LimitationText object is different

Hypothesis

  • The LimitationText object is created somewhere

Experiment
src/model/slentry.rb

    def create_limitation_text
p "getin SlEntry#create_limitation_text"
pp caller(0)
      @limitation_text = LimitationText.new
    end

Result

pointer=#<ODDB::Persistence::Pointer:0x7f47cb0b6f70 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry]]>
pointer=#<ODDB::Persistence::Pointer:0x7f47cb09f1b8 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "017"], [:sl_entry]]>

"getin SlEntry#create_limitation_text"
["/home/masa/ywesee/oddb.org/src/model/slentry.rb:20:in `create_limitation_text'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:229:in `send'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:229:in `issue_create'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:98:in `create'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `failsafe'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:97:in `create'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:299:in `send'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:299:in `resolve'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:289:in `each'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:289:in `resolve'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:267:in `issue_update'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:118:in `update'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `failsafe'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:117:in `update'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1393:in `update'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:434:in `tag_end'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:419:in `each'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:419:in `tag_end'",
 "/usr/lib64/ruby/1.8/rexml/parsers/streamparser.rb:26:in `parse'",
 "/usr/lib64/ruby/1.8/rexml/document.rb:201:in `parse_stream'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:950:in `update_preparations'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:657:in `send'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:657:in `_update'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:787:in `get_input_stream'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:657:in `_update'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1154:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1154:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1297:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1434:in `foreach'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1413:in `open'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1432:in `foreach'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:653:in `_update'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:648:in `update'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:242:in `update_bsv'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:425:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:425:in `wrap_update'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:241:in `update_bsv'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:210:in `run'",
 "jobs/import_daily:13",
 "/home/masa/ywesee/oddb.org/src/util/job.rb:17:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/job.rb:17:in `run'",
 "jobs/import_daily:12"]

"getin SlEntry#create_limitation_text"
["/home/masa/ywesee/oddb.org/src/model/slentry.rb:20:in `create_limitation_text'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:229:in `send'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:229:in `issue_create'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:98:in `create'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `failsafe'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:97:in `create'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:299:in `send'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:299:in `resolve'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:289:in `each'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:289:in `resolve'",
 "/home/masa/ywesee/oddb.org/src/util/persistence.rb:267:in `issue_update'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:118:in `update'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `failsafe'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:117:in `update'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1393:in `update'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:434:in `tag_end'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:419:in `each'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:419:in `tag_end'",
 "/usr/lib64/ruby/1.8/rexml/parsers/streamparser.rb:26:in `parse'",
 "/usr/lib64/ruby/1.8/rexml/document.rb:201:in `parse_stream'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:950:in `update_preparations'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:657:in `send'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:657:in `_update'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:787:in `get_input_stream'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:657:in `_update'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1154:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1154:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1297:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1434:in `foreach'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1413:in `open'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1432:in `foreach'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:653:in `_update'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:648:in `update'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:242:in `update_bsv'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:425:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:425:in `wrap_update'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:241:in `update_bsv'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:210:in `run'",
 "jobs/import_daily:13",
 "/home/masa/ywesee/oddb.org/src/util/job.rb:17:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/job.rb:17:in `run'",
 "jobs/import_daily:12"]

pointer=#<ODDB::Persistence::Pointer:0x7f47caf0e150 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry]]>
pointer=#<ODDB::Persistence::Pointer:0x7f47caef8dc8 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "002"], [:sl_entry]]>

Notes

  • Bingo!!
  • As expected, create_limitation_text is called only in the case of 55972 Preparations

Consideration

  • Pointer#resolve method may be also called somewhere in this process above
  • If I find the condition to create a limitation_text object and it is possible to set (modify) the condition in bsv_xml.rb, this problem will be resolved

Trace the code
Consideration

  • create method is called from resolve method only in the case of 55972 Preparations

Trace ODDB::Persistence::Pointer#resolve method
usr(util/persistence.rb

      def resolve(hook, masa=nil)
p "\n___getin resolve___"
if masa
print '@directions='
p @directions 
end
        Persistence.find_by_pointer(to_s) or begin
          lasthook = hook
          laststep = []
          @directions.each { |step|
print "step=", step, "\n" if masa
            if(hook.nil?)
              call = laststep.shift
              args = laststep.join(',')
              msg = "#{to_s} -> #{lasthook.class}::#{call}(#{args}) returned nil"
              raise(UninitializedPathError.new(msg, self))
            elsif(hook.respond_to?(step.first))
              lasthook = hook
              laststep = step
if masa
print "lasthook=", lasthook, "\n"
print "laststep=", laststep, "\n"
end
              hook = begin
                hook.send(*step)
              rescue
              end

src/util/persistence.rb

      def issue_create(app, masa=nil)
        #new_obj = resolve(app)
        new_obj = resolve(app, masa)
if masa
  print "new_obj="
  pp new_obj
end
        unless new_obj.nil?
          return new_obj
        end

Result

====================
txt_ptr=#<ODDB::Persistence::Pointer:0x7f703af04d38 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry], [:limitation_text]]>
pointer=#<ODDB::Persistence::Pointer:0x7f703af04338 @directions=[[:create, #<ODDB::Persistence::Pointer:0x7f703af04d38 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry], [:limitation_text]]>]]>

___getin resolve___
@directions=[[:create, #<ODDB::Persistence::Pointer:0x7f703af04d38 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry], [:limitation_text]]>]]
step=create:!registration,55972!sequence,03!package,019!sl_entry!limitation_text.
lasthook=#<OddbPrevalence:0x7f7049ee5ac8>
laststep=create:!registration,55972!sequence,03!package,019!sl_entry!limitation_text.
pointer=#<ODDB::Persistence::Pointer:0x7f703af04d38 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry], [:limitation_text]]>

___getin resolve___
@directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry], [:limitation_text]]
step=registration55972
lasthook=#<OddbPrevalence:0x7f7049ee5ac8>
laststep=registration55972
step=sequence03
lasthook=#<ODDB::Registration:0x7f70430fe528>
laststep=sequence03
step=package019
lasthook=Isotretinoin-Mepha 40 mg, Solucaps
laststep=package019
step=sl_entry
lasthook=#<ODDB::Package:0x7f703ed38ac8>
laststep=sl_entry
step=limitation_text
lasthook=#<ODDB::SlEntry:0x7f703af343a8>
laststep=limitation_text
new_obj=nil
"getin SlEntry#create_limitation_text"

....

txt_ptr=#<ODDB::Persistence::Pointer:0x7f703ad631f0 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry], [:limitation_text]]>
pointer=#<ODDB::Persistence::Pointer:0x7f703ad62930 @directions=[[:create, #<ODDB::Persistence::Pointer:0x7f703ad631f0 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry], [:limitation_text]]>]]>

___getin resolve___
@directions=[[:create, #<ODDB::Persistence::Pointer:0x7f703ad631f0 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry], [:limitation_text]]>]]
step=create:!registration,56107!sequence,01!package,004!sl_entry!limitation_text.
lasthook=#<OddbPrevalence:0x7f7049ee5ac8>
laststep=create:!registration,56107!sequence,01!package,004!sl_entry!limitation_text.
pointer=#<ODDB::Persistence::Pointer:0x7f703ad631f0 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry], [:limitation_text]]>

___getin resolve___
@directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry], [:limitation_text]]
new_obj=#<ODDB::LimitationText:0x7f703ad58f98
 @descriptions=
  {"it"=>
    #<ODDB::Text::Chapter:0x7f703ad58ca0
     @heading="",
     @sections=
      [#<ODDB::Text::Section:0x7f703ad58b88
        @paragraphs=
         [#<ODDB::Text::Paragraph:0x7f703ad58ac0
           @format=
            #<ODDB::Text::Format:0x7f703ad589f8 @end=-1, @start=0, @values=[]>,
           @formats=
            [#<ODDB::Text::Format:0x7f703ad589f8
              @end=-1,
              @start=0,
              @values=[]>],
           @preformatted=false,
           @raw_txt=nil,
           @text="Forme gravi di acne, resistenti alla terapia.">],
        @subheading="Isotretinoin Teva\n">]>,

....

Difference
55972

___getin resolve___
@directions=[[:registration, "55972"], [:sequence, "03"], [:package, "017"], [:sl_entry], [:limitation_text]]
step=registration55972

56107

___getin resolve___
@directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry], [:limitation_text]]
new_obj=#<ODDB::LimitationText:0x7f30dd651610

Consideration

  • In the case of 56107 Preparation, the resolve method can find the object by Persistence.find_by_pointer method
  • In the case of 55972 Preparation, the resolve method canNOT find the object by Persistence.find_by_pointer method
  • But there is NOT find_by_pointer method defined in Persistence class!!

BraSt What to do next

  • Search and readPersistence class
  • How can (cannot) the Persistence.find_by_pointer method find the object?

Experiment
src/util/persistence.rb

      def resolve(hook)
       #Persistence.find_by_pointer(to_s) or begin
       begin

Result

So

  • I have to understand the condition where Persistence#find_by_pointer method can find a object
  • On the other hand, the object can be found in the case of 56107 Preparation
  • This might mean that the link is not deleted

Search the part to delete the link between sl_entry and limitation_text

Experimentsrc/util/persistence.rb

      def issue_delete(app)
p "getin issue_delete"

Result

sl pointer=#<ODDB::Persistence::Pointer:0x7f6df16fe7d8 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry]]>
sl pointer=#<ODDB::Persistence::Pointer:0x7f6df16e5530 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "017"], [:sl_entry]]>
"getin issue_delete"
"getin issue_delete"
sl pointer=#<ODDB::Persistence::Pointer:0x7f6df1581e28 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry]]>
sl pointer=#<ODDB::Persistence::Pointer:0x7f6df156a890 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "002"], [:sl_entry]]>

Notes

  • BINGO!!
  • Anyway, the link is deleted only in the case of 55972 Preparation
  • Next, how is it deleted? (how is Pointer#issue_delete called?)

Experiment
src/util/persistence.rb

      def issue_delete(app)
p "getin issue_delete"
pp caller(0)

Result

sl pointer=#<ODDB::Persistence::Pointer:0x7ff979955770 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry]]>
sl pointer=#<ODDB::Persistence::Pointer:0x7ff97993b2a8 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "017"], [:sl_entry]]>
"getin issue_delete"
["/home/masa/ywesee/oddb.org/src/util/persistence.rb:250:in `issue_delete'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:123:in `delete'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `failsafe'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:119:in `delete'",
 "/home/masa/ywesee/oddb.org/src/command/delete.rb:10:in `execute'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:634:in `execute_command'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1360:in `delete'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:426:in `tag_end'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:419:in `each'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:419:in `tag_end'",
 "/usr/lib64/ruby/1.8/rexml/parsers/streamparser.rb:26:in `parse'",
 "/usr/lib64/ruby/1.8/rexml/document.rb:201:in `parse_stream'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:956:in `update_preparations'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:663:in `send'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:663:in `_update'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:787:in `get_input_stream'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:663:in `_update'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1154:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1154:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1297:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1434:in `foreach'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1413:in `open'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1432:in `foreach'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:659:in `_update'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:654:in `update'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:242:in `update_bsv'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:425:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:425:in `wrap_update'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:241:in `update_bsv'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:210:in `run'",
 "jobs/import_daily:13",
 "/home/masa/ywesee/oddb.org/src/util/job.rb:17:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/job.rb:17:in `run'",
 "jobs/import_daily:12"]

"getin issue_delete"
["/home/masa/ywesee/oddb.org/src/util/persistence.rb:250:in `issue_delete'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:123:in `delete'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/failsafe.rb:9:in `failsafe'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:119:in `delete'",
 "/home/masa/ywesee/oddb.org/src/command/delete.rb:10:in `execute'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:634:in `execute_command'",
 "/home/masa/ywesee/oddb.org/src/util/oddbapp.rb:1360:in `delete'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:426:in `tag_end'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:419:in `each'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:419:in `tag_end'",
 "/usr/lib64/ruby/1.8/rexml/parsers/streamparser.rb:26:in `parse'",
 "/usr/lib64/ruby/1.8/rexml/document.rb:201:in `parse_stream'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:956:in `update_preparations'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:663:in `send'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:663:in `_update'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:787:in `get_input_stream'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:663:in `_update'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1154:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1154:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1297:in `each'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1434:in `foreach'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1413:in `open'",
 "/usr/lib64/ruby/gems/1.8/gems/rubyzip-0.9.4/lib/zip/zip.rb:1432:in `foreach'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:659:in `_update'",
 "/home/masa/ywesee/oddb.org/src/plugin/bsv_xml.rb:654:in `update'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:242:in `update_bsv'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:425:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:425:in `wrap_update'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:241:in `update_bsv'",
 "/home/masa/ywesee/oddb.org/src/util/updater.rb:210:in `run'",
 "jobs/import_daily:13",
 "/home/masa/ywesee/oddb.org/src/util/job.rb:17:in `call'",
 "/home/masa/ywesee/oddb.org/src/util/job.rb:17:in `run'",
 "jobs/import_daily:12"]
sl pointer=#<ODDB::Persistence::Pointer:0x7ff9797c9988 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry]]>
sl pointer=#<ODDB::Persistence::Pointer:0x7ff9797b32f0 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "002"], [:sl_entry]]>

Trace

  • The following part is the part where the link is deleted

src/plugin/bsv_xml.rb

                if sl_entry.limitation_text
                  @deleted_limitation_texts += 1
                  @app.delete txt_ptr
                end

Experiment src/plugin/bsv_xml.rb

                if sl_entry.limitation_text || txt_ptr.resolve(@app)
                  @deleted_limitation_texts += 1
                  @app.delete txt_ptr
                end
masa@masa ~/ywesee/oddb.org/data/xml $ cp XMLPublications-2010.09.27.2.2.del_lim.zip XMLPublications-2010.09.27.zip
masa@masa ~/ywesee/oddb.org $ jobs/import_daily
masa@masa ~/ywesee/oddb.org/data/xml $ cp XMLPublications-2010.09.27.2.2.zip XMLPublications-2010.09.27.zip
masa@masa ~/ywesee/oddb.org $ jobs/import_daily

Result

Notes

  • Once this link is removed, everything works well

Solution

  • Create a method 'reset_limitation_text' that deletes all the limitation text object and re-creates the limitation text object in ODBA cache

Question

  • How does the limitation text object remains in ODBA cache without the link from sl_entry object?
  • This may happen again in the future, even if I reset the link by reset_limitation_text script

Solution Test

Experiment
Deleting all the limitation text object in ODBA cache before updating
src/plugin/bsv_xml.rb

if sl_entry.limitation_text || txt_ptr.resolve(@app)
  @app.delete txt_ptr
end
                @app.update txt_ptr.creator, lim_data, :bag

Result

Conclution

  • It works!!
  • I will test it for the actual data tomorrow
view · edit · sidebar · attach · print · history
Page last modified on July 13, 2011, at 11:58 AM