view · edit · sidebar · attach · print · history

20100923-trace-limitation-data-flow-in-oddbapp.rb

<< Masa.20100924-check-sl_entry | 2010 | Masa.20100922-trace-limitation-data-flow-in-bsv_xml >>


  1. Trace limitation data in oddbapp.rb
  2. Search limitation data in odba cache
  3. Summarize test cases

Goal
  • Trace limitation data flow in oddbapp.rb / 80%
Milestones
  1. Focus on a @app.update method in bsv_xml.rb 12:00
  2. Trace limitation data in ODDB::App 15:00
  3. Summarize test cases
  4. Trace @sl_entry in bsv_xml.rb
Summary
Commits
ToDo Tomorrow
Keep in Mind
  • emerge --sync
  1. Dimdi-Import-Error.
Attached Files

Trace limitation data in oddbapp.rb

Focus on and trace one of @app.uddate method in bsv_xml.rb

  1. BsvXmlPlugin::PreparationsListener#tag_end
  2. ODDB::App#update
  3. OddbPrevalence#update
  4. ODDB::Persistence::Pointer#issue_update

Experiment
src/util/persistence.rb

      def issue_update(hook, values, origin = nil, masa = nil)
        obj = resolve(hook)
if masa
print "obj="
pp obj 
end
        unless(obj.nil?)
          diff = obj.diff(values, hook)
if masa
print "diff="
pp diff
print "diff.empty?=", diff.empty?, "\n"
end

Result

txt_ptr=#<ODDB::Persistence::Pointer:0x7f43560cb0c0 @directions=[[:registration, "55972"], [:sequence, "01"], [:package, "011"], [:sl_entry], [:limitation_text]]>
obj=#<ODDB::LimitationText:0x7f43560c3eb0
 @descriptions=
  {"it"=>
    #<ODDB::Text::Chapter:0x7f43560c37f8
     @heading="",
     @sections=
      [#<ODDB::Text::Section:0x7f43560c36b8
        @paragraphs=
         [#<ODDB::Text::Paragraph:0x7f43560c3578
           @format=
            #<ODDB::Text::Format:0x7f43560c3488 @end=-1, @start=0, @values=[]>,
           @formats=
            [#<ODDB::Text::Format:0x7f43560c3488
              @end=-1,
              @start=0,
              @values=[]>],
           @preformatted=false,
           @raw_txt=nil,
           @text="Forme gravi di acne, resistenti alla terapia.">],
        @subheading="Isotretinoine Mepha\n">]>,
   "fr"=>
    #<ODDB::Text::Chapter:0x7f43560c2f88
     @heading="",
     @sections=
      [#<ODDB::Text::Section:0x7f43560c2ee8
        @paragraphs=
         [#<ODDB::Text::Paragraph:0x7f43560c2e48
           @format=
            #<ODDB::Text::Format:0x7f43560c2dd0 @end=-1, @start=0, @values=[]>,
           @formats=
            [#<ODDB::Text::Format:0x7f43560c2dd0
              @end=-1,
              @start=0,
              @values=[]>],
           @preformatted=false,
           @raw_txt=nil,
           @text=
            "Formes graves de l'acn\303\251, r\303\251sistantes \303\240 la th\303\251rapie.">],
        @subheading="Isotretinoine Mepha\n">]>,
   "de"=>
    #<ODDB::Text::Chapter:0x7f43560c3258
     @heading="",
     @sections=
      [#<ODDB::Text::Section:0x7f43560c31b8
        @paragraphs=
         [#<ODDB::Text::Paragraph:0x7f43560c30f0
           @format=
            #<ODDB::Text::Format:0x7f43560c3078 @end=-1, @start=0, @values=[]>,
           @formats=
            [#<ODDB::Text::Format:0x7f43560c3078
              @end=-1,
              @start=0,
              @values=[]>],
           @preformatted=false,
           @raw_txt=nil,
           @text="Schwere, therapieresistente Akneformen.">],
        @subheading="Isotretinoin Mepha\n">]>},
 @odba_id=25010629,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=25010629,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f43560c3c80
   @directions=
    [[:registration, "55972"],
     [:sequence, "01"],
     [:package, "011"],
     [:sl_entry],
     [:limitation_text]]>,
 @revision=Thu Sep 23 07:58:27 +0200 2010>
