view · edit · sidebar · attach · print · history

< Niklaus.20180206-pi-error | Index | Niklaus.20180131-oddb-adsense >>

20180205-drugshortage-error

Summary

  • Fix undefined method in drugshortage
  • RuntimeError in swissmedic-diff
  • Update Analysenlisten Link
  • Fix NoMethod error for certain PI
  • Keep in Mind

Commits

Index

Fix undefined method in drugshortage

Found the following error

Error: NoMethodError
Message: undefined method `code' for nil:NilClass
Backtrace:
/var/www/oddb.org/src/plugin/shortage.rb:221:in `block in update_drugshortage'
/var/www/oddb.org/src/plugin/shortage.rb:209:in `each'
/var/www/oddb.org/src/plugin/shortage.rb:209:in `update_drugshortage'
/var/www/oddb.org/src/plugin/shortage.rb:53:in `update'
/var/www/oddb.org/src/util/updater.rb:372:in `block in update_drugshortage'
/var/www/oddb.org/src/util/updater.rb:532:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:370:in `update_drugshortage'
/var/www/oddb.org/src/util/updater.rb:201:in `run'
jobs/import_daily:13:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/import_daily:12:in `<module:Util>'
jobs/import_daily:11:in `<module:ODDB>'
jobs/import_daily:10:in `<main>'

Looks like we have for the first time a shortage for a drug which has no ATC code defined.

The error stems from the registration 00696 sequence 02, which has no attached ATC-Code (the sequence 01 has J07AN01). Is this error in our database. I do not think so, as the registration 696 does not appear in the Packungen.xlsx. Therefore I will add a nil check.

Fixed with commit Handle drugshortage when not ATC-code present

RuntimeError in swissmedic-diff

Must fix the error

Plugin: ODDB::SwissmedicPlugin

Error: RuntimeError
Message: /var/www/oddb.org/data/xls/Packungen-2018.02.05.xlsx_has_unexpected_column_22_drug_index_(?i-mx:Verz. bei betäubunsmittel-haltigen Präparaten)_but_was_Verz. bei betäubungsmittel-haltigen Präparaten**
N° du tabl. si préparations à base de stupéfiants**
/var/www/oddb.org/data/xls/Packungen-2018.02.05.xlsx_has_unexpected_column_1_seqnr_(?i-mx:Dosistärke-nummer|^Sequenz$)_but_was_Dosisstärke-nummer

Numéro de dosage
Backtrace:
/var/www/oddb.org/vendor/ruby/2.5.0/gems/swissmedic-diff-0.2.2/lib/swissmedic-diff.rb:366:in `get_column_indices'
/var/www/oddb.org/vendor/ruby/2.5.0/gems/swissmedic-diff-0.2.2/lib/swissmedic-diff.rb:152:in `diff'
/var/www/oddb.org/src/plugin/swissmedic.rb:319:in `update'
/var/www/oddb.org/src/util/updater.rb:427:in `block in update_swissmedic'
/var/www/oddb.org/src/util/updater.rb:532:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:425:in `update_swissmedic'
/var/www/oddb.org/src/util/updater.rb:216:in `run'
jobs/import_daily:13:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/import_daily:12:in `<module:Util>'
jobs/import_daily:11:in `<module:ODDB>'
jobs/import_daily:10:in `<main>'

Swissmedic corrected a typo in the cell W5 changing betäubunsmittel to betäubungsmittel (adding a missing "g"). This broke swissmedic. But the fix is easy.

Pushed commits

Releasing a new version of the gem. Then must adapt oddb.org Gemfile. Done with commit Update swissmedic-diff to handle fixed typo. Restarting import_daily on thinpower.

Running import-daily showed another error

Plugin: ODDB::Atc_lessPlugin

Error: RuntimeError
Message: Packungen.xlslx_has_unexpected_column_22_drug_index_(?i-mx:Verz. bei betäubunsmittel-haltigen Präparaten)_but_was_Verz. bei betäubungsmittel-haltigen Präparaten**
N° du tabl. si préparations à base de stupéfiants**
Backtrace:
/var/www/oddb.org/src/util/util.rb:26:in `check_column_indices'
/var/www/oddb.org/src/plugin/atc_less.rb:101:in `update_atc_codes'
/var/www/oddb.org/src/util/updater.rb:543:in `update_immediate'
/var/www/oddb.org/src/util/updater.rb:437:in `update_atc_less'
/var/www/oddb.org/src/util/updater.rb:440:in `update_swissmedic_followers'
/var/www/oddb.org/src/util/updater.rb:217:in `run'
jobs/import_daily:13:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/import_daily:12:in `<module:Util>'
jobs/import_daily:11:in `<module:ODDB>'
jobs/import_daily:10:in `<main>'

Looking at howto fix it. This should be easy, too. Running jobs/update_atc_less to see whether the fix is okay. Pushed commit Adapt to typo fix of swissmedic

Update Analysenlisten Link

We must adapt to the new link New URL for Analysis list:

https://www.bag.admin.ch/dam/bag/de/dokumente/kuv-leistungen/leistungen-und-tarife/Analysenliste/analysenliste-1-1-2018-excel-format.xlsx.download.xlsx/Analysenliste%20vom%2001.01.2018%20in%20Excel-Format%20.xlsx

This caused the error

Plugin: ODDB::AnalysisPlugin

Error: RuntimeError
Message: could not identify url to analysis.xlsx
Backtrace:
/var/www/oddb.org/src/plugin/analysis.rb:74:in `get_latest_file'
/var/www/oddb.org/src/plugin/analysis.rb:48:in `update'
/var/www/oddb.org/src/util/updater.rb:240:in `block in update_analysis'
/var/www/oddb.org/src/util/updater.rb:532:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:238:in `update_analysis'
/var/www/oddb.org/src/util/updater.rb:226:in `block in run'
/var/www/oddb.org/src/util/schedule.rb:10:in `run_on_monthday'
/var/www/oddb.org/src/util/updater.rb:225:in `run'
jobs/import_daily:13:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/import_daily:12:in `<module:Util>'
jobs/import_daily:11:in `<module:ODDB>'
jobs/import_daily:10:in `<main>'

This should be fixed with commit Adapt to changed link of anaylsislist. Runninng jobs/update_analysis on oddb-ci2 to verify result.

Fix NoMethod error for certain PI

Visiting some newly registered PI like https://ch.oddb.org/de/gcc/patinfo/reg/66331/seq/01/pack/001 throw errors

NoMethodError at /de/gcc/patinfo/reg/66331/seq/01/pack/001
undefined method `name' for #<String:0x00007fcb77b35098>
Ruby	/var/www/oddb.org/src/view/drugs/patinfo.rb: in patinfo_name, line 253
Web	GET ch.oddb.org/de/gcc/patinfo/reg/66331/seq/01/pack/001
Traceback (innermost first)
/var/www/oddb.org/src/view/drugs/patinfo.rb: in patinfo_name
    @lookandfeel.lookup(:patinfo_name, model.name) if model...

