<< Masa.20100923-trace-limitation-data-flow-in-oddbapp | 2010 | Masa.20100921-trace-import-limitation-process >>
Experiment
src/plugin/bsv_xml.rb
when 'SwissmedicNo5'
# masa
if @text.to_i == 56107 || @text.to_i == 55972
print "SwissmedicNo5(end_tag): ", @text, "\n"
@masa = true
else
@masa = false
end
when /^Description(..)$/u
key = $~[1].downcase.to_sym
if @in_limitation
if @lim_data # we are within a Package
p 'yes @lim_data' if @masa
chp = Text::Chapter.new
update_chapter chp, @html
@lim_data.store key, chp
else
p 'no @lim_data' if @masa
@lim_texts.each_value do |text_data|
chp = text_data[key] ||= Text::Chapter.new
subheading = if @it_descriptions
[@itcode, @it_descriptions[key]].compact.join(': ')
else
@name[key]
end
update_chapter chp, @html, subheading
end
end
if @masa
p @html
print "@lim_data.length=", @lim_data.length, "\n" if @lim_data
print "@lim_text.length=", @lim_text.length, "\n" if @lim_text
end
Result
SwissmedicNo5(end_tag): 55972 "no @lim_data" "Schwere, therapieresistente Akneformen." "no @lim_data" "Formes graves de l'acn\303\251, r\303\251sistantes \303\240 la th\303\251rapie." "no @lim_data" "Forme gravi di acne, resistenti alla terapia." SwissmedicNo5(end_tag): 55972 "no @lim_data" "Schwere, therapieresistente Akneformen." "no @lim_data" "Formes graves de l'acn\303\251, r\303\251sistantes \303\240 la th\303\251rapie." "no @lim_data" "Forme gravi di acne, resistenti alla terapia." SwissmedicNo5(end_tag): 55972 "no @lim_data" "Schwere, therapieresistente Akneformen." "no @lim_data" "Formes graves de l'acn\303\251, r\303\251sistantes \303\240 la th\303\251rapie." "no @lim_data" "Forme gravi di acne, resistenti alla terapia." SwissmedicNo5(end_tag): 56107 "no @lim_data" "Schwere, therapieresistente Akneformen." "no @lim_data" "Formes graves de l'acn\303\251, r\303\251sistantes \303\240 la th\303\251rapie." "no @lim_data" "Forme gravi di acne, resistenti alla terapia." SwissmedicNo5(end_tag): 56107 "no @lim_data" "Schwere, therapieresistente Akneformen." "no @lim_data" "Formes graves de l'acn\303\251, r\303\251sistantes \303\240 la th\303\251rapie." "no @lim_data" "Forme gravi di acne, resistenti alla terapia."
Consideration
As for @lim_texts,
@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
@app.update pointer.creator, sl_data, :bag
end
end
end
# masa
# probably here limitations are counted
@lim_texts.each do |pac_ptr, lim_data|
if (pac = pac_ptr.resolve(@app)) && (sl_entry = pac.sl_entry)
sl_ptr = sl_entry.pointer
txt_ptr = sl_ptr + :limitation_text
if lim_data.empty?
if sl_entry.limitation_text
@deleted_limitation_texts += 1
@app.delete txt_ptr
end
else
if sl_entry.limitation_text
@updated_limitation_texts += 1
else
@created_limitation_texts += 1
end
@app.update txt_ptr.creator, lim_data, :bag
end
end
end
Experiment
* run update_bsv method with only 10 data
Result
Created SL-Entries 0 Updated SL-Entries 10 Deleted SL-Entries 0 Created Limitation-Texts 4 Updated Limitation-Texts 6 Deleted Limitation-Texts 0
Search result

