qrda_generator 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +12 -0
- data/Rakefile +12 -0
- data/lib/qrda_generator/export/cat_1.rb +136 -0
- data/lib/qrda_generator/export/entry_template_resolver.rb +29 -0
- data/lib/qrda_generator/railtie.rb +7 -0
- data/lib/qrda_generator.rb +20 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.1.cat1.erb +14 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.101.cat1.erb +25 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.103.cat1.erb +12 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.105.cat1.erb +60 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.11.cat1.erb +40 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.12.cat1.erb +50 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.13.cat1.erb +37 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.14.cat1.erb +35 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.17.cat1.erb +22 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.18.cat1.erb +21 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.2.cat1.erb +28 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.20.cat1.erb +20 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.22.cat1.erb +21 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.23.cat1.erb +47 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.28.cat1.erb +20 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.3.cat1.erb +24 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.31.cat1.erb +20 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +15 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.34.cat1.erb +58 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.37.cat1.erb +20 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.38.cat1.erb +16 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.4.cat1.erb +27 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.40.cat1.erb +17 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.41.cat1.erb +46 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.42.cat1.erb +37 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.43.cat1.erb +24 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.44.cat1.erb +24 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.45.cat1.erb +26 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.46.cat1.erb +30 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.47.cat1.erb +26 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.51.cat1.erb +13 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.54.cat1.erb +16 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.55.cat1.erb +10 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.57.cat1.erb +19 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.59.cat1.erb +17 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.62.cat1.erb +36 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.63.cat1.erb +23 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +29 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.66.cat1.erb +34 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.69.cat1.erb +23 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.7.cat1.erb +29 -0
- data/templates/_2.16.840.1.113883.10.20.24.3.76.cat1.erb +32 -0
- data/templates/_measures.cat1.erb +68 -0
- data/templates/_ordinality.cat1.erb +4 -0
- data/templates/_patient_data.cat1.erb +14 -0
- data/templates/_reason.cat1.erb +16 -0
- data/templates/_record_target.cat1.erb +39 -0
- data/templates/_reporting_parameters.cat1.erb +24 -0
- data/templates/_result_value.cat1.erb +16 -0
- data/templates/show.cat1.erb +125 -0
- metadata +197 -0
data/Gemfile
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rake/testtask'
|
2
|
+
require "simplecov"
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test_unit) do |t|
|
5
|
+
t.libs << "test"
|
6
|
+
t.test_files = FileList['test/**/*_test.rb']
|
7
|
+
t.verbose = true
|
8
|
+
end
|
9
|
+
|
10
|
+
task :test => [:test_unit] do
|
11
|
+
system("open coverage/index.html")
|
12
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
module QrdaGenerator
|
2
|
+
module Export
|
3
|
+
module Cat1
|
4
|
+
include HealthDataStandards::Export::TemplateHelper
|
5
|
+
include HealthDataStandards::Util
|
6
|
+
include HealthDataStandards::SVS
|
7
|
+
|
8
|
+
@@vs_map = nil
|
9
|
+
def export(patient, measures, start_date, end_date)
|
10
|
+
self.template_format = "cat1"
|
11
|
+
self.template_directory = File.dirname(__FILE__)
|
12
|
+
render(:template => 'show', :locals => {:patient => patient, :measures => measures,
|
13
|
+
:start_date => start_date, :end_date => end_date})
|
14
|
+
end
|
15
|
+
|
16
|
+
def value_set_map
|
17
|
+
@@vs_map ||= Hash[*ValueSet.all.map{ |p| [p.oid, p] }.flatten]
|
18
|
+
end
|
19
|
+
|
20
|
+
# Find all of the entries on a patient that match the given data criteria
|
21
|
+
def entries_for_data_criteria(data_criteria, patient)
|
22
|
+
data_criteria_oid = HQMFTemplateHelper.template_id_by_definition_and_status(data_criteria.definition,
|
23
|
+
data_criteria.status || '',
|
24
|
+
data_criteria.negation)
|
25
|
+
filtered_entries = []
|
26
|
+
case data_criteria_oid
|
27
|
+
when '2.16.840.1.113883.3.560.1.404'
|
28
|
+
filtered_entries = handle_patient_expired(patient)
|
29
|
+
when '2.16.840.1.113883.3.560.1.401'
|
30
|
+
filtered_entries = handle_clinical_trial_participant(patient)
|
31
|
+
else
|
32
|
+
entries = patient.entries_for_oid(data_criteria_oid)
|
33
|
+
codes = []
|
34
|
+
vs = value_set_map[data_criteria.code_list_id]
|
35
|
+
if vs
|
36
|
+
codes = vs.code_set_map
|
37
|
+
else
|
38
|
+
QrdaGenerator.logger.warn("No codes for #{data_criteria.code_list_id}")
|
39
|
+
end
|
40
|
+
filtered_entries = entries.find_all do |entry|
|
41
|
+
# This special case is for when the code list is a reason
|
42
|
+
if data_criteria.code_list_id =~ /2\.16\.840\.1\.113883\.3\.526\.3\.100[7-9]/
|
43
|
+
entry.negation_reason.present? && codes.first['values'].include?(entry.negation_reason['code'])
|
44
|
+
else
|
45
|
+
# The !! hack makes sure that negation_ind is a boolean
|
46
|
+
entry.is_in_code_set?(codes) && !!entry.negation_ind == data_criteria.negation
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
if filtered_entries.empty?
|
51
|
+
QrdaGenerator.logger.debug("No entries for #{data_criteria.title}")
|
52
|
+
end
|
53
|
+
|
54
|
+
filtered_entries
|
55
|
+
end
|
56
|
+
|
57
|
+
# Given a set of measures, find the data criteria/value set pairs that are unique across all of them
|
58
|
+
# Returns an Array of Hashes. Hashes will have a three key/value pairs. One for the data criteria oid,
|
59
|
+
# one for the value set oid and one for the data criteria itself
|
60
|
+
def unique_data_criteria(measures)
|
61
|
+
all_data_criteria = measures.map {|measure| measure.all_data_criteria}.flatten
|
62
|
+
dc_oids_and_vs_oids = all_data_criteria.map do |data_criteria|
|
63
|
+
data_criteria_oid = HQMFTemplateHelper.template_id_by_definition_and_status(data_criteria.definition,
|
64
|
+
(data_criteria.status || ""),
|
65
|
+
data_criteria.negation)
|
66
|
+
value_set_oid = data_criteria.code_list_id
|
67
|
+
{'data_criteria_oid' => data_criteria_oid, 'value_set_oid' => value_set_oid, 'data_criteria' => data_criteria}
|
68
|
+
end
|
69
|
+
dc_oids_and_vs_oids.uniq_by {|thingy| [thingy['data_criteria_oid'], thingy['value_set_oid']]}
|
70
|
+
end
|
71
|
+
|
72
|
+
def render_data_criteria(dc_oid, vs_oid, entries)
|
73
|
+
html_array = entries.map do |entry|
|
74
|
+
if dc_oid == '2.16.840.1.113883.3.560.1.1001'
|
75
|
+
# This is a special case. This HQMF OID maps to more than one QRDA OID.
|
76
|
+
# So we need to try to figure out what template we should use based on the
|
77
|
+
# content of the entry
|
78
|
+
if vs_oid == '2.16.840.1.113883.3.526.3.1279'
|
79
|
+
# Patient Characteristic Observation Assertion template for
|
80
|
+
# Patient Characteristic: ECOG Performance Status-Poor
|
81
|
+
render(:partial => '2.16.840.1.113883.10.20.24.3.103', :locals => {:entry => entry,
|
82
|
+
:value_set_oid => vs_oid})
|
83
|
+
elsif vs_oid == "2.16.840.1.113883.3.117.1.7.1.402" || vs_oid == "2.16.840.1.113883.3.117.1.7.1.403"
|
84
|
+
# Patient Charasteristic Gestational Age
|
85
|
+
render(:partial => '2.16.840.1.113883.10.20.24.3.101', :locals => {:entry => entry,
|
86
|
+
:value_set_oid => vs_oid})
|
87
|
+
end
|
88
|
+
else
|
89
|
+
render(:partial => EntryTemplateResolver.partial_for(dc_oid), :locals => {:entry => entry,
|
90
|
+
:value_set_oid => vs_oid})
|
91
|
+
end
|
92
|
+
end
|
93
|
+
html_array.join("\n")
|
94
|
+
end
|
95
|
+
|
96
|
+
def render_patient_data(patient, measures)
|
97
|
+
udcs = unique_data_criteria(measures)
|
98
|
+
data_criteria_html = udcs.map do |udc|
|
99
|
+
entries = entries_for_data_criteria(udc['data_criteria'], patient)
|
100
|
+
render_data_criteria(udc['data_criteria_oid'], udc['value_set_oid'], entries)
|
101
|
+
end
|
102
|
+
data_criteria_html.compact.join("\n")
|
103
|
+
end
|
104
|
+
|
105
|
+
def negation_indicator(entry)
|
106
|
+
if entry.negation_ind
|
107
|
+
'negationInd="true"'
|
108
|
+
else
|
109
|
+
''
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def handle_clinical_trial_participant(patient)
|
114
|
+
if patient.clinical_trial_participant
|
115
|
+
[{dummy_entry: true}]
|
116
|
+
else
|
117
|
+
[]
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def handle_patient_expired(patient)
|
122
|
+
if patient.expired
|
123
|
+
[OpenStruct.new(start_date: patient.deathdate)]
|
124
|
+
else
|
125
|
+
[]
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
extend self
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
HealthDataStandards::Export::RenderingContext.class_eval do
|
135
|
+
include QrdaGenerator::Export::Cat1
|
136
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module QrdaGenerator
|
2
|
+
module Export
|
3
|
+
module EntryTemplateResolver
|
4
|
+
def hqmf_qrda_oid_map
|
5
|
+
if @hqmf_qrda_oid_map.blank?
|
6
|
+
template_id_file = File.expand_path('../hqmf-qrda-oids.json', __FILE__)
|
7
|
+
@hqmf_qrda_oid_map = JSON.parse(File.read(template_id_file))
|
8
|
+
end
|
9
|
+
@hqmf_qrda_oid_map
|
10
|
+
end
|
11
|
+
|
12
|
+
def qrda_oid_exist?(oid)
|
13
|
+
hqmf_qrda_oid_map.any? {|map_tuple| map_tuple['qrda_oid'] == oid}
|
14
|
+
end
|
15
|
+
|
16
|
+
def qrda_oid_for_hqmf_oid(hqmf_oid)
|
17
|
+
oid_tuple = hqmf_qrda_oid_map.find {|map_tuple| map_tuple['hqmf_oid'] == hqmf_oid }
|
18
|
+
if oid_tuple.nil?
|
19
|
+
puts "no qrda oid for #{hqmf_oid}"
|
20
|
+
end
|
21
|
+
oid_tuple['qrda_oid']
|
22
|
+
end
|
23
|
+
|
24
|
+
alias :partial_for :qrda_oid_for_hqmf_oid
|
25
|
+
|
26
|
+
extend self
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'health-data-standards'
|
2
|
+
require 'hqmf-parser'
|
3
|
+
require 'ostruct'
|
4
|
+
require 'log4r'
|
5
|
+
|
6
|
+
require_relative 'qrda_generator/export/cat_1'
|
7
|
+
require_relative 'qrda_generator/export/entry_template_resolver'
|
8
|
+
|
9
|
+
module QrdaGenerator
|
10
|
+
class << self
|
11
|
+
attr_accessor :logger
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
if defined?(Rails)
|
16
|
+
require_relative 'qrda_generator/railtie'
|
17
|
+
else
|
18
|
+
QrdaGenerator.logger = Log4r::Logger.new("QRDA Generator")
|
19
|
+
QrdaGenerator.logger.outputters = Log4r::Outputter.stdout
|
20
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<entry>
|
2
|
+
<observation classCode="OBS" moodCode="GOL">
|
3
|
+
<!-- 2.16.840.1.113883.10.20.22.4.44 Plan of Care Activity Observation -->
|
4
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.44"/>
|
5
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.1"/>
|
6
|
+
<id root="<%= entry.id %>"/>
|
7
|
+
<%== code_display(entry, :extra_content => "sdtc:valueSet=\"#{value_set_oid}\"") %>
|
8
|
+
<text><%= entry.description %></text>
|
9
|
+
<statusCode code="active"/>
|
10
|
+
<effectiveTime>
|
11
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
12
|
+
</effectiveTime>
|
13
|
+
</observation>
|
14
|
+
</entry>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<entry>
|
2
|
+
<observation classCode="OBS" moodCode="EVN">
|
3
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.101"/>
|
4
|
+
<id root="<%= entry.id %>"/>
|
5
|
+
<code code="57036006"
|
6
|
+
codeSystem="2.16.840.1.113883.6.96"
|
7
|
+
codeSystemName="SNOMED-CT"
|
8
|
+
displayName="length of gestation"/>
|
9
|
+
|
10
|
+
<statusCode code="completed"/>
|
11
|
+
<effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
|
12
|
+
<!-- ?Note: valueSet of PQ "d" and "wk"-->
|
13
|
+
<value xsi:type="PQ"
|
14
|
+
<% if entry.codes['SNOMED-CT'].include?('80487005')-%>
|
15
|
+
value="39"
|
16
|
+
<% elsif entry.codes['SNOMED-CT'].include?('931004')-%>
|
17
|
+
value="36"
|
18
|
+
<% elsif entry.codes['SNOMED-CT'].include?('43697006')-%>
|
19
|
+
value="37"
|
20
|
+
<% else -%>
|
21
|
+
nullFlavor="UNK"
|
22
|
+
<% end -%>
|
23
|
+
unit="wk"/>
|
24
|
+
</observation>
|
25
|
+
</entry>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<entry>
|
2
|
+
<observation classCode="OBS" moodCode="EVN">
|
3
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.103"/>
|
4
|
+
<id root="<%= entry.id %>"/>
|
5
|
+
<code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4" />
|
6
|
+
<statusCode code="completed" />
|
7
|
+
<effectiveTime <%= value_or_null_flavor(entry.start_time) %>/>
|
8
|
+
<%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT'],
|
9
|
+
'tag_name' => 'value',
|
10
|
+
'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
|
11
|
+
</observation>
|
12
|
+
</entry>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<entry>
|
2
|
+
<act classCode="ACT" moodCode="EVN">
|
3
|
+
<!-- Discharge Medication Entry -->
|
4
|
+
<templateId root="2.16.840.1.113883.10.20.24.4.105"/>
|
5
|
+
<id root="<%= entry.id %>"/>
|
6
|
+
<code code="10183-2"
|
7
|
+
codeSystem="2.16.840.1.113883.6.1"
|
8
|
+
codeSystemName="LOINC"
|
9
|
+
displayName="Discharge medication"/>
|
10
|
+
<statusCode code="active"/>
|
11
|
+
<effectiveTime>
|
12
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
13
|
+
</effectiveTime>
|
14
|
+
<entryRelationship typeCode="SUBJ">
|
15
|
+
<substanceAdministration moodCode="EVN" classCode="SBADM">
|
16
|
+
<!-- Medication Activity (consolidation) template -->
|
17
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.16"/>
|
18
|
+
<!-- Medication, Active template -->
|
19
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.41"/>
|
20
|
+
|
21
|
+
<id root="<%= UUID.generate %>"/>
|
22
|
+
<text><%= entry.description %></text>
|
23
|
+
<statusCode code="active"/>
|
24
|
+
<effectiveTime xsi:type="IVL_TS">
|
25
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
26
|
+
<high <%= value_or_null_flavor(entry.end_time) %>/>
|
27
|
+
</effectiveTime>
|
28
|
+
|
29
|
+
<% if entry.route.present? -%>
|
30
|
+
<!-- Attribute: route -->
|
31
|
+
<routeCode code="<%= entry.route['code'] %>" codeSystem="<%= entry.route['codeSystem'] %>"/>
|
32
|
+
<% end -%>
|
33
|
+
|
34
|
+
<!-- Attribute: dose -->
|
35
|
+
<% if entry.dose.present? -%>
|
36
|
+
<doseQuantity value="<%= entry.dose['value']%>"/>
|
37
|
+
<% end -%>
|
38
|
+
|
39
|
+
|
40
|
+
<% if entry.product_form.present? -%>
|
41
|
+
<administrationUnitCode code="<%= entry.product_form['code'] %>" codeSystem="<%= entry.product_form['codeSystem'] %>"/>
|
42
|
+
<% end -%>
|
43
|
+
|
44
|
+
<consumable>
|
45
|
+
<manufacturedProduct classCode="MANU">
|
46
|
+
<!-- Medication Information (consolidation) template -->
|
47
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.23"/>
|
48
|
+
<id root="<%= UUID.generate %>"/>
|
49
|
+
<manufacturedMaterial>
|
50
|
+
<%== code_display(entry, :extra_content => "sdtc:valueSet=\"#{value_set_oid}\"") %>
|
51
|
+
</manufacturedMaterial>
|
52
|
+
<manufacturerOrganization>
|
53
|
+
<name>Medication Factory Inc.</name>
|
54
|
+
</manufacturerOrganization>
|
55
|
+
</manufacturedProduct>
|
56
|
+
</consumable>
|
57
|
+
</substanceAdministration>
|
58
|
+
</entryRelationship>
|
59
|
+
</act>
|
60
|
+
</entry>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<entry>
|
2
|
+
<!--Diagnosis active: diabetes-->
|
3
|
+
<observation classCode="OBS" moodCode="EVN">
|
4
|
+
<!-- Problem observation template -->
|
5
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.4"/>
|
6
|
+
<!-- Diagnosis active template -->
|
7
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.11"/>
|
8
|
+
<id root="<%= entry.id %>"/>
|
9
|
+
<code code="282291009" displayName="diagnosis" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
|
10
|
+
<text><%= entry.description %></text>
|
11
|
+
<statusCode code="completed"/>
|
12
|
+
<effectiveTime>
|
13
|
+
<!-- Attribute: admission datetime -->
|
14
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
15
|
+
<!-- Attribute: discharge datetime -->
|
16
|
+
<high <%= value_or_null_flavor(entry.end_time) %>/>
|
17
|
+
</effectiveTime>
|
18
|
+
<%== code_display(entry, {'tag_name' => 'value', 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'],
|
19
|
+
'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\""}) %>
|
20
|
+
|
21
|
+
<entryRelationship typeCode="REFR">
|
22
|
+
<observation classCode="OBS" moodCode="EVN">
|
23
|
+
<!-- Problem Status (consolidation) template -->
|
24
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.6"/>
|
25
|
+
<!-- Problem Status, Active template -->
|
26
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.94"/>
|
27
|
+
<id root="<%= UUID.generate %>"/>
|
28
|
+
<code code="33999-4"
|
29
|
+
codeSystem="2.16.840.1.113883.6.1"
|
30
|
+
codeSystemName="LOINC"
|
31
|
+
displayName="status"/>
|
32
|
+
<statusCode code="completed"/>
|
33
|
+
<value xsi:type="CD" code="55561003"
|
34
|
+
displayName="active"
|
35
|
+
codeSystem="2.16.840.1.113883.6.96"
|
36
|
+
codeSystemName="SNOMED CT"/>
|
37
|
+
</observation>
|
38
|
+
</entryRelationship>
|
39
|
+
</observation>
|
40
|
+
</entry>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<entry typeCode="DRIV">
|
2
|
+
<organizer moodCode="EVN" classCode="CLUSTER">
|
3
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.45"/>
|
4
|
+
<!-- Family history organizer template -->
|
5
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.12"/>
|
6
|
+
<statusCode code="completed"/>
|
7
|
+
<effectiveTime>
|
8
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
9
|
+
<high <%= value_or_null_flavor(entry.end_time) %>/>
|
10
|
+
</effectiveTime>
|
11
|
+
<!-- The subject is currently hardcoded to father -->
|
12
|
+
<subject>
|
13
|
+
<relatedSubject classCode="PRS">
|
14
|
+
<code code="FTH" displayName="Father"
|
15
|
+
codeSystemName="HL7RoleCode"
|
16
|
+
codeSystem="2.16.840.1.113883.5.111">
|
17
|
+
<translation code="9947008"
|
18
|
+
displayName="Biological father"
|
19
|
+
codeSystemName="SNOMED CT"
|
20
|
+
codeSystem="2.16.840.1.113883.6.96"/>
|
21
|
+
</code>
|
22
|
+
<subject>
|
23
|
+
<administrativeGenderCode
|
24
|
+
code="M" codeSystem="2.16.840.1.113883.5.1"
|
25
|
+
codeSystemName="HL7AdministrativeGender"
|
26
|
+
displayName="Male"/>
|
27
|
+
<birthTime value="1912"/>
|
28
|
+
</subject>
|
29
|
+
</relatedSubject>
|
30
|
+
</subject>
|
31
|
+
<component>
|
32
|
+
<observation classCode="OBS" moodCode="EVN">
|
33
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.46"/>
|
34
|
+
<id root="<%= entry.id %>"/>
|
35
|
+
<code code="55607006" displayName="Problem"
|
36
|
+
codeSystemName="SNOMED CT"
|
37
|
+
codeSystem="2.16.840.1.113883.6.96"/>
|
38
|
+
<statusCode code="completed"/>
|
39
|
+
<effectiveTime>
|
40
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
41
|
+
<high <%= value_or_null_flavor(entry.end_time) %>/>
|
42
|
+
</effectiveTime>
|
43
|
+
<%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT'],
|
44
|
+
'tag_name' => 'value',
|
45
|
+
'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
|
46
|
+
</observation>
|
47
|
+
</component>
|
48
|
+
</organizer>
|
49
|
+
</entry>
|
50
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<entry>
|
2
|
+
<observation classCode="OBS" moodCode="EVN">
|
3
|
+
<!-- Problem observation template -->
|
4
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.4"/>
|
5
|
+
<!-- Diagnosis, inactive template -->
|
6
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.13"/>
|
7
|
+
<id root="<%= entry.id %>"/>
|
8
|
+
<code code="282291009" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="diagnosis"/>
|
9
|
+
|
10
|
+
<statusCode code="completed"/>
|
11
|
+
|
12
|
+
<effectiveTime>
|
13
|
+
<!-- Attribute: Start Datetime -->
|
14
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
15
|
+
<!-- Attribute: Stop Datetime -->
|
16
|
+
<high <%= value_or_null_flavor(entry.end_time) %>/>
|
17
|
+
</effectiveTime>
|
18
|
+
<%== render(:partial => 'ordinality', :locals => {:entry => entry}) %>
|
19
|
+
|
20
|
+
<%== code_display(entry, 'tag_name' => 'value', 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'LOINC'], 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
|
21
|
+
<!-- Status -->
|
22
|
+
<entryRelationship typeCode="REFR">
|
23
|
+
<observation classCode="OBS" moodCode="EVN">
|
24
|
+
<!-- Problem Status (consolidation) template -->
|
25
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.6"/>
|
26
|
+
<!-- Problem Status, Inactive template -->
|
27
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.95"/>
|
28
|
+
<id root="<%= UUID.generate %>"/>
|
29
|
+
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="status"/>
|
30
|
+
<statusCode code="completed"/>
|
31
|
+
<value code="73425007" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="inactive" xsi:type="CD"/>
|
32
|
+
</observation>
|
33
|
+
|
34
|
+
</entryRelationship>
|
35
|
+
|
36
|
+
</observation>
|
37
|
+
</entry>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<entry>
|
2
|
+
<observation classCode="OBS" moodCode="EVN">
|
3
|
+
<!-- Problem observation template -->
|
4
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.4"/>
|
5
|
+
<!-- Diagnosis, resolved template -->
|
6
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.14"/>
|
7
|
+
<id root="<%= entry.id %>"/>
|
8
|
+
<code code="282291009" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="diagnosis"/>
|
9
|
+
|
10
|
+
<statusCode code="completed"/>
|
11
|
+
<effectiveTime>
|
12
|
+
<!-- Attribute: Start Datetime -->
|
13
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
14
|
+
<!-- Attribute: Stop Datetime -->
|
15
|
+
<high <%= value_or_null_flavor(entry.end_time) %>/>
|
16
|
+
</effectiveTime>
|
17
|
+
<%== render(:partial => 'ordinality', :locals => {:entry => entry}) %>
|
18
|
+
|
19
|
+
<%== code_display(entry, 'tag_name' => 'value', 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'CPT'],
|
20
|
+
'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
|
21
|
+
<!-- Status -->
|
22
|
+
<entryRelationship typeCode="REFR">
|
23
|
+
<observation classCode="OBS" moodCode="EVN">
|
24
|
+
<!-- Problem Status (consolidation) template -->
|
25
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.6"/>
|
26
|
+
<!-- Problem Status, Resolved template -->
|
27
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.96"/>
|
28
|
+
<id root="<%= UUID.generate %>"/>
|
29
|
+
<code code="33999-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="status"/>
|
30
|
+
<statusCode code="completed"/>
|
31
|
+
<value code="413322009" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="resolved" xsi:type="CD"/>
|
32
|
+
</observation>
|
33
|
+
</entryRelationship>
|
34
|
+
</observation>
|
35
|
+
</entry>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<entry>
|
2
|
+
<observation classCode="OBS" moodCode="RQO">
|
3
|
+
<!-- Consolidated Plan of Care Activity Observation
|
4
|
+
templateId (Implied Template) -->
|
5
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.44"/>
|
6
|
+
<!-- Diagnostic Study, Order template -->
|
7
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.17"/>
|
8
|
+
<id root="<%= entry.id %>"/>
|
9
|
+
<%== code_display(entry, 'preferred_code_sets' => ['LOINC'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
|
10
|
+
<text><%= entry.description %></text>
|
11
|
+
<statusCode code="new"/>
|
12
|
+
|
13
|
+
<!-- Attribute: datetime -->
|
14
|
+
<author>
|
15
|
+
<time <%= value_or_null_flavor(entry.as_point_in_time) %>/>
|
16
|
+
<assignedAuthor>
|
17
|
+
<id nullFlavor="NA" root="<%= UUID.generate %>"/>
|
18
|
+
</assignedAuthor>
|
19
|
+
</author>
|
20
|
+
|
21
|
+
</observation>
|
22
|
+
</entry>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<entry>
|
2
|
+
<observation classCode="OBS" moodCode="EVN" <%== negation_indicator(entry) %>>
|
3
|
+
<!-- Consolidated Procedure Activity Observation templateId
|
4
|
+
(Implied Template) -->
|
5
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.13"/>
|
6
|
+
<!-- Diagnostic Study, Performed template -->
|
7
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.18"/>
|
8
|
+
<id root="<%= entry.id %>"/>
|
9
|
+
<%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
|
10
|
+
<text><%= entry.description %></text>
|
11
|
+
<statusCode code="completed"/>
|
12
|
+
<effectiveTime>
|
13
|
+
<!-- Attribute: Start Datetime -->
|
14
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
15
|
+
<!-- Attribute: End Datetime -->
|
16
|
+
<high <%= value_or_null_flavor(entry.end_time) %>/>
|
17
|
+
</effectiveTime>
|
18
|
+
<%== render(:partial => 'result_value', :locals => {:entry => entry}) %>
|
19
|
+
<%== render(:partial => 'reason', :locals => {:entry => entry}) %>
|
20
|
+
</observation>
|
21
|
+
</entry>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<entry>
|
2
|
+
<act classCode="ACT" moodCode="EVN">
|
3
|
+
<!-- Communication from patient to provider -->
|
4
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.2"/>
|
5
|
+
<id root="<%= entry.id %>"/>
|
6
|
+
<%== code_display(entry, :extra_content => "sdtc:valueSet=\"#{value_set_oid}\"") %>
|
7
|
+
<text>
|
8
|
+
<%= entry.description %>
|
9
|
+
</text>
|
10
|
+
<statusCode code="completed"/>
|
11
|
+
<effectiveTime>
|
12
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
13
|
+
</effectiveTime>
|
14
|
+
|
15
|
+
<participant typeCode="AUT">
|
16
|
+
<participantRole classCode="PAT">
|
17
|
+
<code code="116154003" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Patient"/>
|
18
|
+
</participantRole>
|
19
|
+
</participant>
|
20
|
+
|
21
|
+
<participant typeCode="IRCP">
|
22
|
+
<participantRole classCode="ASSIGNED">
|
23
|
+
<code code="158965000" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical Practitioner"/>
|
24
|
+
</participantRole>
|
25
|
+
</participant>
|
26
|
+
|
27
|
+
</act>
|
28
|
+
</entry>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<entry>
|
2
|
+
<observation classCode="OBS" moodCode="EVN" <%== negation_indicator(entry) %>>
|
3
|
+
<!-- Consolidated Result Observation templateId (Implied Template) -->
|
4
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.2"/>
|
5
|
+
<!-- Diagnostic Study, Result template -->
|
6
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.20"/>
|
7
|
+
<id root="<%= entry.id %>"/>
|
8
|
+
<%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT', 'LOINC'],
|
9
|
+
'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
|
10
|
+
<text><%= entry.description %></text>
|
11
|
+
<statusCode code="completed"/>
|
12
|
+
|
13
|
+
<effectiveTime>
|
14
|
+
<low <%= value_or_null_flavor(entry.start_time) %>/>
|
15
|
+
<high <%= value_or_null_flavor(entry.end_time) %>/>
|
16
|
+
</effectiveTime>
|
17
|
+
<%== render(:partial => 'result_value', :locals => {:entry => entry}) %>
|
18
|
+
<%== render(:partial => 'reason', :locals => {:entry => entry}) %>
|
19
|
+
</observation>
|
20
|
+
</entry>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<entry>
|
2
|
+
<encounter classCode="ENC" moodCode="RQO">
|
3
|
+
<!-- Plan of Care Activity Encounter template -->
|
4
|
+
<templateId root="2.16.840.1.113883.10.20.22.4.40"/>
|
5
|
+
<!-- Encounter order template -->
|
6
|
+
<templateId root="2.16.840.1.113883.10.20.24.3.22"/>
|
7
|
+
<id root="<%= entry.id %>"/>
|
8
|
+
<%== code_display(entry, :extra_content => "sdtc:valueSet=\"#{value_set_oid}\"") %>
|
9
|
+
<text><%= entry.description %></text>
|
10
|
+
<statusCode code="new"/>
|
11
|
+
|
12
|
+
<!-- Attribute: datetime -->
|
13
|
+
<author>
|
14
|
+
<time <%= value_or_null_flavor(entry.start_time) %>/>
|
15
|
+
<assignedAuthor>
|
16
|
+
<id root="<%= UUID.generate %>"/>
|
17
|
+
</assignedAuthor>
|
18
|
+
</author>
|
19
|
+
|
20
|
+
</encounter>
|
21
|
+
</entry>
|