<< | Index | >>
suspend
Check
Note
As far as I read the code, update_medwin_companies method is called in update_swissmedic_followers method of src/util/updater.rb. The update_medwin_companies method does as follows: 1. search the company by company name or company ean-code 2. (if the data is found) the company address, phone, fax, etc. are updated
Test
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> registration('31706').package('114').ikskey -> 31706114 ch.oddb> registration('31706').package('114').iksnr -> 31706 ch.oddb> registration('31706').package('114').ikscd -> 114 ch.oddb> registration('31706').package('114').barcode -> 7680317061142
Note
Experiment
#def search_item(eancode, lang = 'DE', search_type = :get_by_gtin) def search_item(code, search_type = :get_by_gtin, lang = 'DE') client = Savon::Client.new do | wsdl, http | wsdl.document = "https://index.ws.e-mediat.net/Swissindex/Pharma/ws_Pharma_V101.asmx?WSDL" end try_time = 3 begin #response = client.request :get_by_gtin do response = client.request search_type do soap.xml = if search_type == :get_by_gting '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GTIN xmlns="http://swissindex.e-mediat.net/SwissindexPharma_out_V101">' + code + '</GTIN> <lang xmlns="http://swissindex.e-mediat.net/SwissindexPharma_out_V101">' + lang + '</lang> </soap:Body> </soap:Envelope>' elsif search_type == :get_by_pharmacode '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <pharmacode xmlns="http://swissindex.e-mediat.net/SwissindexPharma_out_V101">' + code + '</pharmacode> <lang xmlns="http://swissindex.e-mediat.net/SwissindexPharma_out_V101">' + lang + '</lang> </soap:Body> </soap:Envelope>' end end if pharma = response.to_hash[:pharma] return pharma[:item] else return nil end ...
def load_ikskey(pharmacode) SWISSINDEX_PHARMA_SERVER.session(ODDB::Swissindex::SwissindexPharma) do |swissindex| if item = swissindex.search_item(pharmacode, :get_by_pharmacode) if ean = item[:gtin] ikskey = ean.to_s[4,8] end end end end
Result
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> ODDB::SwissindexPharmaPlugin.new(self).load_ikskey('4020608') -> 59169007
Experiment (src/plugin/swissindex.rb#load_ikskey)
def load_ikskey(pharmacode) ikskey = nil nonpharma = false SWISSINDEX_PHARMA_SERVER.session(ODDB::Swissindex::SwissindexPharma) do |swissindex| if item = swissindex.search_item(pharmacode, :get_by_pharmacode) if ean = item[:gtin] ikskey = ean.to_s[4,8] end end end unless ikskey SWISSINDEX_NONPHARMA_SERVER.session(ODDB::Swissindex::SwissindexNonpharma) do |swissindex| if item = swissindex.search_item(pharmacode, :get_by_pharmacode) if ean = item[:gtin] ikskey = ean.to_s[4,8] end end end end open("/home/masa/work/log.dat", "a"){|f| f.print "pharmacode = ", pharmacode, ", ikskey = ", ikskey f.print " (nonpharma)" if nonpharma f.print "\n" } return ikskey end
Result
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> ODDB::SwissindexPlugin.new(self).load_ikskey('4020608') -> 59169007 ch.oddb> ODDB::SwissindexPlugin.new(self).load_ikskey('1111111') ->
Experiment (src/plugin/bsv_xml.rb#load_ikskey)
def load_ikskey pcode return if pcode.to_s.empty? ODDB::SwissindexPlugin.new(@app).load_ikskey(pcode) end
Run
masa@masa ~/ywesee/oddb.org $ bin/admin ch.oddb> Updater.new(self).update_bsv
Result
Created SL-Entries 2 Updated SL-Entries 8332 Deleted SL-Entries 0 Created Limitation-Texts 0 Updated Limitation-Texts 1309 Deleted Limitation-Texts 0 Duplicate Registrations in SL 09.06.2011 0 Package-Data was completed from SL 2 SMeX/SL-Differences (Registrations) 09.06.2011 0 SMeX/SL-Differences (Packages) 09.06.2011 6 Critical Pharmacodes BAG-XML 09.06.2011 9 Missing Swissmedic-Codes in SL 09.06.2011 7 Missing Pharmacodes in SL 09.06.2011 198 Missing Swissmedic-Codes in SL (out of trade) 09.06.2011 28 Unknown Packages in SL 09.06.2011 173 Unknown Registrations in SL 09.06.2011 2 Unknown Packages in SL (out of trade) 09.06.2011 53 Packungen in der ODDB Total: 23782 Packungen ohne Pharmacode: 10695 - ausser Handel: 10683 - inaktive Registration: 1 - noch nicht auf MedWin: 11
Commit