<< | Index | >>
Reference
Check the online latest xml file data and online ch.oddb.org data
For example
ToDo
I confirmed they are totally same
Note
My hypothesis
Consideration
Follow the updating process
Note
Delete the other data than 7680545770922 from Preparations.xml
Zip Preparations.xml to XMLPublications.zip
masa@masa ~/work $ zip XMLPublications.zip Preparations.xml adding: Preparations.xml (deflated 77%)
Modify a code a little bit for experiment
#path = download_file(target_url, save_dir, file_name) path = "/home/masa/work/XMLPublications.zip"
Run
Run updater (update_bsv)
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> Updater.new(self).update_bsv
Result
Created SL-Entries 0 Updated SL-Entries 0 Deleted SL-Entries 8291 Created Limitation-Texts 0 Updated Limitation-Texts 0 Deleted Limitation-Texts 0 Duplicate Registrations in SL 07.01.2011 0 Package-Data was completed from SL 0 SMeX/SL-Differences (Registrations) 07.01.2011 0 SMeX/SL-Differences (Packages) 07.01.2011 1 Critical Pharmacodes BAG-XML 07.01.2011 0 Missing Swissmedic-Codes in SL 07.01.2011 0 Missing Pharmacodes in SL 07.01.2011 0 Missing Swissmedic-Codes in SL (out of trade) 07.01.2011 0 Unknown Packages in SL 07.01.2011 0 Unknown Registrations in SL 07.01.2011 0 Unknown Packages in SL (out of trade) 07.01.2011 0 Packungen in der ODDB Total: 23259 Packungen ohne Pharmacode: 8625 - ausser Handel: 7790 - inaktive Registration: 671 - noch nicht auf MedWin: 164
Check on browser
before
after
Experiment
def tag_end name ... when 'FlagSB20' p "getin FlagSB20" print "@text=", @text, "\n" @pac_data.store :deductible, @text == 'Y' ? :deductible_o : :deductible_g
Restart bin/oddbd
Run update_bsv
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> Updater.new(self).update_bsv
Result
"getin FlagSB20" @text=Y
Note
But
Experiment
def tag_end name case name when 'Pack' p "getin tag_end#Pack" print "@data=" p @data
Restart bin/oddbd
Run update_bsv
Result
@data={:price_exfactory=>#<ODDB::Util::Money:0x7faa6be97650 @credits=3923, @mutation_code="SLAUFNAHME", @amount=39.23, @origin="http://bag.e-mediat.net/SL2007.Web.External
/File.axd?file=XMLPublications.zip (07.01.2011)", @valid_from=Thu Jul 01 00:00:00 +0200 2010, @type="exfactory", @country="CH", @authority=:sl>, :ikscat=>"A", :pharmacode=>"4621130",
:narcotic=>false, :sl_generic_type=>:original, :price_public=>#<ODDB::Util::Money:0x7faa6be82c78 @credits=6140, @mutation_code="SLAUFNAHME", @amount=61.4, @origin="http://bag.e-mediat.net
/SL2007.Web.External/File.axd?file=XMLPublications.zip (07.01.2011)", @valid_from=Thu Jul 01 00:00:00 +0200 2010, @type="public", @country="CH", @authority=:sl>,
:deductible=>:deductible_o
}
Note
Hypothesis
Experiment
def tag_end name case name when 'Pack' p "getin tag_end#Pack" print "1. @data=" pp @data if @pack.nil? && @completed_registrations[@iksnr] && !@out_of_trade @deferred_packages.push({ :ikscd => @ikscd, :sequence => @seq_data, :package => @data, :sl_entry => @sl_data, :lim_text => @lim_data, :size => @size, }) elsif @pack && !@conflict && !@duplicate_iksnr @report.store :pharmacode_oddb, @pack.pharmacode if seq = @pack.sequence @app.update seq.pointer, @seq_data, :bag end pold = @pack.price_public pnew = @data[:price_public] unless pold && pnew pold = @pack.price_exfactory pnew = @data[:price_exfactory] end if pold && pnew if pold > pnew flag_change @pack.pointer, :price_cut elsif pold < pnew flag_change @pack.pointer, :price_rise end end print "@pack=" pp @pack print "2. @data=" pp @data ## don't take the Swissmedic-Category unless it's missing in the DB @data.delete :ikscat if @pack.ikscat @app.update @pack.pointer, @data, :bag @sl_entries.store @pack.pointer, @sl_data @lim_texts.store @pack.pointer, @lim_data end
Restart bin/oddbd
Run update_bsv
Result
1. @data={:price_exfactory=>
#<ODDB::Util::Money:0x7f2ed8186290
@amount=39.23,
@authority=:sl,
@country="CH",
@credits=3923,
@mutation_code="SLAUFNAHME",
@origin=
"http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip (07.01.2011)",
@type="exfactory",
@valid_from=Thu Jul 01 00:00:00 +0200 2010>,
:ikscat=>"A",
:pharmacode=>"4621130",
:narcotic=>false,
:sl_generic_type=>:original,
:price_public=>
#<ODDB::Util::Money:0x7f2ed8174040
@amount=61.4,
@authority=:sl,
@country="CH",
@credits=6140,
@mutation_code="SLAUFNAHME",
@origin=
"http://bag.e-mediat.net/SL2007.Web.External/File.axd?file=XMLPublications.zip (07.01.2011)",
@type="public",
@valid_from=Thu Jul 01 00:00:00 +0200 2010>,
:deductible=>:deductible_o
}
Note
Memo
What to do next?
Experiment
## don't take the Swissmedic-Category unless it's missing in the DB @data.delete :ikscat if @pack.ikscat @app.update @pack.pointer, @data, :bag @sl_entries.store @pack.pointer, @sl_data @lim_texts.store @pack.pointer, @lim_data end @app.update @pack.pointer, @data, :bag @pcode, @pack, @sl_data, @lim_data, @out_of_trade, @ikscd, @data, @size = nil when 'Preparation'
Note
Restart bin/oddbd
Run update_bsv
Result
Note
Next
Experiment (check the cache data)
## don't take the Swissmedic-Category unless it's missing in the DB @data.delete :ikscat if @pack.ikscat @app.update @pack.pointer, @data, :bag @sl_entries.store @pack.pointer, @sl_data @lim_texts.store @pack.pointer, @lim_data end print "@data[:deductible]=" pp @data[:deductible] print "@pack.deductible=" pp @pack.deductible pack_ptr = @pack.pointer pack = pack_ptr.resolve(@app) print "pack.deductible=" pp pack.deductible
Restart bin/oddbd
Run update_bsv
Result
@data[:deductible]=:deductible_o #read data from xml file
@pack.deductible=nil #cache data
pack.deductible=nil #cache data
Note
Experiment
## don't take the Swissmedic-Category unless it's missing in the DB @data.delete :ikscat if @pack.ikscat @app.update @pack.pointer, @data, :bag @sl_entries.store @pack.pointer, @sl_data @lim_texts.store @pack.pointer, @lim_data elsif @pack if @pack.deductible != @pac_data[:deductible] @app.update @pack.pointer, @data, :bag end end
Restart bin/oddbd
Run update_bsv
Result
Note
~/ywesee/oddb.org $ sudo -u postgres dropdb oddb.org ~/ywesee/oddb.org $ sudo -u postgres createdb -E UTF8 -T template0 oddb.org ~/ywesee/oddb.org $ zcat data/sql/oddb.org.20110106.sql.gz |psql -U postgres oddb.org
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> Updater.new(self).update_bsv
Changed part src/plugin/bsv_xml.rb#tag_end
## don't take the Swissmedic-Category unless it's missing in the DB @data.delete :ikscat if @pack.ikscat @app.update @pack.pointer, @data, :bag @sl_entries.store @pack.pointer, @sl_data @lim_texts.store @pack.pointer, @lim_dataelsif @pack
if @pack.deductible != @pac_data[:deductible]
@app.update @pack.pointer, @data, :bag
end
end
This is only for this test src/plugin/bsv_xml.rb#update
#path = download_file(target_url, save_dir, file_name) path = "/home/masa/work/XMLPublications.zip"
Result
Note
Test deleting a package from admin tool
suspend