diff={}
diff.empty?=true

....

txt_ptr=#<ODDB::Persistence::Pointer:0x7f4355a73970 @directions=[[:registration, "56107"], [:sequence, "02"], [:package, "008"], [:sl_entry], [:limitation_text]]>
obj=#<ODDB::LimitationText:0x7f4355a6e718
 @descriptions=
  {"it"=>
    #<ODDB::Text::Chapter:0x7f4355a6e420
     @heading="",
     @sections=
      [#<ODDB::Text::Section:0x7f4355a6e308
        @paragraphs=
         [#<ODDB::Text::Paragraph:0x7f4355a6e240
           @format=
            #<ODDB::Text::Format:0x7f4355a6e178 @end=-1, @start=0, @values=[]>,
           @formats=
            [#<ODDB::Text::Format:0x7f4355a6e178
              @end=-1,
              @start=0,
              @values=[]>],
           @preformatted=false,
           @raw_txt=nil,
           @text="Forme gravi di acne, resistenti alla terapia.">],
        @subheading="Isotretinoin Teva\n">]>,
   "fr"=>
    #<ODDB::Text::Chapter:0x7f4355a6dc78
     @heading="",
     @sections=
      [#<ODDB::Text::Section:0x7f4355a6dbd8
        @paragraphs=
         [#<ODDB::Text::Paragraph:0x7f4355a6db60
           @format=
            #<ODDB::Text::Format:0x7f4355a6dae8 @end=-1, @start=0, @values=[]>,
           @formats=
            [#<ODDB::Text::Format:0x7f4355a6dae8
              @end=-1,
              @start=0,
              @values=[]>],
           @preformatted=false,
           @raw_txt=nil,
           @text=
            "Formes graves de l'acn\303\251, r\303\251sistantes \303\240 la th\303\251rapie.">],
        @subheading="Isotretinoin Teva\n">]>,
   "de"=>
    #<ODDB::Text::Chapter:0x7f4355a6df20
     @heading="",
     @sections=
      [#<ODDB::Text::Section:0x7f4355a6de80
        @paragraphs=
         [#<ODDB::Text::Paragraph:0x7f4355a6de08
           @format=
            #<ODDB::Text::Format:0x7f4355a6dd90 @end=-1, @start=0, @values=[]>,
           @formats=
            [#<ODDB::Text::Format:0x7f4355a6dd90
              @end=-1,
              @start=0,
              @values=[]>],
           @preformatted=false,
           @raw_txt=nil,
           @text="Schwere, therapieresistente Akneformen.">],
        @subheading="Isotretinoin Teva\n">]>},
 @odba_id=11081913,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=11081913,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f4355a6d958
   @directions=
    [[:registration, "56107"],
     [:sequence, "02"],
     [:package, "008"],
     [:sl_entry],
     [:limitation_text]]>,
 @revision=Thu May 13 03:29:09 +0200 2010>
diff={}
diff.empty?=true

Notes

  • There is a limitation data in ODBA cache but it is not shown.

Next question

  • Why is it not shown even if there is a limitation data?

Search limitation data in odba cache

Confirm (there is no limitation data in odba cache)
src/util/oddbapp.rb

    def initialize opts={}
      @rss_mutex = Mutex.new
      @admin_threads = ThreadGroup.new
      start = Time.now
      @system = ODBA.cache.fetch_named('oddbapp', self){
        OddbPrevalence.new
      }
p @system.registrations.length
print "registration no. = 55972\n"
p @systemregistraions['55972'].packages.length
p @systemregistraions['55972'].packages[0].limitation_text
print "registration no. = 56107\n"
p @systemregistraions['56107'].packages.length
p @systemregistraions['56107'].packages[0].limitation_text

Result

9759
registration no. = 55972
6
#<ODBA::Stub:70292215553140#25010630 @odba_class= @odba_container=70292215554380#788738>
"Isotretinoin Mepha\n\nSchwere, therapieresistente Akneformen."
registration no. = 56107
4
nil
""

Notes

  • It is certain that there is not limitation data at the beginning (Reg No. 56107)

Experiment
src/util/persistence.rb

      def issue_update(hook, values, origin = nil, masa = nil)
        obj = resolve(hook)
