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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: faad9a8a2c63b2c26bd1ed689be3cea13a54bc520e9fbcf95a56550b2646a095
4
+ data.tar.gz: cb7867e3555e19a454dc918ef7f018672f177cf3b3eeeef124aff46723693c56
5
+ SHA512:
6
+ metadata.gz: 16ad11bbe2c9131f6977c8eac6b06150f6fb22f4a465364f40e65375e3271cbf241d4777b0ae3cad8fecd0bb0a8a1808957c9f813c761024851a44c05cc530ea
7
+ data.tar.gz: 5c2710035d5e2b6c56e3e25c974b5ecefc131fa5fb058c1b3ed2ad09825639a937f6a75811bd3286fb95364c69d64dcfa45d8778f2875c290d94c5609f46c852
data/Gemfile ADDED
@@ -0,0 +1,33 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec :development_group => :test
4
+
5
+ gem 'mongoid', '~> 6.4.2'
6
+
7
+ # gem 'cqm-models', git: 'https://github.com/projecttacoma/cqm-models.git', branch: 'master'
8
+
9
+ gem 'protected_attributes_continued'
10
+
11
+ group :development, :test do
12
+ gem 'bundler-audit'
13
+ gem 'rubocop', '~> 0.52.1', require: false
14
+ end
15
+
16
+ group :development do
17
+ gem 'rake'
18
+ gem 'byebug'
19
+ end
20
+
21
+ group :test do
22
+ gem 'factory_girl', '~> 4.1.0'
23
+ gem 'tailor', '~> 1.1.2'
24
+ gem 'cane', '~> 2.3.0'
25
+ gem 'codecov'
26
+ gem 'simplecov', :require => false
27
+ gem 'webmock'
28
+ gem 'minitest', '~> 5.3'
29
+ gem 'minitest-reporters'
30
+ gem 'awesome_print', :require => 'ap'
31
+ gem 'cqm-validators', git: 'https://github.com/projecttacoma/cqm-validators.git', branch: 'master'
32
+ gem 'nokogiri-diff'
33
+ end
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # cqm-reports
2
+ A library for import and export of reports for use with electronic Clinical Quality Measures (eCQMs).
3
+
4
+ Versioning
5
+ ==========
6
+
7
+ Starting with version **1.0.0.0** released on 5/22/2019, cqm-reports versioning has the format **W.X.Y.Z**, where:
8
+
9
+ * **W** maps to a version of QRDA Category 1 and QRDA Category 3. See the table below to see the existing mapping to QRDA versions.
10
+
11
+ | W | QRDA Cat 1 | QRDA Cat 3 |
12
+ | --- | --- | --- |
13
+ | 1 | R1 STU5.1 | R1 STU2.1 |
14
+
15
+ * **X.Y.Z** uses [SemVer](http://semver.org/) for versioning. **X.Y.Z** starts at 0.0.0 when **W** is incremented.
16
+
17
+ For the versions available, see [tags on this repository](https://github.com/projecttacoma/cqm-validators/tags).
18
+
19
+ ## License
20
+
21
+ Copyright 2019 The MITRE Corporation
22
+
23
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
24
+
25
+ http://www.apache.org/licenses/LICENSE-2.0
26
+
27
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
data/Rakefile ADDED
@@ -0,0 +1,16 @@
1
+ require 'rake/testtask'
2
+ require 'cane/rake_task'
3
+
4
+ Rake::TestTask.new(:test_unit) do |t|
5
+ t.libs << "test"
6
+ t.test_files = FileList['test/**/*_test.rb']
7
+ t.verbose = false
8
+ t.warning = false
9
+ end
10
+
11
+
12
+
13
+ task :test => [:test_unit] do
14
+
15
+ system("open coverage/index.html")
16
+ end
data/lib/cqm_report.rb ADDED
@@ -0,0 +1,77 @@
1
+ require 'nokogiri'
2
+ require 'json'
3
+ require 'ostruct'
4
+
5
+ require_relative 'util/code_system_helper'
6
+ require_relative 'util/hqmf_template_helper'
7
+ require_relative 'util/qrda_template_helper'
8
+
9
+ require_relative 'qrda-export/helper/frequency_helper.rb'
10
+ require_relative 'qrda-export/helper/aggregate_object_helper.rb'
11
+ require_relative 'qrda-export/helper/date_helper.rb'
12
+ require_relative 'qrda-export/helper/view_helper.rb'
13
+ require_relative 'qrda-export/helper/patient_view_helper.rb'
14
+ require_relative 'qrda-export/helper/cat1_view_helper.rb'
15
+
16
+ require_relative 'html-export/qdm-patient/qdm_patient.rb'
17
+
18
+ require_relative 'qrda-export/catI-r5/qrda1_r5.rb'
19
+ require_relative 'qrda-export/catIII-r2-1/qrda3_r21.rb'
20
+
21
+ require_relative 'qrda-import/entry_package.rb'
22
+ require_relative 'qrda-import/cda_identifier.rb'
23
+ require_relative 'qrda-import/narrative_reference_handler.rb'
24
+ require_relative 'qrda-import/entry_finder.rb'
25
+
26
+ require_relative 'qrda-import/base-importers/section_importer.rb'
27
+ require_relative 'qrda-import/base-importers/demographics_importer.rb'
28
+
29
+ require_relative 'qrda-import/data-element-importers/adverse_event_importer.rb'
30
+ require_relative 'qrda-import/data-element-importers/allergy_intolerance_importer.rb'
31
+ require_relative 'qrda-import/data-element-importers/assessment_order_importer.rb'
32
+ require_relative 'qrda-import/data-element-importers/assessment_performed_importer.rb'
33
+ require_relative 'qrda-import/data-element-importers/assessment_recommended_importer.rb'
34
+ require_relative 'qrda-import/data-element-importers/communication_performed_importer.rb'
35
+ require_relative 'qrda-import/data-element-importers/diagnosis_importer.rb'
36
+ require_relative 'qrda-import/data-element-importers/diagnostic_study_order_importer.rb'
37
+ require_relative 'qrda-import/data-element-importers/diagnostic_study_performed_importer.rb'
38
+ require_relative 'qrda-import/data-element-importers/diagnostic_study_recommended_importer.rb'
39
+ require_relative 'qrda-import/data-element-importers/device_applied_importer.rb'
40
+ require_relative 'qrda-import/data-element-importers/device_order_importer.rb'
41
+ require_relative 'qrda-import/data-element-importers/device_recommended_importer.rb'
42
+ require_relative 'qrda-import/data-element-importers/encounter_order_importer.rb'
43
+ require_relative 'qrda-import/data-element-importers/encounter_performed_importer.rb'
44
+ require_relative 'qrda-import/data-element-importers/encounter_recommended_importer.rb'
45
+ require_relative 'qrda-import/data-element-importers/family_history_importer.rb'
46
+ require_relative 'qrda-import/data-element-importers/immunization_administered_importer.rb'
47
+ require_relative 'qrda-import/data-element-importers/immunization_order_importer.rb'
48
+ require_relative 'qrda-import/data-element-importers/intervention_order_importer.rb'
49
+ require_relative 'qrda-import/data-element-importers/intervention_performed_importer.rb'
50
+ require_relative 'qrda-import/data-element-importers/intervention_recommended_importer.rb'
51
+ require_relative 'qrda-import/data-element-importers/laboratory_test_order_importer.rb'
52
+ require_relative 'qrda-import/data-element-importers/laboratory_test_performed_importer.rb'
53
+ require_relative 'qrda-import/data-element-importers/laboratory_test_recommended_importer.rb'
54
+ require_relative 'qrda-import/data-element-importers/medication_active_importer.rb'
55
+ require_relative 'qrda-import/data-element-importers/medication_administered_importer.rb'
56
+ require_relative 'qrda-import/data-element-importers/medication_discharge_importer.rb'
57
+ require_relative 'qrda-import/data-element-importers/medication_dispensed_importer.rb'
58
+ require_relative 'qrda-import/data-element-importers/medication_order_importer.rb'
59
+ require_relative 'qrda-import/data-element-importers/patient_care_experience_importer.rb'
60
+ require_relative 'qrda-import/data-element-importers/patient_characteristic_clinical_trial_participant_importer.rb'
61
+ require_relative 'qrda-import/data-element-importers/patient_characteristic_expired_importer.rb'
62
+ require_relative 'qrda-import/data-element-importers/patient_characteristic_payer_importer.rb'
63
+ require_relative 'qrda-import/data-element-importers/physical_exam_order_importer.rb'
64
+ require_relative 'qrda-import/data-element-importers/physical_exam_performed_importer.rb'
65
+ require_relative 'qrda-import/data-element-importers/physical_exam_recommended_importer.rb'
66
+ require_relative 'qrda-import/data-element-importers/procedure_order_importer.rb'
67
+ require_relative 'qrda-import/data-element-importers/procedure_performed_importer.rb'
68
+ require_relative 'qrda-import/data-element-importers/procedure_recommended_importer.rb'
69
+ require_relative 'qrda-import/data-element-importers/provider_care_experience_importer.rb'
70
+ require_relative 'qrda-import/data-element-importers/provider_characteristic_importer.rb'
71
+ require_relative 'qrda-import/data-element-importers/substance_administered_importer.rb'
72
+ require_relative 'qrda-import/data-element-importers/substance_order_importer.rb'
73
+ require_relative 'qrda-import/data-element-importers/substance_recommended_importer.rb'
74
+ require_relative 'qrda-import/data-element-importers/symptom_importer.rb'
75
+ require_relative 'qrda-import/patient_importer.rb'
76
+ require_relative 'ext/data_element.rb'
77
+ require_relative 'ext/code.rb'
data/lib/ext/code.rb ADDED
@@ -0,0 +1,11 @@
1
+ module QDM
2
+ class Code
3
+ def ==(other)
4
+ return false unless other.is_a? QDM::Code
5
+
6
+ (code == other.code) && (codeSystem == other.codeSystem) && (codeSystemOid == other.codeSystemOid) && (version == other.version)
7
+ end
8
+
9
+ alias eql? ==
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ module QDM
2
+ class DataElement
3
+ def merge!(other)
4
+ # ensure they're the same category (e.g. 'encounter')
5
+ return unless qdmCategory == other.qdmCategory
6
+
7
+ # ensure they're the same status (e.g. 'performed'), and that they both have a status set (or that they both don't)
8
+ return if respond_to?(:qdmStatus) && !other.respond_to?(:qdmStatus)
9
+ return if !respond_to?(:qdmStatus) && other.respond_to?(:qdmStatus)
10
+ return if respond_to?(:qdmStatus) && other.respond_to?(:qdmStatus) && qdmStatus != other.qdmStatus
11
+
12
+ # iterate over non-code fields
13
+ fields.each_key do |field|
14
+ next if field[0] == '_' || %w[dataElementCodes qdmCategory qdmVersion qdmStatus].include?(field)
15
+
16
+ if send(field).nil?
17
+ send(field + '=', other.send(field))
18
+ end
19
+ end
20
+
21
+ self.dataElementCodes = dataElementCodes.concat(other.dataElementCodes).uniq
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,61 @@
1
+ <style type="text/css">
2
+ body {
3
+ color: #003366;
4
+ background-color: #FFFFFF;
5
+ font-family: Verdana, Tahoma, sans-serif;
6
+ font-size: 11px;
7
+ }
8
+ .criteria-heading {
9
+ font-weight: bold;
10
+ }
11
+ .div-table{
12
+ display: table;
13
+ width: 100%;
14
+ }
15
+ .div-table-body {
16
+ display: table-row-group;
17
+ }
18
+ .div-table-row {
19
+ display: table-row;
20
+ }
21
+ .div-head-row {
22
+ display: table-row;
23
+ }
24
+ .div-table-cell, .div-table-head {
25
+ border: 1px solid #999999;
26
+ display: table-cell;
27
+ padding: 3px 10px;
28
+ }
29
+ .div-table-head--no-border {
30
+ display: table-cell;
31
+ }
32
+ .div-table-heading {
33
+ background-color: #EEE;
34
+ display: table-header-group;
35
+ font-weight: bold;
36
+ }
37
+ .patient_narr_tr {
38
+ background-color: #ccccff;
39
+ }
40
+ .patient_narr_th {
41
+ background-color: #3399ff;
42
+ }
43
+ .td_label{
44
+ font-weight: bold;
45
+ color: white;
46
+ }
47
+ .narr_tr {
48
+ background-color: #ffffcc;
49
+ }
50
+ .narr_th-wide {
51
+ background-color: #ffd700;
52
+ width: 28%;
53
+ }
54
+ .narr_th-narrow {
55
+ background-color: #ffd700;
56
+ width: 16%;
57
+ }
58
+ .div-table-cell-label {
59
+ display: none;
60
+ }
61
+ </style>
@@ -0,0 +1,52 @@
1
+ <script language="javascript">
2
+ var cur_view = "section";
3
+ function toggle(id) {
4
+ var e = document.getElementById(id);
5
+ if (cur_view=="section"){
6
+ document.getElementById("patient_information_by_section").style.display = 'none';
7
+ document.getElementById("table_by_encounter").style.display = 'block';
8
+ document.getElementById('toggle_button').innerHTML="View By Section";
9
+ cur_view = "encounter";
10
+ }else{
11
+ document.getElementById("patient_information_by_section").style.display = 'block';
12
+ document.getElementById("table_by_encounter").style.display = 'none';
13
+ document.getElementById('toggle_button').innerHTML="View By Encounter";
14
+ cur_view = "section";
15
+ }
16
+ }
17
+
18
+ function showConcepts(ev, id) {
19
+ var left = ev.clientX + document.documentElement.scrollLeft;
20
+ var top = ev.clientY + document.documentElement.scrollTop;
21
+
22
+ var concepts = document.getElementById(id);
23
+ concepts.style.display = 'block';
24
+ concepts.style.left = left + 'px';
25
+ concepts.style.top = top + 'px';
26
+ }
27
+ function hideConcepts(ev, id) {
28
+ var concepts = document.getElementById(id);
29
+ concepts.style.display = 'none';
30
+ }
31
+ function showCodes(event, id) {
32
+ //var left = ev.clientX + document.documentElement.scrollLeft;
33
+ //var top = ev.clientY + document.documentElement.scrollTop;
34
+
35
+ // Calculate pageX/Y if missing and clientX/Y available
36
+ if ( event.pageX == null && event.clientX != null ) {
37
+ var doc = document.documentElement, body = document.body;
38
+ event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
39
+ event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
40
+ }
41
+ var left = event.pageX;
42
+ var top = event.pageY;
43
+ var codes = document.getElementById(id);
44
+ codes.style.display = 'block';
45
+ codes.style.left = left + 'px';
46
+ codes.style.top = top + 'px';
47
+ }
48
+ function hideCodes(ev, id) {
49
+ var codes = document.getElementById(id);
50
+ codes.style.display = 'none';
51
+ }
52
+ </script>
@@ -0,0 +1,4 @@
1
+ <div class="div-table-cell"><span class="description-heading">{{description}}</span></div>
2
+ <div class="div-table-cell"><div class="div-table-cell-label">Codes: </div>{{> data_element/_data_element_codes}}</div>
3
+ <div class="div-table-cell"><div class="div-table-cell-label">Time Elements: </div>{{> data_element/_data_element_times}}</div>
4
+ <div class="div-table-cell"><div class="div-table-cell-label">Other Fields: </div>{{> data_element/_data_element_other_fields}}</div>
@@ -0,0 +1,9 @@
1
+ <div class="div-table">
2
+ <div class="div-table-body">
3
+ {{#dataElementCodes}}
4
+ <div class="div-head-row">
5
+ <div class="div-table-head--no-border"><span class="criteria-heading">{{codeSystem}}:</span> {{code}}</div>
6
+ </div>
7
+ {{/dataElementCodes}}
8
+ </div>
9
+ </div>
@@ -0,0 +1,106 @@
1
+ <div class="div-table">
2
+ <div class="div-table-body">
3
+ {{#admissionSource}}
4
+ <div class="div-head-row">
5
+ <div class="div-table-head--no-border"><span class="criteria-heading">Admission Source:</span> {{{code_code_system_string}}}</div>
6
+ </div>
7
+ {{/admissionSource}}
8
+ {{#anatomicalApproachSite}}
9
+ <div class="div-head-row">
10
+ <div class="div-table-head--no-border"><span class="criteria-heading">Anatomical Approach Site:</span> {{{code_code_system_string}}}</div>
11
+ </div>
12
+ {{/anatomicalApproachSite}}
13
+ {{#anatomicalLocationSite}}
14
+ <div class="div-head-row">
15
+ <div class="div-table-head--no-border"><span class="criteria-heading">Anatomical Location Site:</span> {{{code_code_system_string}}}</div>
16
+ </div>
17
+ {{/anatomicalLocationSite}}
18
+ {{#components}}
19
+ {{#code}}
20
+ <div class="div-head-row">
21
+ <div class="div-table-head--no-border"><span class="criteria-heading">Component Code:</span> {{{code_code_system_string}}}</div>
22
+ </div>
23
+ {{/code}}
24
+ {{#result}}
25
+ <div class="div-head-row">
26
+ <div class="div-table-head--no-border"><span class="criteria-heading">Component Result:</span> {{{code_code_system_string}}}</div>
27
+ </div>
28
+ {{/result}}
29
+ {{/components}}
30
+ {{#diagnoses}}
31
+ <div class="div-head-row">
32
+ <div class="div-table-head--no-border"><span class="criteria-heading">Diagnosis:</span> {{{code_code_system_string}}}</div>
33
+ </div>
34
+ {{/diagnoses}}
35
+ {{#dischargeDisposition}}
36
+ <div class="div-head-row">
37
+ <div class="div-table-head--no-border"><span class="criteria-heading">Discharge Disposition:</span> {{{code_code_system_string}}}</div>
38
+ </div>
39
+ {{/dischargeDisposition}}
40
+ {{#facilityLocation}}
41
+ <div class="div-head-row">
42
+ <div class="div-table-head--no-border"><span class="criteria-heading">Facility Location:</span> {{{code_code_system_string}}}</div>
43
+ </div>
44
+ {{/facilityLocation}}
45
+ {{#facilityLocations}}
46
+ <div class="div-head-row">
47
+ <div class="div-table-head--no-border"><span class="criteria-heading">Facility:</span> {{{facility_string}}}</div>
48
+ </div>
49
+ {{/facilityLocations}}
50
+ {{#frequency}}
51
+ <div class="div-head-row">
52
+ <div class="div-table-head--no-border"><span class="criteria-heading">Frequency:</span> {{{code_code_system_string}}}</div>
53
+ </div>
54
+ {{/frequency}}
55
+ {{#lengthOfStay}}
56
+ <div class="div-head-row">
57
+ <div class="div-table-head--no-border"><span class="criteria-heading">Length Of Stay:</span> {{{unit_string}}}</div>
58
+ </div>
59
+ {{/lengthOfStay}}
60
+ {{#negationRationale}}
61
+ <div class="div-head-row">
62
+ <div class="div-table-head--no-border"><span class="criteria-heading">Negation Reason:</span> {{{code_code_system_string}}}</div>
63
+ </div>
64
+ {{/negationRationale}}
65
+ {{#ordinality}}
66
+ <div class="div-head-row">
67
+ <div class="div-table-head--no-border"><span class="criteria-heading">Ordinality:</span> {{{code_code_system_string}}}</div>
68
+ </div>
69
+ {{/ordinality}}
70
+ {{#principalDiagnosis}}
71
+ <div class="div-head-row">
72
+ <div class="div-table-head--no-border"><span class="criteria-heading">Principal Diagnosis:</span> {{{code_code_system_string}}}</div>
73
+ </div>
74
+ {{/principalDiagnosis}}
75
+ {{#reason}}
76
+ <div class="div-head-row">
77
+ <div class="div-table-head--no-border"><span class="criteria-heading">Reason:</span> {{{code_code_system_string}}}</div>
78
+ </div>
79
+ {{/reason}}
80
+ {{#route}}
81
+ <div class="div-head-row">
82
+ <div class="div-table-head--no-border"><span class="criteria-heading">Route:</span> {{{code_code_system_string}}}</div>
83
+ </div>
84
+ {{/route}}
85
+ {{#severity}}
86
+ <div class="div-head-row">
87
+ <div class="div-table-head--no-border"><span class="criteria-heading">Severity:</span> {{{code_code_system_string}}}</div>
88
+ </div>
89
+ {{/severity}}
90
+ {{#status}}
91
+ <div class="div-head-row">
92
+ <div class="div-table-head--no-border"><span class="criteria-heading">Status:</span> {{{code_code_system_string}}}</div>
93
+ </div>
94
+ {{/status}}
95
+ {{#type}}
96
+ <div class="div-head-row">
97
+ <div class="div-table-head--no-border"><span class="criteria-heading">Type:</span> {{{code_code_system_string}}}</div>
98
+ </div>
99
+ {{/type}}
100
+ {{#result}}
101
+ <div class="div-head-row">
102
+ <div class="div-table-head--no-border"><span class="criteria-heading">Result:</span> {{{result_string}}}</div>
103
+ </div>
104
+ {{/result}}
105
+ </div>
106
+ </div>
@@ -0,0 +1,44 @@
1
+ <div class="div-table">
2
+ <div class="div-table-body">
3
+ {{#relevantPeriod}}
4
+ <div class="div-head-row">
5
+ <div class="div-table-head--no-border"><span class="criteria-heading">Relevant Period Start:</span> {{{low}}}</div>
6
+ </div>
7
+ {{#end_time?}}
8
+ <div class="div-head-row">
9
+ <div class="div-table-head--no-border"><span class="criteria-heading">Relevant Period End:</span> {{{high}}}</div>
10
+ </div>
11
+ {{/end_time?}}
12
+ {{/relevantPeriod}}
13
+ {{#prevalencePeriod}}
14
+ <div class="div-head-row">
15
+ <div class="div-table-head--no-border"><span class="criteria-heading">Prevalence Period Start:</span> {{{low}}}</div>
16
+ </div>
17
+ {{#end_time?}}
18
+ <div class="div-head-row">
19
+ <div class="div-table-head--no-border"><span class="criteria-heading">Prevalence Period End:</span> {{{high}}}</div>
20
+ </div>
21
+ {{/end_time?}}
22
+ {{/prevalencePeriod}}
23
+ {{#authorDatetime}}
24
+ <div class="div-head-row">
25
+ <div class="div-table-head--no-border"><span class="criteria-heading">Author Date/Time:</span> {{{authorDatetime}}}</div>
26
+ </div>
27
+ {{/authorDatetime}}
28
+ {{#resultDatetime}}
29
+ <div class="div-head-row">
30
+ <div class="div-table-head--no-border"><span class="criteria-heading">Result Date/Time:</span> {{{resultDatetime}}}</div>
31
+ </div>
32
+ {{/resultDatetime}}
33
+ {{#activeDatetime}}
34
+ <div class="div-head-row">
35
+ <div class="div-table-head--no-border"><span class="criteria-heading">Active Date/Time:</span> {{{activeDatetime}}}</div>
36
+ </div>
37
+ {{/activeDatetime}}
38
+ {{#incisionDatetime}}
39
+ <div class="div-head-row">
40
+ <div class="div-table-head--no-border"><span class="criteria-heading">Incision Date/Time:</span> {{{incisionDatetime}}}</div>
41
+ </div>
42
+ {{/incisionDatetime}}
43
+ </div>
44
+ </div>
@@ -0,0 +1,73 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html xmlns:n1="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
5
+ {{#patient}}
6
+ <title>Cypress Certification Patient Test Record: {{{given_name}}} {{familyName}}</title>
7
+ {{/patient}}
8
+ {{#include_style?}}
9
+ {{> _header_css}}
10
+ {{/include_style?}}
11
+ </head>
12
+ <body>
13
+ {{#patient}}
14
+ <h1 class="h1center">Cypress Certification Patient Test Record: {{{given_name}}} {{familyName}}</h1>
15
+ <div class="div-table">
16
+ <div class="div-table-body">
17
+ <div class="div-head-row patient_narr_tr panel panel-default patient-details">
18
+ <div class="div-table-head patient_narr_th panel-heading"><span class="td_label">Patient</span></div>
19
+ <div class="div-table-head">{{{given_name}}} {{familyName}}</div>
20
+ <div class="div-table-head patient_narr_th panel-heading"><span class="td_label">Sex</span></div>
21
+ <div class="div-table-head">{{{gender}}}</div>
22
+ </div>
23
+ <div class="div-head-row patient_narr_tr panel panel-default patient-details">
24
+ <div class="div-table-head patient_narr_th panel-heading"><span class="td_label">Date of birth</span></div>
25
+ <div class="div-table-head">{{{birthdate}}}</div>
26
+ <div class="div-table-head patient_narr_th panel-heading"><span class="td_label">Date of expiration</span></div>
27
+ <div class="div-table-head"></div>
28
+ </div>
29
+ <div class="div-head-row patient_narr_tr panel panel-default patient-details">
30
+ <div class="div-table-head patient_narr_th panel-heading"><span class="td_label">Race</span></div>
31
+ <div class="div-table-head">{{{race}}}</div>
32
+ <div class="div-table-head patient_narr_th panel-heading"><span class="td_label">Ethnicity</span></div>
33
+ <div class="div-table-head">{{{ethnic_group}}}</div>
34
+ </div>
35
+ <div class="div-head-row patient_narr_tr panel panel-default patient-details">
36
+ <div class="div-table-head patient_narr_th panel-heading"><span class="td_label">Insurance Providers</span></div>
37
+ <div class="div-table-head">{{{payer}}}</div>
38
+ <div class="div-table-head patient_narr_th panel-heading"><span class="td_label">Patient IDs</span></div>
39
+ <div class="div-table-head">{{{mrn}}} Cypress</div>
40
+ </div>
41
+ <div class="div-head-row patient_narr_tr panel panel-default patient-details">
42
+ <div class="div-table-head patient_narr_th panel-heading"><span class="td_label">Contact info</span></div>
43
+ <div class="div-table-head"></div>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ {{/patient}}
48
+ {{> _javascript}}
49
+ {{#data_elements}}
50
+ <div class="panel panel-default patient-details">
51
+ <div class="panel-heading"><h3 class='panel-title'>{{title}}</h3></div>
52
+ <!--table class="narr_table" border="1" width="100%"-->
53
+ <div class="div-table">
54
+ <div class="div-table-heading">
55
+ <div class="div-table-row narr_tr">
56
+ <div class="div-table-head narr_th-wide">Description</div>
57
+ <div class="div-table-head narr_th-narrow">Codes</div>
58
+ <div class="div-table-head narr_th-wide">Time</div>
59
+ <div class="div-table-head narr_th-wide">Fields/Results</div>
60
+ </div>
61
+ </div>
62
+ <div class="div-table-body">
63
+ {{#element_list}}
64
+ <div class="div-table-row narr_tr">
65
+ {{> data_element/_data_element}}
66
+ </div>
67
+ {{/element_list}}
68
+ </div>
69
+ </div>
70
+ </div>
71
+ {{/data_elements}}
72
+ </body>
73
+ </html>
@@ -0,0 +1,47 @@
1
+ require 'mustache'
2
+ class QdmPatient < Mustache
3
+ include Qrda::Export::Helper::PatientViewHelper
4
+
5
+ self.template_path = __dir__
6
+
7
+ def initialize(patient, include_style)
8
+ @include_style = include_style
9
+ @patient = patient
10
+ @qdmPatient = patient.qdmPatient
11
+ end
12
+
13
+ def include_style?
14
+ @include_style
15
+ end
16
+
17
+ def data_elements
18
+ de_hash = {}
19
+ @qdmPatient.dataElements.each do |data_element|
20
+ de_hash[data_element._type] ? de_hash[data_element._type].element_list << data_element : de_hash[data_element._type] = { title: data_element._type, element_list: [data_element] }
21
+ end
22
+ JSON.parse(de_hash.values.to_json)
23
+ end
24
+
25
+ def unit_string
26
+ "#{self['value']} #{self['unit']}"
27
+ end
28
+
29
+ def code_code_system_string
30
+ "#{self['code']} (#{self['codeSystem']})"
31
+ end
32
+
33
+ def result_string
34
+ return unit_string if self['unit']
35
+ return code_code_system_string if self['code']
36
+
37
+ ''
38
+ end
39
+
40
+ def facility_string
41
+ "#{self['code']['code']} (#{self['code']['codeSystem']})"
42
+ end
43
+
44
+ def end_time?
45
+ self['high'] && DateTime.parse(self['high']).year < 3000
46
+ end
47
+ end
@@ -0,0 +1 @@
1
+ {{{code_and_codesystem}}}
@@ -0,0 +1,10 @@
1
+ {{#multiple_codes?}}
2
+ <code {{{primary_code_and_codesystem}}}>
3
+ {{{translation_codes_and_codesystem_list}}}
4
+ </code>
5
+ {{/multiple_codes?}}
6
+ {{^multiple_codes?}}
7
+ {{#dataElementCodes}}
8
+ <code {{> _code}}/>
9
+ {{/dataElementCodes}}
10
+ {{/multiple_codes?}}
@@ -0,0 +1,28 @@
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.22.1.1" extension="2015-08-01"/>
6
+ <!-- QRDA templateId -->
7
+ <templateId root="2.16.840.1.113883.10.20.24.1.1" extension="2017-08-01"/>
8
+ <!-- QDM-based QRDA templateId -->
9
+ <templateId root="2.16.840.1.113883.10.20.24.1.2" extension="2017-08-01"/>
10
+ <!-- CMS QRDA templateId -->
11
+ <templateId root="2.16.840.1.113883.10.20.24.1.3" extension="2018-02-01"/>
12
+ <!-- This is the globally unique identifier for this QRDA document -->
13
+ <id root="{{random_id}}"/>
14
+ <!-- QRDA document type code -->
15
+ <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
16
+ <title>QRDA Incidence Report</title>
17
+ <!-- This is the document creation time -->
18
+ <effectiveTime value="{{{current_time}}}"/>
19
+ <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
20
+ <languageCode code="en"/>
21
+ <!-- reported patient -->
22
+ {{> qrda_header/_record_target}}
23
+ {{> qrda_header/_author}}
24
+ {{> qrda_header/_custodian}}
25
+ {{> qrda_header/_information_recipient}}
26
+ {{> qrda_header/_legal_authenticator}}
27
+ {{> qrda_header/_participant}}
28
+ {{> qrda_header/_documentation_of_service_event}}