2014 | Niklaus.20141216-fix-address-correction >>
search_companies('Mepha')
---
Okay. This was easy and the unit-tests is much simpler than before too. Imported the first 10 doctors. The real import (once DB was loaded) took less than 2 seconds. When running it a second time, no record was change (Corrected: When running a second time no yaml file was read). Fine. But I must document this behaviour and distinguish between updated and unchanged doctors. This proved to be impossible without additional work, eg. an address is compared using its OID which is always different. Also comparing the specialities/capabilites is difficult as the are arrays. Therefore I decided it was not worth effort. Now an email contains a resumen like
Doctors update from /var/www/oddb.org/data/medreg_doctors.yaml Number of doctors in database: 35014 Number of doctors in import: 10 New doctors: 0 Updated doctors: 10 Unchanged doctors: 0
Also found out, that the yaml files produced by the old import were in curious encoding where the Umlauts were not properly UTF-8 encoded. YAML files produced by the medreg gem were all correctly UTF-8 encoded.
Pushed commit Import via data/medreg_doctors.yaml
The following problems should be corrected:
A. . 6929 Gravesano Telefon: 091 760 00 75 Fax: 091 760 00 76
Updated import of doctors to pick up at the last state. Adapted unit tests. Same for companies. Pushed commit Fixed unit-tests. Pick-up from last import
Creating helper script to merge all yaml files. Pushed commits
It was easy to merge my different yaml outputs to a single input file with 32868 entries (File is 20 MB). Now looking for a way to import the generated yaml file into the oddb.org database by modifing the medreg importer.
Corrected yesterday most error. Now I still have to fix the link http://oddb-ci2.dyndns.org/de/gcc/address_suggestion/pharmacy/7601001380028/oid/32401536, which looks okay, but get the error
error in SBSM::Session#http_headers: /de/gcc/address_suggestion/pharmacy/7601001380028/oid/32401536 NoMethodError undefined method `active_address' for #<ODDB::State::Drugs::Init:0x00000008be4f30> /var/www/oddb.org/src/view/admin/address_suggestion.rb:129:in `address' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:68:in `create' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:286:in `compose_component' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:211:in `block in compose' /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.6/lib/htmlgrid/composite.rb:205:in `each'
Here we come because the concerned address_suggestion does not contain a address_pointer. Comparing it in bin/admin with a good one
ch.oddb> address_suggestion(32401536).name -> Apotheke Moor ch.oddb> address_suggestion(32401536).time -> 2014-12-16 22:32:26 +0100 ch.oddb> address_suggestion(32401536).address_pointer.class -> NilClass ch.oddb> address_suggestion(32401536).parent.oid -> 32375338 ch.oddb> address_suggestion(32401536).parent.class -> ODDB::Company # here a good one ch.oddb> address_suggestions.first[1].address_pointer -> :!doctor,4869!address,0.
Now I am asking myself how to correct this situation. Adding correct pointers for all pharamcies and their addresses via a bin/admin script? Or patching them when creating an address suggestion? Neither one. Decided to improve searching for parent in src/state/admin/address_suggestion.rb
Completed watir tests for address_suggestions and made them pass. OID are fix coded. Pushed commit Fix address_suggestion for pharmacies. Add watir test