Yesterday I implemented the search for trademark using the exact search, which find any product which contains the search-query, e.g. it would return Rivoleve 200, Rivoleve 500, Rivoleve 1000 when search for Rivolve (using search_by_sequence). This is how our search by trademark works.
It seems however that Evidentia wants it to match the complete trademark. Therefore a search for Levetiracetam should return nothing, as no product matches this name completely. A search for Levetiracetam Desitin should return some results. But we only have products like Levetiracetam Desitin 500 mg/mL, Levetiracetam Desitin 1000 mg.
Conclusion: We need a new search type, which return all drugs where the name begins with the trademark, but where one or more entities describing the dosage should be excluded.
Must also reactivate the debugging, to look why Rivoleve 250 (registration('62036')) does not come at the top of the search results, as expected. Okay, the search_by_sequence did not work as I expected. Prove is this bin/admin snippet.
ch.oddb> search_by_sequence('Rivoleve') -> [Levetiracetam]
We could probably just look how large is the part of the base_name of the registration which can be initiliazed to a Dose. E.g (500 mg/5 mL).
Testing whether a search like registrations.values.find_all{ |x| /Rivoleve/i.match(x.name_base) }
takes a long time (ignoring the first execution time). No, it completes fast.
Creating watir test cases for "Levetiracetam Desitin" and "Rivoleve" to catch the errors and describe the desired results. Done. Three new tests in spec/evidentia_spec.rb
Found that we have one registration (54935) where the basename is nil.
Some special names that I think I cannnot handle well are
2-Fluorglukose (18-F) 3TC Agoprim 800 /160 Alutard SQ 6-Gräsermischung + Roggen Kombipackung Alutard SQ 6-Gräsermischung Kombipackung
Adding unit tests to handle comparing package names to the desired trademark name. Added unit tests and made them pass. Thinking whether I catched all possible cases, while running all unit and watir tests.
Running the watir test showed, that the unit test for result_sort did not yet take in account the out_of_trade. Must fix that, too.
Pushed commit Fix recognition of trademark for Evidentia. Priorize out of trade, too.
After pushing the commit I checked on evidentia for Levetiracetam Desitin, Inderal Ponstan and Duodopa.
What is weird, is that sometimes it works fine and sometimes not. Finally I discovered that in src/util/resultsort I accessed @session instead of using the session passed to the method sort_result. Rename the variables to a_session. Took some time to fix the unit tests, too. Added small corrections to ignore the case when looking for drug names. Pushed commit Evidentia. Fix trademark and ignore case and Fix unit-tests. Thanks to Travis-CI!
Culprit is registration('56828').sequence('01').comparables "InductOs 1.5 mg/ml, poudre, solvant et matrice pour matrice pour implantation". Pushed work-around with commit Rescue errors when calculation package.comparable
Ist the ATC-Code for M05BC01 the cause?
As described in yesterdays blog I installed xvfb on oddb-ci2. Today I created a small script to run a given watir test headless. See commit Added script to run watir tests via xvfb
I hardcoded some URL in my watir tests to visit URL after entering eg. a corrected address for a pharmacy. They are broken as soon as a new database from thinpower is loaded.
Therefore I want to make them pass (which will work only when they are running on the same machine as the obbb-daemon) by picking up the generated URL from the log file. Eg. spec/address_correction_spec.rb.
Pushed commit Fix address_suggestion for pharmacies