---
Fixed with commit Don't run export oddbdat in export_daily
Requirements:
The existing oddb.csv contains two different type of records namely #MGrp
and #Medi
. Here the some examples
Typ;Reg.-Nr.;Packungsnummer;Swissmedic-Nr.;EAN-Code;BSV-Dossier;Pharmacode;Präparat;Galenische Form;Stärke;Packungsgrösse;Numerisch;EFP;PP;Zulassungsinh.;Kat.;SL;Aufnahme in SL;Limitation;Limitationspunkte;Limitationstext;LPPV;Reg.Dat.;Gültig bis;Deaktiviert;Exportprodukt;CAS Reg.Nr.;Generikum;Hat ein Generikum;SB;Ausser Handel (MedRef);Komplementärprodukt;Index Therapeuticus (BAG);Index Therapeuticus (Swissmedic);Betäubungsmittel;Impfstoff/Blutprodukt;In Erneuerung (Swissmedic #MGrp;A;ALIMENTÄRES SYSTEM UND STOFFWECHSEL #MGrp;A01;STOMATOLOGIKA #MGrp;A01A;STOMATOLOGIKA #Medi;10787;017;10787017;7680107870176;;351372;Sanogencive Plan;Flüssigkeit;233.6 mg/ml;1 à 100 ml;100;;7.90;Laboratoires Plan SA;D;Nein;;;;;Ja;29.07.1941;09.11.2018;;;"";;Nein;;Nein;Ph;13.04.;13.04.;Nein;Nein;Nein
Compare this with line in Packungen xls for Sanogencive Plan 10787 1 Sanogencive Plan, liquide Laboratoires Plan SA 13.04.0. A01A Synthetika human 29.07.1941 29.07.1941 09.11.2018 017 100 ml D myrrha, ratanhiae radix, cochleariae spiritus, camphora racemica myrrha 45.2 mg, ratanhiae radix 15.1 mg, cochleariae spiritus 150.7 mg, camphora racemica 22.6 mg, aromatica, excipiens ad solutionem pro 1 ml, corresp. ethanolum 70-78 % V/V. Pour gargarismes et bains de bouche en cas d'inflammations des gencives
Without digging deeper in the code I don't know how to add support for
Assuming
Support for csv would by adding a format csv (besides dat|xml) via --format=csv.
Alternatively we could emit the dat/xml-files as csv.
Duplicating the method build_dat to build_csv is not very nice, as there are about 15 places with logic about how to generate a field. Therefore it would be probably better to replace the calls of row << content_of_field
by something like add_field(content_of_field)
with different methods depending on whether we want to generate CSV or DAT files. This would support all fields from oddb.dat.
Adapting oddb2xml to replace the oddb*.xml would be trickier, as we have nested fields, which would need special treatement, as CSV files are flat. This problem is absent when creating substances, limitation, interactions, code, company, person)
Not analysed (fi, fi_product)
Here the lists of nested fields for
Here we would have to solve the problem that for XML we are often skipping element, may a adding else add_empty_field
would fix this problem. But we would probably end up with about 10 statement if format == :csv
.
Zeno wants first an estimation of effort including a test, whether sending the e-mail works. Recipients to changed would be
Things to change would be:
mail_recipients: - ywesee_test@ywesee.com - test - bsv - ipn - plugin - ouwerkerk - swissmedic_journal - log # updater - sequence # or should we use admin - xls - dat - dat_extended - oddb2 - oddb2csv - swissdrug
src/state/admin/sequence.rb: mail.to = ODDB::State::Admin::Sequence::RECIPIENTS src/state/admin/sequence.rb: smtp.sendmail(mail.encoded, config.smtp_user, [addr] + RECIPIENTS) src/state/suggest_address.rb: RECIPIENTS = [ 'zdavatz@ywesee.com', 'mhatakeyama@ywesee.com' ] src/state/suggest_address.rb: RECIPIENTS.each { |rec| src/state/admin/sequence.rb: mail.to = ODDB::State::Admin::Sequence::RECIPIENT src/plugin/bsv_xml.rb: RECIPIENTS = [ 'paul.wiederkehr@pharmasuisse.org' ] src/plugin/bsv_xml.rb: BSV_RECIPIENTS = [ 'andrea.frey@bag.admin.ch', src/plugin/csv_export.rb: ODDB_RECIPIENTS = [ "paul.wiederkehr@pharmasuisse.org" ] src/plugin/csv_export.rb: ODDB_RECIPIENTS_DAT = [ "andre.dubied@gmail.com" ] src/plugin/csv_export.rb: ODDB_RECIPIENTS_EXTENDED = [ "ouwerkerk@bluewin.ch", "Tim.Suter@just-medical.com" ] src/plugin/xls_export.rb: RECIPIENTS = [ src/plugin/swissmedicjournal.rb: RECIPIENTS = [ src/plugin/ouwerkerk.rb: RECIPIENTS = [ src/state/suggest_address.rb: RECIPIENTS = [ 'zdavatz@ywesee.com', 'mhatakeyama@ywesee.com' ] src/util/ipn.rb: RECIPIENTS = [ 'zdavatz@ywesee.com', 'mhatakeyama@ywesee.com', ]
But adding a test, whether e-mails reach their destination, is the hot spot and should be resolved first.
Therefore total estimation is between 4 hours and 16 hours of effort.
Also we should eliminate all calls to RMail (inside oddb.org) and replace them by calls to Mail.
Starting work. Pushed commit Use Mail instead of (outdated, last release in 2008) RMail for verification of e-mail addresses
Looking at the code I see that we can remove our implementation of Net::SMTP in src/util/smtp_tls.rb. Will replace all occurences of it with direct call to Mail.deliver.
Refactoring to replace the smtp_tls was quite easy, but still took some hours. But quite confident, as the concerned classes all had unit tests (Thanks Hannes!).
Sending on oddb-ci2 does not work as there is no configuration field smtp_auth defined. Must correct this. Was easy. Now resetting the password works. This will be my first watir test to write for tomorrow morning. Afterwards will have to write watir tests for the other occurrences of sending-emails, too.
And we should also fix the warning seen when sending the e-mail
Non US-ASCII detected and no charset defined. Defaulting to UTF-8, set your own if this is incorrect.
Hint: use add_charset in Mail::Message when body is given.