qrda_generator 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/Gemfile +12 -0
  2. data/Rakefile +12 -0
  3. data/lib/qrda_generator/export/cat_1.rb +136 -0
  4. data/lib/qrda_generator/export/entry_template_resolver.rb +29 -0
  5. data/lib/qrda_generator/railtie.rb +7 -0
  6. data/lib/qrda_generator.rb +20 -0
  7. data/templates/_2.16.840.1.113883.10.20.24.3.1.cat1.erb +14 -0
  8. data/templates/_2.16.840.1.113883.10.20.24.3.101.cat1.erb +25 -0
  9. data/templates/_2.16.840.1.113883.10.20.24.3.103.cat1.erb +12 -0
  10. data/templates/_2.16.840.1.113883.10.20.24.3.105.cat1.erb +60 -0
  11. data/templates/_2.16.840.1.113883.10.20.24.3.11.cat1.erb +40 -0
  12. data/templates/_2.16.840.1.113883.10.20.24.3.12.cat1.erb +50 -0
  13. data/templates/_2.16.840.1.113883.10.20.24.3.13.cat1.erb +37 -0
  14. data/templates/_2.16.840.1.113883.10.20.24.3.14.cat1.erb +35 -0
  15. data/templates/_2.16.840.1.113883.10.20.24.3.17.cat1.erb +22 -0
  16. data/templates/_2.16.840.1.113883.10.20.24.3.18.cat1.erb +21 -0
  17. data/templates/_2.16.840.1.113883.10.20.24.3.2.cat1.erb +28 -0
  18. data/templates/_2.16.840.1.113883.10.20.24.3.20.cat1.erb +20 -0
  19. data/templates/_2.16.840.1.113883.10.20.24.3.22.cat1.erb +21 -0
  20. data/templates/_2.16.840.1.113883.10.20.24.3.23.cat1.erb +47 -0
  21. data/templates/_2.16.840.1.113883.10.20.24.3.28.cat1.erb +20 -0
  22. data/templates/_2.16.840.1.113883.10.20.24.3.3.cat1.erb +24 -0
  23. data/templates/_2.16.840.1.113883.10.20.24.3.31.cat1.erb +20 -0
  24. data/templates/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +15 -0
  25. data/templates/_2.16.840.1.113883.10.20.24.3.34.cat1.erb +58 -0
  26. data/templates/_2.16.840.1.113883.10.20.24.3.37.cat1.erb +20 -0
  27. data/templates/_2.16.840.1.113883.10.20.24.3.38.cat1.erb +16 -0
  28. data/templates/_2.16.840.1.113883.10.20.24.3.4.cat1.erb +27 -0
  29. data/templates/_2.16.840.1.113883.10.20.24.3.40.cat1.erb +17 -0
  30. data/templates/_2.16.840.1.113883.10.20.24.3.41.cat1.erb +46 -0
  31. data/templates/_2.16.840.1.113883.10.20.24.3.42.cat1.erb +37 -0
  32. data/templates/_2.16.840.1.113883.10.20.24.3.43.cat1.erb +24 -0
  33. data/templates/_2.16.840.1.113883.10.20.24.3.44.cat1.erb +24 -0
  34. data/templates/_2.16.840.1.113883.10.20.24.3.45.cat1.erb +26 -0
  35. data/templates/_2.16.840.1.113883.10.20.24.3.46.cat1.erb +30 -0
  36. data/templates/_2.16.840.1.113883.10.20.24.3.47.cat1.erb +26 -0
  37. data/templates/_2.16.840.1.113883.10.20.24.3.51.cat1.erb +13 -0
  38. data/templates/_2.16.840.1.113883.10.20.24.3.54.cat1.erb +16 -0
  39. data/templates/_2.16.840.1.113883.10.20.24.3.55.cat1.erb +10 -0
  40. data/templates/_2.16.840.1.113883.10.20.24.3.57.cat1.erb +19 -0
  41. data/templates/_2.16.840.1.113883.10.20.24.3.59.cat1.erb +17 -0
  42. data/templates/_2.16.840.1.113883.10.20.24.3.62.cat1.erb +36 -0
  43. data/templates/_2.16.840.1.113883.10.20.24.3.63.cat1.erb +23 -0
  44. data/templates/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +29 -0
  45. data/templates/_2.16.840.1.113883.10.20.24.3.66.cat1.erb +34 -0
  46. data/templates/_2.16.840.1.113883.10.20.24.3.69.cat1.erb +23 -0
  47. data/templates/_2.16.840.1.113883.10.20.24.3.7.cat1.erb +29 -0
  48. data/templates/_2.16.840.1.113883.10.20.24.3.76.cat1.erb +32 -0
  49. data/templates/_measures.cat1.erb +68 -0
  50. data/templates/_ordinality.cat1.erb +4 -0
  51. data/templates/_patient_data.cat1.erb +14 -0
  52. data/templates/_reason.cat1.erb +16 -0
  53. data/templates/_record_target.cat1.erb +39 -0
  54. data/templates/_reporting_parameters.cat1.erb +24 -0
  55. data/templates/_result_value.cat1.erb +16 -0
  56. data/templates/show.cat1.erb +125 -0
  57. metadata +197 -0
