Some clients would like to add oddb_calc.xml when calling oddb2xml -e -I 80 --compress=zip
.
Pushed commit Option -e implies now --calc
Must find out, why for IKSNR 47657 seq 01 "Nanocoll" the import does not work as it should. Running jobs/import_swissmedic_only update_compositions 47657
.
2015-03-25 08:32:26 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:89 opts {:fix_galenic_form=>false, :iksnrs=>[47657], :update_compositions=>true} @update_comps true update target nilLatest /var/www/oddb.org/data/xls/Packungen-latest.xlsx 2562552 bytes 2015-03-25 08:32:26 +0100: file2open /var/www/oddb.org/data/xls/Packungen-latest.xlsx 2562552 bytes 2015-03-25 08:33:07 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:584 update_active_agent update 47657/01 from creator 1 substances '' ptr label nil 2 args {:dose=>Quanty(0.2,'mg'), :substance=>"Albuminum Humanum Colloidale 0.5 Mg, Stanni(ii) Chloridum Dihydricum"} 2015-03-25 08:33:08 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:584 update_active_agent update 47657/01 from creator 2 substances '' ptr label nil 2 args {:dose=>Quanty(238,''), :substance=>"Poloxamerum"} 2015-03-25 08:33:08 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:641 update_compositions ODDB::Composition 0 active_agents replace by 2 agents NilClass [] by NilClass [nil, nil] 2015-03-25 08:33:08 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:584 update_active_agent update 47657/01 from creator 1 substances '' ptr label "II" 3 args {:dose=>Quanty(99,''), :substance=>"I) Recenter Radioactivatum", :chemical_substance=>"Natrii Pertechnetas."} 2015-03-25 08:33:08 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:641 update_compositions ODDB::Composition 2 active_agents replace by 1 agents ODDB::ActiveAgent [, ] by NilClass [nil] 2015-03-25 08:33:08 +0100: /var/www/oddb.org/src/plugin/swissmedic.rb:651 iksnr 47657 seqnr 01 comp_idx 2 delete_composition :!registration,47657!sequence,01!composition,33041297. comp.oid 33041297
Trying to debug this with pry. Debugging showed, that no agent.pointer was created when calling create_active_agent. Adding it to the code and running the import again. As after my pry session there were two substances with no name in it. I manually deleted them and ran the import again.
This did not fix the problem, completly. I think parsing
I): albuminum humanum colloidale 0.5 mg, stanni(II) chloridum dihydricum 0.2 mg, glucosum anhydricum, dinatrii phosphas monohydricus, natrii fytas (9:1), poloxamerum 238, q.s. ad pulverem pro vitro. II): pro usu: I) recenter radioactivatum 99m-technetio ut natrii pertechnetas.
does not work correctly. bin/admin says.
ch.oddb> registration('47657').sequence('01').compositions.first.substances -> [nil, Poloxamerum]
Looking at the output of oddb2xml --calc. I see 2 compositions each with one substance, namely
Albuminum Humanum Colloidale 0.5 Mg, Stanni(ii) Chloridum Dihydricum
Poloxamerum
. But quantity is here 238.0
. Correct would be name poloxamerum 238
I think the correct way to represent it is
We have 5 occurrences of pro usu
namely
II): pro usu: I) recenter radioactivatum 99m-technetio ut natrii pertechnetas." II): pro usu: I) recenter radioactivatum 99m-technetio ut natrii pertechnetas." III): pro usu: I) et II) recenter radioactivatum 99m-technetio ut natrii pertechnetas." IV): pro usu: I) et II) et III) recenter radioactivatum 111-indium ut indii(111-In) trichloridum aut pro usu: I) et II) et III) recenter radioactivatum 90-yttrium ut yttrii(90-Y) chloridum."
via http://ch.oddb.org/de/gcc/drug/reg/47657/seq/01 you find
Which does not correspond clearly with the "Wirkstoff" albuminum humanum colloidale, stanni(II) chloridum dihydricum
As we have only 5 occurrences I will leave this problem for the moment, and look more closely at another example, e.g http://ch.oddb.org/de/gcc/drug/reg/65645/seq/04. which shows
Substanz Irinotecan Hydrochlorid Trihydrat Stärke 300mg / 15ml Galenische Form Infusionskonzentrat
Here also the composition is not clean as show by oddb2xml --calc
<GALENIC_FORM>Infusionskonzentrat</GALENIC_FORM> <COMPOSITION> <SUBSTANCES> <SUBSTANCE> <SUBSTANCE_NAME>Irinotecani Hydrochloridum Trihydricum 300 Mg, Sorbitolum, Acidum</SUBSTANCE_NAME> <QTY>0.0</QTY> <UNIT>s,lacticum/15 ml</UNIT> </SUBSTANCE> </SUBSTANCES> </COMPOSITION>
May be we have problems, because the substance name is not clean. Looking for a simple where I can solve the problem with delete/update http://ch.oddb.org/de/gcc/drug/reg/65522/seq/01, but this one display correctly via http://oddb-ci2.dyndns.org/de/gcc/drug/reg/65522/seq/01
http://oddb-ci2.dyndns.org/de/gcc/drug/reg/65201/seq/01 does not display the newly added substances, eg. (E 110). Running an import for it. After the import, the name of substance is not shown. This must be fixed! Looking in the code I find a method ajax_create_active_agent src/state/sequence. Which returns AjaxActiveAgents.new(@session, agents.dup.push(nil))
Looks like creating substances needs some hidden magic. Looking into the test cases. Using bin/admin to explore I fine
ch.oddb> substances[-1] -> Betamethasonum ch.oddb> substances[-1].names -> ["Betamethason", "Betamethasone", "Betamethasone", "Betamethasonum", "Glucocorticoide", "Glucocorticoids", "Glucocorticoides", "Glucocorticoida"] ch.oddb> substances[-1].descriptions -> {"de"=>"Betamethason", "en"=>"Betamethasone", "fr"=>"Betamethasone", "lt"=>"Betamethasonum"} ch.oddb> substances[-1].effective_form -> Glucocorticoida ch.oddb> substances[-1].effective_form.descriptions -> {"de"=>"Glucocorticoide", "en"=>"Glucocorticoids", "fr"=>"Glucocorticoides", "lt"=>"Glucocorticoida"} ch.oddb> $tst = create_substance('E 110') -> E 110 ch.oddb> $tst.names -> ["E 110"] ch.oddb> $tst.descriptions -> {"lt"=>"E 110"} ch.oddb> substances[-1] -> E 110 ch.oddb> $tst.oid -> 33041335 ch.oddb> $tst2 = create_substance('E 110') -> E 110 ch.oddb> $tst2.oid -> 33041336
Conclusion: the utility procedure create_substance in util/oddbapp.rb creates duplicates if given several times the same, new substance name.
Modified in util/oddbapp.rb the method search_single_substance(key) to return 2substance = substances.find{ |x| x.name.eql?(key)}
if found. But the create_substance does not store correctly a new substance. Calling substances.odba_isolated_store in bin/admin afterwards took 4 minutes to finish, but did not help neither. Problem is that the generated substance does not have a pointer. In src/plugin/bsv_xml.rb I found a snippet, where a substance is created.