cqm-reports 1.0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +33 -0
  3. data/README.md +27 -0
  4. data/Rakefile +16 -0
  5. data/lib/cqm_report.rb +77 -0
  6. data/lib/ext/code.rb +11 -0
  7. data/lib/ext/data_element.rb +24 -0
  8. data/lib/html-export/qdm-patient/_header_css.mustache +61 -0
  9. data/lib/html-export/qdm-patient/_javascript.mustache +52 -0
  10. data/lib/html-export/qdm-patient/data_element/_data_element.mustache +4 -0
  11. data/lib/html-export/qdm-patient/data_element/_data_element_codes.mustache +9 -0
  12. data/lib/html-export/qdm-patient/data_element/_data_element_other_fields.mustache +106 -0
  13. data/lib/html-export/qdm-patient/data_element/_data_element_times.mustache +44 -0
  14. data/lib/html-export/qdm-patient/qdm_patient.mustache +73 -0
  15. data/lib/html-export/qdm-patient/qdm_patient.rb +47 -0
  16. data/lib/qrda-export/catI-r5/_code.mustache +1 -0
  17. data/lib/qrda-export/catI-r5/_codes.mustache +10 -0
  18. data/lib/qrda-export/catI-r5/_header.mustache +28 -0
  19. data/lib/qrda-export/catI-r5/_measure_section.mustache +59 -0
  20. data/lib/qrda-export/catI-r5/_reporting_period.mustache +23 -0
  21. data/lib/qrda-export/catI-r5/qrda1_r5.mustache +209 -0
  22. data/lib/qrda-export/catI-r5/qrda1_r5.rb +220 -0
  23. data/lib/qrda-export/catI-r5/qrda_header/_author.mustache +26 -0
  24. data/lib/qrda-export/catI-r5/qrda_header/_custodian.mustache +43 -0
  25. data/lib/qrda-export/catI-r5/qrda_header/_documentation_of_service_event.mustache +88 -0
  26. data/lib/qrda-export/catI-r5/qrda_header/_information_recipient.mustache +7 -0
  27. data/lib/qrda-export/catI-r5/qrda_header/_legal_authenticator.mustache +25 -0
  28. data/lib/qrda-export/catI-r5/qrda_header/_participant.mustache +7 -0
  29. data/lib/qrda-export/catI-r5/qrda_header/_record_target.mustache +44 -0
  30. data/lib/qrda-export/catI-r5/qrda_templates/adverse_event.mustache +40 -0
  31. data/lib/qrda-export/catI-r5/qrda_templates/allergy_intolerance.mustache +42 -0
  32. data/lib/qrda-export/catI-r5/qrda_templates/assessment_order.mustache +25 -0
  33. data/lib/qrda-export/catI-r5/qrda_templates/assessment_performed.mustache +38 -0
  34. data/lib/qrda-export/catI-r5/qrda_templates/assessment_recommended.mustache +25 -0
  35. data/lib/qrda-export/catI-r5/qrda_templates/communication_performed.mustache +62 -0
  36. data/lib/qrda-export/catI-r5/qrda_templates/device_applied.mustache +41 -0
  37. data/lib/qrda-export/catI-r5/qrda_templates/device_order.mustache +38 -0
  38. data/lib/qrda-export/catI-r5/qrda_templates/device_recommended.mustache +37 -0
  39. data/lib/qrda-export/catI-r5/qrda_templates/diagnosis.mustache +55 -0
  40. data/lib/qrda-export/catI-r5/qrda_templates/diagnostic_study_order.mustache +25 -0
  41. data/lib/qrda-export/catI-r5/qrda_templates/diagnostic_study_performed.mustache +50 -0
  42. data/lib/qrda-export/catI-r5/qrda_templates/diagnostic_study_recommended.mustache +21 -0
  43. data/lib/qrda-export/catI-r5/qrda_templates/encounter_order.mustache +35 -0
  44. data/lib/qrda-export/catI-r5/qrda_templates/encounter_performed.mustache +52 -0
  45. data/lib/qrda-export/catI-r5/qrda_templates/encounter_recommended.mustache +37 -0
  46. data/lib/qrda-export/catI-r5/qrda_templates/family_history.mustache +37 -0
  47. data/lib/qrda-export/catI-r5/qrda_templates/immunization_administered.mustache +35 -0
  48. data/lib/qrda-export/catI-r5/qrda_templates/immunization_order.mustache +46 -0
  49. data/lib/qrda-export/catI-r5/qrda_templates/intervention_order.mustache +24 -0
  50. data/lib/qrda-export/catI-r5/qrda_templates/intervention_performed.mustache +36 -0
  51. data/lib/qrda-export/catI-r5/qrda_templates/intervention_recommended.mustache +25 -0
  52. data/lib/qrda-export/catI-r5/qrda_templates/laboratory_test_order.mustache +24 -0
  53. data/lib/qrda-export/catI-r5/qrda_templates/laboratory_test_performed.mustache +42 -0
  54. data/lib/qrda-export/catI-r5/qrda_templates/laboratory_test_recommended.mustache +25 -0
  55. data/lib/qrda-export/catI-r5/qrda_templates/medication_active.mustache +32 -0
  56. data/lib/qrda-export/catI-r5/qrda_templates/medication_administered.mustache +39 -0
  57. data/lib/qrda-export/catI-r5/qrda_templates/medication_discharge.mustache +63 -0
  58. data/lib/qrda-export/catI-r5/qrda_templates/medication_dispensed.mustache +70 -0
  59. data/lib/qrda-export/catI-r5/qrda_templates/medication_order.mustache +64 -0
  60. data/lib/qrda-export/catI-r5/qrda_templates/patient_care_experience.mustache +14 -0
  61. data/lib/qrda-export/catI-r5/qrda_templates/patient_characteristic_clinical_trial_participant.mustache +18 -0
  62. data/lib/qrda-export/catI-r5/qrda_templates/patient_characteristic_expired.mustache +32 -0
  63. data/lib/qrda-export/catI-r5/qrda_templates/patient_characteristic_payer.mustache +14 -0
  64. data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_order.mustache +30 -0
  65. data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_performed.mustache +45 -0
  66. data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_recommended.mustache +30 -0
  67. data/lib/qrda-export/catI-r5/qrda_templates/procedure_order.mustache +32 -0
  68. data/lib/qrda-export/catI-r5/qrda_templates/procedure_performed.mustache +64 -0
  69. data/lib/qrda-export/catI-r5/qrda_templates/procedure_recommended.mustache +34 -0
  70. data/lib/qrda-export/catI-r5/qrda_templates/provider_care_experience.mustache +15 -0
  71. data/lib/qrda-export/catI-r5/qrda_templates/provider_characteristic.mustache +15 -0
  72. data/lib/qrda-export/catI-r5/qrda_templates/substance_recommended.mustache +35 -0
  73. data/lib/qrda-export/catI-r5/qrda_templates/symptom.mustache +48 -0
  74. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_admission_source.mustache +6 -0
  75. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_anatomical_location_site.mustache +1 -0
  76. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_author.mustache +29 -0
  77. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_author_participation.mustache +8 -0
  78. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_component.mustache +13 -0
  79. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_data_element_codes_as_values.mustache +10 -0
  80. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_days_supplied.mustache +6 -0
  81. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_encounter_diagnosis.mustache +21 -0
  82. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_facility_location.mustache +24 -0
  83. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_immunization_details.mustache +14 -0
  84. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_details.mustache +36 -0
  85. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_supply_request.mustache +17 -0
  86. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_method.mustache +1 -0
  87. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_ordinality.mustache +1 -0
  88. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_principal_diagnosis.mustache +8 -0
  89. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_reaction_observation.mustache +9 -0
  90. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_reason.mustache +12 -0
  91. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_related_to.mustache +6 -0
  92. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_results.mustache +24 -0
  93. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_severity.mustache +8 -0
  94. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_status.mustache +8 -0
  95. data/lib/qrda-export/catIII-r2-1/_continuous_variable_value.mustache +17 -0
  96. data/lib/qrda-export/catIII-r2-1/_header.mustache +25 -0
  97. data/lib/qrda-export/catIII-r2-1/_measure_data.mustache +41 -0
  98. data/lib/qrda-export/catIII-r2-1/_measure_section.mustache +74 -0
  99. data/lib/qrda-export/catIII-r2-1/_reporting_period.mustache +23 -0
  100. data/lib/qrda-export/catIII-r2-1/_stratification.mustache +29 -0
  101. data/lib/qrda-export/catIII-r2-1/_supplemental_data.mustache +28 -0
  102. data/lib/qrda-export/catIII-r2-1/qrda3_r21.mustache +11 -0
  103. data/lib/qrda-export/catIII-r2-1/qrda3_r21.rb +127 -0
  104. data/lib/qrda-export/catIII-r2-1/qrda_header/_author.mustache +25 -0
  105. data/lib/qrda-export/catIII-r2-1/qrda_header/_custodian.mustache +17 -0
  106. data/lib/qrda-export/catIII-r2-1/qrda_header/_documentation_of_service_event.mustache +88 -0
  107. data/lib/qrda-export/catIII-r2-1/qrda_header/_legal_authenticator.mustache +25 -0
  108. data/lib/qrda-export/helper/aggregate_object_helper.rb +154 -0
  109. data/lib/qrda-export/helper/cat1_view_helper.rb +81 -0
  110. data/lib/qrda-export/helper/date_helper.rb +108 -0
  111. data/lib/qrda-export/helper/frequency_helper.rb +83 -0
  112. data/lib/qrda-export/helper/patient_view_helper.rb +46 -0
  113. data/lib/qrda-export/helper/view_helper.rb +28 -0
  114. data/lib/qrda-import/base-importers/demographics_importer.rb +38 -0
  115. data/lib/qrda-import/base-importers/section_importer.rb +237 -0
  116. data/lib/qrda-import/cda_identifier.rb +20 -0
  117. data/lib/qrda-import/data-element-importers/adverse_event_importer.rb +26 -0
  118. data/lib/qrda-import/data-element-importers/allergy_intolerance_importer.rb +24 -0
  119. data/lib/qrda-import/data-element-importers/assessment_order_importer.rb +19 -0
  120. data/lib/qrda-import/data-element-importers/assessment_performed_importer.rb +24 -0
  121. data/lib/qrda-import/data-element-importers/assessment_recommended_importer.rb +19 -0
  122. data/lib/qrda-import/data-element-importers/communication_performed_importer.rb +30 -0
  123. data/lib/qrda-import/data-element-importers/device_applied_importer.rb +22 -0
  124. data/lib/qrda-import/data-element-importers/device_order_importer.rb +19 -0
  125. data/lib/qrda-import/data-element-importers/device_recommended_importer.rb +19 -0
  126. data/lib/qrda-import/data-element-importers/diagnosis_importer.rb +24 -0
  127. data/lib/qrda-import/data-element-importers/diagnostic_study_order_importer.rb +19 -0
  128. data/lib/qrda-import/data-element-importers/diagnostic_study_performed_importer.rb +32 -0
  129. data/lib/qrda-import/data-element-importers/diagnostic_study_recommended_importer.rb +19 -0
  130. data/lib/qrda-import/data-element-importers/encounter_order_importer.rb +21 -0
  131. data/lib/qrda-import/data-element-importers/encounter_performed_importer.rb +46 -0
  132. data/lib/qrda-import/data-element-importers/encounter_recommended_importer.rb +21 -0
  133. data/lib/qrda-import/data-element-importers/family_history_importer.rb +21 -0
  134. data/lib/qrda-import/data-element-importers/immunization_administered_importer.rb +23 -0
  135. data/lib/qrda-import/data-element-importers/immunization_order_importer.rb +27 -0
  136. data/lib/qrda-import/data-element-importers/intervention_order_importer.rb +19 -0
  137. data/lib/qrda-import/data-element-importers/intervention_performed_importer.rb +23 -0
  138. data/lib/qrda-import/data-element-importers/intervention_recommended_importer.rb +19 -0
  139. data/lib/qrda-import/data-element-importers/laboratory_test_order_importer.rb +19 -0
  140. data/lib/qrda-import/data-element-importers/laboratory_test_performed_importer.rb +29 -0
  141. data/lib/qrda-import/data-element-importers/laboratory_test_recommended_importer.rb +19 -0
  142. data/lib/qrda-import/data-element-importers/medication_active_importer.rb +25 -0
  143. data/lib/qrda-import/data-element-importers/medication_administered_importer.rb +26 -0
  144. data/lib/qrda-import/data-element-importers/medication_discharge_importer.rb +32 -0
  145. data/lib/qrda-import/data-element-importers/medication_dispensed_importer.rb +37 -0
  146. data/lib/qrda-import/data-element-importers/medication_order_importer.rb +36 -0
  147. data/lib/qrda-import/data-element-importers/patient_care_experience_importer.rb +19 -0
  148. data/lib/qrda-import/data-element-importers/patient_characteristic_clinical_trial_participant_importer.rb +19 -0
  149. data/lib/qrda-import/data-element-importers/patient_characteristic_expired_importer.rb +22 -0
  150. data/lib/qrda-import/data-element-importers/patient_characteristic_payer_importer.rb +19 -0
  151. data/lib/qrda-import/data-element-importers/physical_exam_order_importer.rb +21 -0
  152. data/lib/qrda-import/data-element-importers/physical_exam_performed_importer.rb +27 -0
  153. data/lib/qrda-import/data-element-importers/physical_exam_recommended_importer.rb +21 -0
  154. data/lib/qrda-import/data-element-importers/procedure_order_importer.rb +23 -0
  155. data/lib/qrda-import/data-element-importers/procedure_performed_importer.rb +33 -0
  156. data/lib/qrda-import/data-element-importers/procedure_recommended_importer.rb +23 -0
  157. data/lib/qrda-import/data-element-importers/provider_care_experience_importer.rb +19 -0
  158. data/lib/qrda-import/data-element-importers/provider_characteristic_importer.rb +19 -0
  159. data/lib/qrda-import/data-element-importers/substance_administered_importer.rb +27 -0
  160. data/lib/qrda-import/data-element-importers/substance_order_importer.rb +29 -0
  161. data/lib/qrda-import/data-element-importers/substance_recommended_importer.rb +27 -0
  162. data/lib/qrda-import/data-element-importers/symptom_importer.rb +21 -0
  163. data/lib/qrda-import/entry_finder.rb +20 -0
  164. data/lib/qrda-import/entry_package.rb +16 -0
  165. data/lib/qrda-import/narrative_reference_handler.rb +33 -0
  166. data/lib/qrda-import/patient_importer.rb +128 -0
  167. data/lib/util/code_system_helper.rb +77 -0
  168. data/lib/util/hqmf_template_helper.rb +52 -0
  169. data/lib/util/hqmf_template_oid_map.json +654 -0
  170. data/lib/util/hqmfr2_template_oid_map.json +378 -0
  171. data/lib/util/hqmfr2cql_template_oid_map.json +390 -0
  172. data/lib/util/qrda_template_helper.rb +20 -0
  173. data/lib/util/qrdar5_1_template_oid_map.json +406 -0
  174. data/lib/util/qrdar5_template_oid_map.json +406 -0
  175. metadata +344 -0
