Skip to content

Commit

Permalink
Display new fields corresp and excipiens
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Aug 19, 2015
1 parent 0265d75 commit 9ee5c1a
Show file tree
Hide file tree
Showing 8 changed files with 301 additions and 244 deletions.
20 changes: 16 additions & 4 deletions src/custom/lookandfeelbase.rb
Expand Up @@ -310,7 +310,8 @@ def google_analytics_token
:competition_email => 'E-Mail Konkurrenzanalyse',
:complementary => "Komplementärprodukt",
:complementary_type => "Komplementärprodukt",
:composition => "Zusammensetzung",
:composition => "Zusammensetzung",
:composition_label => "Bezeichnung",
:compositions => "Bestandteile",
:compositions0 => "",
:compositions1 => " Bestandteile",
Expand All @@ -325,7 +326,8 @@ def google_analytics_token
:contact_person => 'Zeno Davatz',
:contact_phone => 'Tel. ',
:correct => 'Korrigieren',
:correspondence => 'Korrespondenzsprache',
:corresp => 'Entspricht',
:correspondence => 'Korrespondenzsprache',
:cpr_link => ' ywesee.com,',
:cpr_updated => ' aktualisiert am: ',
:create_composition => 'Bestandteil hinzufügen',
Expand Down Expand Up @@ -615,6 +617,7 @@ def google_analytics_token
:exam_header => 'Staatsexamenjahr:',
:example_download => 'Beispiel-Download',
:exception_header => 'Es ist ein Fehler aufgetreten:',
:excipiens => 'Excipiens',
:experience => 'Persönliche Erfahrung',
:experience_header => 'Erfahrungsberichte',
:experience_of => 'Erfahrungsbericht von ',
Expand Down Expand Up @@ -1577,8 +1580,10 @@ def google_analytics_token
:th_companyname => 'Firma',
:th_company_url => 'Internet-Adresse',
:th_comparable_size => 'Packungsgrösse',
:th_compositions => 'Zusammensetzung',
:th_compositions => 'Zusammensetzung',
:th_composition_label => 'Bestandteil',
:th_connection_key => 'Verbindungsschlüssel',
:th_corresp => 'Entsprechen',
:th_count => '50',
:th_c_type => "Komplementärprodukt",
:th_date => 'Datum',
Expand Down Expand Up @@ -1606,6 +1611,7 @@ def google_analytics_token
:th_en_description => 'Englische Bezeichnung',
:th_equivalent_substance => 'Entspricht',
:th_example => 'Bsp.:',
:th_excipiens => 'Aufgefüllt mit',
:th_exfactory => 'Exfactory-Preis',
:th_expiration_date => 'Gültig bis',
:th_export_flag => 'Exportprodukt',
Expand Down Expand Up @@ -1965,6 +1971,7 @@ def google_analytics_token
:complementary_type => "Produit Complémentaire",
:composition => "Composition",
:compositions => "Composants",
:composition_label => "Désignation",
:compositions0 => "",
:compositions1 => " Composants",
:compression => 'compression désirée',
Expand Down Expand Up @@ -2955,6 +2962,7 @@ def google_analytics_token
:th_company_url => 'Adresse internet',
:th_comparable_size => 'Taille des prés.',
:th_compositions => 'Composition',
:th_corresp => 'Correspond à',
:th_ddd_price => 'CQ',
:th_ddd_price_title => 'Coût quotidien',
:th_deductible => 'QP',
Expand All @@ -2968,6 +2976,7 @@ def google_analytics_token
:th_date_pi_de => 'IPat dt.',
:th_date_pi_fr => 'IPat fr.',
:th_equivalent_substance => 'Correspondent',
:th_excipiens => 'excipiens',
:th_exfactory => 'Prix exfactory',
:th_firstname => 'Prénom',
:th_galenic_form => 'Forme galénique',
Expand Down Expand Up @@ -3235,6 +3244,7 @@ def google_analytics_token
:complementary_type => "Complementary product",
:composition => "Composition",
:compositions => "Parts",
:composition_label => "Label",
:compositions0 => "",
:compositions1 => " Parts",
:compression => 'Compression of choice',
Expand Down Expand Up @@ -4236,7 +4246,8 @@ def google_analytics_token
:th_company_url => 'Internet Address',
:th_comparable_size => 'Package Size',
:th_compositions => 'Composition',
:th_connection_key => 'Verbindungsschlüssel',
:th_connection_key => 'connection key',
:th_corresp => 'corresponds',
:th_ddd_price => 'DC',
:th_ddd_price_title => 'Daily cost',
:th_de_description => 'German description',
Expand All @@ -4252,6 +4263,7 @@ def google_analytics_token
:th_effective_form => 'Wirkform',
:th_en_description => 'English description',
:th_equivalent_substance => 'Corresponds',
:th_excipiens => 'filler',
:th_exfactory => 'Exfactory price',
:th_fachinfo_short => ' ',
:th_fachinfo_title => 'Doctorinfo title',
Expand Down
32 changes: 21 additions & 11 deletions src/plugin/text_info.rb
Expand Up @@ -150,8 +150,10 @@ def store_patinfo reg, languages
existing = reg.sequences.collect{ |seqnr, seq| seq.patinfo }.compact.first
ptr = Persistence::Pointer.new(:patinfo).creator
if existing
puts_sync "store_patinfo existing #{existing.to_s[0..200]} -> ptr #{ptr == nil} languages #{languages.keys} reg.iksnr #{reg.iksnr}"
LogFile.debug "store_patinfo existing #{existing.to_s[0..200]} -> ptr #{ptr == nil} languages #{languages.keys} reg.iksnr #{reg.iksnr}"
ptr = existing.pointer
else
LogFile.debug "store_patinfo none for reg.iksnr #{reg.iksnr}"
end
@app.update ptr, languages
end
Expand Down Expand Up @@ -583,11 +585,6 @@ def TextInfoPlugin::create_registration(app, info, seqNr ='00', packNr = '000')
args.store :company, company.pointer

