view · edit · sidebar · attach · print · history

Index>

20140513-fix-swissmedic-nil-error

Summary

  • Fix Message: can't dup NilClass. in jobs/import_swissmedic
  • Adapt to new Flickr API-SSH-key
  • Emit XSD for oddb2xml

Commits

Index

Keep in Mind

---

Emit XSD for oddb2xml

We should emit an XSD for oddb2xml which should serve also as documentation for the various fields.

Added the following sub-goals to spec/builder_spec.rb

  • it should generate a valid oddb_article.xsd
  • it should generate a valid oddb_product.xsd
  • it should compare the generated xsd with the old version
  • it should have useful comments in oddb_product.xsd
  • it should return true when validating oddb_product.xml against oddb_product.xsd
  • it should enable specifying element properties, e.g. integer in a xsd file

Remarked that the page http://wiki.oddb.org/wiki.php?pagename=Swissmedic.Datendeklaration is outdated. Must be updated, too.

Running inst2xsd oddb_*.xml -outDir spec -outPrefix test create a (500 lines, 141 names) XSD file.

My initial idea to monkey patch Nokogiri to emit XSD did not work. I am asking myself whether it worth the time or whether I should just manually edit the XSD file and adding the comment manually. The size of the XSD will increase as annotation are quite verbose in XSD. And the automatically generated xsd is quite good as it e.g. limits the known values for NINCD to some known values.

Also running it over all XML files generated with rake test returns a quite different and longer (1134 lines, 320 names) XSD.

Adapt to new Flickr API-SSH-key

Continuing from the yesterday works.

Uploading photo is done using the flickraw gem, which has seen a release 0.9.8 which contains the commit Use secure endpoints

Therefore upgrading from 0.9.7 to 0.9.8 will fix the problem.

As flickr forwards the old http -> https we don't need to update the links.

Updated gem on oddb-ci2. Restarted all services and uploaded a new photo without problem.

Pushing commit Updated flickraw to 0.9.8 to use https. Install flickraw also on thinpower.

Fix Message: can't dup NilClass. in jobs/import_swissmedic

We got the following error

Plugin: ODDB::SwissmedicPlugin
Error: TypeError
Message: can't dup NilClass
Backtrace:
(eval):2:in `dup'
(eval):2:in `dup'
/var/www/oddb.org/src/model/package.rb:173:in `checkout'
/var/www/oddb.org/src/model/package.rb:479:in `checkout'
/var/www/oddb.org/src/util/persistence.rb:240:in `issue_delete'
/var/www/oddb.org/src/util/oddbapp.rb:124:in `block in delete'
/var/www/oddb.org/src/util/failsafe.rb:10:in `call'
/var/www/oddb.org/src/util/failsafe.rb:10:in `failsafe'
/var/www/oddb.org/src/util/oddbapp.rb:120:in `delete'
/var/www/oddb.org/src/command/delete.rb:11:in `execute'
/var/www/oddb.org/src/util/oddbapp.rb:698:in `execute_command'
/var/www/oddb.org/src/util/oddbapp.rb:1521:in `delete'
/var/www/oddb.org/src/plugin/swissmedic.rb:176:in `block in delete'
/var/www/oddb.org/src/plugin/swissmedic.rb:171:in `each'
/var/www/oddb.org/src/plugin/swissmedic.rb:171:in `delete'
/var/www/oddb.org/src/plugin/swissmedic.rb:75:in `update'
/var/www/oddb.org/src/util/updater.rb:398:in `block in update_swissmedic'
/var/www/oddb.org/src/util/updater.rb:500:in `call'
/var/www/oddb.org/src/util/updater.rb:500:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:396:in `update_swissmedic'
jobs/import_swissmedic:14:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `call'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/import_swissmedic:12:in `<module:Util>'
jobs/import_swissmedic:11:in `<module:ODDB>'
jobs/import_swissmedic:10:in `<main>'

I have a problem with my understanding of Ruby as the code in questions looks like this

      if @parts
        @parts.dup.each { |part| # line 173 of src/model/package.rb
          part.checkout
          part.odba_delete
        }
        @parts.odba_delete
      end

@parts.dup is preceded by check for @parts. Therefore it should never be nil.

