view · edit · sidebar · attach · print · history

20110803-test-statistics-bbmb_ch-debug-price-comparison-patinfo-link-oddb_org

<< Masa.20110804-testcases-url-format-oddb_org | 2011 | Masa.20110802-debug-slupdate-oddb_org-testcases-bbmb_ch >>


  1. Result of test_statistics yesterday
  2. Debug price comparison oddb.org
  3. Search the setting part of galenic_group
  4. Rename link URL of PI (PatInfo)
  5. Testcases oddb.org

Goal/Estimate/Evaluation
  • Test run_statistics bbmb.ch / 100% / 100%
  • Debug price comparison oddb.org / 80% / 100%
  • Rename link for Pachinfo / 80% / 100%
Milestones
Summary
Commits

Result of test_statistics yesterday

Result

  • No email
  • Log
ch.bbmb.globopharm> test_statistics
-> undefined local variable or method `resellsers' for #<BbmbApp:0x7f29d84d5ae0>

Note

  • There is no other information

Next

  • Check the process step by step

Experiment (src/util/bbmbapp.rb#test_statistics)

  def test_statistics
p "A"
    gid = '1'
p "B"
    last_month = stat_last_month()
p "C"
    resellers[gid].mail_statistics(last_month)
p "D"
    @prevalence.statistics_mailed(gid, last_month)
p "E"
  end

Run

  • bin/bbmbd
  • bin/admin

Log

ch.bbmb.globopharm> test_statistics
-> /usr/lib64/ruby/1.8/net/protocol.rb:206:in `initialize': Connection refused - connect(2)
"A"
"B"
"C"
"getin mail_statistics in custom"
"getin make_stats_and_total in custom"
"getin make_statistics_export in custom"

Note

  • The error comes from Net::SMTP in CustomGag#mail_send method
  • 'Net::SMTP.new('localhost')' does not work because the localhost is not

Experiment

