Class: HealthDataStandards::Export::HTML

Inherits:
Object
  • Object
show all
Defined in:
lib/health-data-standards/export/html.rb

Instance Method Summary collapse

Constructor Details

#initializeHTML

Returns a new instance of HTML.



4
5
6
7
8
9
10
# File 'lib/health-data-standards/export/html.rb', line 4

def initialize
  template_helper = TemplateHelper.new('html', 'html')
  @rendering_context = RenderingContext.new
  @rendering_context.template_helper = template_helper
  @rendering_context.extensions = [HealthDataStandards::Export::Helper::HTMLViewHelper]
  @code_map = nil
end

Instance Method Details

#build_code_mapObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/health-data-standards/export/html.rb', line 17

def build_code_map
  super_code_map = {}
  val_set_array = HealthDataStandards::SVS::ValueSet.all.to_a
  val_set_array.each do |valset| 
    valset.concepts.each do |concept|
      super_code_map[concept.code_system_name] ||= {}
      super_code_map[concept.code_system_name][concept.code] = concept.display_name unless super_code_map[concept.code_system_name][concept.code]
    end
  end
  super_code_map
end

#export(patient, measures = []) ⇒ Object



12
13
14
15
# File 'lib/health-data-standards/export/html.rb', line 12

def export(patient, measures=[])
  @code_map ||= self.build_code_map
  @rendering_context.render(:template => 'show', :locals => {:patient => patient, :code_map => @code_map, :measures => measures})
end