<< | Index | >>
Continuing search where the patinfo.pointer of Floxal is changed when running imports of Mepha.
Finding all sequences which have Floxal as iksnr (51357, 51358, 55383) or the corresponding patinfo has the name Floxal. After running import Bausch this looks like the following.
ch.oddb> res=[]; sequences.each{ |x| res << [x.pointer, x.iksnr] \ if /51357|51358|55383/.match(x.iksnr) }; res -> [ [:!registration,51358!sequence,01., "51358"], [:!registration,51357!sequence,01., "51357"], [:!registration,55383!sequence,01., "55383"]] ch.oddb> res=[]; sequences.each{ |x| res << [x.pointer, x.iksnr, x.patinfo.pointer] \ if /51357|51358|55383/.match(x.iksnr) or (x.patinfo and /Floxal/i.match(x.patinfo.name_base)) }; res -> [ [:!registration,51358!sequence,01., "51358", :!patinfo,992.], [:!registration,51357!sequence,01., "51357", :!patinfo,992.], [:!registration,55383!sequence,01., "55383", :!patinfo,992.]]
After running import Boehringer, the result looks like:
ch.oddb> res=[]; sequences.each{ |x| res << [x.pointer, x.iksnr, x.patinfo.pointer] if /51357|51358|55383/.match(x.iksnr) }; res -> [[:!registration,51358!sequence,01., "51358", :!patinfo,992.], [:!registration,51357!sequence,01., "51357", :!patinfo,992.], [:!registration,55383!sequence,01., "55383", :!patinfo,992.]] ch.oddb> res=[]; sequences.each{ |x| res << [x.pointer, x.iksnr, x.patinfo.pointer] if /51357|51358|55383/.match(x.iksnr) or (x.patinfo and /Floxal/i.match(x.patinfo.name_base)) }; res -> [[:!registration,51358!sequence,01., "51358", :!patinfo,992.], [:!registration,51357!sequence,01., "51357", :!patinfo,992.], [:!registration,55383!sequence,01., "55383", :!patinfo,992.]]
But http://oddb.niklaus.org/de/gcc/patinfo/reg/51358/seq/01 displays "Patienteninformation zu Buscopan® Dragées/Suppositorien:"
Now beginning to find the problem
ch.oddb> registration('51357').name_base -> Floxal ch.oddb> registration('51357').sequences.first[1].patinfo.name_base -> Fluconazol-Mepha 50 N res = []; reg = registration('51357'); reg.sequences.each{ |seq| res << [seq[1].patinfo.name_base, reg.name_base, seq[1].patinfo.pointer]\ if not seq[1].patinfo.name_base.eql?(reg.name_base)}; res -> [["Fluconazol-Mepha 50 N", "Floxal", :!patinfo,992.]] ch.oddb> res = []; registrations.each{|aReg| reg= aReg[1]; reg.sequences.each{ |seq| next if seq[1].patinfo == nil; res << [seq[1].patinfo.name_base, reg.name_base, seq[1].patinfo.pointer] if not seq[1].patinfo.name_base.eql?(reg.name_base)} }; res.size -> 2173 ch.oddb> sequences.size -> 16324 ch.oddb> res = []; registrations.each{|aReg| reg= aReg[1]; reg.sequences.each{ |seq| next if seq[1].patinfo == nil; res << [seq[1].patinfo.name_base, reg.iksnr, reg.name_base, seq[1].patinfo.pointer] if not seq[1].patinfo.name_base.eql?(reg.name_base)} }; res[0] -> ["Insulin CP Pharma Hypurin Porcine Neutral Vial", "54930", "Insulin CP Pharma Hypurin Porcine Isophane Vial", :!patinfo,30021418.] ch.oddb> res = []; registrations.each{|aReg| reg= aReg[1]; reg.sequences.each{ |seq| next if seq[1].patinfo == nil; res << [seq[1].patinfo.name_base, reg.iksnr, reg.name_base, seq[1].patinfo.pointer] if not seq[1].patinfo.name_base.eql?(reg.name_base)} }; res[1] -> ["Insulin CP Pharma Hypurin Porcine Neutral Vial", "54931", "Insulin CP Pharma Hypurin Porcine Isophane Patronen", :!patinfo,30021418.] ch.oddb> res = []; registrations.each{|aReg| reg= aReg[1]; reg.sequences.each{ |seq| next if seq[1].patinfo == nil; res << [seq[1].patinfo.name_base, reg.iksnr, reg.name_base, seq[1].patinfo.pointer] if not seq[1].patinfo.name_base.eql?(reg.name_base)} }; res[2] -> ["Insulin CP Pharma Hypurin Porcine Neutral Vial", "54933", "Insulin CP Pharma Hypurin Porcine 30/70 Mix Patronen", :!patinfo,30021418.] ch.oddb> res = []; registrations.each{|aReg| reg= aReg[1]; reg.sequences.each{ |seq| next if seq[1].patinfo == nil; res << [seq[1].patinfo.name_base, reg.iksnr, reg.name_base, seq[1].patinfo.pointer] if not seq[1].patinfo.name_base.eql?(reg.name_base)} }; res[3] -> ["Lampren 100 mg, Kapseln", "34914", "Lampren 50 mg, Kapseln", :!patinfo,2843.]
Are there really 2173 wrong (out of 16324) entries in our database? No, as we have too many false positives, eg. ["Lampren 100 mg, Kapseln", "34914", "Lampren 50 mg, Kapseln", :!patinfo,2843.]. Refining search to compare only the first word.
ch.oddb> $res = []; registrations.each{|aReg| reg= aReg[1]; reg.sequences.each{ |seq| next if (seq[1].patinfo == nil or \ seq[1].patinfo.name_base == nil); $res << [seq[1].patinfo.name_base, reg.iksnr, reg.name_base, seq[1].patinfo.pointer] \ if not seq[1].patinfo.name_base.split()[0].eql?(reg.name_base.split()[0])} }; $res.size -> 634 $res[0] -> ["Creon 25'000", "59285", "Arlevert", :!patinfo,23694911.] ch.oddb> $res[1] -> ["Hepeel", "46474", "Alpinamed Wallwurz-Gel", :!patinfo,29696333.] ch.oddb> $res[2] -> ["Dulcolax Picosulfat", "44644", "Elotrans", :!patinfo,1253.] ch.oddb> $res[3] -> ["Coop Vitality Halsweh-Lutschtabletten", "55495", "Activital forte", :!patinfo,1280.]
Now. This looks a lot better. Verifying it with Arlevert, which has only a PI and no FI. Using Swissmedic nur 55495. No FI attached, three sequences, but not real PI attached. Was this item noch correctly.
Dumping the contents of $res into /tmp/problems.txt using $ausgabe = File.open('/tmp/problems.txt', 'w+'); $res.each{ |item| $ausgabe.puts item.inspect}; $ausgabe.close
. See Attach:problems.txt
Now, this report looks good and we find there also old friends like 'Cardiospermum Salbe Cosmochema'
How to proceed? I think it might be good idea to create first a job which checks the consistency of the database. It should be run regularly and provide the following checks
Implemented check-job which seems to work. No log is sent back at the moment. Added also an udate-Job which calls first the check-job to get all the iksnrs to re-import. When running it, got the following error
2013-08-13 13:46:03 +0200NoMethodError: undefined method `fachinfo' for nil:NilClass when updating index 'interactions_index_de' with a ODDB::Sequence ["(eval):2:in `block in proc_instance_origin'", "/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/index.rb:202:in `call'", "/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/index.rb:202:in `update_target'", "/usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/index.rb:161:in `update'"] [...]
As I forget to correctly join two threads. The update terminated with an error. Running the import manually now to test, whether reimporing will really help or not. Running the updater I get the error message ERROR: prepared statement "ruby-dbi:Pg:5641754001376395921.6690276" already exists
. Manually checking Limbitrol 33354.
Run importer for Floxal 51358, then Mepha to see whether Floxal is inaffected now. Manual check after restarting all ODDB-services is okay! Greatè
Reload the DB-backup again. Changed update_si_fi_pi to only change the first 10 inconsistencies in order to have several attempts to find the problem with threads.
Optimised the checks to iterate only once over all registrations. When finding problem with patinfos inside a sequence I delete the patinfo completely and reparse afterwards FI and PI to correct the situation.
After I run the update with only 10 PI to delete. I had the problem that the patinfo of Dolobene 45998 was not correctly update. Running an import for of only 45998. Now the PI for Dolobene shows up. Okay. Found the reason. Must force the options :reparse=true and :download=false. That looks good now. Time to review changes and commit.
Pushed Added check/update-jobs for swissmedicinfo fi and pi and Optimized check/update. Fix running import in case of inconsistency