health-data-standards 4.0.6 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/lib/health-data-standards.rb +3 -0
  3. data/lib/health-data-standards/export/cat_1.rb +2 -2
  4. data/lib/health-data-standards/export/qrda/hqmf-qrda-oids.json +13 -1
  5. data/lib/health-data-standards/export/view_helper.rb +11 -4
  6. data/lib/health-data-standards/import/cat1/adverse_event_importer.rb +12 -0
  7. data/lib/health-data-standards/import/cat1/allergy_intolerance_importer.rb +13 -0
  8. data/lib/health-data-standards/import/cat1/medication_substance_administered_importer.rb +19 -0
  9. data/lib/health-data-standards/validate/qrda_qdm_template_validator.rb +70 -1
  10. data/lib/health-data-standards/validate/validators.rb +10 -0
  11. data/resources/schematron/qrda/cat_1_r5/HL7 QRDA Category I STU 5.sch +3069 -0
  12. data/resources/schematron/qrda/cat_1_r5/voc.xml +1186 -0
  13. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.1.cat1.erb +14 -0
  14. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.103.cat1.erb +17 -0
  15. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.105.cat1.erb +65 -0
  16. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.12.cat1.erb +53 -0
  17. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.135.cat1.erb +69 -0
  18. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.136.cat1.erb +50 -0
  19. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.140.cat1.erb +25 -0
  20. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.144.cat1.erb +24 -0
  21. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.145.cat1.erb +18 -0
  22. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.146.cat1.erb +33 -0
  23. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.147.cat1.erb +28 -0
  24. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.17.cat1.erb +17 -0
  25. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.18.cat1.erb +29 -0
  26. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.2.cat1.erb +29 -0
  27. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.22.cat1.erb +24 -0
  28. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.23.cat1.erb +94 -0
  29. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.3.cat1.erb +25 -0
  30. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.31.cat1.erb +18 -0
  31. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +21 -0
  32. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.37.cat1.erb +16 -0
  33. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.38.cat1.erb +23 -0
  34. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.4.cat1.erb +29 -0
  35. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.41.cat1.erb +45 -0
  36. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.42.cat1.erb +27 -0
  37. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.45.cat1.erb +36 -0
  38. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.47.cat1.erb +41 -0
  39. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.51.cat1.erb +14 -0
  40. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.54.cat1.erb +32 -0
  41. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.55.cat1.erb +18 -0
  42. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.57.cat1.erb +23 -0
  43. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.59.cat1.erb +25 -0
  44. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.63.cat1.erb +15 -0
  45. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +55 -0
  46. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.7.cat1.erb +31 -0
  47. data/templates/cat1/r5/_2.16.840.1.113883.10.20.24.3.9.cat1.erb +35 -0
  48. data/templates/cat1/r5/_2.16.840.1.113883.10.20.28.3.6.cat1.erb +17 -0
  49. data/templates/cat1/r5/_address.cat1.erb +7 -0
  50. data/templates/cat1/r5/_author.cat1.erb +28 -0
  51. data/templates/cat1/r5/_author_qdm.cat1.erb +8 -0
  52. data/templates/cat1/r5/_component_value.cat1.erb +5 -0
  53. data/templates/cat1/r5/_components.cat1.erb +11 -0
  54. data/templates/cat1/r5/_fulfills.cat1.erb +14 -0
  55. data/templates/cat1/r5/_id.cat1.erb +1 -0
  56. data/templates/cat1/r5/_measures.cat1.erb +93 -0
  57. data/templates/cat1/r5/_medication_details.cat1.erb +12 -0
  58. data/templates/cat1/r5/_medication_dispense.cat1.erb +22 -0
  59. data/templates/cat1/r5/_ordinality.cat1.erb +6 -0
  60. data/templates/cat1/r5/_organization.cat1.erb +9 -0
  61. data/templates/cat1/r5/_patient_data.cat1.erb +17 -0
  62. data/templates/cat1/r5/_providers.cat1.erb +76 -0
  63. data/templates/cat1/r5/_reason.cat1.erb +30 -0
  64. data/templates/cat1/r5/_record_target.cat1.erb +54 -0
  65. data/templates/cat1/r5/_reporting_parameters.cat1.erb +31 -0
  66. data/templates/cat1/r5/_result_value.cat1.erb +20 -0
  67. data/templates/cat1/r5/_results.cat1.erb +18 -0
  68. data/templates/cat1/r5/_telecom.cat1.erb +1 -0
  69. data/templates/cat1/r5/show.cat1.erb +192 -0
  70. metadata +65 -3
