Skip to content

Commit

Permalink
Remove unnecessary spaces from ARTICLE.GALENIC_FORM in oddb_calc.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Mar 4, 2015
1 parent 7eb4923 commit 3f96491
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions History.txt
@@ -1,5 +1,6 @@
=== 1.9.8 / 04.03.2015

* Remove unnecessary spaces from ARTICLE.GALENIC_FORM in oddb_calc.xml
* Remove unnecessary spaces from ARTICLE.PKG_SIZE in oddb_calc.xml
* Remove unnecessary spaces from ARTICLE.NAME in oddb_calc.xml
* Emit comment for compositions, eg. 'Solvens: aqua ad iniectabilia.'
Expand Down
10 changes: 7 additions & 3 deletions lib/oddb2xml/calc.rb
Expand Up @@ -182,10 +182,14 @@ def self.update_active_agent(name, part)
[name, dose ? [dose[0], dose[1]] : [nil, nil] ].flatten
end
end
private
def remove_duplicated_spaces(string)
string ? string.to_s.gsub(/\s\s+/, ' ') : nil
end
public
def initialize(name = nil, size = nil, unit = nil, active_substance = nil, composition= nil)
@name = name ? name.gsub(/\s\s+/, ' ') : name
@pkg_size = size ? size.to_s.gsub(/\s\s+/, ' ') : nil
@name = remove_duplicated_spaces(name)
@pkg_size = remove_duplicated_spaces(size)
@unit = unit
# @pkg_size, @galenic_group, @galenic_form =
search_galenic_info
Expand Down Expand Up @@ -374,7 +378,7 @@ def search_galenic_info
# puts "oid #{UnknownGalenicForm} #{@galenic_form.oid} for #{name}"
break unless @galenic_form.oid == UnknownGalenicForm
if @galenic_form.oid == UnknownGalenicForm
@galenic_form = GalenicForm.new(0, {'de' => form_name.gsub(' +', ' ')}, @@galenic_forms[UnknownGalenicForm] )
@galenic_form = GalenicForm.new(0, {'de' => remove_duplicated_spaces(form_name.gsub(' +', ' '))}, @@galenic_forms[UnknownGalenicForm] )
@@new_galenic_forms << form_name
end
}
Expand Down
Binary file modified spec/data/swissmedic_package-galenic.xlsx
Binary file not shown.

0 comments on commit 3f96491

Please sign in to comment.