print "obj.class=", obj.class, "\n" if masa #=> =ODDB::LimitationText
if masa
print "========== ODBA Cache ==========\n"
pp obj
end
        unless(obj.nil?)
          diff = obj.diff(values, hook)
if masa
print "__________ diff __________\n"
print "diff="
pp diff
print "diff.empty?=", diff.empty?, "\n"
end

Result

pointer=#<ODDB::Persistence::Pointer:0x7f1a506244d8 @directions=[[:registration, "55972"], [:sequence, "01"], [:package, "011"], [:sl_entry]]>
obj.class=ODDB::SlEntry
========== ODBA Cache ==========
#<ODDB::SlEntry:0x7f1a5061e330
 @bsv_dossier="17846",
 @data_origins=
  {"status"=>:bag,
   "introduction_date"=>:bag,
   "valid_from"=>:bag,
   "limitation"=>:bag,
   "limitation_points"=>:bag,
   "valid_until"=>:bag,
   "bsv_dossier"=>:bag},
 @introduction_date=Sat, 01 Feb 2003,
 @limitation=true,
 @limitation_points=nil,
 @limitation_text=
  #<ODDB::LimitationText:0x7f1a5061d700
   @odba_class=nil,
   @odba_container=nil,
   @odba_id=25010629,
   @receiver=nil,
   @receiver_loaded=nil>,
 @odba_id=788739,
 @odba_observers=[],
 @odba_persistent=true,
 @odba_prefetch=false,
 @odba_target_ids=nil,
 @oid=788739,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f1a5061da70
   @directions=
    [[:registration, "55972"],
     [:sequence, "01"],
     [:package, "011"],
     [:sl_entry]]>,
 @revision=Thu Sep 23 11:26:55 +0200 2010,
 @status="0",
 @valid_from=Sat, 01 Feb 2003,
 @valid_until=Fri, 31 Dec 9999>
__________ diff __________
diff={:limitation_points=>nil}
diff.empty?=false

pointer=#<ODDB::Persistence::Pointer:0x7f1a505f24d8 @directions=[[:registration, "55972"], [:sequence, "01"], [:package, "009"], [:sl_entry]]>
obj.class=ODDB::SlEntry
========== ODBA Cache ==========
#<ODDB::SlEntry:0x7f1a59f48b50
 @bsv_dossier="17846",
 @data_origins=
  {"status"=>:bag,
   "introduction_date"=>:bag,
   "valid_from"=>:bag,
   "limitation"=>:bag,
   "limitation_points"=>:bag,
   "valid_until"=>:bag,
   "bsv_dossier"=>:bag},
 @introduction_date=Sat, 01 Feb 2003,
 @limitation=true,
 @limitation_points=nil,
 @limitation_text=
  #<ODDB::LimitationText:0x7f1a59f45658
   @descriptions=
    {"it"=>
      #<ODDB::Text::Chapter:0x7f1a59f45018
       @heading="",
       @sections=
        [#<ODDB::Text::Section:0x7f1a59f44f00
          @paragraphs=
           [#<ODDB::Text::Paragraph:0x7f1a59f44de8
             @format=
              #<ODDB::Text::Format:0x7f1a59f44cf8
               @end=-1,
               @start=0,
               @values=[]>,
             @formats=
              [#<ODDB::Text::Format:0x7f1a59f44cf8
                @end=-1,
                @start=0,
                @values=[]>],
             @preformatted=false,
             @raw_txt=nil,
             @text="Forme gravi di acne, resistenti alla terapia.">],
          @subheading="Isotretinoine Mepha\n">]>,
     "fr"=>
      #<ODDB::Text::Chapter:0x7f1a59f44870
       @heading="",
       @sections=
        [#<ODDB::Text::Section:0x7f1a59f447d0
          @paragraphs=
           [#<ODDB::Text::Paragraph:0x7f1a59f44730
             @format=
              #<ODDB::Text::Format:0x7f1a59f446b8
               @end=-1,
               @start=0,
               @values=[]>,
             @formats=
              [#<ODDB::Text::Format:0x7f1a59f446b8
                @end=-1,
                @start=0,
                @values=[]>],
             @preformatted=false,
             @raw_txt=nil,
             @text=
              "Formes graves de l'acn\303\251, r\303\251sistantes \303\240 la th\303\251rapie.">],
          @subheading="Isotretinoine Mepha\n">]>,
     "de"=>
      #<ODDB::Text::Chapter:0x7f1a59f44b18
       @heading="",
       @sections=
        [#<ODDB::Text::Section:0x7f1a59f44a78
          @paragraphs=
           [#<ODDB::Text::Paragraph:0x7f1a59f449d8
             @format=
              #<ODDB::Text::Format:0x7f1a59f44960
               @end=-1,
               @start=0,
               @values=[]>,
             @formats=
              [#<ODDB::Text::Format:0x7f1a59f44960
                @end=-1,
                @start=0,
                @values=[]>],
             @preformatted=false,
             @raw_txt=nil,
             @text="Schwere, therapieresistente Akneformen.">],
          @subheading="Isotretinoin Mepha\n">]>},
   @odba_id=25010630,
   @odba_observers=[],
   @odba_persistent=true,
   @oid=25010630,
   @pointer=
    #<ODDB::Persistence::Pointer:0x7f1a59f45428
     @directions=
      [[:registration, "55972"],
       [:sequence, "01"],
       [:package, "009"],
       [:sl_entry],
       [:limitation_text]]>,
   @revision=Thu Sep 23 07:58:27 +0200 2010>,
 @odba_id=788738,
 @odba_observers=[],
 @odba_persistent=true,
 @odba_prefetch=false,
 @odba_target_ids=nil,
 @oid=788738,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f1a59f48498
   @directions=
    [[:registration, "55972"],
     [:sequence, "01"],
     [:package, "009"],
     [:sl_entry]]>,
 @revision=Thu Sep 23 11:26:55 +0200 2010,
 @status="0",
 @valid_from=Sat, 01 Feb 2003,
 @valid_until=Fri, 31 Dec 9999>