Looks like the model ODDB::State::Drugs::Patinfo::PatinfoWrapper used at src/view/drugs/patinfo.rb:275 is returning for name the whole patinfo and not a chapter. Exmining with pry

[14] pry(#<ODDB::View::Drugs::PatinfoComposite>)> model.pointer
=> #<ODDB::Persistence::Pointer:0x00007f9fa8587d80 @directions=[[:patinfo, 38042352]]>
from (pry):9:in `init'
# in src/state/drugs/patinfo we have
[10] pry(#<ODDB::State::Drugs::Patinfo>)> @model.pointer
=> #<ODDB::Persistence::Pointer:0x00007f41c019fb50 @directions=[[:patinfo, 38042352]]>
# this looks silly for me. Why?
# @request_path is /de/gcc/patinfo/reg/66428/seq/01/pack/001

Checking via bin/admin

-> 12546
ch.oddb> registration('66428').package('001').patinfo.name[0..120]
-> Amoxicilline Axapharm, comprimés dispersibles
Qu'est-ce que l’Amoxicilline Axapharm et quand doit-il être utilisé?
Amoxic
ch.oddb> registration('66428').name_base
-> Amoxicillin Axapharm 500 mg

This PI was imported on January 23 (where the PI mail contains 66428 de: Amoxicillin Axapharm, dispergierbare Tabletten and 66428 fr: Amoxicilline Axapharm, comprimés dispersibles). There must be a problem. I will try to reimport this PI once my analysis import has finished.

Tried to reparse using sudo -u apache bundle exec ruby-250 jobs/update_textinfo_swissmedicinfo pi reparse 66428 and got

Plugin: ODDB::TextInfoPlugin

Error: NoMethodError
Message: undefined method `downcase' for ["pi"]:Array
Backtrace:
/var/www/oddb.org/src/plugin/text_info.rb:1379:in `block in parse_aips_download'
/var/www/oddb.org/src/plugin/text_info.rb:1348:in `each'
/var/www/oddb.org/src/plugin/text_info.rb:1348:in `parse_aips_download'
/var/www/oddb.org/src/plugin/text_info.rb:1437:in `import_swissmedicinfo'
/var/www/oddb.org/src/util/updater.rb:576:in `block in update_notify_simple'
/var/www/oddb.org/src/util/updater.rb:532:in `wrap_update'
/var/www/oddb.org/src/util/updater.rb:570:in `update_notify_simple'
/var/www/oddb.org/src/util/updater.rb:350:in `update_textinfo_swissmedicinfo'
jobs/update_textinfo_swissmedicinfo:39:in `block in <module:Util>'
/var/www/oddb.org/src/util/job.rb:40:in `run'
jobs/update_textinfo_swissmedicinfo:12:in `<module:Util>'
jobs/update_textinfo_swissmedicinfo:11:in `<module:ODDB>'
jobs/update_textinfo_swissmedicinfo:10:in `<main>'

Adding a pry debug statement. Fixed this problem. Rerunning the import and checking why we do not have a correct PatinfoDocument class for patinfo.descriptions[lang].

The problem was, that we did not handle correctly the case when we see new patinfos for de AND fr. This will require reparsing. Sympton is that patinfo.de.eql?(patinfo.fr)

ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de.eql?(x.patinfo.fr)}.size
-> 120
ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de.eql?(x.patinfo.fr)}.first.iksnr
-> 66071
ch.oddb> active_packages.find_all{|x| x.patinfo && x.patinfo.de.eql?(x.patinfo.fr)}.last.iksnr
-> 66513
File.open('tst.lst', 'w+') {|f| f.puts active_packages.find_all{|x| x.patinfo && x.patinfo.de.eql?(x.patinfo.fr)}.collect{|x| x.iksnr}.sort.uniq.join(" ")}

This returns 00627 00657 00685 00702 31514 31723 33801 38605 39253 43307 44448 44915 46996 47000 47909 48280 48669 49137 49188 50581 52535 52815 53161 54058 54378 54604 55065 55269 55584 55902 56072 56257 56349 56906 56922 57178 57526 57664 57870 58868 60808 61251 61252 61621 65100 65311 65497 65892 65916 66003 66068 66071 66105 66130 66172 66216 66331 66345 66363 66377 66415 66428 66468 66483 66490 66513 66590 66659 66719 66837

Tried to fix the problem, but now it loads every time the french version of the PI.

view · edit · sidebar · attach · print · history
Page last modified on February 05, 2018, at 04:19 PM