view · edit · sidebar · attach · print · history

< Niklaus.20170725-sandoz-transfer-encoding | Index | Niklaus.20170712-fix-oddb-errors >>

20170724-sandoz-missing-pharmacode

Summary

  • Missing pharmacode must be shown as number not as the last pharmacode
  • Keep in Mind

Commits

Index

Missing pharmacode must be shown as number not as the last pharmacode

In http://sandoz.bbmb.ch/de/bbmb/order/order_id/4100602379-254 we find 6 Quetiapin XR Sandoz 150 mg Ret Tbl 100 U but the customer had requested a 6 items with pharmacode "3463433", "385566". We do not have these pharmacodes in our database. Therefore we should just post them as numbers.

In the unit tests of xmlconv I do not find any calls where the pharmacode is not null and tested.

On fastpower I see in the log /var/www/sandoz.xmlconv.bbmb.ch/log/2017/07/06/app.log

log/2017/07/06/app.log:D, [2017-07-06T11:43:21.121449 #31495] DEBUG -- : login.rb:17:in `initialize'  xml_src ASCII-8BIT now <?xml version="1.0" encoding="utf-8"?><customerOrder xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" language="fr" productDescriptionDesired="true" communicationSoftwareId="Pharmatic NETREQ.EXE V1.20.0.4 (Requestdate: 06.07.2017 11:48)" xmlns="http://www.e-galexis.com/schemas/"><client number="4100602379" password="7601001023086" /><orderHeader deliveryDate="2017-07-06" referenceNumber="14282" /><orderLines><productOrderLine orderQuantity="1"><pharmaCode id="2508381" /></productOrderLine><productOrderLine orderQuantity="2"><pharmaCode id="2967114" /></productOrderLine><productOrderLine orderQuantity="1"><pharmaCode id="2991130" /></productOrderLine><productOrderLine orderQuantity="6"><pharmaCode id="3463433" /></productOrderLine><productOrderLine orderQuantity="1"><pharmaCode id="4861940" /></productOrderLine><productOrderLine orderQuantity="1"><pharmaCode id="5404386" /></productOrderLine><productOrderLine orderQuantity="1"><pharmaCode id="6427751" /></productOrderLine></orderLines></customerOrder>
log/2017/07/06/app.log:I, [2017-07-06T11:43:21.127495 #31495]  INFO -- : transaction.rb:38:in `execute' _execute REXML::Document => ,4100602379,06072017,,2508381,,,1,,14282,""

Added a test/data/integration/no_pharmacode.xml. Testing it using curl -v http://sandoz.xmlconv.bbmb.ngiger.ch/propharma -d@test/data/integration/no_pharmacode.xml

When going to http://sandoz.xmlconv.bbmb.ngiger.ch/de/sbsm/transaction/state_id/47078490819360/transaction_id/28434 I see

<?xml version "1.0" encoding="utf-8"?>
<customerOrder
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     xmlns="http://www.e-galexis.com/schemas/" version="1.0"
     language="fr" productDescriptionDesired="true"
     communicationSoftwareId="Pharmatic NETREQ.EXE V1.20.0.4
     (Requestdate: 06.07.2017 11:48)">
  <client number="4100602379" password="xxx"/>
  <orderHeader deliveryDate="2017-07-06"
       referenceNumber="14282"/>
  <orderLines>
    <productOrderLine orderQuantity="6">
      <pharmaCode id="3463433"/>
    </productOrderLine>
  </orderLines>
</customerOrder>

But http://sandoz_rack.ngiger.ch/de/bbmb/order/order_id/4100602379-230 displays wrongly

Menge	Artikelbezeichnung	Preis	Total
6	Omeprazol Sandoz Eco 40 mg Kps 56	46.04	276.24
Interne Bestellnummer
14282

Debugging with pry locally. Added /usr/local/bin to the PATH when running the fish shell. Added a pry-debug and got the following backtrace

/var/www/sandoz.xmlconv.bbmb.ch/lib/conversion/sunstore_bdd.rb:43:in `respond'
/home/niklaus/git/xmlconv/lib/xmlconv/util/transaction.rb:103:in `response'
/home/niklaus/git/xmlconv/lib/xmlconv/util/application.rb:152:in `execute_with_response'
/home/niklaus/git/xmlconv/lib/xmlconv/state/login.rb:30:in `initialize'
/home/niklaus/git/sbsm/lib/sbsm/session.rb:417:in `new'
/home/niklaus/git/sbsm/lib/sbsm/session.rb:417:in `logout'
/home/niklaus/git/sbsm/lib/sbsm/session.rb:253:in `block in process_rack'
/home/niklaus/git/sbsm/lib/sbsm/session.rb:209:in `synchronize'
/home/niklaus/git/sbsm/lib/sbsm/session.rb:209:in `process_rack'
/home/niklaus/git/sbsm/lib/sbsm/app.rb:127:in `call'

# where the description is already wrong
responses.first
=> {:order_id=>"4100602379-237", :products=>[{:pcode=>"3463433", :quantity=>6, :article_number=>"00610553", :backorder=>false, :description=>"Omeprazol Sandoz Eco 40 mg Kps 56", :deliverable=>6}]}

33] pry(#<XmlConv::State::Login>)> whereami

From: /home/niklaus/git/xmlconv/lib/xmlconv/state/login.rb @ line 30 XmlConv::State::Login#initialize:

    13: def initialize(session, model)
    14:   if session.request_method.eql?('POST')
    15:     xml_src = session.post_content
    16:     SBSM.debug "XmlConv::State::Login POST params were #{session.request_params}"
    17:     SBSM.debug " xml_src #{xml_src.encoding} now #{xml_src}"
    18:     unless xml_src.length == 0
    19:       transaction = XmlConv::Util::Transaction.new
    20:       transaction.domain      = session.server_name
    21:       transaction.input       = xml_src
    22:       transaction.reader      = 'SunStoreBdd'
    23:       transaction.writer      = XmlConv::CONFIG.writer
    24:       transaction.destination = XmlConv::Util::Destination.book(XmlConv::CONFIG.destination)
    25:       transaction.partner     = File.basename(session.request_path)
    26:       transaction.origin      = "http://#{session.remote_ip}"
    27:       transaction.postprocs.push(['Soap', 'update_partner'])
    28:       transaction.postprocs.push(['Bbmb2', 'inject', XmlConv::CONFIG.bbmb_url, 'customer_id'])
    29:       @transaction = transaction
 => 30:       res = session.app.execute_with_response(transaction)
    31:     end
    32:   end
    33:   super
    34: end

[34] pry(#<XmlConv::State::Login>)> @transaction.model.deliveries.first.items.first
=> #<XmlConv::Model::DeliveryItem:0x0055c9075ca190 @id_table={"pharmacode"=>"3463433"}, @ids={"Pharmacode"=>"3463433"}, @line_no="1", @prices=[], @qty="6", @unit="PCE">

The reader-instance is XmlConv::Conversion::SunStoreBdd. But where get the responses attribute really initialized?

The sandox.xmlconv sends via lib/xmlconv/util/transaction.rb a DRb-Call to the process listening on port 12004 Bbmb(Sandoz). Therefore I must debug the class Bbmb2 which receives ["inject", "druby://localhost:12004", "customer_id"].

Locally calling via sudo -u bbmb /usr/local/bin/bundle-240 exec bin/sandoz_admin config=/var/www/sandoz.bbmb.ch/etc/config.yml BBMB::Model::Product.find_by_pcode('3463433').class returns BBMB::Model::Product whereas it returns NilClass on thinpower. Dropping and reloading the sandoz bbmb database.

Fixed lib/bbmb/util/server.rb to handle the case where we have a pharmacode, but cannot find a product (See Attach:server_diff.txt). But I must now fix the failing unit tests, which were not yet ported to use the rack based SBSM. This will be done tomorrow.

Pushed commit Create new product if only pharmacode is giving and none exists

Fix errors in oddb.org

log/2017/07/12/user_log-[2017-07-12 17:30:53] ERROR Rack::Lint::LintError: Response body was given for HEAD request, but should be empty
log/2017/07/12/user_log-        /var/www/oddb.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:20:in `assert'
log/2017/07/12/user_log-        /var/www/oddb.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:688:in `verify_content_length'
log/2017/07/12/user_log-        /var/www/oddb.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:716:in `each'
log/2017/07/12/user_log-        /var/www/oddb.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/body_proxy.rb:36:in `each'
log/2017/07/12/user_log-        /var/www/oddb.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/body_proxy.rb:36:in `each'
log/2017/07/12/user_log-        /var/www/oddb.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/lint.rb:708:in `each'
log/2017/07/12/user_log-        /var/www/oddb.org/vendor/bundle/ruby/2.4.0/gems/rack-2.0.3/lib/rack/handler/webrick.rb:110:in `service'
log/2017/07/12/user_log-        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:140:in `service'
log/2017/07/12/user_log-        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/httpserver.rb:96:in `run'
log/2017/07/12/user_log:        /usr/local/ruby-2.4.0/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread'
log/2017/07/12/user_log-188.40.81.134 - - [12/Jul/2017 17:30:53] "GET http://ch.oddb.org/de/gcc/rss/channel/price_cut.rss HTTP/1.1" 200 296066 0.0276  "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.3) Gecko/2008092814 Iceweasel/3.0.3 (Debian-3.0.3-3)"
view · edit · sidebar · attach · print · history
Page last modified on July 25, 2017, at 08:15 AM