Sha256: afd4d3bada456a4ca7060c407051b410223a0d78fb697fc18d5676c687c2ce18

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

module HealthDataStandards
  module Export
    class HTML
      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 ||= self.build_code_map
      end

      def export(patient)
        @rendering_context.render(:template => 'show', :locals => {:patient => patient, :code_map => @code_map})
      end
      
      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
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
health-data-standards-3.0.6 lib/health-data-standards/export/html.rb
health-data-standards-3.0.5 lib/health-data-standards/export/html.rb
health-data-standards-3.0.4 lib/health-data-standards/export/html.rb
health-data-standards-3.0.3 lib/health-data-standards/export/html.rb