(on branch Wirkstoffe)
Stuff todo:
What and how to add
FSME-Immun CC, Suspension zur intramuskulären Injektion
conserv)
Continuing work of last week. Add new fields to swissmedic plugin.
When trying to make the test defined in test_exporter to pass, I remarked when sending the result of the CSV files, we use an uninitialized variable @recipients in src/util/exporter.rb in an unused method mail_notification_stats. Removing mail_notification_stats and its accompanying test. Done with commit Remove unused method mail_notification_stats
Comparing the datastructures of oddb2xml and oddb.org: oddb_calc.xml generates somethin like
<ARTICLE>
<GTIN>7680002770014</GTIN>
<NAME>Coeur-Vaisseaux Sérocytol, suppositoire</NAME>
<PKG_SIZE>3</PKG_SIZE>
<SELLING_UNITS>3</SELLING_UNITS>
<MEASURE>Suppositorien</MEASURE>
<GALENIC_FORM>suppositoire</GALENIC_FORM>
<GALENIC_GROUP>unbekannt</GALENIC_GROUP>
<COMPOSITIONS>
<COMPOSITION>
<EXCIPIENS>
<SUBSTANCE_NAME>Excipiens pro Suppositorio</SUBSTANCE_NAME>
</EXCIPIENS>
<SUBSTANCES>
<SUBSTANCE>
<SUBSTANCE_NAME>Globulina Equina (immunisé Avec Coeur, Endothélium Vasculaire Porcins)</SUBSTANCE_NAME>
<IS_ACTIVE_AGENT>false</IS_ACTIVE_AGENT>
<QTY>8</QTY>
<UNIT>mg</UNIT>
</SUBSTANCE>
<..>
Therefore we have hierarchy in oddb2xml
The composition is derived from a row in the Swissmedic-Packungen.xlsx using the columns A (Zulassungsnummer), B (Dosisstärkenummer, aka sequence-number), C (Präparatebezeichnung), K (Packungscode), Q (Wirkstoff(e)), R (Zusammensetzung)
In oddb.org we have at the moment only substance which describe active agents. A package corresponds to an ARTICLE in oddb_calc which are both identified by a unit GTIN.
Each part has (among others) the following fields
Each part has (among others) the following fields
Each active_agent has (among others) the following fields
There is also a Composition which is attached to each sequence.
Running now jobs/import_swissmedic_only update_compositions to see, whether my changes work. This seems to be running fine. Verifying via bin/admin.
ch.oddb> registration('00334').sequence('01').compositions.first.active_agents.each.collect{ |x| x.more_info}
-> [nil, nil, nil, "conserv.", nil, "conserv.", nil]
But I got the following error
Error: NoMethodError Message: undefined method `strip!' for #<ParseSubstance:0x00000054589fb8> Backtrace: /var/www/oddb.org/src/plugin/swissmedic.rb:1068:in `update_substance' /var/www/oddb.org/src/plugin/swissmedic.rb:629:in `update_active_agent' /var/www/oddb.org/src/plugin/swissmedic.rb:739:in `block (2 levels) in update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:726:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:726:in `each_with_index' /var/www/oddb.org/src/plugin/swissmedic.rb:726:in `block in update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:723:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:723:in `each_with_index' /var/www/oddb.org/src/plugin/swissmedic.rb:723:in `update_compositions' /var/www/oddb.org/src/plugin/swissmedic.rb:136:in `block in update' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-3.3.1/lib/rubyXL/worksheet.rb:23:in `block in each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-3.3.1/lib/rubyXL/worksheet.rb:23:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/rubyXL-3.3.1/lib/rubyXL/worksheet.rb:23:in `each' /var/www/oddb.org/src/plugin/swissmedic.rb:118:in `update' /var/www/oddb.org/src/util/updater.rb:444:in `block in update_swissmedic' /var/www/oddb.org/src/util/updater.rb:549:in `call' /var/www/oddb.org/src/util/updater.rb:549:in `wrap_update' /var/www/oddb.org/src/util/updater.rb:442:in `update_swissmedic' jobs/import_swissmedic_only:29:in `block in <module:Util>' /var/www/oddb.org/src/util/job.rb:40:in `call' /var/www/oddb.org/src/util/job.rb:40:in `run' jobs/import_swissmedic_only:12:in `<module:Util>' jobs/import_swissmedic_only:11:in `<module:ODDB>' jobs/import_swissmedic_only:10:in `<main>'
Trying to fix it. Was easy. Restarted import stopped suddenly. Last lines seen were
2015-07-13 20:55:26 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb:637 update_active_agent update 00488/02 active_agent ptr :!registration,00488!sequence,02!composition,24362297!active_agent,Hepatitidis B Virus Antigenum. 4 agent.oid 24362301 substances 'Hepatitidis b Virus Antigenum' ptr :!registration,00488!sequence,02!composition,24362297!active_agent,Hepatitidis B Virus Antigenum. 2 args {:more_info=>nil, :is_active_agent=>false} substance #<ParseSubstance:0x000000468ee400>
2015-07-13 20:55:27 +0200: /var/www/oddb.org/src/plugin/swissmedic.rb: 1083: update_substance Glycinum
Will continue tomorrow.