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,23 @@
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"/>
5
+ <!-- QRDA Procedure, Order TemplateId -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.63"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-PCS', 'ICD-10-PCS'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="new"/>
11
+ <!-- Attribute: method-->
12
+ <methodCode nullFlavor="UNK"/>
13
+
14
+ <!-- Attribute: datetime -->
15
+ <author>
16
+ <time <%= value_or_null_flavor(entry.start_time) %>/>
17
+ <assignedAuthor>
18
+ <id nullFlavor="NA"/>
19
+ </assignedAuthor>
20
+ </author>
21
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
22
+ </procedure>
23
+ </entry>
@@ -0,0 +1,29 @@
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"/>
5
+ <!-- Procedure Activity Procedure-->
6
+ <templateId root="2.16.840.1.113883.10.20.22.4.14"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'CPT', 'ICD-9-PCS', 'ICD-10-PCS'], '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 => 'reason', :locals => {:entry => entry}) %>
16
+ <% if entry.respond_to?(:incision_time) && entry.incision_time.present? -%>
17
+ <entryRelationship typeCode="REFR">
18
+ <procedure classCode="PROC" moodCode="EVN">
19
+ <templateId root="2.16.840.1.113883.10.20.24.3.89"/>
20
+ <code code="34896006"
21
+ codeSystem="2.16.840.1.113883.6.96"
22
+ codeSystemName="SNOMED CT"
23
+ displayName="incision"/>
24
+ <effectiveTime <%= value_or_null_flavor(entry.incision_time) %>/>
25
+ </procedure>
26
+ </entryRelationship>
27
+ <% end -%>
28
+ </procedure>
29
+ </entry>
@@ -0,0 +1,34 @@
1
+ <entry>
2
+ <procedure classCode="PROC" moodCode="EVN">
3
+ <!-- Consolidated Procedure Activity Procedure TemplateId
4
+ (Implied Template) -->
5
+ <templateId root="2.16.840.1.113883.10.20.22.4.14"/>
6
+ <!-- QRDA Procedure, Result TemplateId -->
7
+ <templateId root="2.16.840.1.113883.10.20.24.3.66"/>
8
+ <id root="<%= entry.id %>"/>
9
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'CPT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
10
+ <text><%= entry.description %></text>
11
+ <statusCode code="completed"/>
12
+ <effectiveTime>
13
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
14
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
15
+ </effectiveTime>
16
+ <% if entry.respond_to?(:ordinality_code) && entry.ordinality_code.present? -%>
17
+ <!-- Attribute: ordinality -->
18
+ <priorityCode code="<%= entry.ordinality_code['code'] %>" codeSystem="<%= entry.ordinality_code['code'] %>"/>
19
+ <% end -%>
20
+ <entryRelationship typeCode="REFR">
21
+ <observation classCode="OBS" moodCode="EVN">
22
+ <!-- Result Observation template (consolidation) -->
23
+ <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
24
+ <!-- Result template -->
25
+ <templateId root="2.16.840.1.113883.10.20.24.3.87"/>
26
+ <id root="<%= UUID.generate %>"/>
27
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'CPT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
28
+ <statusCode code="completed"/>
29
+ <effectiveTime <%= value_or_null_flavor(entry.start_time) %>/>
30
+ <%== render(:partial => 'result_value', :locals => {:entry => entry}) %>
31
+ </observation>
32
+ </entryRelationship>
33
+ </procedure>
34
+ </entry>
@@ -0,0 +1,23 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Consolidation Assessment Scale Observation templateId -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.69"/>
5
+ <!-- Risk Category Assessment -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.69"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ <statusCode code="completed"/>
10
+
11
+ <effectiveTime>
12
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
13
+ </effectiveTime>
14
+
15
+ <% ev = entry.values.first
16
+ if ev.present? && ev.respond_to?(:scalar) -%>
17
+ <value xsi:type="INT" value="<%= ev.scalar %>"/>
18
+ <% else -%>
19
+ <value nullFlavor="UNK"/>
20
+ <% end -%>
21
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
22
+ </observation>
23
+ </entry>
@@ -0,0 +1,29 @@
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"/>
5
+ <!-- Device Applied -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.7"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <code code="360030002" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="application of device"/>
9
+ <text>Device, Applied</text>
10
+ <statusCode code="completed"/>
11
+
12
+ <effectiveTime>
13
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
14
+ </effectiveTime>
15
+
16
+ <% if entry.respond_to?(:anatomical_structure) && entry.anatomical_structure.present? -%>
17
+ <targetSiteCode code="<%= entry.anatomical_structure['code'] %>"
18
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.anatomical_structure['codeSystem']) %>"/>
19
+ <% end -%>
20
+ <participant typeCode="DEV">
21
+ <participantRole classCode="MANU">
22
+ <playingDevice classCode="DEV">
23
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-PCS', 'ICD-10-PCS', 'CPT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
24
+ </playingDevice>
25
+ </participantRole>
26
+ </participant>
27
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
28
+ </procedure>
29
+ </entry>
@@ -0,0 +1,32 @@
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
+ <!-- Symptom, active template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.76"/>
7
+ <id root="<%= entry.id %>"/>
8
+ <code code="418799008" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Symptom"/>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="completed"/>
11
+ <%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT'], 'tag_name' => 'value', 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
12
+
13
+ <effectiveTime>
14
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
15
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
16
+ </effectiveTime>
17
+
18
+ <!-- Status -->
19
+ <entryRelationship typeCode="REFR">
20
+ <observation classCode="OBS" moodCode="EVN">
21
+ <!-- Problem Status (consolidation) template -->
22
+ <templateId root="2.16.840.1.113883.10.20.22.4.6"/>
23
+ <!-- Problem Status, Active template -->
24
+ <templateId root="2.16.840.1.113883.10.20.24.3.94"/>
25
+ <id root="<%= UUID.generate %>"/>
26
+ <code code="33999-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="status"/>
27
+ <statusCode code="completed"/>
28
+ <value code="55561003" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="active" xsi:type="CD"/>
29
+ </observation>
30
+ </entryRelationship>
31
+ </observation>
32
+ </entry>
@@ -0,0 +1,68 @@
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>NQF eMeasure Number</th>
23
+ <th>Version specific identifier</th>
24
+ </tr>
25
+ </thead>
26
+ <tbody>
27
+ <% measures.each do |measure| -%>
28
+ <tr>
29
+ <td><%= measure.title %></td>
30
+ <td><%= measure.hqmf_set_id %></td>
31
+ <td><%= measure.hqmf_version_number %></td>
32
+ <td><%= measure.id %></td>
33
+ <td><%= measure.hqmf_id %></td>
34
+ <td></td>
35
+ </tr>
36
+ <% end -%>
37
+ </tbody>
38
+ </table>
39
+ </text>
40
+ <!-- 1..* Organizers, each containing a reference to an eMeasure -->
41
+ <% measures.each do |measure| -%>
42
+ <entry>
43
+ <organizer classCode="CLUSTER" moodCode="EVN">
44
+ <!-- This is the templateId for Measure Reference -->
45
+ <templateId root="2.16.840.1.113883.10.20.24.3.98"/>
46
+ <!-- This is the templateId for eMeasure Reference QDM -->
47
+ <templateId root="2.16.840.1.113883.10.20.24.3.97"/>
48
+ <statusCode code="completed"/>
49
+ <!-- Containing isBranch external references -->
50
+ <reference typeCode="REFR">
51
+ <externalDocument classCode="DOC" moodCode="EVN">
52
+ <!-- SHALL: This is the version specific identifier for eMeasure: QualityMeasureDocument/id it is a GUID-->
53
+ <id root="<%= measure.hqmf_id %>"/>
54
+ <!-- SHOULD: This is the NQF Number, root is an NQF OID and for eMeasure Number and extension is the eMeasure's NQF number -->
55
+ <id root="2.16.840.1.113883.3.560.1" extension="<%= measure.id %>"/>
56
+ <!-- SHOULD This is the title of the eMeasure -->
57
+ <text><%= measure.title %></text>
58
+ <!-- SHOULD: setId is the eMeasure version neutral id -->
59
+ <setId root="<%= measure.hqmf_set_id %>"/>
60
+ <!-- This is the sequential eMeasure Version number -->
61
+ <versionNumber value="<%= measure.hqmf_version_number %>"/>
62
+ </externalDocument>
63
+ </reference>
64
+ </organizer>
65
+ </entry>
66
+ <% end -%>
67
+ </section>
68
+ </component>
@@ -0,0 +1,4 @@
1
+ <% if entry.respond_to?(:ordinality) && entry.ordinality.present? -%>
2
+ <priorityCode code="<%= entry.ordinality['code'] %>"
3
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.ordinality['codeSystem']) %>"/>
4
+ <% end -%>
@@ -0,0 +1,14 @@
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"/>
7
+ <code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
8
+ <title>Patient Data</title>
9
+ <text>
10
+
11
+ </text>
12
+ <%== render_patient_data(patient, measures) %>
13
+ </section>
14
+ </component>
@@ -0,0 +1,16 @@
1
+ <% if entry.negation_reason.present? -%>
2
+ <entryRelationship typeCode="RSON">
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.88"/>
5
+ <code code="410666004"
6
+ codeSystem="2.16.840.1.113883.6.96"
7
+ displayName="reason"
8
+ codeSystemName="SNOMED CT"/>
9
+ <statusCode code="completed"/>
10
+ <effectiveTime <%= value_or_null_flavor(entry.start_time) %>/>
11
+ <value xsi:type="CD"
12
+ code="<%= entry.negation_reason['code'] %>"
13
+ codeSystem="<%= entry.negation_reason['codeSystem'] %>"/>
14
+ </observation>
15
+ </entryRelationship>
16
+ <% end -%>
@@ -0,0 +1,39 @@
1
+ <recordTarget>
2
+ <patientRole>
3
+ <id root="Cypress" extension="<%= patient.id %>"/>
4
+ <!-- Fake Medicare HIC number -->
5
+ <id extension="12345" root="2.16.840.1.113883.4.572"/>
6
+ <addr use="HP">
7
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
8
+ <city>Bedford</city>
9
+ <state>MA</state>
10
+ <postalCode>01730</postalCode>
11
+ <country>US</country>
12
+ </addr>
13
+ <telecom use="WP" value="tel:+1-781-271-3000"/>
14
+ <patient>
15
+ <name>
16
+ <given><%= patient.first %></given>
17
+ <family><%= patient.last %></family>
18
+ </name>
19
+ <administrativeGenderCode code="<%= patient.gender %>" codeSystem="2.16.840.1.113883.5.1" codeSystemName="HL7 AdministrativeGender"/>
20
+ <birthTime value="<%= Time.at(patient.birthdate).utc.to_formatted_s(:number) %>"/>
21
+ <% if (patient.race) %>
22
+ <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"/>
23
+ <% end %>
24
+ <% if (patient.race) %>
25
+ <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"/>
26
+ <% end %>
27
+ <%
28
+ languages = patient.languages
29
+ languages = ["en-US"] if languages.nil? or languages.empty?
30
+ languages.each do |language|%>
31
+ <languageCommunication>
32
+ <templateId root="2.16.840.1.113883.3.88.11.83.2" assigningAuthorityName="HITSP/C83"/>
33
+ <templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.1" assigningAuthorityName="IHE/PCC"/>
34
+ <languageCode code="<%= language %>"/>
35
+ </languageCommunication>
36
+ <% end %>
37
+ </patient>
38
+ </patientRole>
39
+ </recordTarget>
@@ -0,0 +1,24 @@
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
+ <code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
6
+ <title>Reporting Parameters</title>
7
+ <text>
8
+ <list>
9
+ <item>Reporting period: <%= start_date.to_formatted_s(:long_ordinal) %> - <%= end_date.to_formatted_s(:long_ordinal) %></item>
10
+ </list>
11
+ </text>
12
+ <entry typeCode="DRIV">
13
+ <act classCode="ACT" moodCode="EVN">
14
+ <!-- This is the templateId for Reporting Parameteres Act -->
15
+ <templateId root="2.16.840.1.113883.10.20.17.3.8"/>
16
+ <code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
17
+ <effectiveTime>
18
+ <low value="<%= start_date.to_formatted_s(:number) %>"/>
19
+ <high value="<%= end_date.to_formatted_s(:number) %>"/>
20
+ </effectiveTime>
21
+ </act>
22
+ </entry>
23
+ </section>
24
+ </component>
@@ -0,0 +1,16 @@
1
+ <% ev = entry.values.first
2
+ if ev.present?
3
+ if ev.respond_to?(:codes) -%>
4
+ <%== code_display(ev, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'tag_name' => 'value', 'extra_content' => "xsi:type=\"CD\"") %>
5
+ <% elsif ev.respond_to?(:scalar) -%>
6
+ <% if is_num?(ev.scalar) -%>
7
+ <value xsi:type="PQ" value="<%= ev.scalar %>" <% if ev.units -%>unit="<%= ev.units %>"<% end -%>/>
8
+ <% elsif is_bool?(ev.scalar)%>
9
+ <value xsi:type="BL" value="<%= ev.scalar %>" />
10
+ <% else -%>
11
+ <value xsi:type="ST" ><%= ev.scalar %></value>
12
+ <% end
13
+ end
14
+ else -%>
15
+ <value xsi:type="CD" nullFlavor="UNK"/>
16
+ <% end -%>
@@ -0,0 +1,125 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <?xml-stylesheet type="text/xsl" href="cda.xsl"?>
3
+ <ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+ xmlns="urn:hl7-org:v3"
5
+ xmlns:voc="urn:hl7-org:v3/voc"
6
+ xmlns:sdtc="urn:hl7-org:sdtc">
7
+ <!-- QRDA Header -->
8
+ <realmCode code="US"/>
9
+ <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
10
+ <!-- US Realm Header Template Id -->
11
+ <templateId root="2.16.840.1.113883.10.20.22.1.1"/>
12
+ <!-- QRDA templateId -->
13
+ <templateId root="2.16.840.1.113883.10.20.24.1.1"/>
14
+ <!-- QDM-based QRDA templateId -->
15
+ <templateId root="2.16.840.1.113883.10.20.24.1.2"/>
16
+ <!-- This is the globally unique identifier for this QRDA document -->
17
+ <id root="5b010313-eff2-432c-9909-6193d8416fac"/>
18
+ <!-- QRDA document type code -->
19
+ <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
20
+ <title>QRDA Incidence Report</title>
21
+ <!-- This is the document creation time -->
22
+ <effectiveTime value="<%= Time.now.utc.to_formatted_s(:number) %>"/>
23
+ <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
24
+ <languageCode code="en-US"/>
25
+ <!-- reported patient -->
26
+ <%== render :partial => 'record_target', :locals => {:patient => patient} %>
27
+ <!-- Example of an author who is a device -->
28
+ <author>
29
+ <time value="<%= Time.now.utc.to_formatted_s(:number) %>"/>
30
+ <assignedAuthor>
31
+ <id extension="Cypress" root="2.16.840.1.113883.19.5"/>
32
+ <!-- NPI -->
33
+ <id extension="FakeNPI" root="2.16.840.1.113883.4.6"/>
34
+ <addr>
35
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
36
+ <city>Bedford</city>
37
+ <state>MA</state>
38
+ <postalCode>01730</postalCode>
39
+ <country>US</country>
40
+ </addr>
41
+ <telecom use="WP" value="tel:(781)271-3000"/>
42
+ <assignedAuthoringDevice>
43
+ <manufacturerModelName>Cypress</manufacturerModelName >
44
+ <softwareName>Cypress</softwareName >
45
+ </assignedAuthoringDevice >
46
+ </assignedAuthor>
47
+ </author>
48
+ <custodian>
49
+ <assignedCustodian>
50
+ <representedCustodianOrganization>
51
+ <id root="2.16.840.1.113883.19.5"/>
52
+ <name>Cypress Test Deck</name>
53
+ <telecom use="WP" value="tel:(781)271-3000"/>
54
+ <addr>
55
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
56
+ <city>Bedford</city>
57
+ <state>MA</state>
58
+ <postalCode>01730</postalCode>
59
+ <country>US</country>
60
+ </addr>
61
+ </representedCustodianOrganization>
62
+ </assignedCustodian>
63
+ </custodian>
64
+ <legalAuthenticator>
65
+ <time value="<%= Time.now.utc.to_formatted_s(:number) %>"/>
66
+ <signatureCode code="S"/>
67
+ <assignedEntity>
68
+ <id root="bc01a5d1-3a34-4286-82cc-43eb04c972a7"/>
69
+ <addr>
70
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
71
+ <city>Bedford</city>
72
+ <state>MA</state>
73
+ <postalCode>01730</postalCode>
74
+ <country>US</country>
75
+ </addr>
76
+ <telecom use="WP" value="tel:(781)271-3000"/>
77
+ <assignedPerson>
78
+ <name>
79
+ <given>Henry</given>
80
+ <family>Seven</family>
81
+ </name>
82
+ </assignedPerson>
83
+ <representedOrganization>
84
+ <id root="2.16.840.1.113883.19.5"/>
85
+ <name>Cypress</name>
86
+ </representedOrganization>
87
+ </assignedEntity>
88
+ </legalAuthenticator>
89
+
90
+ <!-- TODO: This is where the provider information will go.
91
+ It is currently hard coded, but should be replaced with the providers
92
+ and the time over which they are performing. -->
93
+ <documentationOf typeCode="DOC">
94
+ <serviceEvent classCode="PCPR"> <!-- care provision -->
95
+ <effectiveTime>
96
+ <low value="20100601"/>
97
+ <high value="20100915"/>
98
+ </effectiveTime>
99
+ <!-- You can include multiple performers, each with an NPI, TIN, CCN. -->
100
+ <performer typeCode="PRF">
101
+ <time>
102
+ <low value="20020716"/>
103
+ <high value="20070915"/>
104
+ </time>
105
+ <assignedEntity>
106
+ <!-- This is the provider NPI -->
107
+ <id root="2.16.840.1.113883.4.6" extension="111111111" />
108
+ <representedOrganization>
109
+ <!-- This is the organization TIN -->
110
+ <id root="2.16.840.1.113883.4.2" extension="1234567" />
111
+ <!-- This is the organization CCN -->
112
+ <id root="2.16.840.1.113883.4.336" extension="54321" />
113
+ </representedOrganization>
114
+ </assignedEntity>
115
+ </performer>
116
+ </serviceEvent>
117
+ </documentationOf>
118
+ <component>
119
+ <structuredBody>
120
+ <%== render :partial => 'measures', :locals => {:measures => measures} %>
121
+ <%== render :partial => 'reporting_parameters', :locals => {:start_date => start_date, :end_date => end_date} %>
122
+ <%== render :partial => 'patient_data', :locals => {:measures => measures, :patient => patient} %>
123
+ </structuredBody>
124
+ </component>
125
+ </ClinicalDocument>