__________ diff __________
diff={:limitation_points=>nil}
diff.empty?=false

pointer=#<ODDB::Persistence::Pointer:0x7f1a500c36b0 @directions=[[:registration, "56107"], [:sequence, "02"], [:package, "008"], [:sl_entry]]>
obj.class=ODDB::SlEntry
========== ODBA Cache ==========
#<ODDB::SlEntry:0x7f1a500bdff8
 @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=24334829,
 @odba_observers=[],
 @odba_persistent=true,
 @oid=24334829,
 @pointer=
  #<ODDB::Persistence::Pointer:0x7f1a500bd990
   @directions=
    [[:registration, "56107"],
     [:sequence, "02"],
     [:package, "008"],
     [:sl_entry]]>,
 @revision=Thu Sep 23 11:26:55 +0200 2010,
 @status="0",
 @valid_from=Thu, 01 May 2003,
 @valid_until=Fri, 31 Dec 9999>
__________ diff __________
diff={:limitation_points=>nil}
diff.empty?=false

Notes

  • All the sl_entries for 55972 have @limitation_text variable
  • But there are differences about @limitation_text among the sl_entries in ODBA cache
  • All the sl_entries for 56107 do not have @limitation_text
  • But diff method does not detect the differences about @limitation_text

Read ODDB::Persistence#diff method

    def diff(values, app=nil)
      #adjust_types(values, app)
      result = {}
      adjust_types(values, app).each { |key, value|
        if(self.respond_to?(key))
          oldval = self.send(key)
          if(oldval.nil? || undiffable?(oldval) || value != oldval)
            result.store(key, value)
          end
        end
      }
      result
    end

BraSt

  • How do I update sl_entry#@limitation_text?

Summarize test cases

I just testted to delete and return the limitation description in Preparation.xml.

Case 1: good case: it is possible to delete 'L' and return 'L'

Before

After

Case 2: bad case: once deleting 'L', 'L' will never come back

Before

After

Notes

  • I have not find the reason why this happens

Trace @sl_entry in the case of 55972

Questions

  • Why is the system work well in the case of Reg. No. 55972?

Solution

  • Trace @sl_entry in bsv_xml.rb of the registration and deleting processes
view · edit · sidebar · attach · print · history
Page last modified on July 13, 2011, at 11:58 AM