health-data-standards 2.2.1 → 3.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (264) hide show
  1. data/Gemfile +5 -0
  2. data/lib/health-data-standards.rb +55 -12
  3. data/lib/health-data-standards/export/c32.rb +7 -6
  4. data/lib/health-data-standards/export/cat_1.rb +18 -0
  5. data/lib/health-data-standards/export/ccda.rb +8 -8
  6. data/lib/health-data-standards/export/green_c32/entry.rb +8 -5
  7. data/lib/health-data-standards/export/green_c32/export_generator.rb +1 -1
  8. data/lib/health-data-standards/export/green_c32/record.rb +10 -7
  9. data/lib/health-data-standards/export/hdata/metadata.rb +7 -6
  10. data/lib/health-data-standards/export/helper/cat1_view_helper.rb +133 -0
  11. data/lib/health-data-standards/export/helper/gc32_view_helper.rb +39 -0
  12. data/lib/health-data-standards/export/helper/html_view_helper.rb +23 -0
  13. data/lib/health-data-standards/export/html.rb +22 -10
  14. data/lib/health-data-standards/export/qrda/entry_template_resolver.rb +31 -0
  15. data/lib/health-data-standards/export/qrda/hqmf-qrda-oids.json +638 -0
  16. data/lib/health-data-standards/export/rendering_context.rb +37 -3
  17. data/lib/health-data-standards/export/template_helper.rb +20 -23
  18. data/lib/health-data-standards/export/view_helper.rb +8 -42
  19. data/lib/health-data-standards/import/bundle/importer.rb +148 -0
  20. data/lib/health-data-standards/import/c32/care_goal_importer.rb +14 -26
  21. data/lib/health-data-standards/import/c32/condition_importer.rb +12 -51
  22. data/lib/health-data-standards/import/c32/immunization_importer.rb +9 -27
  23. data/lib/health-data-standards/import/c32/insurance_provider_importer.rb +24 -21
  24. data/lib/health-data-standards/import/c32/patient_importer.rb +27 -34
  25. data/lib/health-data-standards/import/cat1/diagnosis_active_importer.rb +19 -0
  26. data/lib/health-data-standards/import/cat1/diagnosis_inactive_importer.rb +19 -0
  27. data/lib/health-data-standards/import/cat1/diagnostic_study_order_importer.rb +24 -0
  28. data/lib/health-data-standards/import/cat1/encounter_order_importer.rb +24 -0
  29. data/lib/health-data-standards/import/cat1/entry_package.rb +25 -0
  30. data/lib/health-data-standards/import/cat1/gestational_age_importer.rb +42 -0
  31. data/lib/health-data-standards/import/cat1/lab_order_importer.rb +24 -0
  32. data/lib/health-data-standards/import/cat1/medication_dispensed_importer.rb +13 -0
  33. data/lib/health-data-standards/import/cat1/patient_importer.rb +104 -0
  34. data/lib/health-data-standards/import/cat1/procedure_intolerance_importer.rb +13 -0
  35. data/lib/health-data-standards/import/cat1/procedure_order_importer.rb +38 -0
  36. data/lib/health-data-standards/import/cat1/tobacco_use_importer.rb +19 -0
  37. data/lib/health-data-standards/import/ccda/allergy_importer.rb +2 -8
  38. data/lib/health-data-standards/import/ccda/care_goal_importer.rb +1 -1
  39. data/lib/health-data-standards/import/ccda/condition_importer.rb +2 -3
  40. data/lib/health-data-standards/import/ccda/encounter_importer.rb +2 -5
  41. data/lib/health-data-standards/import/ccda/immunization_importer.rb +1 -3
  42. data/lib/health-data-standards/import/ccda/insurance_provider_importer.rb +1 -1
  43. data/lib/health-data-standards/import/ccda/medical_equipment_importer.rb +2 -4
  44. data/lib/health-data-standards/import/ccda/medication_importer.rb +2 -4
  45. data/lib/health-data-standards/import/ccda/patient_importer.rb +1 -1
  46. data/lib/health-data-standards/import/ccda/procedure_importer.rb +2 -6
  47. data/lib/health-data-standards/import/ccda/result_importer.rb +2 -5
  48. data/lib/health-data-standards/import/ccda/vital_sign_importer.rb +2 -3
  49. data/lib/health-data-standards/import/cda/allergy_importer.rb +32 -0
  50. data/lib/health-data-standards/import/cda/condition_importer.rb +51 -0
  51. data/lib/health-data-standards/import/{c32 → cda}/encounter_importer.rb +9 -35
  52. data/lib/health-data-standards/import/cda/entry_finder.rb +22 -0
  53. data/lib/health-data-standards/import/{c32 → cda}/locatable_import_utils.rb +2 -3
  54. data/lib/health-data-standards/import/cda/medical_equipment_importer.rb +24 -0
  55. data/lib/health-data-standards/import/{c32 → cda}/medication_importer.rb +13 -15
  56. data/lib/health-data-standards/import/cda/narrative_reference_handler.rb +35 -0
  57. data/lib/health-data-standards/import/{c32 → cda}/organization_importer.rb +1 -1
  58. data/lib/health-data-standards/import/cda/procedure_importer.rb +35 -0
  59. data/lib/health-data-standards/import/{c32 → cda}/provider_importer.rb +4 -8
  60. data/lib/health-data-standards/import/cda/result_importer.rb +31 -0
  61. data/lib/health-data-standards/import/{c32 → cda}/section_importer.rb +26 -48
  62. data/lib/health-data-standards/import/{c32 → cda}/vital_sign_importer.rb +2 -3
  63. data/lib/health-data-standards/import/green_c32/section_importer.rb +8 -6
  64. data/lib/health-data-standards/import/provider_import_utils.rb +2 -2
  65. data/lib/health-data-standards/models/address.rb +1 -1
  66. data/lib/health-data-standards/models/condition.rb +7 -6
  67. data/lib/health-data-standards/models/cqm/bundle.rb +45 -0
  68. data/lib/health-data-standards/models/cqm/measure.rb +36 -0
  69. data/lib/health-data-standards/models/guarantor.rb +1 -0
  70. data/lib/health-data-standards/models/insurance_provider.rb +2 -0
  71. data/lib/health-data-standards/models/order_information.rb +2 -0
  72. data/lib/health-data-standards/models/record.rb +6 -5
  73. data/lib/health-data-standards/models/svs/value_set.rb +1 -1
  74. data/lib/health-data-standards/railtie.rb +11 -0
  75. data/lib/health-data-standards/tasks/bundle.rake +107 -0
  76. data/lib/health-data-standards/util/code_system_helper.rb +9 -1
  77. data/lib/hqmf-generator/attribute.xml.erb +11 -0
  78. data/lib/hqmf-generator/characteristic_criteria.xml.erb +21 -0
  79. data/lib/hqmf-generator/code.xml.erb +13 -0
  80. data/lib/hqmf-generator/condition_criteria.xml.erb +22 -0
  81. data/lib/hqmf-generator/derivation.xml.erb +6 -0
  82. data/lib/hqmf-generator/description.xml.erb +1 -0
  83. data/lib/hqmf-generator/document.xml.erb +63 -0
  84. data/lib/hqmf-generator/effective_time.xml.erb +4 -0
  85. data/lib/hqmf-generator/encounter_criteria.xml.erb +21 -0
  86. data/lib/hqmf-generator/field.xml.erb +28 -0
  87. data/lib/hqmf-generator/hqmf-generator.rb +292 -0
  88. data/lib/hqmf-generator/observation_criteria.xml.erb +25 -0
  89. data/lib/hqmf-generator/population_criteria.xml.erb +23 -0
  90. data/lib/hqmf-generator/precondition.xml.erb +14 -0
  91. data/lib/hqmf-generator/procedure_criteria.xml.erb +22 -0
  92. data/lib/hqmf-generator/reason.xml.erb +3 -0
  93. data/lib/hqmf-generator/reference.xml.erb +3 -0
  94. data/lib/hqmf-generator/source.xml.erb +6 -0
  95. data/lib/hqmf-generator/specific_occurrence.xml.erb +7 -0
  96. data/lib/hqmf-generator/subset.xml.erb +8 -0
  97. data/lib/hqmf-generator/substance_criteria.xml.erb +26 -0
  98. data/lib/hqmf-generator/supply_criteria.xml.erb +26 -0
  99. data/lib/hqmf-generator/template_id.xml.erb +5 -0
  100. data/lib/hqmf-generator/temporal_relationship.xml.erb +6 -0
  101. data/lib/hqmf-generator/value.xml.erb +24 -0
  102. data/lib/hqmf-generator/variable_criteria.xml.erb +12 -0
  103. data/lib/hqmf-model/attribute.rb +35 -0
  104. data/lib/hqmf-model/data_criteria.json +1123 -0
  105. data/lib/hqmf-model/data_criteria.rb +344 -0
  106. data/lib/hqmf-model/document.rb +178 -0
  107. data/lib/hqmf-model/population_criteria.rb +96 -0
  108. data/lib/hqmf-model/precondition.rb +91 -0
  109. data/lib/hqmf-model/types.rb +319 -0
  110. data/lib/hqmf-model/utilities.rb +52 -0
  111. data/lib/hqmf-parser.rb +56 -0
  112. data/lib/hqmf-parser/1.0/attribute.rb +68 -0
  113. data/lib/hqmf-parser/1.0/comparison.rb +34 -0
  114. data/lib/hqmf-parser/1.0/data_criteria.rb +92 -0
  115. data/lib/hqmf-parser/1.0/data_criteria_oid_xpath.json +91 -0
  116. data/lib/hqmf-parser/1.0/document.rb +203 -0
  117. data/lib/hqmf-parser/1.0/expression.rb +58 -0
  118. data/lib/hqmf-parser/1.0/observation.rb +61 -0
  119. data/lib/hqmf-parser/1.0/population_criteria.rb +75 -0
  120. data/lib/hqmf-parser/1.0/precondition.rb +89 -0
  121. data/lib/hqmf-parser/1.0/range.rb +65 -0
  122. data/lib/hqmf-parser/1.0/restriction.rb +160 -0
  123. data/lib/hqmf-parser/1.0/utilities.rb +41 -0
  124. data/lib/hqmf-parser/2.0/data_criteria.rb +319 -0
  125. data/lib/hqmf-parser/2.0/document.rb +165 -0
  126. data/lib/hqmf-parser/2.0/population_criteria.rb +53 -0
  127. data/lib/hqmf-parser/2.0/precondition.rb +44 -0
  128. data/lib/hqmf-parser/2.0/types.rb +223 -0
  129. data/lib/hqmf-parser/2.0/utilities.rb +30 -0
  130. data/lib/hqmf-parser/converter/pass1/data_criteria_converter.rb +252 -0
  131. data/lib/hqmf-parser/converter/pass1/document_converter.rb +185 -0
  132. data/lib/hqmf-parser/converter/pass1/population_criteria_converter.rb +165 -0
  133. data/lib/hqmf-parser/converter/pass1/precondition_converter.rb +173 -0
  134. data/lib/hqmf-parser/converter/pass1/precondition_extractor.rb +188 -0
  135. data/lib/hqmf-parser/converter/pass1/simple_data_criteria.rb +26 -0
  136. data/lib/hqmf-parser/converter/pass1/simple_operator.rb +89 -0
  137. data/lib/hqmf-parser/converter/pass1/simple_population_criteria.rb +10 -0
  138. data/lib/hqmf-parser/converter/pass1/simple_precondition.rb +51 -0
  139. data/lib/hqmf-parser/converter/pass1/simple_restriction.rb +64 -0
  140. data/lib/hqmf-parser/converter/pass2/comparison_converter.rb +112 -0
  141. data/lib/hqmf-parser/converter/pass2/operator_converter.rb +102 -0
  142. data/lib/hqmf-parser/parser.rb +54 -0
  143. data/lib/hqmf-parser/value_sets/value_set_parser.rb +241 -0
  144. data/lib/util/counter.rb +20 -0
  145. data/templates/{_allergies.c32.erb → c32/_allergies.c32.erb} +0 -0
  146. data/templates/{_allergies_no_current.c32.erb → c32/_allergies_no_current.c32.erb} +0 -0
  147. data/templates/{_care_goals.c32.erb → c32/_care_goals.c32.erb} +0 -0
  148. data/templates/{_code_with_reference.c32.erb → c32/_code_with_reference.c32.erb} +0 -0
  149. data/templates/{_conditions.c32.erb → c32/_conditions.c32.erb} +0 -0
  150. data/templates/{_conditions_no_current.c32.erb → c32/_conditions_no_current.c32.erb} +0 -0
  151. data/templates/{_encounters.c32.erb → c32/_encounters.c32.erb} +0 -0
  152. data/templates/{_immunizations.c32.erb → c32/_immunizations.c32.erb} +0 -0
  153. data/templates/{_medical_equipment.c32.erb → c32/_medical_equipment.c32.erb} +0 -0
  154. data/templates/{_medications.c32.erb → c32/_medications.c32.erb} +0 -0
  155. data/templates/{_medications_no_current.c32.erb → c32/_medications_no_current.c32.erb} +0 -0
  156. data/templates/{_narrative_block.c32.erb → c32/_narrative_block.c32.erb} +0 -0
  157. data/templates/{_procedures.c32.erb → c32/_procedures.c32.erb} +0 -0
  158. data/templates/{_results.c32.erb → c32/_results.c32.erb} +0 -0
  159. data/templates/{_social_history.c32.erb → c32/_social_history.c32.erb} +0 -0
  160. data/templates/{_vital_signs.c32.erb → c32/_vital_signs.c32.erb} +0 -0
  161. data/templates/{show.c32.erb → c32/show.c32.erb} +0 -0
  162. data/templates/cat1/_2.16.840.1.113883.10.20.22.4.85.cat1.erb +18 -0
  163. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.1.cat1.erb +14 -0
  164. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.101.cat1.erb +25 -0
  165. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.103.cat1.erb +12 -0
  166. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.105.cat1.erb +60 -0
  167. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.11.cat1.erb +41 -0
  168. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.12.cat1.erb +50 -0
  169. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.13.cat1.erb +37 -0
  170. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.14.cat1.erb +35 -0
  171. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.17.cat1.erb +22 -0
  172. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.18.cat1.erb +21 -0
  173. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.2.cat1.erb +28 -0
  174. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.20.cat1.erb +20 -0
  175. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.22.cat1.erb +21 -0
  176. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.23.cat1.erb +71 -0
  177. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.28.cat1.erb +20 -0
  178. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.3.cat1.erb +24 -0
  179. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.31.cat1.erb +20 -0
  180. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +15 -0
  181. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.34.cat1.erb +58 -0
  182. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.37.cat1.erb +20 -0
  183. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.38.cat1.erb +16 -0
  184. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.4.cat1.erb +27 -0
  185. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.40.cat1.erb +17 -0
  186. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.41.cat1.erb +38 -0
  187. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.42.cat1.erb +38 -0
  188. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.43.cat1.erb +24 -0
  189. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.44.cat1.erb +24 -0
  190. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.45.cat1.erb +26 -0
  191. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.46.cat1.erb +30 -0
  192. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.47.cat1.erb +26 -0
  193. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.51.cat1.erb +13 -0
  194. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.54.cat1.erb +16 -0
  195. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.55.cat1.erb +10 -0
  196. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.57.cat1.erb +19 -0
  197. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.59.cat1.erb +17 -0
  198. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.62.cat1.erb +36 -0
  199. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.63.cat1.erb +23 -0
  200. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +29 -0
  201. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.66.cat1.erb +34 -0
  202. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.69.cat1.erb +23 -0
  203. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.7.cat1.erb +30 -0
  204. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.76.cat1.erb +32 -0
  205. data/templates/cat1/_measures.cat1.erb +66 -0
  206. data/templates/cat1/_medication_details.cat1.erb +9 -0
  207. data/templates/cat1/_ordinality.cat1.erb +4 -0
  208. data/templates/cat1/_patient_data.cat1.erb +14 -0
  209. data/templates/cat1/_reason.cat1.erb +16 -0
  210. data/templates/cat1/_record_target.cat1.erb +39 -0
  211. data/templates/cat1/_reporting_parameters.cat1.erb +24 -0
  212. data/templates/cat1/_result_value.cat1.erb +16 -0
  213. data/templates/cat1/show.cat1.erb +125 -0
  214. data/templates/{_address.gc32.erb → gc32/_address.gc32.erb} +1 -1
  215. data/templates/gc32/_advance_directive.gc32.erb +5 -0
  216. data/templates/gc32/_allergy.gc32.erb +12 -0
  217. data/templates/{_care_goal.gc32.erb → gc32/_care_goal.gc32.erb} +1 -1
  218. data/templates/gc32/_condition.gc32.erb +10 -0
  219. data/templates/gc32/_encounter.gc32.erb +28 -0
  220. data/templates/gc32/_entry.gc32.erb +3 -0
  221. data/templates/gc32/_entry_attributes.gc32.erb +10 -0
  222. data/templates/gc32/_immunization.gc32.erb +9 -0
  223. data/templates/gc32/_insurance_provider.gc32.erb +28 -0
  224. data/templates/gc32/_medical_equipment.gc32.erb +6 -0
  225. data/templates/gc32/_medication.gc32.erb +91 -0
  226. data/templates/{_name.gc32.erb → gc32/_name.gc32.erb} +0 -0
  227. data/templates/gc32/_organization.gc32.erb +10 -0
  228. data/templates/gc32/_person_attributes.gc32.erb +7 -0
  229. data/templates/gc32/_procedure.gc32.erb +9 -0
  230. data/templates/gc32/_provider.gc32.erb +9 -0
  231. data/templates/gc32/_result.gc32.erb +12 -0
  232. data/templates/gc32/_social_history.gc32.erb +6 -0
  233. data/templates/{_support.gc32.erb → gc32/_support.gc32.erb} +4 -3
  234. data/templates/gc32/_telecom.gc32.erb +1 -0
  235. data/templates/gc32/_vital_sign.gc32.erb +4 -0
  236. data/templates/{record.gc32.erb → gc32/record.gc32.erb} +26 -10
  237. data/templates/html/_entries_by_encounter.html.erb +2 -2
  238. data/templates/html/_entries_by_section.html.erb +1 -1
  239. data/templates/html/_entry.html.erb +16 -21
  240. data/templates/html/_header.html.erb +1 -1
  241. data/templates/html/_section.html.erb +1 -1
  242. data/templates/html/show.html.erb +23 -2
  243. data/templates/metadata.hdata.erb +3 -3
  244. metadata +282 -54
  245. data/lib/health-data-standards/import/c32/allergy_importer.rb +0 -47
  246. data/lib/health-data-standards/import/c32/medical_equipment_importer.rb +0 -45
  247. data/lib/health-data-standards/import/c32/procedure_importer.rb +0 -62
  248. data/lib/health-data-standards/import/c32/result_importer.rb +0 -56
  249. data/templates/_advance_directive.gc32.erb +0 -8
  250. data/templates/_allergy.gc32.erb +0 -23
  251. data/templates/_condition.gc32.erb +0 -9
  252. data/templates/_encounter.gc32.erb +0 -26
  253. data/templates/_entry.gc32.erb +0 -14
  254. data/templates/_immunization.gc32.erb +0 -11
  255. data/templates/_insurance_provider.gc32.erb +0 -0
  256. data/templates/_medical_equipment.gc32.erb +0 -7
  257. data/templates/_medication.gc32.erb +0 -72
  258. data/templates/_organization.gc32.erb +0 -10
  259. data/templates/_procedure.gc32.erb +0 -10
  260. data/templates/_provider.gc32.erb +0 -19
  261. data/templates/_result.gc32.erb +0 -16
  262. data/templates/_social_history.gc32.erb +0 -8
  263. data/templates/_telecom.gc32.erb +0 -1
  264. data/templates/_vital_sign.gc32.erb +0 -7