Looking at log/oddb/debug/2014/05.log I found the following helpful lines:

2014-05-09 09:37:08 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 68 changes: {"00450"=>[:unit, :sequence], "00612"=>[:substances, :composition], "00673"=>[:expiry_date], "00683"=>[:unit, :sequence], "00687"=>[:expiry_date], "08909"=>[:expiry_date], "08910"=>[:production_science, :expiry_date], "10445"=>[:expiry_date], "10989"=>[:expiry_date], "16710"=>[:expiry_date], "22257"=>[:sequence], "24122"=>[:company], "24586"=>[:expiry_date], "25636"=>[:expiry_date], "26660"=>[:company], "26762"=>[:expiry_date, :composition], "29555"=>[:sequence], "30649"=>[:expiry_date], "30986"=>[:expiry_date], "31151"=>[:expiry_date], "31546"=>[:expiry_date], "32665"=>[:sequence], "33332"=>[:expiry_date], "33481"=>[:sequence], "33667"=>[:expiry_date], "34201"=>[:company], "35501"=>[:expiry_date], "35797"=>[:expiry_date], "38034"=>[:expiry_date], "38189"=>[:expiry_date], "38470"=>[:expiry_date], "38989"=>[:expiry_date], "39387"=>[:expiry_date], "41434"=>[:expiry_date], "41822"=>[:expiry_date], "41903"=>[:expiry_date], "41904"=>[:expiry_date], "41905"=>[:expiry_date], "42084"=>[:expiry_date], "42423"=>[:expiry_date], "42425"=>[:expiry_date], "42496"=>[:expiry_date], "42637"=>[:expiry_date], "42692"=>[:expiry_date], "42695"=>[:expiry_date], "42778"=>[:expiry_date, :composition], "44021"=>[:expiry_date], "44036"=>[:expiry_date], "44065"=>[:expiry_date], "44157"=>[:expiry_date], "44867"=>[:company], "45041"=>[:expiry_date], "45078"=>[:expiry_date], "45209"=>[:expiry_date], "45535"=>[:unit], "46259"=>[:expiry_date], "46440"=>[:expiry_date], "46529"=>[:expiry_date], "46535"=>[:expiry_date], "46673"=>[:expiry_date], "46694"=>[:company], "46908"=>[:expiry_date], "46935"=>[:expiry_date], "46996"=>[:company], "47183"=>[:company], "47333"=>[:expiry_date], "48112"=>[:expiry_date], "48787"=>[:substances], "49358"=>[:expiry_date], "49783"=>[:expiry_date], "49971"=>[:expiry_date], "50354"=>[:substances, :composition], "50373"=>[:expiry_date], "50795"=>[:expiry_date], "50844"=>[:company], "51039"=>[:expiry_date, :indication_registration], "51193"=>[:company], "51547"=>[:expiry_date], "51684"=>[:unit], "51691"=>[:unit], "51704"=>[:unit], "51809"=>[:company], "51872"=>[:expiry_date], "51908"=>[:unit], "52022"=>[:unit], "52034"=>[:name_base], "52113"=>[:name_base], "52810"=>[:expiry_date], "52958"=>[:expiry_date], "53018"=>[:expiry_date], "53105"=>[:expiry_date], "53162"=>[:expiry_date], "53178"=>[:expiry_date], "53179"=>[:expiry_date], "53244"=>[:expiry_date], "53272"=>[:expiry_date], "53712"=>[:unit], "54068"=>[:expiry_date], "54159"=>[:expiry_date], "54168"=>[:expiry_date], "54182"=>[:expiry_date], "54231"=>[:expiry_date], "54316"=>[:expiry_date], "54525"=>[:unit], "54571"=>[:expiry_date], "54604"=>[:company], "54617"=>[:expiry_date], "54937"=>[:expiry_date], "54975"=>[:expiry_date], "55045"=>[:expiry_date], "55046"=>[:expiry_date], "55057"=>[:name_base, :sequence], "55070"=>[:expiry_date], "55118"=>[:expiry_date], "55119"=>[:expiry_date], "55236"=>[:expiry_date], "55274"=>[:sequence], "55391"=>[:composition], "55650"=>[:substances], "56046"=>[:expiry_date], "56114"=>[:company], "56209"=>[:company], "56355"=>[:expiry_date], "56364"=>[:composition], "56379"=>[:size], "56381"=>[:expiry_date], "56400"=>[:name_base, :expiry_date, :indication_registration], "56401"=>[:name_base, :expiry_date, :indication_registration], "56422"=>[:new], "56457"=>[:sequence], "56722"=>[:expiry_date], "56750"=>[:expiry_date], "56755"=>[:expiry_date], "56756"=>[:expiry_date], "56885"=>[:expiry_date], "56914"=>[:substances, :composition], "56936"=>[:expiry_date], "56965"=>[:expiry_date], "57049"=>[:expiry_date], "57068"=>[:sequence, :replaced_package], "57155"=>[:expiry_date], "57346"=>[:expiry_date], "57348"=>[:company], "57813"=>[:company], "57831"=>[:company], "57924"=>[:expiry_date], "57952"=>[:expiry_date], "58009"=>[:expiry_date], "58125"=>[:expiry_date], "58271"=>[:new], "58277"=>[:unit], "58286"=>[:unit], "58325"=>[:expiry_date, :composition], "58377"=>[:expiry_date], "58440"=>[:expiry_date], "58443"=>[:expiry_date], "58486"=>[:expiry_date], "58492"=>[:expiry_date], "58513"=>[:unit], "58758"=>[:expiry_date], "58805"=>[:expiry_date], "58834"=>[:sequence, :replaced_package, :replaced_package], "58867"=>[:expiry_date], "59090"=>[:expiry_date], "59092"=>[:expiry_date], "59193"=>[:expiry_date], "59209"=>[:expiry_date], "59267"=>[:expiry_date], "59311"=>[:expiry_date], "59324"=>[:name_base], "59436"=>[:expiry_date], "59437"=>[:expiry_date], "59796"=>[:expiry_date], "60019"=>[:sequence], "60058"=>[:expiry_date], "60128"=>[:expiry_date], "60374"=>[:expiry_date], "60450"=>[:expiry_date], "60488"=>[:indication_registration, :unit, :sequence], "60539"=>[:expiry_date], "60555"=>[:expiry_date], "60719"=>[:expiry_date], "60720"=>[:expiry_date], "60808"=>[:expiry_date], "60954"=>[:expiry_date], "61251"=>[:expiry_date, :composition], "61252"=>[:expiry_date, :composition], "61456"=>[:composition], "61653"=>[:expiry_date], "62132"=>[:sequence], "62155"=>[:composition], "62156"=>[:composition], "62255"=>[:sequence, :replaced_package], "62574"=>[:sequence], "62575"=>[:unit], "62608"=>[:sequence], "62674"=>[:new], "62764"=>[:new], "62783"=>[:expiry_date], "62827"=>[:new], "62829"=>[:new], "62987"=>[:new], "63049"=>[:new], "63053"=>[:indication_registration, :indication_sequence], "63177"=>[:new], "63185"=>[:new], "63191"=>[:new], "63238"=>[:new], "63241"=>[:new], "63265"=>[:new], "65005"=>[:new], "65044"=>[:new], "65110"=>[:new], "65202"=>[:new], "65224"=>[:new], "35342"=>[:delete], "36227"=>[:delete], "36231"=>[:delete], "36234"=>[:delete], "38382"=>[:delete], "38983"=>[:delete], "46010"=>[:delete], "47254"=>[:delete], "48506"=>[:delete], "50788"=>[:delete], "53232"=>[:delete], "54523"=>[:delete], "55022"=>[:delete], "55957"=>[:delete], "57224"=>[:delete], "57603"=>[:delete], "57932"=>[:delete], "58418"=>[:delete], "58508"=>[:delete], "58510"=>[:delete], "58558"=>[:delete], "59201"=>[:delete], "59399"=>[:delete], "59428"=>[:delete], "60395"=>[:delete], "60560"=>[:delete], "60723"=>[:delete], "61429"=>[:delete], "61430"=>[:delete], "62767"=>[:delete]}
<..>
2014-05-09 11:39:43 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 173: delete iksnr '35342' seqnr 01 pack  
2014-05-09 11:39:43 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 175: delete iksnr '35342' ptr :!registration,35342!sequence,01!package,028. row ["35342", "01", "028", 0]  
<..>
2014-05-09 11:50:45 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 162: deactivate iksnr '35342' seqnr 01 pack
<..>
2014-05-09 11:50:45 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 162: deactivate iksnr '35342' seqnr 01 pack
<..>
2014-05-12 16:27:52 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 68 changes: {"00450"=>[:unit, :sequence], "00612"=>[:substances, :composition], "00673"=>[:expiry_date], "00683"=>[:unit, :sequence], "00687"=>[:expiry_date], "08909"=>[:expiry_date], "08910"=>[:production_science, :expiry_date], "10445"=>[:expiry_date], "10989"=>[:expiry_date], "16710"=>[:expiry_date], "22257"=>[:sequence], "24122"=>[:company], "24586"=>[:expiry_date], "25636"=>[:expiry_date], "26660"=>[:company], "26762"=>[:expiry_date, :composition], "29555"=>[:sequence], "30649"=>[:expiry_date], "30986"=>[:expiry_date], "31151"=>[:expiry_date], "31546"=>[:expiry_date], "32665"=>[:sequence], "33332"=>[:expiry_date], "33481"=>[:sequence], "33667"=>[:expiry_date], "34201"=>[:company], "35501"=>[:expiry_date], "35797"=>[:expiry_date], "38034"=>[:expiry_date], "38189"=>[:expiry_date], "38470"=>[:expiry_date], "38989"=>[:expiry_date], "39387"=>[:expiry_date], "41434"=>[:expiry_date], "41822"=>[:expiry_date], "41903"=>[:expiry_date], "41904"=>[:expiry_date], "41905"=>[:expiry_date], "42084"=>[:expiry_date], "42423"=>[:expiry_date], "42425"=>[:expiry_date], "42496"=>[:expiry_date], "42637"=>[:expiry_date], "42692"=>[:expiry_date], "42695"=>[:expiry_date], "42778"=>[:expiry_date, :composition], "44021"=>[:expiry_date], "44036"=>[:expiry_date], "44065"=>[:expiry_date], "44157"=>[:expiry_date], "44867"=>[:company], "45041"=>[:expiry_date], "45078"=>[:expiry_date], "45209"=>[:expiry_date], "45535"=>[:unit], "46259"=>[:expiry_date], "46440"=>[:expiry_date], "46529"=>[:expiry_date], "46535"=>[:expiry_date], "46673"=>[:expiry_date], "46694"=>[:company], "46908"=>[:expiry_date], "46935"=>[:expiry_date], "46996"=>[:company], "47183"=>[:company], "47333"=>[:expiry_date], "48112"=>[:expiry_date], "48787"=>[:substances], "49358"=>[:expiry_date], "49783"=>[:expiry_date], "49971"=>[:expiry_date], "50354"=>[:substances, :composition], "50373"=>[:expiry_date], "50795"=>[:expiry_date], "50844"=>[:company], "51039"=>[:expiry_date, :indication_registration], "51193"=>[:company], "51547"=>[:expiry_date], "51684"=>[:unit], "51691"=>[:unit], "51704"=>[:unit], "51809"=>[:company], "51872"=>[:expiry_date], "51908"=>[:unit], "52022"=>[:unit], "52034"=>[:name_base], "52113"=>[:name_base], "52810"=>[:expiry_date], "52958"=>[:expiry_date], "53018"=>[:expiry_date], "53105"=>[:expiry_date], "53162"=>[:expiry_date], "53178"=>[:expiry_date], "53179"=>[:expiry_date], "53244"=>[:expiry_date], "53272"=>[:expiry_date], "53712"=>[:unit], "54068"=>[:expiry_date], "54159"=>[:expiry_date], "54168"=>[:expiry_date], "54182"=>[:expiry_date], "54231"=>[:expiry_date], "54316"=>[:expiry_date], "54525"=>[:unit], "54571"=>[:expiry_date], "54604"=>[:company], "54617"=>[:expiry_date], "54937"=>[:expiry_date], "54975"=>[:expiry_date], "55045"=>[:expiry_date], "55046"=>[:expiry_date], "55057"=>[:name_base, :sequence], "55070"=>[:expiry_date], "55118"=>[:expiry_date], "55119"=>[:expiry_date], "55236"=>[:expiry_date], "55274"=>[:sequence], "55391"=>[:composition], "55650"=>[:substances], "56046"=>[:expiry_date], "56114"=>[:company], "56209"=>[:company], "56355"=>[:expiry_date], "56364"=>[:composition], "56379"=>[:size], "56381"=>[:expiry_date], "56400"=>[:name_base, :expiry_date, :indication_registration], "56401"=>[:name_base, :expiry_date, :indication_registration], "56422"=>[:new], "56457"=>[:sequence], "56722"=>[:expiry_date], "56750"=>[:expiry_date], "56755"=>[:expiry_date], "56756"=>[:expiry_date], "56885"=>[:expiry_date], "56914"=>[:substances, :composition], "56936"=>[:expiry_date], "56965"=>[:expiry_date], "57049"=>[:expiry_date], "57068"=>[:sequence, :replaced_package], "57155"=>[:expiry_date], "57346"=>[:expiry_date], "57348"=>[:company], "57813"=>[:company], "57831"=>[:company], "57924"=>[:expiry_date], "57952"=>[:expiry_date], "58009"=>[:expiry_date], "58125"=>[:expiry_date], "58271"=>[:new], "58277"=>[:unit], "58286"=>[:unit], "58325"=>[:expiry_date, :composition], "58377"=>[:expiry_date], "58440"=>[:expiry_date], "58443"=>[:expiry_date], "58486"=>[:expiry_date], "58492"=>[:expiry_date], "58513"=>[:unit], "58758"=>[:expiry_date], "58805"=>[:expiry_date], "58834"=>[:sequence, :replaced_package, :replaced_package], "58867"=>[:expiry_date], "59090"=>[:expiry_date], "59092"=>[:expiry_date], "59193"=>[:expiry_date], "59209"=>[:expiry_date], "59267"=>[:expiry_date], "59311"=>[:expiry_date], "59324"=>[:name_base], "59436"=>[:expiry_date], "59437"=>[:expiry_date], "59796"=>[:expiry_date], "60019"=>[:sequence], "60058"=>[:expiry_date], "60128"=>[:expiry_date], "60374"=>[:expiry_date], "60450"=>[:expiry_date], "60488"=>[:indication_registration, :unit, :sequence], "60539"=>[:expiry_date], "60555"=>[:expiry_date], "60719"=>[:expiry_date], "60720"=>[:expiry_date], "60808"=>[:expiry_date], "60954"=>[:expiry_date], "61251"=>[:expiry_date, :composition], "61252"=>[:expiry_date, :composition], "61456"=>[:composition], "61653"=>[:expiry_date], "62132"=>[:sequence], "62155"=>[:composition], "62156"=>[:composition], "62255"=>[:sequence, :replaced_package], "62574"=>[:sequence], "62575"=>[:unit], "62608"=>[:sequence], "62674"=>[:new], "62764"=>[:new], "62783"=>[:expiry_date], "62827"=>[:new], "62829"=>[:new], "62987"=>[:new], "63049"=>[:new], "63053"=>[:indication_registration, :indication_sequence], "63177"=>[:new], "63185"=>[:new], "63191"=>[:new], "63238"=>[:new], "63241"=>[:new], "63265"=>[:new], "65005"=>[:new], "65044"=>[:new], "65110"=>[:new], "65202"=>[:new], "65224"=>[:new], "35342"=>[:delete], "36227"=>[:delete], "36231"=>[:delete], "36234"=>[:delete], "38382"=>[:delete], "38983"=>[:delete], "46010"=>[:delete], "47254"=>[:delete], "48506"=>[:delete], "50788"=>[:delete], "53232"=>[:delete], "54523"=>[:delete], "55022"=>[:delete], "55957"=>[:delete], "57224"=>[:delete], "57603"=>[:delete], "57932"=>[:delete], "58418"=>[:delete], "58508"=>[:delete], "58510"=>[:delete], "58558"=>[:delete], "59201"=>[:delete], "59399"=>[:delete], "59428"=>[:delete], "60395"=>[:delete], "60560"=>[:delete], "60723"=>[:delete], "61429"=>[:delete], "61430"=>[:delete], "62767"=>[:delete]}
<..>
2014-05-12 16:54:00 +0200: update_compositions: row[0] 63053 iksnr 63053 01 seq Jetrea, Konzentrat zur Herstellung einer Injektionslösung opts {:create_only=>false, :date=>#<Date: 2014-05-12 ((2456790j,0s,0n),+0s,2299161j)>, :composition=>0, :label=>nil} cell_content Lösung: ocriplasminum 0.500 mg, q.s. ad solutionem pro 0.2 ml.
2014-05-12 18:24:26 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 173: delete iksnr '22257' seqnr 01 pack  
2014-05-12 18:24:26 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 175: delete iksnr '22257' ptr :!registration,22257!sequence,01!package,013. row ["22257", "01", "013", 0]
2014-05-12 18:24:27 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 173: delete iksnr '32665' seqnr 02 pack
2014-05-12 18:24:27 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 175: delete iksnr '32665' ptr :!registration,32665!sequence,02!package,039. row ["32665", "02", "039", 0]
2014-05-12 18:24:27 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 173: delete iksnr '32665' seqnr 02 pack
2014-05-12 18:24:27 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 175: delete iksnr '32665' ptr :!registration,32665!sequence,02!package,047. row ["32665", "02", "047", 0]
2014-05-12 18:24:28 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 173: delete iksnr '32665' seqnr 02 pack
2014-05-12 18:24:28 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 175: delete iksnr '32665' ptr :!registration,32665!sequence,02!package,055. row ["32665", "02", "055", 0]
2014-05-12 18:24:28 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 173: delete iksnr '33481' seqnr 01 pack
2014-05-12 18:24:28 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 175: delete iksnr '33481' ptr :!registration,33481!sequence,01!package,012. row ["33481", "01", "012", 0]
2014-05-12 18:24:29 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 173: delete iksnr '35342' seqnr 01 pack
2014-05-12 18:24:29 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 175: delete iksnr '35342' ptr :!registration,35342!sequence,01!package,028. row ["35342", "01", "028", 0]
2014-05-12 18:24:29 CEST @files={}
2014-05-12 18:24:29 CEST start outgoing process

Looking at Iksnr 35342 Primpéran. ch.oddb.org shows that it has neither in sequence 01 nor 02 any packages. Also it seems that swissmedic.rb tried to remove these package twice once on May 9 and once on May 12.

Analysing the callback

/var/www/oddb.org/src/model/package.rb:173:in `checkout' (of class MailOrderPrice)
/var/www/oddb.org/src/model/package.rb:479:in `checkout' (calls super)
/var/www/oddb.org/src/util/persistence.rb:240:in `issue_delete' (call object.checkout if respond_to?(:checkout)
/var/www/oddb.org/src/util/oddbapp.rb:124:in `block in delete'
/var/www/oddb.org/src/util/failsafe.rb:10:in `call'
/var/www/oddb.org/src/util/failsafe.rb:10:in `failsafe' (catches error)
/var/www/oddb.org/src/util/oddbapp.rb:120:in `delete'        (delete(pointer))
/var/www/oddb.org/src/command/delete.rb:11:in `execute'
/var/www/oddb.org/src/util/oddbapp.rb:698:in `execute_command'
/var/www/oddb.org/src/util/oddbapp.rb:1521:in `delete'  (@system.execute_command(DeleteCommand.new(pointer)))
/var/www/oddb.org/src/plugin/swissmedic.rb:176:in `block in delete' (debug msg delete iksnr; @app.delete
/var/www/oddb.org/src/plugin/swissmedic.rb:171:in `each'
/var/www/oddb.org/src/plugin/swissmedic.rb:171:in `delete'
/var/www/oddb.org/src/plugin/swissmedic.rb:75:in `update'

Bin admin reports that registration('35342').sequence('01').packages realls is an empty hash {}.

Added some more debug output and running import_swissmedic with db replaced (May 11) to reproduce the error on oddb-ci2. Got the error and the following output

173: parts {@parts.inspect}
ODBA::Stub was unable to replace Array#28868651 from ODDB::Package:#220866
-> "220 mx.google.com ESMTP e44sm30661423eeg.24 - gsmtp\r\n"
<- "EHLO ywesee.com\r\n"
-> "250-mx.google.com at your service, [84.73.49.252]\r\n"
-

Forgot to add #. Must rerun the import again. Adding a patch to trace also the result of @parts.dup and break if is nil.

Reworked plugin/swissmedic.rb to emit even more debug messages and checking package_deletions more thoroughly.

Got the following error messsage

2014-05-13 21:51:52 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 178: delete iksnr '35342' seqnr 01 pack 
2014-05-13 21:51:52 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 180: delete iksnr '35342' ptr :!registration,35342!sequence,01!package,028. row ["35342", "01", "028", 0]
2014-05-13 21:51:53 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 184: delete object #<ODDB::Package:0x007fa9c99e9790 @swissmedic_source={:import_date=>#<Date: 2013-11-05 ((2456602j,0s,0n),+0s,2299161j)>, :iksnr=>"35342", :seqnr=>"01", :name_base=>"Primpéran, suppositoires pour adultes", :company=>"Sanofi-Aventis (Suisse) SA", :index_therapeuticus=>"04.06.0.", :atc_class=>"A03FA01", :production_science=>"Synthetika human", :registration_date=>#<Date: 1970-06-19 ((2440757j,0s,0n),+0s,2299161j)>, :sequence_date=>#<Date: 1970-06-19 ((2440757j,0s,0n),+0s,2299161j)>, :expiry_date=>#<Date: 2016-02-07 ((2457426j,0s,0n),+0s,2299161j)>, :ikscd=>"028", :size=>"6", :unit=>"Suppositorien", :ikscat=>"B", :substances=>"metoclopramidum", :composition=>"metoclopramidum 20 mg, excipiens pro suppositorio.", :indication_registration=>"Troubles digestifs", :indication_sequence=>nil}, @oid=4726, @data_origins={"size"=>:swissmedic, "deductible"=>:bag, "pharmacode"=>:refdata, "price_public"=>:bag, "price_exfactory"=>:sl, "sl_generic_type"=>:bag, "swissmedic_source"=>:swissmedic, "refdata_override"=>:swissmedic}, @odba_persistent=true, @ikscat="B", @revision=2014-05-03 01:02:31 +0200, @sequence=#<ODBA::Stub:70183604411560#73025 @odba_class= @odba_container=70183604407240#220866>, @odba_id=220866, @parts=#<ODBA::Stub:70183604427120#28868651 @odba_class=Array @odba_container=70183604407240#220866>, @odba_observers=[], @pointer=:!registration,35342!sequence,01!package,028., @ikscd="028", @feedbacks=nil, @refdata_override=true, @narcotics=nil, @odba_target_ids=nil, @odba_prefetch=false, @prices={:public=>#<ODBA::Stub:70183604434920#27852065 @odba_class=Array @odba_container=70183604419200#27852064>, :exfactory=>#<ODBA::Stub:70183604429980#27852066 @odba_class=Array @odba_container=70183604419200#27852064>}, @comparable_size=Quanty(6.0,''), @price_exfactory=148, @descr="", @pharmacode="137816", @deductible=:deductible_g, @sl_entry=#<ODBA::Stub:70183604442040#706979 @odba_class= @odba_container=70183604407240#220866>, @sl_generic_type=nil, @mail_order_prices=#<ODBA::Stub:70183604420920#31672915 @odba_class=Array @odba_container=70183604407240#220866>>
2014-05-13 21:51:53 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 186: delete object.oid 4726
ensure_object_connections: ensure 2 target_ids [689832, 26257256, 10, 6, 934654, 795431, 9, 11, 868627, 3, 20, 18, 8, 724033, 1252741, 726317, 17, 16, 13, 393389, 780360, 19, 1211301, 15, 5, 12, 7, 724030, 14, 1067430, 9587859, 4, 22, 21, 810961, 954379, 28724410, 28834017, 28850745, 31673883, 31208308] sql         SELECT target_id FROM object_connection
        WHERE origin_id = ?
173: parts #<ODBA::Stub:70183604427120#28868651 @odba_class=Array @odba_container=70183604407240#220866>
ODBA::Stub was unable to replace Array#28868651 from ODDB::Package:#220866
-> "220 mx.google.com ESMTP a45sm36073723eez.2 - gsmtp\r\n"
view · edit · sidebar · attach · print · history
Page last modified on May 20, 2014, at 03:37 PM