Notes
Confirm the limitation data parsed
src/plugin/bsv_xml.rb
print "txt_ptr="
p txt_ptr
print "lim_data="
pp lim_data
@app.update txt_ptr.creator, lim_data, :bag
Result
txt_ptr=#<ODDB::Persistence::Pointer:0x7ff6749dbb70 @directions=[[:registration, "55972"], [:sequence, "01"], [:package, "011"], [:sl_entry], [:limitation_text]]>
lim_data={:de=>
#<ODDB::Text::Chapter:0x7f1c43c0f2b8
@heading="",
@sections=
[#<ODDB::Text::Section:0x7f1c43c0f1c8
@paragraphs=
[#<ODDB::Text::Paragraph:0x7f1c43c0f088
@format=
#<ODDB::Text::Format:0x7f1c43c0eed0 @end=-1, @start=0, @values=[]>,
@formats=
[#<ODDB::Text::Format:0x7f1c43c0eed0 @end=-1, @start=0, @values=[]>],
@preformatted=false,
@raw_txt=nil,
@text="Schwere, therapieresistente Akneformen.">],
@subheading="Isotretinoin Mepha\n">]>,
:fr=>
#<ODDB::Text::Chapter:0x7f1c43c0d378
@heading="",
@sections=
[#<ODDB::Text::Section:0x7f1c43c0d260
@paragraphs=
[#<ODDB::Text::Paragraph:0x7f1c43c0d148
@format=
#<ODDB::Text::Format:0x7f1c43c0cf90 @end=-1, @start=0, @values=[]>,
@formats=
[#<ODDB::Text::Format:0x7f1c43c0cf90 @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">]>,
:it=>
#<ODDB::Text::Chapter:0x7f1c43c0b730
@heading="",
@sections=
[#<ODDB::Text::Section:0x7f1c43c0b640
@paragraphs=
[#<ODDB::Text::Paragraph:0x7f1c43c0b528
@format=
#<ODDB::Text::Format:0x7f1c43c0b3c0 @end=-1, @start=0, @values=[]>,
@formats=
[#<ODDB::Text::Format:0x7f1c43c0b3c0 @end=-1, @start=0, @values=[]>],
@preformatted=false,
@raw_txt=nil,
@text="Forme gravi di acne, resistenti alla terapia.">],
@subheading="Isotretinoine Mepha\n">]>}
....
txt_ptr=#<ODDB::Persistence::Pointer:0x7ff6743d3b60 @directions=[[:registration, "56107"], [:sequence, "02"], [:package, "008"], [:sl_entry], [:limitation_text]]>
lim_data={:de=>
#<ODDB::Text::Chapter:0x7f1c43608180
@heading="",
@sections=
[#<ODDB::Text::Section:0x7f1c43607aa0
@paragraphs=
[#<ODDB::Text::Paragraph:0x7f1c43607988
@format=
#<ODDB::Text::Format:0x7f1c43607848 @end=-1, @start=0, @values=[]>,
@formats=
[#<ODDB::Text::Format:0x7f1c43607848 @end=-1, @start=0, @values=[]>],
@preformatted=false,
@raw_txt=nil,
@text="Schwere, therapieresistente Akneformen.">],
@subheading="Isotretinoin Teva\n">]>,
:fr=>
#<ODDB::Text::Chapter:0x7f1c436068a8
@heading="",
@sections=
[#<ODDB::Text::Section:0x7f1c436061c8
@paragraphs=
[#<ODDB::Text::Paragraph:0x7f1c436060b0
@format=
#<ODDB::Text::Format:0x7f1c43605f70 @end=-1, @start=0, @values=[]>,
@formats=
[#<ODDB::Text::Format:0x7f1c43605f70 @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">]>,
:it=>
#<ODDB::Text::Chapter:0x7f1c43604fd0
@heading="",
@sections=
[#<ODDB::Text::Section:0x7f1c436048f0
@paragraphs=
[#<ODDB::Text::Paragraph:0x7f1c436047d8
@format=
#<ODDB::Text::Format:0x7f1c43604698 @end=-1, @start=0, @values=[]>,
@formats=
[#<ODDB::Text::Format:0x7f1c43604698 @end=-1, @start=0, @values=[]>],
@preformatted=false,
@raw_txt=nil,
@text="Forme gravi di acne, resistenti alla terapia.">],
@subheading="Isotretinoin Teva\n">]>}
Notes
Confirm data
src/plugin/bsv_xml.rb
@sl_entries.each do |pac_ptr, sl_data|
print "pac_ptr="
p pac_ptr
print "sl_data="
pp sl_data
Result
pac_ptr=#<ODDB::Persistence::Pointer:0x7ffc904718e8 @directions=[[:registration, "55972"], [:sequence, "01"], [:package, "011"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sat, 01 Feb 2003,
:limitation=>nil,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sat, 01 Feb 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7ffc90476320 @directions=[[:registration, "55972"], [:sequence, "01"], [:package, "009"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sat, 01 Feb 2003,
:limitation=>nil,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sat, 01 Feb 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7ffc9045d6b8 @directions=[[:registration, "55972"], [:sequence, "02"], [:package, "015"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sat, 01 Feb 2003,
:limitation=>nil,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sat, 01 Feb 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7ffc90461c18 @directions=[[:registration, "55972"], [:sequence, "02"], [:package, "013"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sat, 01 Feb 2003,
:limitation=>nil,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sat, 01 Feb 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7ffc9044dad8 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sun, 01 Jul 2007,
:limitation=>nil,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sun, 01 Jul 2007}
pac_ptr=#<ODDB::Persistence::Pointer:0x7ffc9044a658 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "017"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sun, 01 Jul 2007,
:limitation=>nil,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sun, 01 Jul 2007}
pac_ptr=#<ODDB::Persistence::Pointer:0x7ffc906f8418 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17885",
:status=>"0",
:introduction_date=>Thu, 01 May 2003,
:limitation=>nil,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Thu, 01 May 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7ffc906fed68 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "002"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17885",
:status=>"0",
:introduction_date=>Thu, 01 May 2003,
:limitation=>nil,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Thu, 01 May 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7ffc906e5200 @directions=[[:registration, "56107"], [:sequence, "02"], [:package, "006"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17885",
:status=>"0",
:introduction_date=>Thu, 01 May 2003,
:limitation=>nil,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Thu, 01 May 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7ffc906df490 @directions=[[:registration, "56107"], [:sequence, "02"], [:package, "008"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17885",
:status=>"0",
:introduction_date=>Thu, 01 May 2003,
:limitation=>nil,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Thu, 01 May 2003}
Consideration
Try it again
@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
@app.update pointer.creator, sl_data, :bag
end
end
print "pac_ptr="
p pac_ptr
print "sl_data="
pp sl_data
end
Result
pac_ptr=#<ODDB::Persistence::Pointer:0x7f1d42637778 @directions=[[:registration, "55972"], [:sequence, "01"], [:package, "011"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sat, 01 Feb 2003,
:limitation=>true,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sat, 01 Feb 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7f1d4263c160 @directions=[[:registration, "55972"], [:sequence, "01"], [:package, "009"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sat, 01 Feb 2003,
:limitation=>true,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sat, 01 Feb 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7f1d42625370 @directions=[[:registration, "55972"], [:sequence, "02"], [:package, "015"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sat, 01 Feb 2003,
:limitation=>true,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sat, 01 Feb 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7f1d42629380 @directions=[[:registration, "55972"], [:sequence, "02"], [:package, "013"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sat, 01 Feb 2003,
:limitation=>true,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sat, 01 Feb 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7f1d426154c0 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sun, 01 Jul 2007,
:limitation=>true,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sun, 01 Jul 2007}
pac_ptr=#<ODDB::Persistence::Pointer:0x7f1d426122e8 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "017"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17846",
:status=>"0",
:introduction_date=>Sun, 01 Jul 2007,
:limitation=>true,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Sun, 01 Jul 2007}
pac_ptr=#<ODDB::Persistence::Pointer:0x7f1d428b9af0 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17885",
:status=>"0",
:introduction_date=>Thu, 01 May 2003,
:limitation=>true,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Thu, 01 May 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7f1d428bf388 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "002"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17885",
:status=>"0",
:introduction_date=>Thu, 01 May 2003,
:limitation=>true,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Thu, 01 May 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7f1d428a4880 @directions=[[:registration, "56107"], [:sequence, "02"], [:package, "006"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17885",
:status=>"0",
:introduction_date=>Thu, 01 May 2003,
:limitation=>true,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Thu, 01 May 2003}
pac_ptr=#<ODDB::Persistence::Pointer:0x7f1d4289e278 @directions=[[:registration, "56107"], [:sequence, "02"], [:package, "008"]]>
sl_data={:limitation_points=>nil,
:bsv_dossier=>"17885",
:status=>"0",
:introduction_date=>Thu, 01 May 2003,
:limitation=>true,
:valid_until=>Fri, 31 Dec 9999,
:valid_from=>Thu, 01 May 2003}
Consideration
So
Confrim2
Setting
src/plugin/bsv_xml.rb
print "txt_ptr="
p txt_ptr
print "sl_enry.limitation_text="
pp sl_entry.limitation_text
@app.update txt_ptr.creator, lim_data, :bag
Result
txt_ptr=#<ODDB::Persistence::Pointer:0x7f9a28118040 @directions=[[:registration, "55972"], [:sequence, "01"], [:package, "011"], [:sl_entry], [:limitation_text]]> sl_enry.limitation_text=nil txt_ptr=#<ODDB::Persistence::Pointer:0x7f9a280e8a98 @directions=[[:registration, "55972"], [:sequence, "01"], [:package, "009"], [:sl_entry], [:limitation_text]]> sl_enry.limitation_text=nil txt_ptr=#<ODDB::Persistence::Pointer:0x7f9a27f91b40 @directions=[[:registration, "55972"], [:sequence, "02"], [:package, "015"], [:sl_entry], [:limitation_text]]> sl_enry.limitation_text=#<ODDB::LimitationText:0x7f9a27fb46e0 @odba_class=nil, @odba_container=nil, @odba_id=11081906, @receiver=nil, @receiver_loaded=nil> txt_ptr=#<ODDB::Persistence::Pointer:0x7f9a27f838d8 @directions=[[:registration, "55972"], [:sequence, "02"], [:package, "013"], [:sl_entry], [:limitation_text]]> sl_enry.limitation_text=#<ODDB::LimitationText:0x7f9a27fa0500 @odba_class=nil, @odba_container=nil, @odba_id=11081907, @receiver=nil, @receiver_loaded=nil> txt_ptr=#<ODDB::Persistence::Pointer:0x7f9a27e51f00 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "019"], [:sl_entry], [:limitation_text]]> sl_enry.limitation_text=#<ODDB::LimitationText:0x7f9a27e74708 @odba_class=nil, @odba_container=nil, @odba_id=10899070, @receiver=nil, @receiver_loaded=nil> txt_ptr=#<ODDB::Persistence::Pointer:0x7f9a27e42410 @directions=[[:registration, "55972"], [:sequence, "03"], [:package, "017"], [:sl_entry], [:limitation_text]]> sl_enry.limitation_text=#<ODDB::LimitationText:0x7f9a27e5fd80 @odba_class=nil, @odba_container=nil, @odba_id=10899071, @receiver=nil, @receiver_loaded=nil> txt_ptr=#<ODDB::Persistence::Pointer:0x7f9a27d0a9d0 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "004"], [:sl_entry], [:limitation_text]]> sl_enry.limitation_text=nil txt_ptr=#<ODDB::Persistence::Pointer:0x7f9a27cfd578 @directions=[[:registration, "56107"], [:sequence, "01"], [:package, "002"], [:sl_entry], [:limitation_text]]> sl_enry.limitation_text=nil txt_ptr=#<ODDB::Persistence::Pointer:0x7f9a27bdf3d0 @directions=[[:registration, "56107"], [:sequence, "02"], [:package, "006"], [:sl_entry], [:limitation_text]]> sl_enry.limitation_text=nil txt_ptr=#<ODDB::Persistence::Pointer:0x7f9a27bd4e80 @directions=[[:registration, "56107"], [:sequence, "02"], [:package, "008"], [:sl_entry], [:limitation_text]]> sl_enry.limitation_text=nil
Screen Shots
Before

After

Therefore
Mail https://mail.google.com/a/ywesee.com/#inbox/12b386d75ffa3f24