view · edit · sidebar · attach · print · history

20130925-import-fi-not-in-packages-2

<< | Index | >>


Summary

  • Import FI even when it is not yet in Packungen.xls

Commits

Index


Import FI even when it is not yet in Packungen.xls

Fixed an error in my code for the case where new products don't have an ATC-Code. Added lists of new IKSNR to reports. Reloaded the DB.

Running the import and checking with bin/admin shows, that the info for Xeljanz is correctly extracted from AIPS.xml.

2013-09-25 08:11:38 +0200: create_registration info #<struct Struct::SwissmedicMetaInfo iksnr="62630", atcCode="L04AA29", title="Xeljanz", authHolder="Pfizer AG", substances="Tofacitinibum">
2013-09-25 08:11:38 +0200: create_registration set company 'Pfizer AG'
2013-09-25 08:11:44 +0200: create_registration created atc L04AA29
2013-09-25 08:11:45 +0200: create_registration 62630 :!create,:!registration,62630..
2013-09-25 08:11:45 +0200: Check 1 atcCode not found
2013-09-25 08:11:45 +0200: Check 3 registration company Pfizer AG
2013-09-25 08:11:45 +0200: Check 4 registration iksnr 62630
2013-09-25 08:11:45 +0200: Check 5 registration name_base Xeljanz

ch.oddb> self.registration('34921').name_base
-> Furadantin retard
ch.oddb> registration('62630').class
-> NilClass
ch.oddb> 

Code to insert was


    def create_registration(info)
      puts_sync "create_registration info #{info.inspect}"
      # should probably be similar to method update_registration in src/plugin/swissmedic.rb
      reg_ptr = Persistence::Pointer.new([:registration, info.iksnr]).creator
      args = { 
        :ith_swissmedic      => nil,
        :production_science  => nil,
        :vaccine             => nil,
        :registration_date   => nil,
        :expiration_date     => nil,
        :renewal_flag        => false,
        :renewal_flag_swissmedic => false,
        :inactive_date       => nil,
        :export_flag         => nil,
      }

      company_args = { :name => info.authHolder, :business_area => 'ba_pharma' }
      company = nil
      if(company = @app.company_by_name(info.authHolder, 0.8))
        puts_sync "create_registration set company '#{info.authHolder}'"
        @app.update company.pointer, args
      else
        puts_sync "create_registration created company #{info.authHolder}"
        company_ptr = Persistence::Pointer.new(:company).creator
        company = @app.update company_ptr, company_args
      end
      args.store :company, company.pointer

      registration = @app.update reg_ptr, args, :swissmedic_text_info

      # create dummy sequence 00 TODO: remove this sequence when Packungen.xls contains this iksnr
      # seq_ptr = Persistence::Pointer.new([:sequence, 0]).creator
      seq_ptr = (registration.pointer + [:sequence, 0]).creator
      unless seq_ptr
         puts_sync "Failed to create"
         exit 2
      end
      seq_args = { 
        :composition_text => nil,
        :name_base        => info.title,
        :name_descr       => nil,
        :dose             => nil,
        :sequence_date    => nil,
        :export_flag      => nil,
      }
      if info.atcCode and atc = @app.unique_atc_class(info.atcCode)
        puts_sync "create_registration found atc #{info.atcCode}"
        seq_args.store :atc_class, atc.code
      else
        puts_sync "create_registration created atc #{info.atcCode}"
        seq_args.store :atc_class, info.atcCode
      end
      res = @app.update seq_ptr, seq_args, :swissmedic_text_info

      puts_sync "create_registration #{info.iksnr} #{reg_ptr.inspect}"      
      if @app.atc_classes and info.atcCode and @app.atc_classes[info.atcCode]
        puts_sync "Check 1 atcCode #{@app.atc_classes[info.atcCode].id}"
      else
        puts_sync "Check 1 atcCode not found"
      end
#      puts_sync "Check 2 registration substance_names #{@app.registration(info.iksnr).substance_names}"
      if reg = @app.registration(info.iksnr) and not defined?(MiniTest)
        puts_sync "Check 3 registration company #{reg.company}"
        puts_sync "Check 4 registration iksnr #{reg.iksnr}"
        puts_sync "Check 5 registration name_base #{reg.name_base}"
      end
      @new_iksnrs[info.iksnr] = info.title
    end    

The received E-Mail contained the list of the new iksnr and showed:


Create Iks-Numbers: 28
Aprokam® (63029)
Desloratadin Spirig HC®  (63030)
Isoniazid USP (62438)
Latuda (62785)
Levocetirizin Spirig HC® (62920)
Lorado® Pollen Sandoz (57515)
Natrium-Bicarbonat B. Braun (33709)
Nicorette® Spray zur Anwendung in der Mundhöhle (62566)
Prick-Test (67769)
Rebalance® Rx (62658)
Simvastatin-Mepha® 20/40/80  (62612)
STALORAL Pollen, Lösung zur sublingualen Anwendung (69870)
Synalar®-N (29300)
Torasemid Helvepharm (57487)
Xeljanz (62630)
Yellox (62786)
Co-Losartan Spirig® (58458)
Diencéphale/Zwischenhirn Sérocytol® (00828)
Dr. Brand Salbe (17644)
Infludo® Tropfen (12498)
Magnesia S. Pellegrino® (10754)
Memoria® Tropfen (62470)
Mucoseptal® (42180)
NovoNorm® (54371)
Practomil® (31919)
Sanukehl® Staph D5, Injektionslösung (72736)
Vinceel, Spray zur Anwendung in der Mundhöhle (62583)
Weleda Fieberbläschen-Salbe (52265)
<..>
New/Updates FI/PI from swissmedicinfo.ch
Skipped FI/PI form swissmedicinfo.ch
[]  ISKNR : Fachinfo - DE - Xeljanz
[]  ISKNR : Fachinfo - FR - Xeljanz®
[]  ISKNR : Patinfo - DE - Xeljanz
[]  ISKNR : Patinfo - FR - Xeljanz®
Invalid FI/PI from swissmedicXML
Not found FI/PI in swissmedicXML

