Module: HealthDataStandards::Export::QRDA::EntryTemplateResolver

Extended by:
EntryTemplateResolver
Included in:
EntryTemplateResolver
Defined in:
lib/health-data-standards/export/qrda/entry_template_resolver.rb

Instance Method Summary collapse

Instance Method Details

#hqmf_qrda_oid_mapObject



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

def hqmf_qrda_oid_map
  if @hqmf_qrda_oid_map.blank?
    template_id_file = File.expand_path('../hqmf-qrda-oids.json', __FILE__)
    @hqmf_qrda_oid_map = JSON.parse(File.read(template_id_file))
  end
  @hqmf_qrda_oid_map
end

#qrda_oid_exist?(oid) ⇒ Boolean

Returns:

  • (Boolean)


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

def qrda_oid_exist?(oid)
  hqmf_qrda_oid_map.any? {|map_tuple| map_tuple['qrda_oid'] == oid}
end

#qrda_oid_for_hqmf_oid(hqmf_oid, vs_oid = nil, qrda_version = nil) ⇒ Object Also known as: partial_for



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/health-data-standards/export/qrda/entry_template_resolver.rb', line 17

def qrda_oid_for_hqmf_oid(hqmf_oid, vs_oid = nil, qrda_version = nil)

  if (vs_oid && hqmf_oid == '2.16.840.1.113883.3.560.1.1001')
    qrda_oid_for_hqmf_patient_characteristic(vs_oid, qrda_version)
  else
    oid_tuple = hqmf_qrda_oid_map.find {|map_tuple| map_tuple['hqmf_oid'] == hqmf_oid }
    if oid_tuple.nil?
      if hqmf_oid.nil?
        raise "This may be due to a discrepency between QDM 4.2 and QRDA R3. "\
              "Expected cases for this error include: "\
              "Diagnosis, Family History, Symptom, Immunization data types, "\
              "and Encounter Performed attributes for Diagnosis and Principal Diagnosis."
      else
        raise "No QRDA template available for OID #{hqmf_oid}: #{__FILE__} line #{__LINE__}"
      end
    end
    "#{oid_tuple['qrda_oid']}"
  end

end

#qrda_oid_for_hqmf_patient_characteristic(vs_oid, qrda_version = nil) ⇒ Object

given a value set oid for a patient characteristic, return the qrda oid for the correct characteristic



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/health-data-standards/export/qrda/entry_template_resolver.rb', line 39

def qrda_oid_for_hqmf_patient_characteristic(vs_oid, qrda_version = nil)
  # This is a special case. This HQMF OID maps to more than one QRDA OID.
  # So we need to try to figure out what template we should use based on the
  # content of the entry
  case vs_oid
  when '2.16.840.1.113883.3.526.3.1279'
    # Patient Characteristic Observation Assertion template for
    # Patient Characteristic: ECOG Performance Status-Poor
    '2.16.840.1.113883.10.20.24.3.103'
  when '2.16.840.1.113883.3.117.1.7.1.402', '2.16.840.1.113883.3.117.1.7.1.403',
       '2.16.840.1.113883.3.117.1.7.1.287', '2.16.840.1.113883.3.117.1.7.1.307'
    # Patient Charasteristic Gestational Age
    '2.16.840.1.113883.10.20.24.3.101'
  when '2.16.840.1.113883.3.526.3.1189', '2.16.840.1.113883.3.526.3.1170', '2.16.840.1.113883.3.600.2390'
    # Patient Characteristic Tobacco User/Non-User
    case qrda_version
    when 'r3_1', 'r3'
      '2.16.840.1.113883.10.20.24.3.103'
    else
      '2.16.840.1.113883.10.20.22.4.85'
    end
  else
    # return generic pc observation template for anything not specificly mapped to its own template
    '2.16.840.1.113883.10.20.24.3.103'
  end

end