@@ -0,0 +1,47 @@
1
+ <entry>
2
+ <encounter classCode="ENC" moodCode="EVN">
3
+ <!-- Encounter activities template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.49"/>
5
+ <!-- Encounter performed template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.23"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'CPT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="completed"/>
11
+ <effectiveTime>
12
+ <!-- We try to look for the admit/discharge times on the encounter if they are
13
+ there. If not, we fall back to the typical start/end date. -->
14
+ <low <%= value_or_null_flavor(entry.admit_time || entry.start_time) %>/>
15
+ <high <%= value_or_null_flavor(entry.discharge_time || entry.end_time) %>/>
16
+ </effectiveTime>
17
+ <% if entry.respond_to?(:facility) && entry.facility.present? && entry.facility.code.present? -%>
18
+ <participant typeCode="LOC">
19
+ <!-- Facility Location template -->
20
+ <templateId root="2.16.840.1.113883.10.20.24.3.100"/>
21
+ <time>
22
+ <!-- Attribute: facility location arrival datetime -->
23
+ <low <%= value_or_null_flavor(entry.facility.start_time) %>/>
24
+ <!-- Attribute: facility location departure datetime -->
25
+ <high <%= value_or_null_flavor(entry.facility.end_time) %>/>
26
+ </time>
27
+ <participantRole classCode="SDLOC">
28
+ <code code="<%= entry.facility.code['code'] %>"
29
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.facility.code['codeSystem']) %>"/>
30
+ <% if entry.facility.addresses.present? -%>
31
+ <addr>
32
+ <streetAddressLine><%= entry.facility.addresses.first.street %></streetAddressLine>
33
+ <city><%= entry.facility.addresses.first.city %></city>
34
+ <state><%= entry.facility.addresses.first.state %></state>
35
+ <postalCode><%= entry.facility.addresses.first.zip %></postalCode>
36
+ <country><%= entry.facility.addresses.first.country %></country>
37
+ </addr>
38
+ <% end -%>
39
+ <telecom nullFlavor="UNK"/>
40
+ <playingEntity classCode="PLC">
41
+ <name><%= entry.facility.name %></name>
42
+ </playingEntity>
43
+ </participantRole>
44
+ </participant>
45
+ <% end -%>
46
+ </encounter>
47
+ </entry>
@@ -0,0 +1,20 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- Functional Status Result Observation (consolidation) template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.67"/>
5
+ <!-- Functional Status, Result template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.28"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="completed"/>
11
+
12
+ <effectiveTime>
13
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
14
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
15
+ </effectiveTime>
16
+
17
+ <!-- Result -->
18
+ <%== render(:partial => 'result_value', :locals => {:entry => entry}) %>
19
+ </observation>
20
+ </entry>
@@ -0,0 +1,24 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.3"/>
4
+ <id root="<%= entry.id %>"/>
5
+ <%== code_display(entry, :extra_content => "sdtc:valueSet=\"#{value_set_oid}\"") %>
6
+ <text><%= entry.description %></text>
7
+ <statusCode code="completed"/>
8
+
9
+ <effectiveTime>
10
+ <low <%= value_or_null_flavor(entry.as_point_in_time) %>/>
11
+ </effectiveTime>
12
+
13
+ <participant typeCode="AUT">
14
+ <participantRole classCode="ASSIGNED">
15
+ <code code="158965000" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical Practitioner"/>
16
+ </participantRole>
17
+ </participant>
18
+
19
+ <participant typeCode="IRCP">
20
+ <participantRole classCode="PAT"/>
21
+ </participant>
22
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
23
+ </act>
24
+ </entry>
@@ -0,0 +1,20 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="RQO">
3
+ <!-- Plan of Care Activity Act template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.39"/>
5
+ <!-- Intervention Order template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.31"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ <statusCode code="completed"/>
10
+ <author>
11
+ <time <%= value_or_null_flavor(entry.as_point_in_time) %>/>
12
+ <assignedAuthor>
13
+ <id root="<%= UUID.generate %>"/>
14
+ </assignedAuthor>
15
+ </author>
16
+ <effectiveTime>
17
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
18
+ </effectiveTime>
19
+ </act>
20
+ </entry>
@@ -0,0 +1,15 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Consolidation CDA: Procedure Activity Act template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.12"/>
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.32"/>
6
+ <id root="<%= entry.id %>"/>
7
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
8
+ <statusCode code="completed"/>
9
+ <effectiveTime>
10
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
11
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
12
+ </effectiveTime>
13
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
14
+ </act>
15
+ </entry>
@@ -0,0 +1,58 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN">
3
+ <!-- Consolidation CDA: Procedure Activity Act template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.12"/>
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.34"/>
6
+ <id root="<%= entry.id %>"/>
7
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
8
+ <statusCode code="completed"/>
9
+ <effectiveTime>
10
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
11
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
12
+ </effectiveTime>
13
+ <entryRelationship typeCode="REFR">
14
+ <observation classCode="OBS" moodCode="EVN">
15
+ <!-- Result Observation template (consolidation) -->
16
+ <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
17
+ <!-- Result template -->
18
+ <templateId root="2.16.840.1.113883.10.20.24.3.87"/>
19
+ <id root="<%= UUID.generate %>"/>
20
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
21
+ <statusCode code="completed"/>
22
+ <effectiveTime <%= value_or_null_flavor(entry.start_time) %>/>
23
+ <% ev = entry.values.first
24
+ if ev.present?
25
+ if ev.respond_to?(:codes) -%>
26
+ <%== code_display(ev, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'tag_name' => 'value', 'extra_content' => "xsi:type=\"CD\"") %>
27
+ <% elsif ev.respond_to?(:scalar) -%>
28
+ <% if is_num?(ev.scalar) -%>
29
+ <value xsi:type="PQ" value="<%= ev.scalar %>" <% if ev.units -%>unit="<%= ev.units %>"<% end -%>/>
30
+ <% elsif is_bool?(ev.scalar)%>
31
+ <value xsi:type="BL" value="<%= ev.scalar %>" />
32
+ <% else -%>
33
+ <value xsi:type="ST" ><%= ev.scalar %></value>
34
+ <% end
35
+ end
36
+ else -%>
37
+ <value xsi:type="PQ" nullFlavor="UNK"/>
38
+ <% end -%>
39
+
40
+ <!-- Attribute: Status -->
41
+ <entryRelationship typeCode="REFR">
42
+ <observation classCode="OBS" moodCode="EVN">
43
+ <templateId root="2.16.840.1.113883.10.20.24.3.93"/>
44
+ <id root="<%= UUID.generate %>"/>
45
+ <code code="33999-4"
46
+ codeSystem="2.16.840.1.113883.6.1"
47
+ codeSystemName="LOINC"
48
+ displayName="Status"/>
49
+ <value xsi:type="CD"
50
+ code="33999-4"
51
+ codeSystem="2.16.840.1.113883.6.1"
52
+ displayName="Final Report"/>
53
+ </observation>
54
+ </entryRelationship>
55
+ </observation>
56
+ </entryRelationship>
57
+ </act>
58
+ </entry>
@@ -0,0 +1,20 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="RQO">
3
+ <!-- Consolidation Plan of Care Activity Observation -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.44"/>
5
+ <!-- Lab Test Order -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.37"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC'], '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.as_point_in_time) %>/>
15
+ <assignedAuthor>
16
+ <id nullFlavor="NA" root="<%= UUID.generate %>"/>
17
+ </assignedAuthor>
18
+ </author>
19
+ </observation>
20
+ </entry>
@@ -0,0 +1,16 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Lab test performed -->
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.38"/>
5
+ <id root="<%= entry.id %>"/>
6
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
7
+ <text><%= entry.description %></text>
8
+ <statusCode code="completed"/>
9
+
10
+ <effectiveTime>
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
13
+ </effectiveTime>
14
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
15
+ </observation>
16
+ </entry>
@@ -0,0 +1,27 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Communication from provider to provider -->
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.4"/>
5
+ <id root="<%= entry.id %>"/>
6
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
7
+ <text><%= entry.description %></text>
8
+ <statusCode code="completed"/>
9
+
10
+ <effectiveTime>
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ </effectiveTime>
13
+
14
+ <participant typeCode="AUT">
15
+ <participantRole classCode="ASSIGNED">
16
+ <code code="158965000" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical Practitioner"/>
17
+ </participantRole>
18
+ </participant>
19
+
20
+ <participant typeCode="IRCP">
21
+ <participantRole classCode="ASSIGNED">
22
+ <code code="158965000" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical Practitioner"/>
23
+ </participantRole>
24
+ </participant>
25
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
26
+ </act>
27
+ </entry>
@@ -0,0 +1,17 @@
1
+ <entry>
2
+ <!--Laboratory test, result -->
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <!-- Result Observation (consolidation) template -->
5
+ <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
6
+ <!-- Laboratory Test, Result template -->
7
+ <templateId root="2.16.840.1.113883.10.20.24.3.40"/>
8
+ <id root="<%= entry.id %>"/>
9
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', '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
+ <low value="<%= entry.start_time %>"/>
14
+ </effectiveTime>
15
+ <%== render(:partial => 'result_value', :locals => {:entry => entry}) %>
16
+ </observation>
17
+ </entry>
@@ -0,0 +1,46 @@
1
+ <entry>
2
+ <substanceAdministration classCode="SBADM" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Medication Activity (consolidation) template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.16"/>
5
+ <!-- Medication, Active template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.41"/>
7
+
8
+ <id root="<%= entry.id %>"/>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="active"/>
11
+ <effectiveTime xsi:type="IVL_TS">
12
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
13
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
14
+ </effectiveTime>
15
+
16
+ <% if entry.route.present? -%>
17
+ <!-- Attribute: route -->
18
+ <routeCode code="<%= entry.route['code'] %>" codeSystem="<%= entry.route['codeSystem'] %>"/>
19
+ <% end -%>
20
+
21
+ <!-- Attribute: dose -->
22
+ <% if entry.dose.present? -%>
23
+ <doseQuantity value="<%= entry.dose['value']%>"/>
24
+ <% end -%>
25
+
26
+
27
+ <% if entry.product_form.present? -%>
28
+ <administrationUnitCode code="<%= entry.product_form['code'] %>" codeSystem="<%= entry.product_form['codeSystem'] %>"/>
29
+ <% end -%>
30
+
31
+ <consumable>
32
+ <manufacturedProduct classCode="MANU">
33
+ <!-- Medication Information (consolidation) template -->
34
+ <templateId root="2.16.840.1.113883.10.20.22.4.23"/>
35
+ <id root="<%= UUID.generate %>"/>
36
+ <manufacturedMaterial>
37
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
38
+ </manufacturedMaterial>
39
+ <manufacturerOrganization>
40
+ <name>Medication Factory Inc.</name>
41
+ </manufacturerOrganization>
42
+ </manufacturedProduct>
43
+ </consumable>
44
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
45
+ </substanceAdministration>
46
+ </entry>
@@ -0,0 +1,37 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Medication, Administered template -->
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.42"/>
5
+ <id root="<%= entry.id %>"/>
6
+ <code code="416118004" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Administration"/>
7
+ <statusCode code="completed"/>
8
+ <effectiveTime xsi:type="IVL_TS">
9
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
10
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
11
+ </effectiveTime>
12
+ <entryRelationship typeCode="COMP">
13
+ <substanceAdministration classCode="SBADM" moodCode="EVN">
14
+ <!-- Medication Activity (consolidation) template -->
15
+ <templateId root="2.16.840.1.113883.10.20.22.4.16"/>
16
+ <id root="<%= UUID.generate %>"/>
17
+ <text><%= entry.description %></text>
18
+ <statusCode code="completed"/>
19
+ <effectiveTime xsi:type="IVL_TS">
20
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
21
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
22
+ </effectiveTime>
23
+ <consumable>
24
+ <manufacturedProduct classCode="MANU">
25
+ <!-- Medication Information (consolidation) template -->
26
+ <templateId root="2.16.840.1.113883.10.20.22.4.23"/>
27
+ <id root="<%= UUID.generate %>"/>
28
+ <manufacturedMaterial>
29
+ <%== code_display(entry, 'preferred_code_sets' => ['RxNorm', 'CVX', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
30
+ </manufacturedMaterial>
31
+ </manufacturedProduct>
32
+ </consumable>
33
+ </substanceAdministration>
34
+ </entryRelationship>
35
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
36
+ </act>
37
+ </entry>
@@ -0,0 +1,24 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- consolidation CDA Allergy observation template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.7"/>
5
+ <!-- Medication Allergy -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.43"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <code code="ASSERTION" displayName="Assertion" codeSystem="2.16.840.1.113883.5.4" codeSystemName="ActCode"/>
9
+ <statusCode code="completed"/>
10
+ <effectiveTime>
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ </effectiveTime>
13
+ <value code="62014003" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Adverse drug effect" xsi:type="CD"/>
14
+
15
+ <participant typeCode="CSM">
16
+ <participantRole classCode="MANU">
17
+ <playingEntity classCode="MMAT">
18
+ <%== code_display(entry, 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
19
+ <name><%= entry.description %></name>
20
+ </playingEntity>
21
+ </participantRole>
22
+ </participant>
23
+ </observation>
24
+ </entry>
@@ -0,0 +1,24 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- consolidation CDA Allergy observation template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.7"/>
5
+ <!-- Medication Allergy -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.44"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <code code="ASSERTION" displayName="Assertion" codeSystem="2.16.840.1.113883.5.4" codeSystemName="ActCode"/>
9
+ <statusCode code="completed"/>
10
+ <effectiveTime>
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ </effectiveTime>
13
+ <value code="416098002" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Drug allergy" xsi:type="CD"/>
14
+
15
+ <participant typeCode="CSM">
16
+ <participantRole classCode="MANU">
17
+ <playingEntity classCode="MMAT">
18
+ <%== code_display(entry, 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
19
+ <name><%= entry.description %></name>
20
+ </playingEntity>
21
+ </participantRole>
22
+ </participant>
23
+ </observation>
24
+ </entry>
@@ -0,0 +1,26 @@
1
+ <entry>
2
+ <!--Medication dispensed -->
3
+ <supply classCode="SPLY" moodCode="EVN">
4
+ <!-- Medication Dispensed template -->
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.45"/>
6
+ <!-- Medication Dispense template -->
7
+ <templateId root="2.16.840.1.113883.10.20.22.4.18"/>
8
+ <id root="<%= entry.id %>"/>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="completed"/>
11
+ <effectiveTime xsi:type="IVL_TS">
12
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
13
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
14
+ </effectiveTime>
15
+ <product>
16
+ <manufacturedProduct classCode="MANU">
17
+ <!-- Medication Information (consolidation) template -->
18
+ <templateId root="2.16.840.1.113883.10.20.22.4.23"/>
19
+ <id root="<%= UUID.generate %>"/>
20
+ <manufacturedMaterial>
21
+ <%== code_display(entry, :extra_content => "sdtc:valueSet=\"#{value_set_oid}\"") %>
22
+ </manufacturedMaterial>
23
+ </manufacturedProduct>
24
+ </product>
25
+ </supply>
26
+ </entry>
@@ -0,0 +1,30 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- consolidation CDA Allergy Observation template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.7"/>
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.46"/>
6
+ <id root="<%= entry.id %>"/>
7
+ <code code="ASSERTION"
8
+ displayName="Assertion"
9
+ codeSystem="2.16.840.1.113883.5.4"
10
+ codeSystemName="ActCode"/>
11
+ <statusCode code="completed"/>
12
+ <effectiveTime>
13
+ <low value="<%= entry.start_time %>"/>
14
+ </effectiveTime>
15
+ <value xsi:type="CD"
16
+ code="59037007"
17
+ displayName="Drug intolerance"
18
+ codeSystem="2.16.840.1.113883.6.96"
19
+ codeSystemName="SNOMED CT"/>
20
+
21
+ <participant typeCode="CSM">
22
+ <participantRole classCode="MANU">
23
+ <playingEntity classCode="MMAT">
24
+ <%== code_display(entry, 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
25
+ <text><%= entry.description %></text>
26
+ </playingEntity>
27
+ </participantRole>
28
+ </participant>
29
+ </observation>
30
+ </entry>
@@ -0,0 +1,26 @@
1
+ <entry>
2
+ <!--Medication Order -->
3
+ <substanceAdministration classCode="SBADM" moodCode="RQO" <%== negation_indicator(entry) %>>
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.42"/>
5
+ <!-- Medication, Order template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.47"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <text><%= entry.description %></text>
9
+ <statusCode code="new"/>
10
+ <effectiveTime xsi:type="IVL_TS">
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
13
+ </effectiveTime>
14
+ <consumable>
15
+ <manufacturedProduct classCode="MANU">
16
+ <!-- Medication Information (consolidation) template -->
17
+ <templateId root="2.16.840.1.113883.10.20.22.4.23"/>
18
+ <id root="<%= UUID.generate %>"/>
19
+ <manufacturedMaterial>
20
+ <%== code_display(entry, 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
21
+ </manufacturedMaterial>
22
+ </manufacturedProduct>
23
+ </consumable>
24
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
25
+ </substanceAdministration>
26
+ </entry>
@@ -0,0 +1,13 @@
1
+ <entry>
2
+ <!-- Clinical Trial Participant -->
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.51"/>
5
+ <id root="<%= UUID.generate %>"/>
6
+ <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
7
+ <statusCode code="active"/>
8
+ <effectiveTime>
9
+ <low value="20100101"/> <!-- Currently hardcoded to January 1, 2010 -->
10
+ </effectiveTime>
11
+ <value code="428024001" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="clinical trial participant" xsi:type="CD"/>
12
+ </observation>
13
+ </entry>
@@ -0,0 +1,16 @@
1
+ <entry>
2
+ <!-- Patient characteristic expired -->
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <!-- Consolidation Deceased Observation templateId -->
5
+ <templateId root="2.16.840.1.113883.10.20.22.4.79"/>
6
+ <!-- Patient Characteristic Expired -->
7
+ <templateId root="2.16.840.1.113883.10.20.24.3.54"/>
8
+ <id root="<%= UUID.generate %>"/>
9
+ <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4" codeSystemName="HL7ActCode"/>
10
+ <statusCode code="completed"/>
11
+ <effectiveTime>
12
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
13
+ </effectiveTime>
14
+ <value code="419099009" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Dead" sdtc:valueSet="2.16.840.1.113883.3.666.5.539" xsi:type="CD"/>
15
+ </observation>
16
+ </entry>
@@ -0,0 +1,10 @@
1
+ <entry>
2
+ <!-- Patient Characteristic Payer -->
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.55"/>
5
+ <id root="<%= entry.id %>"/>
6
+ <code code="48768-6" codeSystemName="LOINC" displayName="Payment source"/>
7
+ <statusCode code="completed"/>
8
+ <%== code_display(entry, 'tag_name' => 'value', 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ </observation>
10
+ </entry>
@@ -0,0 +1,19 @@
1
+ <entry>
2
+ <!-- Physical Exam Finding -->
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <!-- Result observation template -->
5
+ <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
6
+ <!-- Physical Exam, Finding template -->
7
+ <templateId root="2.16.840.1.113883.10.20.24.3.57"/>
8
+ <id root="<%= entry.id %>"/>
9
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
10
+
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
+ </observation>
19
+ </entry>
@@ -0,0 +1,17 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Procedure Activity Procedure (Consolidation) template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.13"/>
5
+ <!-- Physical Exam, Performed template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.59"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="completed"/>
11
+ <effectiveTime>
12
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
13
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
14
+ </effectiveTime>
15
+ <%== render(:partial => 'result_value', :locals => {:entry => entry}) %>
16
+ </observation>
17
+ </entry>
@@ -0,0 +1,36 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.62"/>
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.104"/>
5
+ <id root="<%= entry.id %>"/>
6
+ <code code="ASSERTION"
7
+ codeSystem="2.16.840.1.113883.5.4"
8
+ codeSystemName="ActCode"
9
+ displayName="Assertion"/>
10
+ <statusCode code="completed"/>
11
+ <effectiveTime>
12
+ <low value="<%= entry.start_time %>"/>
13
+ </effectiveTime>
14
+ <value xsi:type="CD"
15
+ code="102460003"
16
+ codeSystem="2.16.840.1.113883.6.96"
17
+ codeSystemName="SNOMED CT"
18
+ displayName="Decreased tolerance"/>
19
+ <entryRelationship typeCode="CAUS" inversionInd="true">
20
+ <procedure classCode="PROC" moodCode="EVN">
21
+ <!-- Procedure performed template -->
22
+ <templateId root="2.16.840.1.113883.10.20.24.3.64"/>
23
+ <!-- Procedure Activity Procedure-->
24
+ <templateId root="2.16.840.1.113883.10.20.22.4.14"/>
25
+ <id root="<%= entry.id %>"/>
26
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'CPT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
27
+ <text><%= entry.description %></text>
28
+ <statusCode code="completed"/>
29
+ <effectiveTime>
30
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
31
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
32
+ </effectiveTime>
33
+ </procedure>
34
+ </entryRelationship>
35
+ </observation>
36
+ </entry>