view · edit · sidebar · attach · print · history




  • Use refdata to import doctors
  • remove feedback from migel
  • problem startup
  • Keep in Mind



Use refdata to import doctors, hospitals, pharmacies and companies

During the night I ran the importer for doctors twice (removing the latest file between). This did not work as expected as in the second run the new address is not correctly recognisec, eg. I found lines like 2017-12-06 00:35:49 +0100: RefdataDoctorPlugin store_doctor update 7601000108951 oid 37292309 in database. pointer nil {"addresses"=>"no new address"}

This must be fixed.

This happens if I find an entry in the refdatabase

      <ITEM xmlns="" DT="2016-01-06T00:00:00">

where only the search via returns an addresss. I think in this case I should not report any change. Fixing this problem.

Also remarked that the hospital pharmacies are not correctly update (e.g, 7601002028127 Bethesda-Spital) always appears in the list of new partners.

Renaming jobs, files, etc from doctors -> nat and partners - jur. Done.

Now running the jobs/import_refdata_jur detects correctly hospital pharmacies, but does not correctly store new hospitals. Debugging with with pry.

When storing the hospitals I see the following inconsistency

[1] pry(#<ODDB::Companies::RefdataJurPlugin>)> @app.hospital_by_gln(7601002001229)
=> nil
[2] pry(#<ODDB::Companies::RefdataJurPlugin>)> @app.hospitals[7601002001229].odba_id
=> 37533070
[3] pry(#<ODDB::Companies::RefdataJurPlugin>)> 

This stems from the fact, that the ean13 was stored as a String and not as Integer. Whereas for companies ean13 is an Integer. Fixing create_hospital in src/util/oddbapp.rb

Pushed the following commits

Analysing the problem, why a search for Kriens does not list all pharmacies. bin/admin shows

-> Alters- und Pflegeheim Grossfeld
ch.oddb> pharmacy_by_gln(7601002051163).search_terms
-> Array
ch.oddb> pharmacy_by_gln(7601002051163).search_terms.find_all{|x| /kriens/i.match(x.downcase)}
-> ["6010 Kriens", "Kriens"]
ch.oddb> pharmacy_by_gln(7610840000042)
-> Coop Vitality Apotheke Kriens
ch.oddb> pharmacy_by_gln(7610840000042).search_terms
-> undefined method `split' for 7610840000042:Integer

After adding a unit-test and fixing this problems I must run sudo -u apache bundle-240 exec ruby-240 jobs/rebuild_indices company_index before I can see a result. It took about 10 minutes to rebuild the index, and now I can see the two new "Coop Vitality" pharmacies for Kriens.

Must get the link info for the details of each doctor on medreg. Parsing using mechanize is not easy at all, as it uses a lot a javascript, which watir this is a simple job.

Pushed commits

Tried using the GLN to fetch the details, eg. fails with Message Der Parameter idPerson fehlt.

I do not like the idea to use watir, as this would require a running webbrowser and xvfb on the server. But may be there are other ruby gems we could use, eg.

Or does ext/swissreg/src/swissreg.rb handle a similar web site?

Also parsing should be a log faster. Whey is it so slow?

Runing the full watir tests showed, that I also have the same search term problems for doctors. Fixed with commit Fix search_terms for doctors

remove feedback from migel

Running watir smoke_test before pushing commit Remove migel feedback has problem starting up with doctors

symptons were error messages like

Plugin: ODDB::RssPlugin

Error: NoMethodError
Message: undefined method `update' for #<ODDB::Doctor:0x007f22de5f4828>
/var/www/ `method_missing'
/var/www/ `block in update_indices'
/var/www/ `each'
/var/www/ `update_indices'
/var/www/ `store'
/var/www/ `odba_isolated_store'
/var/www/ `block in method_missing'
/var/www/ `synchronize'
/var/www/ `method_missing'
/var/www/ `update_rss_feeds'
/var/www/ `update_swissmedic_feed'
/var/www/ `update_recall_feed'
/var/www/ `update_immediate_with_error_report'
/var/www/ `update_recall_feed'
/var/www/ `update_swissmedic_feeds'
/var/www/ `run'
jobs/import_daily:13:in `block in <module:Util>'
/var/www/ `run'
jobs/import_daily:12:in `<module:Util>'
jobs/import_daily:11:in `<module:ODDB>'
jobs/import_daily:10:in `<main>'

Using pry sees

=> ["/var/www/ `method_missing'",
 "/var/www/ `block in update_indices'",
 "/var/www/ `each'",
 "/var/www/ `update_indices'",
 "/var/www/ `store'",
 "/var/www/ `odba_isolated_store'",
 "/var/www/ `block in odba_store_unsaved'",
 "/var/www/ `each'",
 "/var/www/ `odba_store_unsaved'",
 "/var/www/ `odba_store'",
 "/var/www/ `initialize'",
 "/var/www/ `new'",
 "/var/www/ `block in <main>'",
 "/var/www/ `instance_eval'",
 "/var/www/ `initialize'",
 "/var/www/ `new'",
 "/var/www/ `<main>'",
 "/var/www/ `eval'",
 "/var/www/ `new_from_string'",
 "/var/www/ `parse_file'",
 "/var/www/ `build_app_and_options_from_config'",
 "/var/www/ `app'",
 "/var/www/ `wrapped_app'",
 "/var/www/ `start'",
 "/var/www/ `start'",
 "/var/www/ `<top (required)>'",
 "/var/www/ `load'",
 "/var/www/ `<main>'"]
[3] pry(#<ODDB::App>)> 

As we have problems updating the index I will try to remove the dictionary: 'simple' from the doctor_index, as we have no such corresponding for companies.

Will drop the database and reload to try it. Removed the doctor_index from etc/index_definitions.yml. Now starts up without any problem and bin/admin reports

ch.oddb> companies.size
-> 4635
ch.oddb> companies.first
-> [123, #<ODBA::Stub:47331105489240#508 @odba_class= @odba_container=47331118660100#3>]
ch.oddb> companies.values.first
-> athenstaedt AG
ch.oddb> doctors.size
-> 59762
ch.oddb> doctors.first
-> [8227, #<ODBA::Stub:47331137941240#425438 @odba_class= @odba_container=69925593816720#393389>]
ch.oddb> doctors.values.first
-> #<ODDB::Doctor:0x007f31a5923e60>
ch.oddb> doctors.values.first.ean13
-> 7601000216885
ch.oddb> doctors.values.first.ean13.class
-> String
ch.oddb> doctors.values.find_all{|x| x.ean13.is_a?(String)}.size
-> 26478
ch.oddb> doctors.values.find_all{|x| x.ean13.is_a?(Integer)}.size
-> 29224

No adding a new index (with a different name) for doctors, trying to rebuild it and restarting afterwards. With the new index doctor_index_without_dictionary the services start okay. Rebuilding the index takes time (over 15 minutes). But know a search for doctors failes (tried Brunner, Schönbucher, Luzern).

Ran sudo -u apache bundle-240 exec ruby-240 jobs/rebuild_indices doctor_index on thinpower and this fixed the problem.

view · edit · sidebar · attach · print · history
Page last modified on December 07, 2017, at 01:30 PM