@@ -0,0 +1,14 @@
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" extension="2017-08-01"/>
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_or_null_flavor(entry.start_time) %>/>
10
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
11
+ </effectiveTime>
12
+ <%== code_display(entry, {'tag_name' => 'value', 'value_set_map' => filtered_vs_map,'preferred_code_sets' => ['*'], 'extra_content' => "xsi:type=\"CD\""}) %>
13
+ </observation>
14
+ </entry>
@@ -0,0 +1,32 @@
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" extension="2015-08-01"/>
6
+ <!-- Patient Characteristic Expired -->
7
+ <templateId root="2.16.840.1.113883.10.20.24.3.54" extension="2016-02-01"/>
8
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
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" xsi:type="CD"/>
15
+ <% if entry.respond_to? :code
16
+ # Currently, Record does not support coded cause of death, but this should allow it to work
17
+ # when Record supports it.
18
+ -%>
19
+ <entryRelationship typeCode="CAUS">
20
+ <observation classCode="OBS" moodCode="EVN">
21
+ <id root="<%= UUID.generate %>"/>
22
+ <code code="ASSERTION"
23
+ codeSystem="2.16.840.1.113883.5.4"
24
+ codeSystemName="HL7ActCode"/>
25
+ <statusCode code="completed"/>
26
+ <%== code_display(entry, 'tag_name' => 'value', 'preferred_code_sets' => ['SNOMED-CT'], 'extra_content' => "xsi:type=\"CD\"") %>
27
+ <text><%= entry.description %></text>
28
+ </observation>
29
+ </entryRelationship>
30
+ <% end -%>
31
+ </observation>
32
+ </entry>
@@ -0,0 +1,18 @@
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="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
6
+ <code code="48768-6" codeSystemName="LOINC" codeSystem="2.16.840.1.113883.6.1" displayName="Payment source"/>
7
+ <statusCode code="completed"/>
8
+ <effectiveTime>
9
+ <!-- Attribute: Start Datetime -->
10
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
11
+ <% if entry.end_time %>
12
+ <high value="<%= time_if_not_nil(entry.end_time) %>" />
13
+ <% end %>
14
+ </effectiveTime>
15
+ <%== code_display(entry, 'preferred_code_sets' =>["SOP","Source of Payment Typology"] , 'tag_name' => 'value', 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"2.16.840.1.114222.4.11.3591\"") %>
16
+
17
+ </observation>
18
+ </entry>
@@ -0,0 +1,23 @@
1
+ <% vals = entry.values.empty? ? [nil] : entry.values
2
+ vals.each do |value|
3
+ %>
4
+ <entry>
5
+ <!-- Physical Exam Finding -->
6
+ <observation classCode="OBS" moodCode="EVN">
7
+ <!-- Result observation template -->
8
+ <templateId root="2.16.840.1.113883.10.20.22.4.2" extension="2014-06-09"/>
9
+ <!-- Physical Exam, Finding template -->
10
+ <templateId root="2.16.840.1.113883.10.20.24.3.57" extension="2014-12-01"/>
11
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
12
+ <%== code_display(entry, 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT']) %>
13
+ <text><%= entry.description %></text>
14
+ <statusCode code="completed"/>
15
+
16
+ <effectiveTime>
17
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
18
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
19
+ </effectiveTime>
20
+ <%== render(:partial => 'result_value', :locals => {:values => [value], :result_oids=>result_oids}) %>
21
+ </observation>
22
+ </entry>
23
+ <% end %>
@@ -0,0 +1,25 @@
1
+ <% vals = entry.values.empty? ? [nil] : entry.values
2
+ vals.each do |value|
3
+ %>
4
+ <entry>
5
+ <observation classCode="OBS" moodCode="EVN" <%== negation_indicator(entry) %>>
6
+ <!-- Procedure Activity Procedure (Consolidation) template -->
7
+ <templateId root="2.16.840.1.113883.10.20.22.4.13" extension="2014-06-09"/>
8
+ <!-- Physical Exam, Performed template -->
9
+ <templateId root="2.16.840.1.113883.10.20.24.3.59" extension="2017-08-01"/>
10
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
11
+ <%== code_display(entry, 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'LOINC']) %>
12
+ <text><%= entry.description %></text>
13
+ <statusCode code="completed"/>
14
+ <effectiveTime>
15
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
16
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
17
+ </effectiveTime>
18
+ <%== render(:partial => 'result_value', :locals => {:values => [value], :result_oids=>result_oids}) %>
19
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
20
+ <% if entry.components -%>
21
+ <%== render(:partial => 'components', :locals => {:entry => entry} ) %>
22
+ <% end %>
23
+ </observation>
24
+ </entry>
25
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <entry>
2
+ <procedure classCode="PROC" moodCode="RQO" <%== negation_indicator(entry) %>>
3
+ <!-- Consolidated Plan of Care Activity Procedure TemplateId (Implied Template) -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.41" extension="2014-06-09"/>
5
+ <!-- QRDA Procedure, Order TemplateId -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.63" extension="2017-08-01"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-PCS', 'ICD-10-PCS']) %>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="active"/>
11
+ <!-- Attribute: datetime -->
12
+ <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %>
13
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
14
+ </procedure>
15
+ </entry>
@@ -0,0 +1,55 @@
1
+ <entry>
2
+ <procedure classCode="PROC" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Procedure performed template -->
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.64" extension="2017-08-01"/>
5
+ <!-- Procedure Activity Procedure-->
6
+ <templateId root="2.16.840.1.113883.10.20.22.4.14" extension="2014-06-09"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['*']) %>
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 => 'ordinality', :locals => {:entry => entry, :ordinality_oids=>field_oids["ORDINAL"]}) %>
16
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
17
+ <% if entry.respond_to?(:incision_time) && entry.incision_time.present? -%>
18
+ <entryRelationship typeCode="REFR">
19
+ <procedure classCode="PROC" moodCode="EVN">
20
+ <templateId root="2.16.840.1.113883.10.20.24.3.89"/>
21
+ <id root="1.3.6.1.4.1.115" extension="<%= identifier_for([entry.id, entry.incision_time]) %>" />
22
+ <code code="34896006"
23
+ codeSystem="2.16.840.1.113883.6.96"
24
+ codeSystemName="SNOMED CT"
25
+ displayName="incision"/>
26
+ <effectiveTime <%= value_or_null_flavor(entry.incision_time) %>/>
27
+ </procedure>
28
+ </entryRelationship>
29
+ <% end -%>
30
+
31
+ <% entry.values.each do |value| %>
32
+ <entryRelationship typeCode="REFR">
33
+ <observation classCode="OBS" moodCode="EVN">
34
+ <!-- Conforms to C-CDA R2 Result Observation (V2) -->
35
+ <templateId root="2.16.840.1.113883.10.20.22.4.2" extension="2015-08-01"/>
36
+ <!-- Result (QRDA I R3) -->
37
+ <templateId root="2.16.840.1.113883.10.20.24.3.87" extension="2016-02-01"/>
38
+ <id root="1.3.6.1.4.1.115" extension="<%= identifier_for(value) %>"/>
39
+ <%== code_display(entry, 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['*']) %>
40
+ <statusCode code="completed"/>
41
+ <effectiveTime>
42
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
43
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
44
+ </effectiveTime>
45
+ <%== render(:partial=> 'result_value', :locals => {:values => [value]}) %>
46
+
47
+ </observation>
48
+ </entryRelationship>
49
+ <% end %>
50
+ <% if entry.components -%>
51
+ <%== render(:partial => 'components', :locals => {:entry => entry} ) %>
52
+ <% end %>
53
+ </procedure>
54
+ </entry>
55
+
@@ -0,0 +1,31 @@
1
+ <entry>
2
+ <procedure classCode="PROC" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Procedure Activity Procedure -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.14" extension="2014-06-09"/>
5
+ <!-- Device Applied -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.7" extension="2017-08-01"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <code code="360030002" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="application of device"/>
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.removal_time || entry.end_time) %>/>
15
+ </effectiveTime>
16
+
17
+ <% if entry.respond_to?(:anatomical_target) && entry.anatomical_target.present? -%>
18
+ <targetSiteCode code="<%= entry.anatomical_target['code'] %>"
19
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.anatomical_target['code_system']) %>"/>
20
+ <% end -%>
21
+ <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %>
22
+ <participant typeCode="DEV">
23
+ <participantRole classCode="MANU">
24
+ <playingDevice classCode="DEV">
25
+ <%== code_display(entry, 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['*']) %>
26
+ </playingDevice>
27
+ </participantRole>
28
+ </participant>
29
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
30
+ </procedure>
31
+ </entry>
@@ -0,0 +1,35 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="RQO" <%== negation_indicator(entry) %>>
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.130" extension="2017-08-01"/>
4
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
5
+ <code code="SPLY" codeSystem="2.16.840.1.113883.5.6" displayName="Supply" codeSystemName="ActClass"/>
6
+
7
+ <entryRelationship typeCode="SUBJ">
8
+ <supply classCode="SPLY" moodCode="RQO">
9
+ <!-- Plan of Care Activity Supply -->
10
+ <templateId root="2.16.840.1.113883.10.20.22.4.43" extension="2014-06-09"/>
11
+ <!-- Device, Order -->
12
+ <templateId root="2.16.840.1.113883.10.20.24.3.9" extension="2017-08-01"/>
13
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
14
+ <text><%= entry.description %></text>
15
+ <statusCode code="active"/>
16
+
17
+ <effectiveTime xsi:type="IVL_TS">
18
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
19
+ <high <%= value_or_null_flavor(entry.removal_time || entry.end_time) %>/>
20
+ </effectiveTime>
21
+
22
+ <%== render(:partial => 'author_qdm', :locals => {:entry => entry}) %>
23
+
24
+ <participant typeCode="DEV">
25
+ <participantRole classCode="MANU">
26
+ <playingDevice classCode="DEV">
27
+ <%== code_display(entry, 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['*']) %>
28
+ </playingDevice>
29
+ </participantRole>
30
+ </participant>
31
+ </supply>
32
+ </entryRelationship>
33
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
34
+ </act>
35
+ </entry>
@@ -0,0 +1,17 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.51" extension="2016-02-01"/>
4
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
5
+ <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4" />
6
+ <statusCode code="active" />
7
+ <effectiveTime>
8
+ <!-- Attribute: Start Datetime -->
9
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
10
+ <!-- Attribute: Stop Datetime -->
11
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
12
+ </effectiveTime>
13
+ <%== code_display(entry, 'preferred_code_sets' => ['*'],
14
+ 'tag_name' => 'value','value_set_map' => filtered_vs_map,
15
+ 'extra_content' => "xsi:type=\"CD\"") %>
16
+ </observation>
17
+ </entry>
@@ -0,0 +1,7 @@
1
+ <addr use="<%= address.use %>">
2
+ <streetAddressLine><%= address.street.join(' ') %></streetAddressLine>
3
+ <city><%= address.city %></city>
4
+ <state><%= address.state %></state>
5
+ <postalCode><%= address.zip %></postalCode>
6
+ <country><%= address.country %></country>
7
+ </addr>
@@ -0,0 +1,28 @@
1
+ <!-- SHALL have 1..* author. MAY be device or person.
2
+ The author of the CDA document in this example is a device at a data submission vendor/registry. -->
3
+ <author>
4
+ <time value="<%= author.time.to_formatted_s(:number) %>"/>
5
+ <assignedAuthor>
6
+ <!-- Registry author ID -->
7
+ <%== render :partial=>"id", :collection=>author.ids, :id=>"identifier" %>
8
+ <%== render :partial=>"address" , :collection=>author.addresses %>
9
+ <%== render :partial=>"telecom" , :collection=>author.telecoms %>
10
+
11
+ <% if author.person %>
12
+ <assignedPerson>
13
+ <name>
14
+ <given><%= author.person.given %></given>
15
+ <family><%= author.person.family %></family>
16
+ </name>
17
+ </assignedPerson>
18
+ <% elsif author.device %>
19
+ <assignedAuthoringDevice>
20
+ <manufacturerModelName><%= author.device.model %></manufacturerModelName>
21
+ <softwareName><%= author.device.name %></softwareName>
22
+ </assignedAuthoringDevice>
23
+ <% end %>
24
+
25
+ <%== render :partial=>"organization", :locals=>{organization: author.organization, tag_name: "representedOrganization"} %>
26
+
27
+ </assignedAuthor>
28
+ </author>
@@ -0,0 +1,8 @@
1
+ <author>
2
+ <templateId root="2.16.840.1.113883.10.20.24.3.155" extension="2017-08-01"/>
3
+ <time <%= value_or_null_flavor(entry.as_point_in_time) %>/>
4
+ <assignedAuthor>
5
+ <id nullFlavor="NA"/>
6
+ </assignedAuthor>
7
+ </author>
8
+
@@ -0,0 +1,5 @@
1
+ <% if result['code'] -%>
2
+ <value xsi:type="CD" code="<%= result['code'].code %>" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(result['code'].code_system) %>" />
3
+ <% elsif result['scalar'] %>
4
+ <value xsi:type="PQ" value="<%= result['scalar'] %>" unit="<%= result['units'] %>"/>
5
+ <% end %>
@@ -0,0 +1,11 @@
1
+ <% entry.components['values'].each do |component| %>
2
+ <entryRelationship typeCode="REFR">
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <!-- Component -->
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.149" extension="2017-08-01" />
6
+ <id root="1.3.6.1.4.1.115" extension="<%= identifier_for(component) %>"/>
7
+ <code code="<%= component.code['code'] %>" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(component.code['code_system']) %>" />
8
+ <%== render(:partial => 'component_value', :locals => {:result => component.result} ) %>
9
+ </observation>
10
+ </entryRelationship>
11
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% if entry.references.present?
2
+ -%>
3
+ <% entry.references.each do |reference|
4
+ resolved_reference = reference.resolve_reference %>
5
+ <% if reference.type == "fulfills" %>
6
+ <sdtc:inFulfillmentOf1 typeCode="FLFS">
7
+ <sdtc:templateId root="2.16.840.1.113883.10.20.24.3.126" extension="2016-08-01"/>
8
+ <sdtc:actReference classCode="ACT" moodCode="<%= resolved_reference.mood_code %>">
9
+ <sdtc:id root="1.3.6.1.4.1.115" extension="<%= reference.referenced_id %>"/>
10
+ </sdtc:actReference>
11
+ </sdtc:inFulfillmentOf1>
12
+ <% end %>
13
+ <% end %>
14
+ <% end -%>
@@ -0,0 +1 @@
1
+ <id <%== identifier.root.nil? ? "" : "root='#{identifier.root}'" -%> extension="<%= identifier.extension %>"/>
@@ -0,0 +1,93 @@
1
+ <component>
2
+ <section>
3
+ <!--
4
+ *****************************************************************
5
+ Measure Section
6
+ *****************************************************************
7
+ -->
8
+ <!-- This is the templateId for Measure Section -->
9
+ <templateId root="2.16.840.1.113883.10.20.24.2.2"/>
10
+ <!-- This is the templateId for Measure Section QDM -->
11
+ <templateId root="2.16.840.1.113883.10.20.24.2.3"/>
12
+ <!-- This is the LOINC code for "Measure document". This stays the same for all measure section required by QRDA standard -->
13
+ <code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
14
+ <title>Measure Section</title>
15
+ <text>
16
+ <table border="1" width="100%">
17
+ <thead>
18
+ <tr>
19
+ <th>eMeasure Title</th>
20
+ <th>Version neutral identifier</th>
21
+ <th>eMeasure Version Number</th>
22
+ <th>Version specific identifier</th>
23
+ </tr>
24
+ </thead>
25
+ <tbody>
26
+ <% measures.each do |measure| -%>
27
+ <tr>
28
+ <td><%= measure.title %></td>
29
+ <td><%= measure.hqmf_set_id %></td>
30
+ <td><%= measure.hqmf_version_number %></td>
31
+ <td><%= measure.hqmf_id %></td>
32
+ <td></td>
33
+ </tr>
34
+ <% end -%>
35
+ </tbody>
36
+ </table>
37
+ </text>
38
+ <!-- 1..* Organizers, each containing a reference to an eMeasure -->
39
+ <% measures.each do |measure| -%>
40
+ <entry>
41
+ <organizer classCode="CLUSTER" moodCode="EVN">
42
+ <!-- This is the templateId for Measure Reference -->
43
+ <templateId root="2.16.840.1.113883.10.20.24.3.98"/>
44
+ <!-- This is the templateId for eMeasure Reference QDM -->
45
+ <templateId root="2.16.840.1.113883.10.20.24.3.97"/>
46
+ <id root="1.3.6.1.4.1.115" extension="<%= measure['id'] %>"/>
47
+ <statusCode code="completed"/>
48
+ <!-- Containing isBranch external references -->
49
+ <reference typeCode="REFR">
50
+ <externalDocument classCode="DOC" moodCode="EVN">
51
+ <!-- SHALL: This is the version specific identifier for eMeasure: QualityMeasureDocument/id it is a GUID-->
52
+ <id root="2.16.840.1.113883.4.738" extension="<%= measure.hqmf_id %>"/>
53
+ <!-- SHOULD This is the title of the eMeasure -->
54
+ <text><%= measure.title %></text>
55
+ <!-- SHOULD: setId is the eMeasure version neutral id -->
56
+ <setId root="<%= measure.hqmf_set_id %>"/>
57
+ <!-- This is the sequential eMeasure Version number -->
58
+ <versionNumber value="<%= measure.hqmf_version_number %>"/>
59
+ </externalDocument>
60
+ </reference>
61
+ </organizer>
62
+
63
+ <% # Only want the epxected values when running from Bonnie
64
+ if patient.respond_to?('expected_values_for_qrda_export') -%>
65
+ <component>
66
+ <%
67
+ # # Going to assume that any expected_value > 0 is a TRUE
68
+ # # As per HL7 CDA R2:QRDA I, R1, STU Release 3.1, US Realm, Vol. 2 —Templates and Supporting Material
69
+ # # Set negationInd="false" to assert true (that the criteria are met by the included data). Set negationInd="true" to assert false (that the criteria are not met by the included data).
70
+ # # QRDA expects IPOP instead of IPP.
71
+ qrda_expected_values = patient.expected_values_for_qrda_export(measure)
72
+ qrda_expected_values.each do |qev| -%>
73
+ <observation classCode="OBS" moodCode="EVN" negationInd="<%= qev[:expected_value] == '0' ? 'true' : 'false' %>">
74
+ <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
75
+ <value xsi:type="CD"
76
+ code="<%= qev[:code] == 'IPP' ? 'IPOP' : qev[:code] %>"
77
+ codeSystem="2.16.840.1.113883.5.4"
78
+ codeSystemName="ActCode"
79
+ displayName="<%= qev[:display_name] %>"/>
80
+ <!-- Explicit reference to the eMeasure population (because some eMeasures have multiple Numerators, etc -->
81
+ <reference typeCode="REFR">
82
+ <externalObservation classCode="OBS" moodCode="EVN">
83
+ <id root="<%= qev[:hqmf_id] %>"/>
84
+ </externalObservation>
85
+ </reference>
86
+ </observation>
87
+ <% end -%>
88
+ </component>
89
+ <% end -%>
90
+ </entry>
91
+ <% end -%>
92
+ </section>
93
+ </component>