registration = app.update reg_ptr, args, :text_plugin_create_registration
seq_ptr = (registration.pointer + [:sequence, seqNr]).creator
unless seq_ptr
LogFile.debug("Failed to create")
raise "Failed to create #{iksnr} seq #{seqNr}"
end
seq_args = {
:composition_text => nil,
:name_base => info.title,
Expand All @@ -601,10 +598,10 @@ def TextInfoPlugin::create_registration(app, info, seqNr ='00', packNr = '000')
else
seq_args.store :atc_class, info.atcCode
end
res = app.update seq_ptr, seq_args, :text_plugin
sequence = app.update((registration.pointer + [:sequence, seqNr]).creator, seq_args, :text_plugin)
app.registrations[iksnr]=registration
app.registrations.odba_store
sequence = app.registration(iksnr).sequence(seqNr)
# pointer = reg_pointer + [:sequence, seq.seqnr]
sequence.create_package(packNr)
package = sequence.package(packNr)
part = package.create_part
Expand Down Expand Up @@ -1051,6 +1048,7 @@ def parse_and_update(names, type)
iksnrs_from_xml = nil
name = ''
dist = nil
content = nil
[:de, :fr].each do |lang|
next unless names[lang]
name = names[lang]
Expand All @@ -1072,7 +1070,10 @@ def parse_and_update(names, type)
File.open(dist.sub('.html', '.styles'), 'w+') { |fh| fh.puts(styles) }
content,html = nil,nil
update = false
if !@options[:reparse] and File.exists?(dist)
if iksnrs_from_xml.size > 0 && type == 'fachinfo' and @app.registration(iksnrs_from_xml[0]) and not @app.registration(iksnrs_from_xml[0]).fachinfo
LogFile.debug "parse_and_update: must add fachinfo for #{iksnrs_from_xml}"
update = true
elsif !@options[:reparse] and File.exists?(dist)
if File.size(dist) != File.size(temp)
update = true
else
Expand All @@ -1082,26 +1083,35 @@ def parse_and_update(names, type)
else
update = true
end
msg = "parse_#{type} reparse #{@options[:reparse]}dist #{dist} #{File.exists?(dist)} iksnrs_from_xml #{iksnrs_from_xml.inspect} #{File.basename(dist)}, name #{name} #{lang} title #{title}"
if update
FileUtils.mv(temp, dist)
extract_image(name, type, lang, dist, iksnrs_from_xml)
puts_sync "parse_and_update: calls parse_#{type} dist #{dist} iksnrs_from_xml #{iksnrs_from_xml.inspect} #{File.basename(dist)}, name #{name} #{lang} title #{title}"
LogFile.debug "parse_and_update: calls " + msg
puts_sync " Mismatch between title #{title} and name #{name}" unless name.eql?(title)
infos[lang] = self.send("parse_#{type}", dist, styles)
File.open(dist.sub('.html', '.yaml'), 'w+') { |fh| fh.puts(infos[lang].to_yaml) }
else
LogFile.debug "parse_and_update: no " + msg
File.unlink(temp)
end
end
end
# LogFile.debug "#{type} empty? content #{content == nil} #{infos.empty?} iksnrs_from_xml #{iksnrs_from_xml} dist #{dist} i #{infos}"
LogFile.debug "#{type} empty? content #{content == nil} #{infos.empty?} iksnrs_from_xml #{iksnrs_from_xml} dist #{dist} i #{infos.inspect.to_s[0..400]}"
# import_daily_2015.08.11-fresh-debug.log:2015-08-13 09:07:36 +0200: /var/www/oddb.org/src/plugin/text_info.rb:1094:in `block in parse_and_update': parse_and_update: no parse_fachinfo dist /var/www/oddb.org/data/html/fachinfo/de/Cefepim Labatec_ 1 g i_v__i_m__2 g i_v__swissmedicinfo.html iksnrs_from_xml ["65452"]
# import_daily_2015.08.11-fresh-debug.log:2015-08-13 09:07:36 +0200: /var/www/oddb.org/src/plugin/text_info.rb:1099:in `parse_and_update': fachinfo empty? content true true iksnrs_from_xml ["65452"] dist /var/www/oddb.org/data/html/fachinfo/fr/Cefepim Labatec_ 1 g i_v__i_m__2 g i_v__swissmedicinfo.html i {}
# update_textinfo_65452-fresh-debug.log:2015-08-13 09:24:06 +0200: /var/www/oddb.org/src/plugin/text_info.rb:1089:in `block in parse_and_update': parse_and_update: calls parse_fachinfo dist /var/www/oddb.org/data/html/fachinfo/fr/Cefepim Labatec_ 1 g i_v__i_m__2 g i_v__swissmedicinfo.html iksnrs_from_xml ["65452"] Cefepim Labatec_ 1 g i_v__i_m__2 g i_v__swissmedicinfo.html, name Cefepim Labatec® 1 g i.v./i.m./2 g i.v. fr title Cefepim Labatec® 1 g i.v./i.m./2 g i.v.
# update_textinfo_65452-fresh-debug.log:2015-08-13 09:23:55 +0200: /var/www/oddb.org/src/plugin/text_info.rb:1099:in `parse_and_update': fachinfo empty? content true false iksnrs_from_xml ["65452"] dist /var/www/oddb.org/data/html/fachinfo/de/Cefepim Labatec_ 1 g i_v__i_m__2 g i_v__swissmedicinfo.html i {:de=>#<ODDB::FachinfoDocument2001:0x00000052881cb8 @amzv=nil, @contra_indications=Kontraindikationen
# import_daily_2015.08.11-fresh-debug-2.log:2015-08-13 09:43:07 +0200: /var/www/oddb.org/src/plugin/text_info.rb:1095:in `block in parse_and_update': parse_and_update: no parse_fachinfo reparse dist /var/www/oddb.org/data/html/fachinfo/fr/Cefepim Labatec_ 1 g i_v__i_m__2 g i_v__swissmedicinfo.html true iksnrs_from_xml ["65452"] Cefepim Labatec_ 1 g i_v__i_m__2 g i_v__swissmedicinfo.html, name Cefepim Labatec® 1 g i.v./i.m./2 g i.v. fr title Cefepim Labatec® 1 g i.v./i.m./2 g i.v.
# import_daily_2015.08.11-fresh-debug-2.log:2015-08-13 09:40:20 +0200: /var/www/oddb.org/src/plugin/text_info.rb:1095:in `block in parse_and_update': parse_and_update: no parse_fachinfo reparse dist /var/www/oddb.org/data/html/fachinfo/fr/Cefepim Labatec_ 1 g i_v__i_m__2 g i_v__swissmedicinfo.html true iksnrs_from_xml ["65452"] Cefepim Labatec_ 1 g i_v__i_m__2 g i_v__swissmedicinfo.html, name Cefepim Labatec® 1 g i.v./i.m./2 g i.v. fr title Cefepim Labatec® 1 g i.v./i.m./2 g i.v.
unless infos.empty?
_infos = {}
[:de, :fr].map do |lang|
unless strange?(infos[lang])
_infos[lang] = infos[lang]
end
end
LogFile.debug "calling update_#{type} #{name}, #{iksnrs_from_xml}"
self.send("update_#{type}", name, iksnrs_from_xml, _infos, {})
end
[iksnrs, infos]
Expand Down

0 comments on commit 9ee5c1a

Please sign in to comment.