Class: HealthDataStandards::Util::HQMFTemplateHelper

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

Overview

General helpers for working with codes and code systems

Class Method Summary collapse

Class Method Details

.definition_for_template_id(template_id) ⇒ Object



6
7
8
# File 'lib/health-data-standards/util/hqmf_template_helper.rb', line 6

def self.definition_for_template_id(template_id)
  template_id_map[template_id]
end

.template_id_by_definition_and_status(definition, status, negation = false) ⇒ Object



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

def self.template_id_by_definition_and_status(definition, status, negation=false)
  kv_pair = template_id_map.find {|k, v| v['definition'] == definition && 
                                         v['status'] == status && 
                                         v['negation'] == negation}
  if kv_pair
    kv_pair.first
  else
    nil
  end
end

.template_id_mapObject



10
11
12
13
14
15
16
# File 'lib/health-data-standards/util/hqmf_template_helper.rb', line 10

def self.template_id_map
  if @id_map.blank?
    template_id_file = File.expand_path('../hqmf_template_oid_map.json', __FILE__)
    @id_map = JSON.parse(File.read(template_id_file))  
  end
  @id_map
end