view · edit · sidebar · attach · print · history

20130919-iphone-price

<< | Index | >>


Summary

  • Fix links to price for iphone

Commits

Index


Sometimes having a Vertreter breaks output of brand2csv

Looking why we have the problems that the lines after Dragana don't display correctly.

  • bin/brand2csv 24.01.2006-24.01.2016 IPMA works okay (only 6 hits)
  • bin/brand2csv 01.01.2001-24.01.2016 Dr has 192 hits

At the first site, I think that an xpath is wrong and fetches also the Vertreter address and not only the Inhaber address.

oddbdat-export: fix Undefined method `-' for nil:NilClass

Modified my fix for handling the nil and restarting the oddbdat export on my VM. It went again into a loop, but I found now the problem.

When generating the file s31x the formatting of MultiCell fails and prints lines like

31|20130918000000|1860443|D|1|4|<BI>Zusammensetzung<E><P>lopamiro enthält in wässriger Lösung lopamidol , N ,N’ -bis [2-hydroxy-1-( hydroxymethyl ) ethyl ]-5-[(2-hydroxy-1-oxopropyl) amino ]-2,4,6-triio
31|20130918000000|1860443|D|2|4|ml<E>
31|20130918000000|1860443|D|3|4|<P><N>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
31|20130918000000|1860443|D|4|4|#<ODDB::Text::MultiCell:0x007fd3097bfc80>  #<ODDB::Text::MultiCell:0x007fd3099bbca0>  #<ODDB::Text::MultiCell:0x007fd309cd7f38>  #<ODDB::Text::MultiCell:0x007fd309fc94a8>  #<O
3

The first medicament with this problem is Hepatodoron (IKSRN 18604). I reparsed in on my VM, as this might affect the problem. A problem with MultiCell could be in 44140 Iopamiro.

The corresponding unit test ext/export/test/test_oddbdat.rb show 13 errors when running the file stand-alone.

Before the import it displayed in Zusammensetzung

1 Tablette à 200mg enthält: getrockneteWalderdbeerblätter 40mg / getrockneteWeinrebenblätter40mg.
Hilfsstoffe: Milchzucker, Weizenstärke,Zucker, Talk.

After the import it displayed in Zusammensetzung

1 Tablette à 200mg enthält: getrocknete Walderdbeerblätter 40mg / getrocknete Weinrebenblätter 40mg.
Hilfsstoffe: Milchzucker, Weizenstärke, Zucker, Talk.

MultiCell content does not get written to oddbdat correct e.g data/html/fachinfo/de/Iopamiro__swissmedicinfo.yaml.

Created unit-tests for both cases (Iopamiro and Hepatodoron) which break at two different locations in ext/export/src/oddbdat.rb. Made the unit-tests pass. Testing the whole export on my VM. The fix is probably not okay as the output of a table does not contain any line-breaks. The unit tests takes two rows from the lopamiro FI and uses as expectation

<BI>Zusammensetzung<E><P><I>Pro 1 ml<E><P><N>----------------------------------------- IOPAMIRO 370    ----------------------------------------- Wirkstoff:      ----------------------------------------- Iopamidol(mg)  306,2  408,2  612,4  755,3   -----------------------------------------<E>

The fix is not yet correct and fails with imaglinks. Error msg it

Error: NoMethodError
Message: undefined method `formats' for (image):ODDB::Text::ImageLink
Backtrace:
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/oddbdat.rb:173:in `block (2 levels) in format_line'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/oddbdat.rb:166:in `each'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/oddbdat.rb:166:in `block in format_line'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/oddbdat.rb:161:in `each'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/oddbdat.rb:161:in `format_line'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/oddbdat.rb:139:in `block (2 levels) in lines'
(druby://localhost:10005) /var/www/oddb.org/src/model/fachinfo.rb:206:in `call'
(druby://localhost:10005) /var/www/oddb.org/src/model/fachinfo.rb:206:in `block in each_chapter'
(druby://localhost:10005) /var/www/oddb.org/src/model/fachinfo.rb:204:in `each'
(druby://localhost:10005) /var/www/oddb.org/src/model/fachinfo.rb:204:in `each_chapter'
(druby://localhost:10005) /usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/oddbdat.rb:138:in `block in lines'
(druby://localhost:10005) /usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `each'
(druby://localhost:10005) /usr/local/lib64/ruby/gems/1.9.1/gems/odba-1.1.0/lib/odba/stub.rb:112:in `method_missing'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/oddbdat.rb:136:in `lines'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/odba_exporter.rb:190:in `block (2 levels) in export_oddbdat'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/odba_exporter.rb:189:in `each'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/odba_exporter.rb:189:in `block in export_oddbdat'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/odba_exporter.rb:187:in `each'
(druby://localhost:10005) /var/www/oddb.org/ext/export/src/odba_exporter.rb:187:in `export_oddbdat'
(druby://localhost:10005) /usr/lib64/ruby/1.9.1/drb/drb.rb:1548:in `perform_without_block'
(druby://localhost:10005) /usr/lib64/ruby/1.9.1/drb/drb.rb:1508:in `perform'
(druby://localhost:10005) /usr/lib64/ruby/1.9.1/drb/drb.rb:1586:in `block (2 levels) in main_loop'
(druby://localhost:10005) /usr/lib64/ruby/1.9.1/drb/drb.rb:1582:in `loop'
(druby://localhost:10005) /usr/lib64/ruby/1.9.1/drb/drb.rb:1582:in `block in main_loop'
/var/www/oddb.org/src/plugin/oddbdat_export.rb:144:in `export_fachinfos'
/var/www/oddb.org/src/util/exporter.rb:198:in `block in export_oddbdat'
/var/www/oddb.org/src/util/exporter.rb:427:in `call'
/var/www/oddb.org/src/util/exporter.rb:427:in `safe_export'
/var/www/oddb.org/src/util/exporter.rb:194:in `export_oddbdat'
/var/www/oddb.org/src/util/exporter.rb:55:in `run'
/var/www/oddb.org/jobs/export_daily:13: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'
/var/www/oddb.org/jobs/export_daily:12:in `<module:Util>'
/var/www/oddb.org/jobs/export_daily:11:in `<module:ODDB>'
/var/www/oddb.org/jobs/export_daily:10:in `<main>'

Another small refactoring of the unit-tests. Starting an oddbdat export again on my VM. Now the oddbdat export finished after more or less completing the jobs. Error msg was

Error: DRb::DRbConnError
Message: connection closed
Backtrace:
/usr/lib64/ruby/1.9.1/drb/drb.rb:570:in `load'
/usr/lib64/ruby/1.9.1/drb/drb.rb:632:in `recv_reply'
/usr/lib64/ruby/1.9.1/drb/drb.rb:918:in `recv_reply'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1197:in `send_message'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1088:in `block (2 levels) in method_missing'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1172:in `open'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1087:in `block in method_missing'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1105:in `with_friend'
/usr/lib64/ruby/1.9.1/drb/drb.rb:1086:in `method_missing'
/var/www/oddb.org/src/plugin/oddbdat_export.rb:144:in `export_fachinfos'
/var/www/oddb.org/src/util/exporter.rb:198:in `block in export_oddbdat'
/var/www/oddb.org/src/util/exporter.rb:427:in `call'
/var/www/oddb.org/src/util/exporter.rb:427:in `safe_export'
/var/www/oddb.org/src/util/exporter.rb:194:in `export_oddbdat'
/var/www/oddb.org/src/util/exporter.rb:55:in `run'
/var/www/oddb.org/jobs/export_daily:13: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'
/var/www/oddb.org/jobs/export_daily:12:in `<module:Util>'
/var/www/oddb.org/jobs/export_daily:11:in `<module:ODDB>'
/var/www/oddb.org/jobs/export_daily:10:in `<main>'

on iPhone the pricelink does not work

Using the iPhone the pricelinks, e.g. for Esomep don't work. Probably because we are using a different CSS for the iPhone. We are using http://dojotoolkit.org version 1.3.0. In src/util/csstemplate.rb I find some switching around for different templates like desitin or mobile. (Probably what is used with iphone?)

Changed the browser recognition in Konqueror to match Apple's Safari on iPhone. Then I could see that in http://i.ch.oddb.org/de/mobile/search/zone/drugs/search_query/Esomep/search_type/st_sequence?#best_result I could not see the result. Analysed the generated HTML code.

The first difference lays already in the generated links (added some spaces for easier matching)

Linux  http://  ch.oddb.org/de/gcc   /search/zone/drugs/search_query/Esomep/search_type/st_sequence #best_result
iPhone http://i.ch.oddb.org/de/mobile/search/zone/drugs/search_query/Esomep/search_type/st_sequence?#best_result 

Found the following HTML text for the first price (10.34).

Linux  <td class="list right original"><a name="price_history" href="http://ch.oddb.org/de/gcc/price_history/reg/60574/seq/01/pack/001/search_type/st_sequence/search_query/Esomep" title="EUR: 8.36 / USD: 11.16 (Klicken um die Preishistorie anzuschauen)">10.34</a></td>
iPhone <td class="list right"><span title="EUR: 8.36 / USD: 11.16">10.34</span></td>

The generated code does therefore not contain a link to the price history for the iphone (mobile) version of ch.oddb.ch. Also only the linux loads a lot of javascripts files via linux_price_files/parser.js

Looking whether we have any unit tests for these kind of problems. Yes, see test/test_view/drugs/price_history.rb. But I must first fix 7 failures and 2 errors. Done. But the test don't consider the differences between mobile and gcc. Neither I find a reference to the function is_mobile_app?

Asking myself to which value in view/drugs/dataformat the expression if @lookandfeel.enabled?(:price_history) evaluates. I think it by design, as in the class LookandfeelMobile in lookandfeelwrapper we have no :price_history. Changing this on my VM to test it. Can't test because i.oddb-ci.dyndns.org is not correctly handled (nginx).

Remarked that we have 10 failures in the unit tests test/test_custom/test_lookandfeelwrapper.rb.

Updated my VM to render also i.oddb-ci et al. Merged content from Apache2 thinpower with the following limitations:

  • FastCGI does not work
  • Created dummy directories for webalizer

See commit Merged 20_oddb.org.conf from thinpower in oddb_vhost.conf.erb

Now I was able to test my small change to enable the price_history in the Mobile LookAndFeel. Pages like

Committed Added price_history to Mobile lookandfeel. Some hours passed to add exactly one line!

view · edit · sidebar · attach · print · history
Page last modified on September 19, 2013, at 10:26 AM