require 'util/smtp_tls'
...
    def mail_send(mail, from, to)
      #smtp = Net::SMTP.new('localhost')
            smtp = Net::SMTP.new('smtp.gmail.com', 587)
      #smtp.start {
            #smtp.start("smpt_domain", "smtp_user", "smtp_password", :plain) {
            smtp.start("ywesee.com", "mhatakeyama@ywesee.com", "password", :plain) {

Result

Monatlicher Export verkaufte Produkte: Masapharm-03.08.2011
Verkaufte Produkte von 01. bis 31.07.2011
Attached: exportMasapharm-03.08.2011.csv

exportMasapharm-03.08.2011.csv

Total Umsatz;;;;;0.00
Umsatzbeteiligung exkl. MwSt.;;;;;0.00
MwSt. (8.0%);;;;;0.00
Umsatzbeteiligung inkl. MwSt. (8.0%);;;;;0.00

Note

  • There is no order

Experiment

  • src/util/bbmbapp.rb#test_statistics
  def test_statistics
    gid = '1'
    #last_month = stat_last_month()
    this_month = Time.local(now.year, now.mon)...Time.local(now.year, now.mon+1)
    #resellers[gid].mail_statistics(last_month)
    resellers[gid].mail_statistics(last_month)
    #@prevalence.statistics_mailed(gid, last_month)
    @prevalence.statistics_mailed(gid, this_month)
  end

Run

  • bin/bbmbd
  • bin/admin
ch.bbmb.globopharm> test_statistics

Result

exportMasapharm-03.08.2011.csv

402858;masa;03.08.2011 08:07;;1;53000002;TYSABRI Inf Konz300mg/15ml Fl 15ml;2017.13
Total Umsatz;;;;;2017.13
Umsatzbeteiligung exkl. MwSt.;;;;;2.02
MwSt. (8.0%);;;;;0.02
Umsatzbeteiligung inkl. MwSt. (8.0%);;;;;2.03

Note

  • Looks good
  • Now ready to commit
  • (But be careful (for me) because some code is modifed only for the local PC from the git repository)

Debug price comparison oddb.org

Problem

  • 'Lev Desitin' does not show the daily cost (TK: Tageskosten)

Email

Experiment

ch.oddb> ODDB::Package.find_by_pharmacode('2204600').name
-> Keppra 1000 mg, Filmtabletten
ch.oddb> ODDB::Package.find_by_pharmacode('2204600').ddd_price
-> 4.30
ch.oddb> ODDB::Package.find_by_pharmacode('2204600').galenic_group
-> Tabletten

ch.oddb> ODDB::Package.find_by_pharmacode('4876798').name
-> Lev Desitin 1000 mg, Minipacks mit Mini-Filmtabletten
ch.oddb> ODDB::Package.find_by_pharmacode('4876798').ddd_price
-> 
ch.oddb> ODDB::Package.find_by_pharmacode('4876798').galenic_group
-> unbekannt

Refer to src/model/package.rb#ddd_price

    def ddd_price
      if(!@disable_ddd_price && (ddd = self.ddd) \
        && (grp = galenic_group) && grp.match(@@ddd_galforms) \
        && (price = price_public) && (ddose = ddd.dose) && (mdose = dose) \
        && size = comparable_size)
        factor = (longevity || 1).to_f
        if(mdose > (ddose * factor))
          (price / size.to_f) / factor
        else
          (price / size.to_f) \
            * (ddose.to_f * factor / mdose.want(ddose.unit).to_f) / factor
        end
      end
    rescue RuntimeError
    end

Note

  • '@@ddd_galforms = /tabletten?/iu' is defined in Package class
  • Is the galenic_group (unbekant) related to the price comparison?

Experiment

ch.oddb> ODDB::Package.find_by_pharmacode('2204600').sequence.compositions[0].galenic_form.galenic_group
-> Tabletten
ch.oddb> ODDB::Package.find_by_pharmacode('4876798').sequence.compositions[0].galenic_form.galenic_group
-> unbekannt
ch.oddb> ODDB::Package.find_by_pharmacode('4876798').sequence.compositions[0].galenic_form.galenic_group = ODDB::Package.find_by_pharmacode('2204600').sequence.compositions[0].galenic_form.galenic_group
-> Tabletten

Result

  • Bingo!

Note

  • The cause is the 'galenic_group' that belongs to Sequence/Composition/GalenicForm/GalenicGroup class
  • This will be gone after oddbd reboots because it is not saved in the database, it is saved only on the cache

Next

  • Where is the code to set the 'galenic_group'?

Search the setting part of galenic_group

Experiment (bin/admin)

ch.oddb> open('/home/masa/work/log.dat','w'){|f| galenic_groups.keys.sort.each{|k| f.print k, "\t", galenic_groups[k], "\n"}}

Result

Experiment

  • Admin -> Galenik -> Tabletten (or unbekannt) -> Minipacks mit Mini-Filmtabletten -> Galenische Gruppe -> Tabletten, and 'Speichern'

Result

  • Bingo!

Rename link URL of PI (PatInfo)

Task

Experiment

      def _fachinfo(model, css='square infos')
        if(model.fachinfo_active?)
          link = HtmlGrid::Link.new(:square_fachinfo,
              model, @session, self)
          link.href = @lookandfeel._event_url(:fachinfo,
            {:swissmedicnr => model.iksnr})
          link.css_class = css
          link.set_attribute('title', @lookandfeel.lookup(:fachinfo))
p "WWW"
p link.href
          link
        end
      end

Run

  • bin/oddbd
  • search something

Log

"WWW"
"http://oddb.masa.org/de/gcc/fachinfo/swissmedicnr/55297"
"WWW"
"http://oddb.masa.org/de/gcc/fachinfo/swissmedicnr/55297"
"WWW"
"http://oddb.masa.org/de/gcc/fachinfo/swissmedicnr/55297"
"WWW"
"http://oddb.masa.org/de/gcc/fachinfo/swissmedicnr/55297"
"WWW"
"http://oddb.masa.org/de/gcc/fachinfo/swissmedicnr/55297"
...

Note

  • The FI link is created in src/view/additional_information.rb

Experiment

      def patinfo(model, session=@session)
        if(model.has_patinfo?)
          href = nil
          klass = nil
          if(pdf_patinfo = model.pdf_patinfo)
            klass = HtmlGrid::PopupLink
            href = @lookandfeel.resource_global(:pdf_patinfo, pdf_patinfo)
          elsif(patinfo = model.patinfo and model.respond_to?(:sequence))
            klass = HtmlGrid::Link
            #href = @lookandfeel._event_url(:resolve, {'pointer' => patinfo.pointer})
 href = @lookandfeel._event_url(:patinfo, {:seqnr => model.sequence.seqnr, :swissmedicnr => model.iksnr})
          end
          link = klass.new(:square_patinfo, model, @session, self)
          link.href = href
          link.set_attribute('title', @lookandfeel.lookup(:patinfo))
          link.css_class = 'square infos'
          link
        end
      end
  • src/state/global.rb#patinfo
      def patinfo
        if (iksnr = @session.user_input(:swissmedicnr)) \
          && (seqnr = @session.user_input(:seqnr)) \
          && (reg = @session.app.registration(iksnr)) \
          && (seq = reg.sequence(seqnr)) \
          && (patinfo = seq.patinfo)
          State::Drugs::Patinfo.new(@session, patinfo)
        else
          Http404.new(@session, nil)
        end
      end
    EVENTS = [
...
      :patinfo,
...
    ]

Result

Note

Summary (URL, SBSM)

  • http://(domain)/(language)/(flavor)/(event)/(key)/(value)/(key)/(value)/...
  • The key and value are saved as @session.user_input (Hash) in the oddb application
  • The event and keys have to be validated in src/util/validator.rb
  • Some values are valided in src/util/validator.rb
  • SBSM::_event_url makes the url, and the order of the (key, value)s becomes random (probably dictionary order), namely it depends on Hash.collect method. See SBSM::lookandfeel.rb#_event_url
  • The event should be defined as a method in src/state/global.rb

Commit

Next

  • Update the testcases

Testcases oddb.org

view · edit · sidebar · attach · print · history
Page last modified on July 01, 2013, at 09:07 PM