view · edit · sidebar · attach · print · history

Index>

20150113-fix-search-company

Summary

  • Fix search companies
  • info registration holder like mepha should should include fields like ydim-ID
  • Correct address button does not work for companies

Commits

Index

Keep in Mind for work to do in 2015
  • Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • info registration holder like mepha should should include fields like ydim-ID. Mepha (No) and Novartis Ophthalmics AG (Yes, but fields are empty)
  • creat gem: task: input=file with ean-codes, standard output show ean-codes + atc-code. Source is Swissmedic Packungen.xlsx or XML.
  • Display 10 recalls not only those from this month
  • Import via data/medreg_companies.yaml
  • In home_pharmacies/ pressing pharmacy_list does not display the list but reverts to home. In home_hospital and home_companies everything is okay.

---

info registration holder like mepha should should include fields like ydim-ID

info registration holder like mepha should should include fields like ydim-ID. Mepha (No) and Novartis Ophthalmics AG (Yes, but fields are empty)

Checking

When displaying via ean13 or OID mepha never displays the ydim-ID. Why?

Adding debug printfs and trying various stuff.

AjaxCompanyComposite.init
AjaxCompanyComposite Novartis Ophthalmics AG oid 64 ba ba_pharma
AjaxPharmaCompanyForm.init @model Novartis Ophthalmics AG
AjaxCompanyComposite.company_users model.odba_id 558
AjaxCompanyComposite.company_users model [] for users []
AjaxCompanyComposite.init
AjaxCompanyComposite Mepha Pharma AG oid 133 ba ba_pharma
AjaxCompanyComposite.company_users model.odba_id 45
AjaxCompanyComposite.company_users model [#<ODDB::View::Admin::Entities::Wrapper:0x00000006228980 @entity=wiltrud.baier@mepha.ch>] for users wiltrud.baier@mepha.ch

Okay. It looks as we have some kind of permission problem. No. Not all companies were takeinto account.

The problem stems that a few companies have symbols and other have Strings for their business_area. Search for all occurrences of business_area under src and test and fixed all places where I considered it necessary.

Running watir tests before pulling changes on thinpower. Pushed commit Force business_area to String

But the link sent to the administrator is wrong for companies, etc. No. But you must be logged in before you may visit it.

Pushed commits:

Watir test for sending address correction often fail, because I do not login as unprivileged user. Probably should create such a user.

Correct address button does not work for companies

Also following the link "Correct address" in http://oddb-ci2.dyndns.org/de/gcc/company/ean/7601001001121 (when not logged into) goes to http://oddb-ci2.dyndns.org/de/gcc/suggest_address/pointer//zone/companies. Pressing a similar button on http://oddb-ci2.dyndns.org/de/gcc/pharmacy/ean/7601001380028 gets me redirected to http://oddb-ci2.dyndns.org/de/gcc/suggest_address/pharmacy/7601001380028/address/0/zone/pharmacies which looks okay. But when I change a line and press "Send" I get a Die von Ihnen gewünschte Information ist leider nicht mehr vorhanden. No output from oddbd neither. Okay, we land there only if we did not submit a valid e-mail address.

Corrected src/view/address.rb to use http://oddb-ci2.dyndns.org/de/gcc/suggest_address/company/7601001001121/address/0/zone/companies. But this address does not work as it should

After changing state/global.rb a little bit I was able to fix the problem. The watir test now works for companies, too.

Fix search companies

Continueing investigation why the search via admin returns correct results, but not via browser.

Found the interesting place in state/global.rb where for companies we use search_registration_holder. bin/admin shows

ch.oddb> search_companies('Mepha')
-> [Mepha Pharma AG]
ch.oddb> search_registration_holder('Mepha')
-> []

Now I have to solve the problem why Mepha is not found as a registration holder. Also it is unfortunate that the view name contains search/zone/companies whereas we want to search sometime registration holder, sometimes pharmacies and on other occasions hospitals.

Will ask Zeno whether I can replace companies by registration_holders or if anybody depends on the link name.

I found the reason, business_area is a symbol in old entries. E.g

ch.oddb> search_companies('Mepha').first.business_area.inspect
-> :ba_pharma
ch.oddb> search_companies('Mepha').first.business_area == ODDB::BA_type::BA_pharma
-> false
ch.oddb> search_companies('Mepha').first.business_area.to_s == ODDB::BA_type::BA_pharma.to_s
-> true

Fixing the search_registration_holder in util/oddbapp.rb. Bingo! Now a search for mepha works fine. But it does not show up when I search via "Basel".

Looks like we have to change the search terms for companies. E.g

ch.oddb> search_companies('Mepha').first.search_terms
-> ["Mepha", "Pharma", "Mepha Pharma AG", "7601001001121", "Kirschgartenstrasse 14  ", "4051  Basel ", "+41617054343 ", "+41617054344 ", "  Basel ", "4051"]
ch.oddb> search_companies('Mepha').first.addresses.first.search_terms
-> ["Kirschgartenstrasse 14  ", "4051  Basel ", "+41617054343 ", "+41617054344 ", "  Basel ", "4051"]

We should use 'Basel' and not ' Basel ' as search term. Also I think we should replace "Kirschgartenstrasse 14 " by "Kirschgartenstrasse" and "14"

Found another problem, that the address of Mepha contains a location which looks like 4051 Basel. The first space is 0xa0 and not 0x20. Fixed this by stripping leading non word characters in the city method of Address2.

Now calling jobs/rebuild_indices company_index. Now I find 26 registration holders via 'Basel' which looks a lot better than the 8 before.

Pushing commits:

Runnning spec tests before pulling on thinpower and rebuilding indices there.

view · edit · sidebar · attach · print · history
Page last modified on January 13, 2015, at 06:32 PM