@@ -0,0 +1,20 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- Functional Status Result Observation (consolidation) template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.67"/>
5
+ <!-- Functional Status, Result template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.28"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="completed"/>
11
+
12
+ <effectiveTime>
13
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
14
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
15
+ </effectiveTime>
16
+
17
+ <!-- Result -->
18
+ <%== render(:partial => 'result_value', :locals => {:entry => entry}) %>
19
+ </observation>
20
+ </entry>
@@ -0,0 +1,24 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.3"/>
4
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
5
+ <%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
6
+ <text><%= entry.description %></text>
7
+ <statusCode code="completed"/>
8
+
9
+ <effectiveTime>
10
+ <low <%= value_or_null_flavor(entry.as_point_in_time) %>/>
11
+ </effectiveTime>
12
+
13
+ <participant typeCode="AUT">
14
+ <participantRole classCode="ASSIGNED">
15
+ <code code="158965000" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical Practitioner"/>
16
+ </participantRole>
17
+ </participant>
18
+
19
+ <participant typeCode="IRCP">
20
+ <participantRole classCode="PAT"/>
21
+ </participant>
22
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
23
+ </act>
24
+ </entry>
@@ -0,0 +1,20 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="RQO">
3
+ <!-- Plan of Care Activity Act template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.39"/>
5
+ <!-- Intervention Order template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.31"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ <statusCode code="completed"/>
10
+ <author>
11
+ <time <%= value_or_null_flavor(entry.as_point_in_time) %>/>
12
+ <assignedAuthor>
13
+ <id root="<%= UUID.generate %>"/>
14
+ </assignedAuthor>
15
+ </author>
16
+ <effectiveTime>
17
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
18
+ </effectiveTime>
19
+ </act>
20
+ </entry>
@@ -0,0 +1,15 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Consolidation CDA: Procedure Activity Act template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.12"/>
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.32"/>
6
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
7
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
8
+ <statusCode code="completed"/>
9
+ <effectiveTime>
10
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
11
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
12
+ </effectiveTime>
13
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
14
+ </act>
15
+ </entry>
@@ -0,0 +1,58 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN">
3
+ <!-- Consolidation CDA: Procedure Activity Act template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.12"/>
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.34"/>
6
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
7
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
8
+ <statusCode code="completed"/>
9
+ <effectiveTime>
10
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
11
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
12
+ </effectiveTime>
13
+ <entryRelationship typeCode="REFR">
14
+ <observation classCode="OBS" moodCode="EVN">
15
+ <!-- Result Observation template (consolidation) -->
16
+ <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
17
+ <!-- Result template -->
18
+ <templateId root="2.16.840.1.113883.10.20.24.3.87"/>
19
+ <id root="<%= UUID.generate %>"/>
20
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
21
+ <statusCode code="completed"/>
22
+ <effectiveTime <%= value_or_null_flavor(entry.start_time) %>/>
23
+ <% ev = entry.values.first
24
+ if ev.present?
25
+ if ev.respond_to?(:codes) -%>
26
+ <%== code_display(ev, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'tag_name' => 'value', 'extra_content' => "xsi:type=\"CD\"") %>
27
+ <% elsif ev.respond_to?(:scalar) -%>
28
+ <% if is_num?(ev.scalar) -%>
29
+ <value xsi:type="PQ" value="<%= ev.scalar %>" <% if ev.units -%>unit="<%= ev.units %>"<% end -%>/>
30
+ <% elsif is_bool?(ev.scalar)%>
31
+ <value xsi:type="BL" value="<%= ev.scalar %>" />
32
+ <% else -%>
33
+ <value xsi:type="ST" ><%= ev.scalar %></value>
34
+ <% end
35
+ end
36
+ else -%>
37
+ <value xsi:type="PQ" nullFlavor="UNK"/>
38
+ <% end -%>
39
+
40
+ <!-- Attribute: Status -->
41
+ <entryRelationship typeCode="REFR">
42
+ <observation classCode="OBS" moodCode="EVN">
43
+ <templateId root="2.16.840.1.113883.10.20.24.3.93"/>
44
+ <id root="<%= UUID.generate %>"/>
45
+ <code code="33999-4"
46
+ codeSystem="2.16.840.1.113883.6.1"
47
+ codeSystemName="LOINC"
48
+ displayName="Status"/>
49
+ <value xsi:type="CD"
50
+ code="33999-4"
51
+ codeSystem="2.16.840.1.113883.6.1"
52
+ displayName="Final Report"/>
53
+ </observation>
54
+ </entryRelationship>
55
+ </observation>
56
+ </entryRelationship>
57
+ </act>
58
+ </entry>
@@ -0,0 +1,20 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="RQO">
3
+ <!-- Consolidation Plan of Care Activity Observation -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.44"/>
5
+ <!-- Lab Test Order -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.37"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="new"/>
11
+
12
+ <!-- Attribute: datetime -->
13
+ <author>
14
+ <time <%= value_or_null_flavor(entry.as_point_in_time) %>/>
15
+ <assignedAuthor>
16
+ <id nullFlavor="NA" root="<%= UUID.generate %>"/>
17
+ </assignedAuthor>
18
+ </author>
19
+ </observation>
20
+ </entry>
@@ -0,0 +1,16 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Lab test performed -->
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.38"/>
5
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
6
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
7
+ <text><%= entry.description %></text>
8
+ <statusCode code="completed"/>
9
+
10
+ <effectiveTime>
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
13
+ </effectiveTime>
14
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
15
+ </observation>
16
+ </entry>
@@ -0,0 +1,27 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Communication from provider to provider -->
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.4"/>
5
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
6
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
7
+ <text><%= entry.description %></text>
8
+ <statusCode code="completed"/>
9
+
10
+ <effectiveTime>
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ </effectiveTime>
13
+
14
+ <participant typeCode="AUT">
15
+ <participantRole classCode="ASSIGNED">
16
+ <code code="158965000" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical Practitioner"/>
17
+ </participantRole>
18
+ </participant>
19
+
20
+ <participant typeCode="IRCP">
21
+ <participantRole classCode="ASSIGNED">
22
+ <code code="158965000" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical Practitioner"/>
23
+ </participantRole>
24
+ </participant>
25
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
26
+ </act>
27
+ </entry>
@@ -0,0 +1,17 @@
1
+ <entry>
2
+ <!--Laboratory test, result -->
3
+ <observation classCode="OBS" moodCode="EVN">
4
+ <!-- Result Observation (consolidation) template -->
5
+ <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
6
+ <!-- Laboratory Test, Result template -->
7
+ <templateId root="2.16.840.1.113883.10.20.24.3.40"/>
8
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
9
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
10
+ <text><%= entry.description %></text>
11
+ <statusCode code="completed"/>
12
+ <effectiveTime>
13
+ <low value="<%= entry.start_time %>"/>
14
+ </effectiveTime>
15
+ <%== render(:partial => 'result_value', :locals => {:entry => entry}) %>
16
+ </observation>
17
+ </entry>
@@ -0,0 +1,38 @@
1
+ <entry>
2
+ <substanceAdministration classCode="SBADM" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Medication Activity (consolidation) template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.16"/>
5
+ <!-- Medication, Active template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.41"/>
7
+
8
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="active"/>
11
+ <effectiveTime xsi:type="IVL_TS">
12
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
13
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
14
+ </effectiveTime>
15
+
16
+ <%== render(:partial => 'medication_details', :locals => {:entry => entry}) %>
17
+
18
+
19
+ <% if entry.product_form.present? -%>
20
+ <administrationUnitCode code="<%= entry.product_form['code'] %>" codeSystem="<%= entry.product_form['codeSystem'] %>"/>
21
+ <% end -%>
22
+
23
+ <consumable>
24
+ <manufacturedProduct classCode="MANU">
25
+ <!-- Medication Information (consolidation) template -->
26
+ <templateId root="2.16.840.1.113883.10.20.22.4.23"/>
27
+ <id root="<%= UUID.generate %>"/>
28
+ <manufacturedMaterial>
29
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
30
+ </manufacturedMaterial>
31
+ <manufacturerOrganization>
32
+ <name>Medication Factory Inc.</name>
33
+ </manufacturerOrganization>
34
+ </manufacturedProduct>
35
+ </consumable>
36
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
37
+ </substanceAdministration>
38
+ </entry>
@@ -0,0 +1,38 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Medication, Administered template -->
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.42"/>
5
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
6
+ <code code="416118004" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Administration"/>
7
+ <statusCode code="completed"/>
8
+ <effectiveTime xsi:type="IVL_TS">
9
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
10
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
11
+ </effectiveTime>
12
+ <entryRelationship typeCode="COMP">
13
+ <substanceAdministration classCode="SBADM" moodCode="EVN">
14
+ <!-- Medication Activity (consolidation) template -->
15
+ <templateId root="2.16.840.1.113883.10.20.22.4.16"/>
16
+ <id root="<%= UUID.generate %>"/>
17
+ <text><%= entry.description %></text>
18
+ <statusCode code="completed"/>
19
+ <effectiveTime xsi:type="IVL_TS">
20
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
21
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
22
+ </effectiveTime>
23
+ <%== render(:partial => 'medication_details', :locals => {:entry => entry}) %>
24
+ <consumable>
25
+ <manufacturedProduct classCode="MANU">
26
+ <!-- Medication Information (consolidation) template -->
27
+ <templateId root="2.16.840.1.113883.10.20.22.4.23"/>
28
+ <id root="<%= UUID.generate %>"/>
29
+ <manufacturedMaterial>
30
+ <%== code_display(entry, 'preferred_code_sets' => ['RxNorm', 'CVX', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
31
+ </manufacturedMaterial>
32
+ </manufacturedProduct>
33
+ </consumable>
34
+ </substanceAdministration>
35
+ </entryRelationship>
36
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
37
+ </act>
38
+ </entry>
@@ -0,0 +1,24 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- consolidation CDA Allergy observation template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.7"/>
5
+ <!-- Medication Allergy -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.43"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <code code="ASSERTION" displayName="Assertion" codeSystem="2.16.840.1.113883.5.4" codeSystemName="ActCode"/>
9
+ <statusCode code="completed"/>
10
+ <effectiveTime>
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ </effectiveTime>
13
+ <value code="62014003" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Adverse drug effect" xsi:type="CD"/>
14
+
15
+ <participant typeCode="CSM">
16
+ <participantRole classCode="MANU">
17
+ <playingEntity classCode="MMAT">
18
+ <%== code_display(entry, 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
19
+ <name><%= entry.description %></name>
20
+ </playingEntity>
21
+ </participantRole>
22
+ </participant>
23
+ </observation>
24
+ </entry>
@@ -0,0 +1,24 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- consolidation CDA Allergy observation template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.7"/>
5
+ <!-- Medication Allergy -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.44"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <code code="ASSERTION" displayName="Assertion" codeSystem="2.16.840.1.113883.5.4" codeSystemName="ActCode"/>
9
+ <statusCode code="completed"/>
10
+ <effectiveTime>
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ </effectiveTime>
13
+ <value code="416098002" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Drug allergy" xsi:type="CD"/>
14
+
15
+ <participant typeCode="CSM">
16
+ <participantRole classCode="MANU">
17
+ <playingEntity classCode="MMAT">
18
+ <%== code_display(entry, 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
19
+ <name><%= entry.description %></name>
20
+ </playingEntity>
21
+ </participantRole>
22
+ </participant>
23
+ </observation>
24
+ </entry>
@@ -0,0 +1,26 @@
1
+ <entry>
2
+ <!--Medication dispensed -->
3
+ <supply classCode="SPLY" moodCode="EVN">
4
+ <!-- Medication Dispensed template -->
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.45"/>
6
+ <!-- Medication Dispense template -->
7
+ <templateId root="2.16.840.1.113883.10.20.22.4.18"/>
8
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="completed"/>
11
+ <effectiveTime xsi:type="IVL_TS">
12
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
13
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
14
+ </effectiveTime>
15
+ <product>
16
+ <manufacturedProduct classCode="MANU">
17
+ <!-- Medication Information (consolidation) template -->
18
+ <templateId root="2.16.840.1.113883.10.20.22.4.23"/>
19
+ <id root="<%= UUID.generate %>"/>
20
+ <manufacturedMaterial>
21
+ <%== code_display(entry, :extra_content => "sdtc:valueSet=\"#{value_set_oid}\"") %>
22
+ </manufacturedMaterial>
23
+ </manufacturedProduct>
24
+ </product>
25
+ </supply>
26
+ </entry>
@@ -0,0 +1,30 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- consolidation CDA Allergy Observation template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.7"/>
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.46"/>
6
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
7
+ <code code="ASSERTION"
8
+ displayName="Assertion"
9
+ codeSystem="2.16.840.1.113883.5.4"
10
+ codeSystemName="ActCode"/>
11
+ <statusCode code="completed"/>
12
+ <effectiveTime>
13
+ <low value="<%= entry.start_time %>"/>
14
+ </effectiveTime>
15
+ <value xsi:type="CD"
16
+ code="59037007"
17
+ displayName="Drug intolerance"
18
+ codeSystem="2.16.840.1.113883.6.96"
19
+ codeSystemName="SNOMED CT"/>
20
+
21
+ <participant typeCode="CSM">
22
+ <participantRole classCode="MANU">
23
+ <playingEntity classCode="MMAT">
24
+ <%== code_display(entry, 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
25
+ <text><%= entry.description %></text>
26
+ </playingEntity>
27
+ </participantRole>
28
+ </participant>
29
+ </observation>
30
+ </entry>
@@ -0,0 +1,26 @@
1
+ <entry>
2
+ <!--Medication Order -->
3
+ <substanceAdministration classCode="SBADM" moodCode="RQO" <%== negation_indicator(entry) %>>
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.42"/>
5
+ <!-- Medication, Order template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.47"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <text><%= entry.description %></text>
9
+ <statusCode code="new"/>
10
+ <effectiveTime xsi:type="IVL_TS">
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
13
+ </effectiveTime>
14
+ <consumable>
15
+ <manufacturedProduct classCode="MANU">
16
+ <!-- Medication Information (consolidation) template -->
17
+ <templateId root="2.16.840.1.113883.10.20.22.4.23"/>
18
+ <id root="<%= UUID.generate %>"/>
19
+ <manufacturedMaterial>
20
+ <%== code_display(entry, 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
21
+ </manufacturedMaterial>
22
+ </manufacturedProduct>
23
+ </consumable>
24
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
25
+ </substanceAdministration>
26
+ </entry>