view · edit · sidebar · attach · print · history

<< | Index | >>

20131210-oddb2xml-use-ean-if-no-pharmacode-2

Summary

  • If a product has no pharmacode but an EAN use it to fetch flags/price

Commits

Index

---

If a product has no pharmacode but an EAN use it to fetch flags/price.

Examples are (see also spec/builder_spec.rb):

  • 3TC with Pharmacode 1699947. EAN 7680536620137
  • Levetiracetam DESITIN without pharmacode. EAN is 7680620690084

Trying to finish the spec to import two products one which pharmacode and one without. Using pry to walk through the final steps. Okay. Besides the Preparation.xml the articles must also appear in the downloaded SwissIndex (swissmedic_package.xls). Therefore I must generate demo values for this file, too. spec/data/swissindex_pharma.xml contains only a dummy product from an example.com.

Changed downloader.rb to save the downloaded swissindex_#{@type}_#{@lang}.xml files under data/download.

In the downloaded file I find

      <ITEM DT="2013-06-22T00:00:00">
        <GTIN>7680536620137</GTIN>
        <PHAR>1699947</PHAR>
        <STATUS>A</STATUS>
        <STDATE>1996-03-20T00:00:00</STDATE>
        <LANG>DE</LANG>
        <DSCR>3TC Filmtabl 150 mg</DSCR>
        <ADDSCR>60 Stk</ADDSCR>
        <ATC>J05AF05</ATC>
        <COMP>
          <NAME>ViiV Healthcare GmbH</NAME>
          <GLN>7601001392175</GLN>
        </COMP>
      </ITEM>
<..>
      <ITEM DT="2013-12-06T00:00:00">
        <GTIN>7680620690084</GTIN>
        <PHAR>5819012</PHAR>
        <STATUS>A</STATUS>
        <STDATE>2013-10-26T00:00:00</STDATE>
        <LANG>DE</LANG>
        <DSCR>LEVETIRACETAM DESITIN Filmtabl 250 mg</DSCR>
        <ADDSCR>30 Stk</ADDSCR>
        <ATC>N03AX14</ATC>
        <COMP>
          <NAME>Desitin Pharma GmbH</NAME>
          <GLN>7601001320451</GLN>
        </COMP>
      </ITEM>

Had to change the order of pharma and non_pharma in spec/spec_helper.rb. I don't care about this problem at the moment.

What was less amusing it that the served file had no correct content. Fixed this problem, too.

My debug-output looks better now. I find there:

SwissIndexExtractor: PHARMA. Adding 7680536620137 pharma "1699947"
SwissIndexExtractor: PHARMA. Adding 7680620690084 pharma "5819012"
BagXmlExtractor: Adding 1699947 desc Filmtabl 150 mg  iksnr 53662
BagXmlExtractor: Adding 7680620690084 desc Filmtabl 250 mg  iksnr 62069

Now I must find the article also via EAN if not found by pharmacode. Must add Levetiracetam also to spec/data/swissmedic_package.xls. Seems to work now. Added a test for EphaExtractor (5 minutes of work).

Comparing output of bin/oddb2xml with last released version. There is something wrong as I have now a file which contains 30866 records compared to before 15433 in oddb_article.xml. Oddb_product.xml is the same (except timestamp). Found the culprit which doubled the number of articles. Now the diff between the new and the old oddb_article.xml have 23 sections like the following

467812,467821d467811
<     <ARTPRI>
<       <VDAT>01.11.2013</VDAT>
<       <PTYP>PEXF</PTYP>
<       <PRICE>3.5</PRICE>
<     </ARTPRI>
<     <ARTPRI>
<       <VDAT>15.03.1999</VDAT>
<       <PTYP>PPUB</PTYP>
<       <PRICE>6.45</PRICE>
<     </ARTPRI>

This looks good for me. Pushed commit Added more specs. Use ean to find price-info if no pharmacode. Waiting for Travis-CI to complete. Travis reports failure with ruby 1.8.7 and 2.0.0.

  • Failures with ruby 1.8.7 indicate failure which probably has been present already before.
  • Failures with ruby 2.0.0 cannot be reproduced here with ruby 2.0.0p247. Installing ruby-2.0.0-p353 as on travis.

Fixed failures with ruby 2.0 with commit Create data/download only if options[:skip_download].

Problem with ruby 1.8.7 drives me crazy. Sometimes it fails, sometimes it is okay. Tried @mutex, added a sleep but nothing was worked.

view · edit · sidebar · attach · print · history
Page last modified on December 10, 2013, at 08:35 PM