After double checking I could see that the data was correctly filled, except for SwissmedicMetaInfo iksnr="54371", atcCode=nil, title="NovoNorm®", authHolder="Novo Nordisk Pharma AG", substances=nil>

Banged my head, but I don't understand why I am unable to avoid this error. Finally found it. 54371 is an 'old' number. Therefore I looked it up in Packungen.xls and found that it is an "ad us. vet." product. I suspect that we have relicts of a sequence belonging to 54371 laying around in our database.

No. This is not the case. Simply there is a missmatch between Packungen.xls which has

54371	1	Clomicalm 5 ad us.vet., Tabletten	Novartis Tiergesundheit AG		QN06AA04	Tierarzneimittel	05.09.1997	05.09.1997	26.02.2018	012	30	Tablette(n)	B	clomipramini hydrochloridum	clomipramini hydrochloridum 5 mg, aromatica, excipients per tablet.	Serotonin Wiederaufnahmehemmer für Hunde

and Aips_download.xml, which has no occurrence of "Rimadyl", but has

  <medicalInformation type="pi" version="4" lang="de" safetyRelevant="false">
    <title>NovoNorm®</title>
    <authHolder>Novo Nordisk Pharma AG</authHolder>
    <authNrs>54371</authNrs>

Conclusion: MetaTag 54371 are edited by Hand and wrongly copied from the HTML, where they show up correctly '54571'.

Pushed commits:

Wanting to understand what is happening I tried to run the unit-tests for oddbapp.rb. They fail without giving the minitest out

Problems running test-oddbapp

The only output I see when running test/util/oddbapp.rb is like this

Eprocess: test/test_util/oddbapp.rb
init system
init system: 0.000481796
setup drb-delegation
reset
reset: 0.000515884

Adding a line in $stdout.puts "teardown name is #{name}"; $stdout.flush in the teardown showed that it happened again even when disabling the named test.

After adding a counter to get the number occurrences in App.initialize src/util/oddbapp.rb I see that it fails exactly after 200 occurrences. Therefore it probably hits a limitation counter.

When removing about a third of tests in test/test_util/oddbapp.rb. I get errors of the kind

123) Error:
TestOddbApp#test_delete_registration:
DRb::DRbConnError: drbssl://localhost:9997 - #<Errno::ECONNREFUSED: Connection refused - connect(2)>
    /home/niklaus/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/drb/drb.rb:736:in `rescue in block in open'
    /home/niklaus/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/drb/drb.rb:730:in `block in open'
    /home/niklaus/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/drb/drb.rb:729:in `each'
    /home/niklaus/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/drb/drb.rb:729:in `open'
    /home/niklaus/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/drb/drb.rb:1191:in `initialize'
    /home/niklaus/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/drb/drb.rb:1171:in `new'
    /home/niklaus/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/drb/drb.rb:1171:in `open'
    /home/niklaus/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/drb/drb.rb:1087:in `block in method_missing'
    /home/niklaus/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/drb/drb.rb:1105:in `with_friend'
    /home/niklaus/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/drb/drb.rb:1086:in `method_missing'
    /home/niklaus/.rvm/gems/ruby-1.9.3-p448/gems/sbsm-1.2.3/lib/sbsm/drb.rb:17:in `respond_to?'
    /home/niklaus/.rvm/gems/ruby-1.9.3-p448/gems/flexmock-1.3.2/lib/flexmock/partial_mock.rb:265:in `create_alias_for_existing_method'
    /home/niklaus/.rvm/gems/ruby-1.9.3-p448/gems/flexmock-1.3.2/lib/flexmock/partial_mock.rb:245:in `stow_existing_definition'
    /home/niklaus/.rvm/gems/ruby-1.9.3-p448/gems/flexmock-1.3.2/lib/flexmock/partial_mock.rb:99:in `add_mock_method'
    /home/niklaus/.rvm/gems/ruby-1.9.3-p448/gems/flexmock-1.3.2/lib/flexmock/partial_mock.rb:48:in `initialize'
    /home/niklaus/.rvm/gems/ruby-1.9.3-p448/gems/flexmock-1.3.2/lib/flexmock/mock_container.rb:271:in `new'
    /home/niklaus/.rvm/gems/ruby-1.9.3-p448/gems/flexmock-1.3.2/lib/flexmock/mock_container.rb:271:in `make_partial_proxy'
    /home/niklaus/.rvm/gems/ruby-1.9.3-p448/gems/flexmock-1.3.2/lib/flexmock/mock_container.rb:153:in `flexmock'
    test/test_util/oddbapp.rb:209:in `setup'

Now I add a call to pry in ~/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/test/unit.rb at line 167 (before RaiseException) in non_options, then the unit tests run and inspecting the _run variable of the pry debugger I see the cause. See Attach:debug.txt.

Opened an issue for this problem. See https://github.com/jimweirich/flexmock/issues/16. The problem is not present with Ruby 2.0.0

Worked one hour or so on commit Fixes some failure and accelerating the Unit-test. Introducing some small changes (sleeping only) in ext/meddata/src/session.rb brings the time needed to run its corresponding unit test down from 200 seconds to 2!

view · edit · sidebar · attach · print · history
Page last modified on September 25, 2013, at 09:30 PM