@@ -0,0 +1,14 @@
1
+ {{#route}}
2
+ <!-- QDM Attribute: Route -->
3
+ <routeCode {{> _code}}/>
4
+ {{/route}}
5
+ {{#negated}}
6
+ <!-- QDM Attribute: Dosage -->
7
+ <doseQuantity nullFlavor="NA"/>
8
+ {{/negated}}
9
+ {{^negated}}
10
+ {{#dosage}}
11
+ <!-- QDM Attribute: Dosage -->
12
+ <doseQuantity value="{{value}}" unit="{{unit}}"/>
13
+ {{/dosage}}
14
+ {{/negated}}
@@ -0,0 +1,36 @@
1
+ {{#negated}}
2
+ <!-- QDM Attribute: Frequency -->
3
+ <effectiveTime xsi:type="PIVL_TS" institutionSpecified="true" operator="A">
4
+ <period nullFlavor="NA"/>
5
+ </effectiveTime>
6
+ {{/negated}}
7
+ {{^negated}}
8
+ {{#frequency}}
9
+ <!-- QDM Attribute: Frequency -->
10
+ {{{medication_frequency}}}
11
+ {{/frequency}}
12
+ {{/negated}}
13
+ {{#negated}}
14
+ <!-- QDM Attribute: Refills -->
15
+ <repeatNumber nullFlavor="NA"/>
16
+ {{/negated}}
17
+ {{^negated}}
18
+ {{#refills}}
19
+ <!-- QDM Attribute: Refills -->
20
+ <repeatNumber value="{{.}}"/>
21
+ {{/refills}}
22
+ {{/negated}}
23
+ {{#route}}
24
+ <!-- QDM Attribute: Route -->
25
+ <routeCode {{> _code}}/>
26
+ {{/route}}
27
+ {{#negated}}
28
+ <!-- QDM Attribute: Dosage -->
29
+ <doseQuantity nullFlavor="NA"/>
30
+ {{/negated}}
31
+ {{^negated}}
32
+ {{#dosage}}
33
+ <!-- QDM Attribute: Dosage -->
34
+ <doseQuantity value="{{value}}" unit="{{unit}}"/>
35
+ {{/dosage}}
36
+ {{/negated}}
@@ -0,0 +1,17 @@
1
+ <supply classCode="SPLY" moodCode="RQO">
2
+ <!-- Medication Supply Request (V2) template -->
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.99" extension="2014-04-05"/>
4
+ <!-- Conforms to C-CDA R2 Planned Supply (V2) template-->
5
+ <templateId root="2.16.840.1.113883.10.20.22.4.43" extension="2014-06-09" />
6
+ <id root="{{random_id}}"/>
7
+ <statusCode code="active"/>
8
+ {{#relevantPeriod}}
9
+ {{{medication_supply_request_period}}}
10
+ {{/relevantPeriod}}
11
+ {{^relevantPeriod}}
12
+ {{#authorDatetime}}
13
+ {{{author_effective_time}}}
14
+ {{/authorDatetime}}
15
+ {{/relevantPeriod}}
16
+ <quantity value="{{value}}"/>
17
+ </supply>
@@ -0,0 +1 @@
1
+ <methodCode {{> _code}}/>
@@ -0,0 +1 @@
1
+ <priorityCode {{> _code}}/>
@@ -0,0 +1,8 @@
1
+ <entryRelationship typeCode="REFR">
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.152" extension="2017-08-01"/>
4
+ <id root="{{random_id}}"/>
5
+ <code code="8319008" codeSystem="2.16.840.1.113883.6.96" displayName="Principal Diagnosis" codeSystemName="SNOMED"/>
6
+ <value {{> _code}} xsi:type="CD"/>
7
+ </observation>
8
+ </entryRelationship>
@@ -0,0 +1,9 @@
1
+ <entryRelationship typeCode="MFST" inversionInd="true">
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.22.4.9" extension="2014-06-09" />
4
+ <id root="4adc1020-7b14-11db-9fe1-0800200c9a64" />
5
+ <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4" />
6
+ <statusCode code="completed" />
7
+ {{> qrda_templates/template_partials/_data_element_codes_as_values}}
8
+ </observation>
9
+ </entryRelationship>
@@ -0,0 +1,12 @@
1
+ <entryRelationship typeCode="RSON">
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.88" extension="2017-08-01"/>
4
+ <id root="1.3.6.1.4.1.115" extension="{{random_id}}" />
5
+ <code code="77301-0" codeSystem="2.16.840.1.113883.6.1" displayName="reason" codeSystemName="LOINC"/>
6
+ <statusCode code="completed"/>
7
+ {{#relevantPeriod}}
8
+ {{{relevant_period}}}
9
+ {{/relevantPeriod}}
10
+ <value {{> _code}} xsi:type="CD"/>
11
+ </observation>
12
+ </entryRelationship>
@@ -0,0 +1,6 @@
1
+ <sdtc:inFulfillmentOf1 typeCode="FLFS">
2
+ <sdtc:templateId root="2.16.840.1.113883.10.20.24.3.150" extension="2017-08-01"/>
3
+ <sdtc:actReference classCode="ACT" moodCode="EVN">
4
+ <sdtc:id root="1.3.6.1.4.1.115" extension="{{{as_id}}}"/>
5
+ </sdtc:actReference>
6
+ </sdtc:inFulfillmentOf1>
@@ -0,0 +1,24 @@
1
+ <entryRelationship typeCode="REFR">
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- Conforms to C-CDA R2 Result Observation (V2) -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.2" extension="2015-08-01"/>
5
+ <id root="1.3.6.1.4.1.115" extension="{{random_id}}"/>
6
+ {{> _codes}}
7
+ <statusCode code="completed"/>
8
+ {{#resultDatetime}}
9
+ {{{result_date_time}}}
10
+ {{/resultDatetime}}
11
+ {{^resultDatetime}}
12
+ {{#relevantPeriod}}
13
+ {{{relevant_period_as_value}}}
14
+ {{/relevantPeriod}}
15
+ {{^relevantPeriod}}
16
+ {{#authorDatetime}}
17
+ {{{author_effective_time}}}
18
+ {{/authorDatetime}}
19
+ {{/relevantPeriod}}
20
+ {{/resultDatetime}}
21
+ {{{result_value}}}
22
+ </observation>
23
+ </entryRelationship>
24
+
@@ -0,0 +1,8 @@
1
+ <entryRelationship typeCode="REFR">
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.22.4.8" extension="2014-06-09" />
4
+ <code code="SEV" codeSystem="2.16.840.1.113883.5.4" />
5
+ <statusCode code="completed" />
6
+ <value xsi:type="CD" {{> _code}}/>
7
+ </observation>
8
+ </entryRelationship>
@@ -0,0 +1,8 @@
1
+ <entryRelationship typeCode="REFR">
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.93"/>
4
+ <id root="1.3.6.1.4.1.115" extension="{{random_id}}"/>
5
+ <code code="33999-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Status"/>
6
+ <value xsi:type="CD" {{> _code}}/>
7
+ </observation>
8
+ </entryRelationship>
@@ -0,0 +1,17 @@
1
+ <entryRelationship typeCode="COMP">
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.27.3.2"/>
4
+ <code nullFlavor="OTH">
5
+ <originalText>Time Difference</originalText>
6
+ </code>
7
+ <statusCode code="completed"/>
8
+ <value xsi:type="PQ" value="{{value}}" unit="min"/>
9
+ <methodCode code="MEDIAN" displayName="Median" codeSystem="2.16.840.1.113883.5.84" codeSystemName="ObservationMethod"/>
10
+ <reference typeCode="REFR">
11
+ <!-- reference to the relevant measure observation in the eMeasure -->
12
+ <externalObservation classCode="OBS" moodCode="EVN">
13
+ <id root="{{id}}"/>
14
+ </externalObservation>
15
+ </reference>
16
+ </observation>
17
+ </entryRelationship>
@@ -0,0 +1,25 @@
1
+ <!-- QRDA Header -->
2
+ <realmCode code="US"/>
3
+ <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
4
+ <!-- US Realm Header Template Id -->
5
+ <templateId root="2.16.840.1.113883.10.20.27.1.1" extension="2017-06-01"/>
6
+ <!-- This is the globally unique identifier for this QRDA document -->
7
+ <id root="{{random_id}}"/>
8
+ <!-- QRDA III document type code -->
9
+ <code code="55184-6" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Reporting Document Architecture Calculated Summary Report"/>
10
+ <title>QRDA Calculated Summary Report</title>
11
+ <!-- This is the document creation time -->
12
+ <effectiveTime value="{{current_time}}"/>
13
+ <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
14
+ <languageCode code="en"/>
15
+ <versionNumber value="1"/>
16
+ <!-- reported patient -->
17
+ <recordTarget>
18
+ <patientRole>
19
+ <id nullFlavor="NA"/>
20
+ </patientRole>
21
+ </recordTarget>
22
+ {{> qrda_header/_author}}
23
+ {{> qrda_header/_custodian}}
24
+ {{> qrda_header/_legal_authenticator}}
25
+ {{> qrda_header/_documentation_of_service_event}}
@@ -0,0 +1,41 @@
1
+ {{#populations}}
2
+ {{#not_observ?}}
3
+ <component>
4
+ <!-- MEASURE DATA REPORTING FOR <%= population.type %> <%= population.id %> -->
5
+ <observation classCode="OBS" moodCode="EVN">
6
+ <!-- Measure Data template -->
7
+ <templateId root="2.16.840.1.113883.10.20.27.3.5" extension="2016-09-01"/>
8
+ <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4" displayName="Assertion" codeSystemName="ActCode"/>
9
+ <statusCode code="completed"/>
10
+ <value xsi:type="CD" code="{{population_type}}" codeSystem="2.16.840.1.113883.5.4" codeSystemName="ActCode"/>
11
+ <!-- Aggregate Count -->
12
+ <entryRelationship typeCode="SUBJ" inversionInd="true">
13
+ <observation classCode="OBS" moodCode="EVN">
14
+ <templateId root="2.16.840.1.113883.10.20.27.3.3"/>
15
+ <code code="MSRAGG" displayName="rate aggregation" codeSystem="2.16.840.1.113883.5.4" codeSystemName="ActCode"/>
16
+ <value xsi:type="INT" value="{{population_value}}"/>
17
+ <methodCode code="COUNT" displayName="Count" codeSystem="2.16.840.1.113883.5.84" codeSystemName="ObservationMethod"/>
18
+ </observation>
19
+ </entryRelationship>
20
+ {{#stratifications}}
21
+ {{> _stratification}}
22
+ {{/stratifications}}
23
+ {{#supplemental_data}}
24
+ {{#population_supplemental_data}}
25
+ {{> _supplemental_data}}
26
+ {{/population_supplemental_data}}
27
+ {{/supplemental_data}}
28
+ {{#msrpopl?}}
29
+ {{#population_observation}}
30
+ {{> _continuous_variable_value}}
31
+ {{/population_observation}}
32
+ {{/msrpopl?}}
33
+ <reference typeCode="REFR">
34
+ <externalObservation classCode="OBS" moodCode="EVN">
35
+ <id root="{{id}}"/>
36
+ </externalObservation>
37
+ </reference>
38
+ </observation>
39
+ </component>
40
+ {{/not_observ?}}
41
+ {{/populations}}
@@ -0,0 +1,74 @@
1
+ <component>
2
+ <section>
3
+ <!--
4
+ *****************************************************************
5
+ Measure Section
6
+ *****************************************************************
7
+ -->
8
+ <!-- Implied template Measure Section templateId -->
9
+ <templateId root="2.16.840.1.113883.10.20.24.2.2"/>
10
+ <!-- In this case the query is using an eMeasure -->
11
+ <!-- QRDA Category III Measure Section template -->
12
+ <templateId extension="2017-06-01" root="2.16.840.1.113883.10.20.27.2.1"/>
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 specific identifier</th>
21
+ </tr>
22
+ </thead>
23
+ <tbody>
24
+ {{#measure_results}}
25
+ <tr>
26
+ <td>{{description}}</td>
27
+ <td>{{hqmf_id}}</td>
28
+ <td/>
29
+ </tr>
30
+ {{/measure_results}}
31
+ </tbody>
32
+ </table>
33
+ </text>
34
+ <!-- 1..* Organizers, each containing a reference to an eMeasure -->
35
+ {{#measure_results}}
36
+ <entry>
37
+ <organizer classCode="CLUSTER" moodCode="EVN">
38
+ <!-- Implied template Measure Reference templateId -->
39
+ <templateId root="2.16.840.1.113883.10.20.24.3.98"/>
40
+ <!-- SHALL 1..* (one for each referenced measure) Measure Reference and Results template -->
41
+ <templateId extension="2016-09-01" root="2.16.840.1.113883.10.20.27.3.1"/>
42
+ <id extension="{{random_id}}" root="1.3.6.1.4.1.115"/>
43
+ <statusCode code="completed"/>
44
+ <!-- Containing isBranch external references -->
45
+ <reference typeCode="REFR">
46
+ <externalDocument classCode="DOC" moodCode="EVN">
47
+ <!-- SHALL: This is the version specific identifier for eMeasure: QualityMeasureDocument/id it is a GUID-->
48
+ <id extension="{{hqmf_id}}" root="2.16.840.1.113883.4.738"/>
49
+ <!-- SHOULD This is the title of the eMeasure -->
50
+ <text>{{description}}</text>
51
+ <!-- SHOULD: setId is the eMeasure version neutral id -->
52
+ <setId root="{{hqmf_set_id}}"/>
53
+ </externalDocument>
54
+ </reference>
55
+ {{#aggregate_count}}
56
+ {{> _measure_data}}
57
+ {{/aggregate_count}}
58
+ </organizer>
59
+ </entry>
60
+ {{/measure_results}}
61
+ <entry>
62
+ <act classCode="ACT" moodCode="EVN">
63
+ <!-- This is the templateId for Reporting Parameteres Act -->
64
+ <templateId root="2.16.840.1.113883.10.20.17.3.8"/>
65
+ <id extension="{{random_id}}" root="1.3.6.1.4.1.115"/>
66
+ <code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
67
+ <effectiveTime>
68
+ <low value="{{{performance_period_start}}}"/>
69
+ <high value="{{{performance_period_end}}}"/>
70
+ </effectiveTime>
71
+ </act>
72
+ </entry>
73
+ </section>
74
+ </component>
@@ -0,0 +1,23 @@
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
+ <!-- This is the templateId for the QRDA III Reporting Parameters Section -->
6
+ <templateId root="2.16.840.1.113883.10.20.27.2.2"/>
7
+ <code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
8
+ <title>Reporting Parameters</title>
9
+ <text></text>
10
+ <entry typeCode="DRIV">
11
+ <act classCode="ACT" moodCode="EVN">
12
+ <!-- This is the templateId for Reporting Parameteres Act -->
13
+ <templateId root="2.16.840.1.113883.10.20.17.3.8"/>
14
+ <id extension="{{random_id}}" root="1.3.6.1.4.1.115"/>
15
+ <code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
16
+ <effectiveTime>
17
+ <low value="{{{performance_period_start}}}"/>
18
+ <high value="{{{performance_period_end}}}"/>
19
+ </effectiveTime>
20
+ </act>
21
+ </entry>
22
+ </section>
23
+ </component>
@@ -0,0 +1,29 @@
1
+ <!-- Stratification Reporting Template for <%= population.type %> <%= population.id %> Stratification <%= strat.id %> -->
2
+ <entryRelationship typeCode="COMP">
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <templateId root="2.16.840.1.113883.10.20.27.3.4"/>
5
+ <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4" displayName="Assertion" codeSystemName="ActCode"/>
6
+ <statusCode code="completed"/>
7
+ <value xsi:type="CD" nullFlavor="OTH">
8
+ <originalText>Stratum</originalText>
9
+ </value>
10
+ <entryRelationship typeCode="SUBJ" inversionInd="true">
11
+ <observation classCode="OBS" moodCode="EVN">
12
+ <templateId root="2.16.840.1.113883.10.20.27.3.3"/>
13
+ <code code="MSRAGG" displayName="rate aggregation" codeSystem="2.16.840.1.113883.5.4" codeSystemName="ActCode"/>
14
+ <value xsi:type="INT" value="{{population_value}}"/>
15
+ <methodCode code="COUNT" displayName="Count" codeSystem="2.16.840.1.113883.5.84" codeSystemName="ObservationMethod"/>
16
+ </observation>
17
+ </entryRelationship>
18
+ {{#msrpopl?}}
19
+ {{#stratification_observation}}
20
+ {{> _continuous_variable_value}}
21
+ {{/stratification_observation}}
22
+ {{/msrpopl?}}
23
+ <reference typeCode="REFR">
24
+ <externalObservation classCode="OBS" moodCode="EVN">
25
+ <id root="{{id}}"/>
26
+ </externalObservation>
27
+ </reference>
28
+ </observation>
29
+ </entryRelationship>
@@ -0,0 +1,28 @@
1
+ <entryRelationship typeCode="COMP">
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- {{type}} -->
4
+ {{#supplemental_template_ids}}
5
+ <templateId root="{{tid}}" extension="{{extension}}"/>
6
+ {{/supplemental_template_ids}}
7
+ <id nullFlavor="NA" />
8
+ {{#supplemental_data_code}}
9
+ <code code="{{supplemental_data_code}}" codeSystem="{{supplemental_data_code_system}}"/>
10
+ {{/supplemental_data_code}}
11
+ <statusCode code="completed"/>
12
+ {{#unknown_supplemental_value?}}
13
+ <value xsi:type="CD" nullFlavor="UNK" />
14
+ {{/unknown_supplemental_value?}}
15
+ {{^unknown_supplemental_value?}}
16
+ <value xsi:type="CD" code="{{code}}" codeSystem="{{supplemental_data_value_code_system}}"/>
17
+ {{/unknown_supplemental_value?}}
18
+ <entryRelationship typeCode="SUBJ" inversionInd="true">
19
+ <!-- Aggregate Count template -->
20
+ <observation classCode="OBS" moodCode="EVN">
21
+ <templateId root="2.16.840.1.113883.10.20.27.3.3"/>
22
+ <code code="MSRAGG" displayName="rate aggregation" codeSystem="2.16.840.1.113883.5.4" codeSystemName="ActCode"/>
23
+ <value xsi:type="INT" value="{{value}}"/>
24
+ <methodCode code="COUNT" displayName="Count" codeSystem="2.16.840.1.113883.5.84" codeSystemName="ObservationMethod"/>
25
+ </observation>
26
+ </entryRelationship>
27
+ </observation>
28
+ </entryRelationship>
@@ -0,0 +1,11 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <ClinicalDocument xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:hl7-org:v3" xmlns:voc="urn:hl7-org:v3/voc">
3
+
4
+ {{> _header}}
5
+ <component>
6
+ <structuredBody>
7
+ {{> _reporting_period}}
8
+ {{> _measure_section}}
9
+ </structuredBody>
10
+ </component>
11
+ </ClinicalDocument>
@@ -0,0 +1,127 @@
1
+ require 'mustache'
2
+ class Qrda3R21 < Mustache
3
+ include Qrda::Export::Helper::DateHelper
4
+ include Qrda::Export::Helper::ViewHelper
5
+ include Qrda::Export::Helper::PatientViewHelper
6
+
7
+ self.template_path = __dir__
8
+
9
+ def initialize(aggregate_results, measures, options = {})
10
+ @aggregate_results = aggregate_results
11
+ @measures = measures
12
+ @measure_result_hash = {}
13
+ @measures.each do |measure|
14
+ @measure_result_hash[measure.hqmf_id] = { population_sets: measure.population_sets, hqmf_id: measure.hqmf_id, hqmf_set_id: measure.hqmf_set_id, description: measure.description, measure_data: [], aggregate_count: [] }
15
+ end
16
+ @aggregate_results.each do |hqmf_id, measure_aggregate_result|
17
+ measure_aggregate_result.each do |_key, aggregate_result|
18
+ @measure_result_hash[hqmf_id].measure_data << aggregate_result
19
+ end
20
+ end
21
+ @measure_result_hash.each do |key, hash|
22
+ @measure_result_hash[key][:aggregate_count] = agg_results(key, hash.measure_data, hash.population_sets)
23
+ end
24
+ @provider = options[:provider]
25
+ @performance_period_start = options[:start_time]
26
+ @performance_period_end = options[:end_time]
27
+ @submission_program = options[:submission_program]
28
+ end
29
+
30
+ def agg_results(measure_id, cache_entries, population_sets)
31
+ aggregate_count = Qrda::Export::Helper::AggregateCount.new(measure_id)
32
+ cache_entries.each do |cache_entry|
33
+ aggregate_count.add_entry(cache_entry, population_sets)
34
+ end
35
+ aggregate_count
36
+ end
37
+
38
+ def measure_results
39
+ @measure_result_hash.values.as_json
40
+ end
41
+
42
+ def population_type
43
+ self['type'] == 'IPP' ? 'IPOP' : self['type']
44
+ end
45
+
46
+ def population_value
47
+ self['value'].round
48
+ end
49
+
50
+ def msrpopl?
51
+ self['type'] == 'MSRPOPL'
52
+ end
53
+
54
+ def not_observ?
55
+ self['type'] != 'OBSERV'
56
+ end
57
+
58
+ def stratification_observation
59
+ observation = @measure_result_hash[self['measure_id']].aggregate_count.populations.find {|p| p.type == "OBSERV"}
60
+ stratification_observation = @measure_result_hash[self['measure_id']].aggregate_count.populations.find {|p| p.type == "OBSERV"}.stratifications.find {|s| s.id == self['id'] }
61
+ stratification_observation.id = observation.id
62
+ stratification_observation
63
+ end
64
+
65
+ def population_observation
66
+ @measure_result_hash[self['measure_id']].aggregate_count.populations.find {|p| p.type == "OBSERV"}
67
+ end
68
+
69
+ def supplemental_template_ids
70
+ case self['type']
71
+ when 'RACE'
72
+ [{ tid: '2.16.840.1.113883.10.20.27.3.8', extension: '2016-09-01' }]
73
+ when 'ETHNICITY'
74
+ [{ tid: '2.16.840.1.113883.10.20.27.3.7', extension: '2016-09-01' }]
75
+ when 'SEX'
76
+ [{ tid: '2.16.840.1.113883.10.20.27.3.6', extension: '2016-09-01' }]
77
+ when 'PAYER'
78
+ [{ tid: '2.16.840.1.113883.10.20.27.3.9', extension: '2016-02-01' }]
79
+ end
80
+ end
81
+
82
+ def supplemental_data_code
83
+ case self['type']
84
+ when 'RACE'
85
+ [{ supplemental_data_code: '72826-1', supplemental_data_code_system: '2.16.840.1.113883.6.1' }]
86
+ when 'ETHNICITY'
87
+ [{ supplemental_data_code: '69490-1', supplemental_data_code_system: '2.16.840.1.113883.6.1' }]
88
+ when 'SEX'
89
+ [{ supplemental_data_code: '76689-9', supplemental_data_code_system: '2.16.840.1.113883.6.1' }]
90
+ when 'PAYER'
91
+ [{ supplemental_data_code: '48768-6', supplemental_data_code_system: '2.16.840.1.113883.6.1' }]
92
+ end
93
+ end
94
+
95
+ def supplemental_data_value_code_system
96
+ case self['type']
97
+ when 'RACE'
98
+ '2.16.840.1.113883.6.238'
99
+ when 'ETHNICITY'
100
+ '2.16.840.1.113883.6.238'
101
+ when 'SEX'
102
+ '2.16.840.1.113883.5.1'
103
+ when 'PAYER'
104
+ '2.16.840.1.113883.3.221.5'
105
+ end
106
+ end
107
+
108
+ def unknown_supplemental_value?
109
+ self['code'] == "" || self['code'] == "UNK"
110
+ end
111
+
112
+ def population_supplemental_data
113
+ reformat_supplemental_data(self['supplemental_data'])
114
+ end
115
+
116
+ def reformat_supplemental_data(supplemental_data)
117
+ supplemental_data_array = []
118
+ supplemental_data.each do |supplemental_data_key, counts|
119
+ counts.each do |key, value|
120
+ supplemental_data_count = { code: key, value: value, type: supplemental_data_key }
121
+ supplemental_data_array << supplemental_data_count
122
+ end
123
+ end
124
+ supplemental_data_array
125
+ end
126
+
127
+ end
@@ -0,0 +1,25 @@
1
+ <author>
2
+ <time value="{{current_time}}"/>
3
+ <assignedAuthor>
4
+ <!-- id extension="Cypress" root="2.16.840.1.113883.19.5"/ -->
5
+ <!-- NPI -->
6
+ <id extension="1982671962" root="2.16.840.1.113883.4.6"/>
7
+ <addr>
8
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
9
+ <city>Bedford</city>
10
+ <state>MA</state>
11
+ <postalCode>01730</postalCode>
12
+ <country>US</country>
13
+ </addr>
14
+ <telecom use="WP" value="tel:(781)271-3000"/>
15
+ <assignedAuthoringDevice>
16
+ <manufacturerModelName>Cypress</manufacturerModelName>
17
+ <softwareName>Cypress</softwareName>
18
+ </assignedAuthoringDevice>
19
+ <representedOrganization>
20
+ <!-- The organization id is optional, but the name is required -->
21
+ <id root="2.16.840.1.113883.19.5" extension="98765"/>
22
+ <name>Good Health Hospital</name>
23
+ </representedOrganization>
24
+ </assignedAuthor>
25
+ </author>
@@ -0,0 +1,17 @@
1
+ <custodian>
2
+ <assignedCustodian>
3
+ <representedCustodianOrganization>
4
+ <!-- HQR Only -->
5
+ <id extension="800890" root="2.16.840.1.113883.4.336"/>
6
+ <name>Cypress Test Deck</name>
7
+ <telecom use="WP" value="tel:(781)271-3000"/>
8
+ <addr>
9
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
10
+ <city>Bedford</city>
11
+ <state>MA</state>
12
+ <postalCode>01730</postalCode>
13
+ <country>US</country>
14
+ </addr>
15
+ </representedCustodianOrganization>
16
+ </assignedCustodian>
17
+ </custodian>