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,12 @@
1
+ <% if entry.respond_to?(:route) && entry.route.present?
2
+ # hard coded to NCI Thesaurus for the code system since Cat I mandates that
3
+ -%>
4
+ <routeCode code="<%= entry.route[:code] %>"
5
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.route[:code_system]) %>"
6
+ />
7
+ <% end -%>
8
+ <% if entry.negationInd %>
9
+ <doseQuantity nullFlavor="NA"/>
10
+ <% elsif entry.respond_to?(:dose) && entry.dose.present? -%>
11
+ <doseQuantity <%= dose_quantity(entry.codes, entry.dose) %>/>
12
+ <% end -%>
@@ -0,0 +1,22 @@
1
+
2
+ <entryRelationship typeCode="REFR">
3
+ <supply classCode="SPLY" moodCode="EVN">
4
+ <!-- Medication Dispense template -->
5
+ <templateId root="2.16.840.1.113883.10.20.22.4.18" extension="2014-06-09"/>
6
+ <id root="1.3.6.1.4.1.115" extension="<%= UUID.generate %>"/>
7
+ <statusCode code="completed"/>
8
+ <effectiveTime <%= value_or_null_flavor(medication_dispense.dispense_date) %>/>
9
+ <repeatNumber value="1"/>
10
+ <quantity <%= fulfillment_quantity(entry.codes, medication_dispense, entry.dose) %>/>
11
+ <product>
12
+ <manufacturedProduct classCode="MANU">
13
+ <!-- Medication Information (consolidation) template -->
14
+ <templateId root="2.16.840.1.113883.10.20.22.4.23" extension="2014-06-09"/>
15
+ <id root="<%= UUID.generate %>"/>
16
+ <manufacturedMaterial>
17
+ <%== code_display(entry, 'preferred_code_sets' =>["RxNorm"], 'value_set_map' => filtered_vs_map) %>
18
+ </manufacturedMaterial>
19
+ </manufacturedProduct>
20
+ </product>
21
+ </supply>
22
+ </entryRelationship>
@@ -0,0 +1,6 @@
1
+ <% if entry.respond_to?(:ordinality) && entry.ordinality.present?
2
+ -%>
3
+ <priorityCode code="<%= entry.ordinality[:code] %>"
4
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.ordinality[:codeSystem] || entry.ordinality[:code_system]) %>"
5
+ />
6
+ <% end -%>
@@ -0,0 +1,9 @@
1
+ <<%=tag_name %>>
2
+ <!-- Represents unique registry organization TIN -->
3
+ <%== render :partial => "id", :collection => organization.ids, :id => "identifier" %>
4
+ <!-- Contains name - specific registry not required-->
5
+ <name><%= organization.name %></name>
6
+ <%== render :partial => "telecom", :collection => organization.telecoms %>
7
+ <%== render :partial => "address", :collection => organization.addresses %>
8
+
9
+ </<%=tag_name %>>
@@ -0,0 +1,17 @@
1
+ <component>
2
+ <section>
3
+ <!-- This is the templateId for Patient Data section -->
4
+ <templateId root="2.16.840.1.113883.10.20.17.2.4"/>
5
+ <!-- This is the templateId for Patient Data QDM section -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.2.1" extension="2016-08-01" />
7
+ <% if cms_compatibility %>
8
+ <templateId root="2.16.840.1.113883.10.20.24.2.1.1" extension="2017-07-01"/>
9
+ <% end %>
10
+ <code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
11
+ <title>Patient Data</title>
12
+ <text>
13
+
14
+ </text>
15
+ <%== render_patient_data(patient, measures, false, qrda_version) %>
16
+ </section>
17
+ </component>
@@ -0,0 +1,76 @@
1
+ <documentationOf typeCode="DOC">
2
+ <serviceEvent classCode="PCPR"> <!-- care provision -->
3
+ <% if patient.provider_performances.empty? -%>
4
+ <!-- No provider data found in the patient record
5
+ putting in a fake provider -->
6
+ <effectiveTime>
7
+ <low value="20020716"/>
8
+ <high value="<%= Time.now.utc.to_formatted_s(:number) %>"/>
9
+ </effectiveTime>
10
+ <!-- You can include multiple performers, each with an NPI, TIN, CCN. -->
11
+ <performer typeCode="PRF">
12
+ <time>
13
+ <low value="20020716"/>
14
+ <high value="<%= Time.now.utc.to_formatted_s(:number) %>"/>
15
+ </time>
16
+ <assignedEntity>
17
+ <!-- This is the provider NPI -->
18
+ <id root="2.16.840.1.113883.4.6" extension="111111111" />
19
+ <representedOrganization>
20
+ <!-- This is the organization TIN -->
21
+ <id root="2.16.840.1.113883.4.2" extension="1234567" />
22
+ <!-- This is the organization CCN -->
23
+ <id root="2.16.840.1.113883.4.336" extension="54321" />
24
+ </representedOrganization>
25
+ </assignedEntity>
26
+ </performer>
27
+ <% else -%>
28
+ <% patient.provider_performances.each do |pp| -%>
29
+ <effectiveTime>
30
+ <low <%= value_or_null_flavor(pp.start_date) %>/>
31
+ <high <%= value_or_null_flavor(pp.end_date) %>/>
32
+ </effectiveTime>
33
+ <!-- You can include multiple performers, each with an NPI, TIN, CCN. -->
34
+ <performer typeCode="PRF">
35
+ <time>
36
+ <low <%= value_or_null_flavor(pp.start_date) %>/>
37
+ <high <%= value_or_null_flavor(pp.end_date) %>/>
38
+ </time>
39
+ <assignedEntity>
40
+ <% pp.provider.cda_identifiers.each do |cda_id| -%>
41
+ <% unless cda_id.root.eql? '2.16.840.1.113883.4.2' -%>
42
+ <id root="<%= cda_id.root %>" extension="<%= cda_id.extension %>" />
43
+ <% end -%>
44
+ <% end -%>
45
+ <% if pp.provider.specialty %>
46
+ <code code="<%= pp.provider.specialty %>" codeSystemName="Healthcare Provider Taxonomy (HIPAA)" codeSystem="2.16.840.1.113883.6.101"/>
47
+ <% end %>
48
+ <%== render :partial=>"address" , :collection=>pp.provider.addresses %>
49
+ <%== render :partial=>"telecom", :collection=>pp.provider.telecoms %>
50
+ <assignedPerson>
51
+ <name>
52
+ <given><%= pp.provider.given_name %></given>
53
+ <family><%= pp.provider.family_name %></family>
54
+ </name>
55
+ </assignedPerson>
56
+ <representedOrganization>
57
+ <% pp.provider.cda_identifiers.each do |cda_id| -%>
58
+ <% if cda_id.root.eql?('2.16.840.1.113883.4.2') -%>
59
+ <id root="2.16.840.1.113883.4.2" extension="<%= cda_id.extension %>" />
60
+ <% end -%>
61
+ <% end -%>
62
+ <%if pp.provider.organization %>
63
+ <name><%= pp.provider.organization.name %></name>
64
+ <%== render :partial=>"address" , :collection=>pp.provider.organization.addresses %>
65
+ <%== render :partial=>"telecom", :collection=>pp.provider.organization.telecoms %>
66
+ <% else %>
67
+ <%== render :partial=>"address" , :collection=>pp.provider.addresses %>
68
+ <%== render :partial=>"telecom", :collection=>pp.provider.telecoms %>
69
+ <% end %>
70
+ </representedOrganization>
71
+ </assignedEntity>
72
+ </performer>
73
+ <% end -%>
74
+ <% end -%>
75
+ </serviceEvent>
76
+ </documentationOf>
@@ -0,0 +1,30 @@
1
+ <% if entry.negation_reason.present?
2
+ reason = entry.negation_reason
3
+ elsif entry.reason.present?
4
+ reason = entry.reason
5
+ end
6
+
7
+ if reason.present?
8
+ -%>
9
+ <entryRelationship typeCode="RSON">
10
+ <observation classCode="OBS" moodCode="EVN">
11
+ <templateId root="2.16.840.1.113883.10.20.24.3.88" extension="2014-12-01"/>
12
+ <id root="1.3.6.1.4.1.115" extension="<%= identifier_for([reason, entry.start_time]) %>" />
13
+ <code code="77301-0"
14
+ codeSystem="2.16.840.1.113883.6.1"
15
+ displayName="reason"
16
+ codeSystemName="LOINC"/>
17
+ <statusCode code="completed"/>
18
+ <effectiveTime>
19
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
20
+ </effectiveTime>
21
+ <value xsi:type="CD"
22
+ code="<%= reason[:code] %>"
23
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(reason[:codeSystem] || reason[:code_system]) %>"
24
+ <% if reason.respond_to?('title') || reason.has_key?('title') -%>
25
+ displayName="<%=reason['title']%>"
26
+ <% end -%>
27
+ />
28
+ </observation>
29
+ </entryRelationship>
30
+ <% end -%>
@@ -0,0 +1,54 @@
1
+ <recordTarget>
2
+ <patientRole>
3
+ <% if (patient.medical_record_number && patient.medical_record_assigner) %>
4
+ <id extension="<%= patient.medical_record_number %>" root="<%= patient.medical_record_assigner %>"/>
5
+ <% if cms_compatibility %>
6
+ <id extension="<%= patient.medical_record_number %>" root="1.3.6.1.4.1.115" />
7
+ <% end %>
8
+ <% else -%>
9
+ <id extension="12345" root="PlaceholderOrganization" />
10
+ <% end -%>
11
+ <addr use="HP">
12
+ <% if patient.addresses.present?
13
+ patient.addresses.each do |address| -%>
14
+ <streetAddressLine><%= address.street.join(' ') %></streetAddressLine>
15
+ <city><%= address.city %></city>
16
+ <state><%= address.state %></state>
17
+ <postalCode><%= address.zip %></postalCode>
18
+ <country><%= address.country %></country>
19
+ <% end -%>
20
+ <% else -%>
21
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
22
+ <city>Bedford</city>
23
+ <state>MA</state>
24
+ <postalCode>01730</postalCode>
25
+ <country>US</country>
26
+ <% end -%>
27
+ </addr>
28
+ <telecom use="WP" value="tel:+1-781-271-3000"/>
29
+ <patient>
30
+ <name>
31
+ <given><%= patient.first %></given>
32
+ <family><%= patient.last %></family>
33
+ </name>
34
+ <administrativeGenderCode code="<%= patient.gender %>" codeSystem="2.16.840.1.113883.5.1" codeSystemName="HL7 AdministrativeGender"/>
35
+ <birthTime value="<%= Time.at(patient.birthdate).utc.to_formatted_s(:number) %>"/>
36
+ <% if (patient.race) %>
37
+ <raceCode code="<%= patient.race[:code] %>" <% if patient.race[:name]%>displayName="<%= patient.race[:name] %>"<% end %> codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/>
38
+ <% end %>
39
+ <% if (patient.ethnicity) %>
40
+ <ethnicGroupCode code="<%= patient.ethnicity[:code] %>" <% if patient.ethnicity[:name]%>displayName="<%= patient.ethnicity[:name] %>"<% end %> codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/>
41
+ <% end %>
42
+ <%
43
+ languages = patient.languages
44
+ languages = ["eng"] if languages.nil? or languages.empty?
45
+ languages.each do |language|%>
46
+ <languageCommunication>
47
+ <templateId root="2.16.840.1.113883.3.88.11.83.2" assigningAuthorityName="HITSP/C83"/>
48
+ <templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.1" assigningAuthorityName="IHE/PCC"/>
49
+ <languageCode code="<%= language %>"/>
50
+ </languageCommunication>
51
+ <% end %>
52
+ </patient>
53
+ </patientRole>
54
+ </recordTarget>
@@ -0,0 +1,31 @@
1
+ <component>
2
+ <section>
3
+ <!-- This is the templateId for Reporting Parameters section -->
4
+ <templateId root="2.16.840.1.113883.10.20.17.2.1" />
5
+ <% if cms_compatibility %>
6
+ <templateId root="2.16.840.1.113883.10.20.17.2.1.1" extension="2016-03-01" />
7
+ <% end %>
8
+ <code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
9
+ <title>Reporting Parameters</title>
10
+ <text>
11
+ <list>
12
+ <item>Reporting period: <%= start_date.to_formatted_s(:long_ordinal) %> - <%= end_date.to_formatted_s(:long_ordinal) %></item>
13
+ </list>
14
+ </text>
15
+ <entry typeCode="DRIV">
16
+ <act classCode="ACT" moodCode="EVN">
17
+ <!-- This is the templateId for Reporting Parameteres Act -->
18
+ <templateId root="2.16.840.1.113883.10.20.17.3.8" />
19
+ <% if cms_compatibility %>
20
+ <templateId root="2.16.840.1.113883.10.20.17.3.8.1" extension="2016-03-01" />
21
+ <% end %>
22
+ <id root="1.3.6.1.4.1.115" extension="<%= identifier_for([start_date, end_date]) %>" />
23
+ <code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
24
+ <effectiveTime>
25
+ <low value="<%= start_date.to_formatted_s(:number) %>"/>
26
+ <high value="<%= end_date.to_formatted_s(:number) %>"/>
27
+ </effectiveTime>
28
+ </act>
29
+ </entry>
30
+ </section>
31
+ </component>
@@ -0,0 +1,20 @@
1
+ <% values.compact!
2
+ if !values.empty?
3
+ values.each do |ev|
4
+ if ev.respond_to?(:codes)
5
+ -%>
6
+ <%== code_display(ev, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'tag_name' => 'value', 'extra_content' => 'xsi:type="CD"') %>
7
+ <% elsif ev.respond_to?(:scalar) -%>
8
+ <% if is_num?(ev.scalar) -%>
9
+ <value xsi:type="PQ" value="<%= ev.scalar %>" <% if ev.units && (ev.units != "") -%>unit="<%= ev.units %>"<% else -%>unit="1"<% end -%>/>
10
+ <% elsif is_bool?(ev.scalar)%>
11
+ <value xsi:type="BL" value="<%= ev.scalar %>" />
12
+ <% else -%>
13
+ <value xsi:type="ST" ><%= ev.scalar %></value>
14
+ <% end
15
+ end
16
+ end
17
+ # else is empty
18
+ else -%>
19
+ <value xsi:type="CD" nullFlavor="UNK"/>
20
+ <% end -%>
@@ -0,0 +1,18 @@
1
+ <% entry.values.each do |value| %>
2
+ <entryRelationship typeCode="REFR">
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <!-- Conforms to C-CDA R2 Result Observation (V2) -->
5
+ <templateId root="2.16.840.1.113883.10.20.22.4.2" extension="2015-08-01"/>
6
+ <!-- Result (QRDA I R3) -->
7
+ <templateId root="2.16.840.1.113883.10.20.24.3.87" extension="2016-02-01"/>
8
+ <id root="1.3.6.1.4.1.115" extension="<%= identifier_for(value) %>"/>
9
+ <%== code_display(entry, 'value_set_map' => filtered_vs_map, 'preferred_code_sets' => ['*']) %>
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 => {:values => [value], :result_oids=>result_oids}) %>
16
+ </observation>
17
+ </entryRelationship>
18
+ <% end %>
@@ -0,0 +1 @@
1
+ <telecom use="<%=telecom.use%>" value="tel:+<%=telecom.value%>" />
@@ -0,0 +1,192 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <% if !measures.empty? %>
3
+ <% reporting_program = if measures.first.type == 'ep'
4
+ 'PQRS_MU_INDIVIDUAL'
5
+ else
6
+ 'HQR_EHR'
7
+ end -%>
8
+ <ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9
+ xmlns="urn:hl7-org:v3"
10
+ xmlns:voc="urn:hl7-org:v3/voc"
11
+ xmlns:sdtc="urn:hl7-org:sdtc">
12
+ <!-- QRDA Header -->
13
+ <realmCode code="US"/>
14
+ <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
15
+ <!-- US Realm Header Template Id -->
16
+ <templateId root="2.16.840.1.113883.10.20.22.1.1" extension="2015-08-01"/>
17
+ <!-- QRDA templateId -->
18
+ <templateId root="2.16.840.1.113883.10.20.24.1.1" extension="2016-02-01"/>
19
+ <!-- QDM-based QRDA templateId -->
20
+ <templateId root="2.16.840.1.113883.10.20.24.1.2" extension="2016-02-01"/>
21
+ <% if cms_compatibility %>
22
+ <!-- CMS QRDA templateId -->
23
+ <templateId root="2.16.840.1.113883.10.20.24.1.3" extension="2017-07-01" />
24
+ <% end %>
25
+ <!-- This is the globally unique identifier for this QRDA document -->
26
+ <id root="<%= UUID.generate %>"/>
27
+ <!-- QRDA document type code -->
28
+ <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
29
+ <title>QRDA Incidence Report</title>
30
+ <!-- This is the document creation time -->
31
+ <effectiveTime value="<%= Time.now.utc.to_formatted_s(:number) %>"/>
32
+ <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
33
+ <languageCode code="en"/>
34
+ <!-- reported patient -->
35
+ <%== render :partial => 'record_target', :locals => {:patient => patient, :cms_compatibility => cms_compatibility} %>
36
+ <!-- Example of an author who is a device -->
37
+ <% if header %>
38
+ <%== render :partial=>"author", :collection=>header.authors %>
39
+ <!-- SHALL have 1..* author. MAY be device or person.
40
+ The author of the CDA document in this example is a device at a data submission vendor/registry. -->
41
+
42
+ <!-- The custodian of the CDA document is the same as the legal authenticator in this
43
+ example and represents the reporting organization. -->
44
+ <!-- SHALL -->
45
+ <custodian>
46
+ <assignedCustodian>
47
+ <%== render :partial=>"organization", :locals=>{organization: header.custodian.organization, tag_name: "representedCustodianOrganization"} %>
48
+ </assignedCustodian>
49
+ </custodian>
50
+ <!-- This needs to take reporting program into account EH/EP-->
51
+ <% if cms_compatibility %>
52
+ <informationRecipient>
53
+ <intendedRecipient>
54
+ <id root="2.16.840.1.113883.3.249.7" extension="<%= reporting_program %>"/>
55
+ </intendedRecipient>
56
+ </informationRecipient>
57
+ <% end %>
58
+ <!-- The legal authenticator of the CDA document is a single person who is at the
59
+ same organization as the custodian in this example. This element must be present. -->
60
+ <!-- SHALL -->
61
+ <legalAuthenticator>
62
+ <!-- SHALL -->
63
+ <time value="<%= header.legal_authenticator.time.utc.to_formatted_s(:number) %>"/>
64
+ <!-- SHALL -->
65
+ <signatureCode code="S"/>
66
+ <assignedEntity>
67
+ <!-- SHALL ID -->
68
+ <%== render :partial=>"id", :collection=>header.legal_authenticator.ids, :id=>"identifier" %>
69
+ <%== render :partial=>"address" , :collection=>header.legal_authenticator.addresses %>
70
+ <%== render :partial => "telecom", :collection => header.legal_authenticator.telecoms %>
71
+ <assignedPerson>
72
+ <name>
73
+ <given><%= header.legal_authenticator.person.given %></given>
74
+ <family><%= header.legal_authenticator.person.family %></family>
75
+ </name>
76
+ </assignedPerson>
77
+
78
+ <%== render :partial=>"organization", :locals=>{organization: header.legal_authenticator.organization, tag_name: "representedOrganization"} %>
79
+ </assignedEntity>
80
+ </legalAuthenticator>
81
+ <% else %>
82
+ <author>
83
+ <time value="<%= Time.now.utc.to_formatted_s(:number) %>"/>
84
+ <assignedAuthor>
85
+ <!-- id extension="Cypress" root="2.16.840.1.113883.19.5"/ -->
86
+ <!-- NPI -->
87
+ <% if cms_compatibility %>
88
+ <% patient.provider_performances.each do |pp| -%>
89
+ <% pp.provider.cda_identifiers.each do |cda_id| -%>
90
+ <% if cda_id.root.eql?('2.16.840.1.113883.4.6') -%>
91
+ <id root="2.16.840.1.113883.4.6" extension="<%= cda_id.extension %>" />
92
+ <% end -%>
93
+ <% end -%>
94
+ <% end -%>
95
+ <% else %>
96
+ <id extension="FakeNPI" root="2.16.840.1.113883.4.6"/>
97
+ <% end %>
98
+ <addr>
99
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
100
+ <city>Bedford</city>
101
+ <state>MA</state>
102
+ <postalCode>01730</postalCode>
103
+ <country>US</country>
104
+ </addr>
105
+ <telecom use="WP" value="tel:(781)271-3000"/>
106
+ <assignedAuthoringDevice>
107
+ <manufacturerModelName>Cypress</manufacturerModelName >
108
+ <softwareName>Cypress</softwareName >
109
+ </assignedAuthoringDevice >
110
+ </assignedAuthor>
111
+ </author>
112
+ <custodian>
113
+ <assignedCustodian>
114
+ <representedCustodianOrganization>
115
+ <!-- HQR Only -->
116
+ <% if cms_compatibility && reporting_program == 'HQR_EHR' %>
117
+ <id root="2.16.840.1.113883.4.336" extension="800890"/>
118
+ <% else %>
119
+ <id root="2.16.840.1.113883.19.5"/>
120
+ <% end %>
121
+ <name>Cypress Test Deck</name>
122
+ <telecom use="WP" value="tel:(781)271-3000"/>
123
+ <addr>
124
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
125
+ <city>Bedford</city>
126
+ <state>MA</state>
127
+ <postalCode>01730</postalCode>
128
+ <country>US</country>
129
+ </addr>
130
+ </representedCustodianOrganization>
131
+ </assignedCustodian>
132
+ </custodian>
133
+ <!-- This needs to take reporting program into account EH/EP-->
134
+ <% if cms_compatibility %>
135
+ <informationRecipient>
136
+ <intendedRecipient>
137
+ <id root="2.16.840.1.113883.3.249.7" extension="<%= reporting_program %>"/>
138
+ </intendedRecipient>
139
+ </informationRecipient>
140
+ <% end %>
141
+ <legalAuthenticator>
142
+ <time value="<%= Time.now.utc.to_formatted_s(:number) %>"/>
143
+ <signatureCode code="S"/>
144
+ <assignedEntity>
145
+ <id root="bc01a5d1-3a34-4286-82cc-43eb04c972a7"/>
146
+ <addr>
147
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
148
+ <city>Bedford</city>
149
+ <state>MA</state>
150
+ <postalCode>01730</postalCode>
151
+ <country>US</country>
152
+ </addr>
153
+ <telecom use="WP" value="tel:(781)271-3000"/>
154
+ <assignedPerson>
155
+ <name>
156
+ <given>Henry</given>
157
+ <family>Seven</family>
158
+ </name>
159
+ </assignedPerson>
160
+ <representedOrganization>
161
+ <id root="2.16.840.1.113883.19.5"/>
162
+ <name>Cypress</name>
163
+ </representedOrganization>
164
+ </assignedEntity>
165
+ </legalAuthenticator>
166
+ <% if cms_compatibility %>
167
+ <participant typeCode="DEV">
168
+ <associatedEntity classCode="RGPR">
169
+ <!-- CMS EHR Certification Number (formerly known as Office of the
170
+ National Coordinator Certification Number) -->
171
+ <id root="2.16.840.1.113883.3.2074.1" extension="123456789"/>
172
+ </associatedEntity>
173
+ </participant>
174
+ <% end %>
175
+ <% end %>
176
+
177
+ <%== render :partial => 'providers', :locals => {:patient => patient} %>
178
+
179
+ <component>
180
+ <structuredBody>
181
+ <%== render :partial => 'measures', :locals => {:measures => measures, :patient => patient} %>
182
+ <%== render :partial => 'reporting_parameters', :locals => {:start_date => start_date, :end_date => end_date, :cms_compatibility => cms_compatibility} %>
183
+ <%== render :partial => 'patient_data', :locals => {:measures => measures, :patient => patient, :cms_compatibility => cms_compatibility, :qrda_version => qrda_version} %>
184
+ </structuredBody>
185
+ </component>
186
+ </ClinicalDocument>
187
+ <% else %>
188
+ <ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
189
+ xmlns="urn:hl7-org:v3"
190
+ xmlns:voc="urn:hl7-org:v3/voc"
191
+ xmlns:sdtc="urn:hl7-org:sdtc"/>
192
+ <% end %>