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
File without changes
@@ -0,0 +1,18 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.22.4.85"/>
4
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
5
+ <code code="ASSERTION"
6
+ displayName="Assertion"
7
+ codeSystem="2.16.840.1.113883.5.4"
8
+ codeSystemName="ActCode"/>
9
+ <statusCode code="completed"/>
10
+ <effectiveTime>
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
13
+ </effectiveTime>
14
+ <%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT'],
15
+ 'tag_name' => 'value',
16
+ 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
17
+ </observation>
18
+ </entry>
@@ -0,0 +1,14 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="GOL">
3
+ <!-- 2.16.840.1.113883.10.20.22.4.44 Plan of Care Activity Observation -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.44"/>
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.1"/>
6
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
7
+ <%== code_display(entry, :extra_content => "sdtc:valueSet=\"#{value_set_oid}\"") %>
8
+ <text><%= entry.description %></text>
9
+ <statusCode code="active"/>
10
+ <effectiveTime>
11
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
12
+ </effectiveTime>
13
+ </observation>
14
+ </entry>
@@ -0,0 +1,25 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.101"/>
4
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
5
+ <code code="57036006"
6
+ codeSystem="2.16.840.1.113883.6.96"
7
+ codeSystemName="SNOMED-CT"
8
+ displayName="length of gestation"/>
9
+
10
+ <statusCode code="completed"/>
11
+ <effectiveTime <%= value_or_null_flavor(entry.as_point_in_time) %>/>
12
+ <!-- ?Note: valueSet of PQ "d" and "wk"-->
13
+ <value xsi:type="PQ"
14
+ <% if entry.codes['SNOMED-CT'].include?('80487005')-%>
15
+ value="39"
16
+ <% elsif entry.codes['SNOMED-CT'].include?('931004')-%>
17
+ value="36"
18
+ <% elsif entry.codes['SNOMED-CT'].include?('43697006')-%>
19
+ value="37"
20
+ <% else -%>
21
+ nullFlavor="UNK"
22
+ <% end -%>
23
+ unit="wk"/>
24
+ </observation>
25
+ </entry>
@@ -0,0 +1,12 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <templateId root="2.16.840.1.113883.10.20.24.3.103"/>
4
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
5
+ <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4" />
6
+ <statusCode code="completed" />
7
+ <effectiveTime <%= value_or_null_flavor(entry.start_time) %>/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT'],
9
+ 'tag_name' => 'value',
10
+ 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
11
+ </observation>
12
+ </entry>
@@ -0,0 +1,60 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN">
3
+ <!-- Discharge Medication Entry -->
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.105"/>
5
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
6
+ <code code="10183-2"
7
+ codeSystem="2.16.840.1.113883.6.1"
8
+ codeSystemName="LOINC"
9
+ displayName="Discharge medication"/>
10
+ <statusCode code="active"/>
11
+ <effectiveTime>
12
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
13
+ </effectiveTime>
14
+ <entryRelationship typeCode="SUBJ">
15
+ <substanceAdministration moodCode="EVN" classCode="SBADM">
16
+ <!-- Medication Activity (consolidation) template -->
17
+ <templateId root="2.16.840.1.113883.10.20.22.4.16"/>
18
+ <!-- Medication, Active template -->
19
+ <templateId root="2.16.840.1.113883.10.20.24.3.41"/>
20
+
21
+ <id root="<%= UUID.generate %>"/>
22
+ <text><%= entry.description %></text>
23
+ <statusCode code="active"/>
24
+ <effectiveTime xsi:type="IVL_TS">
25
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
26
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
27
+ </effectiveTime>
28
+
29
+ <% if entry.route.present? -%>
30
+ <!-- Attribute: route -->
31
+ <routeCode code="<%= entry.route['code'] %>" codeSystem="<%= entry.route['codeSystem'] %>"/>
32
+ <% end -%>
33
+
34
+ <!-- Attribute: dose -->
35
+ <% if entry.dose.present? -%>
36
+ <doseQuantity value="<%= entry.dose['value']%>"/>
37
+ <% end -%>
38
+
39
+
40
+ <% if entry.product_form.present? -%>
41
+ <administrationUnitCode code="<%= entry.product_form['code'] %>" codeSystem="<%= entry.product_form['codeSystem'] %>"/>
42
+ <% end -%>
43
+
44
+ <consumable>
45
+ <manufacturedProduct classCode="MANU">
46
+ <!-- Medication Information (consolidation) template -->
47
+ <templateId root="2.16.840.1.113883.10.20.22.4.23"/>
48
+ <id root="<%= UUID.generate %>"/>
49
+ <manufacturedMaterial>
50
+ <%== code_display(entry, :extra_content => "sdtc:valueSet=\"#{value_set_oid}\"") %>
51
+ </manufacturedMaterial>
52
+ <manufacturerOrganization>
53
+ <name>Medication Factory Inc.</name>
54
+ </manufacturerOrganization>
55
+ </manufacturedProduct>
56
+ </consumable>
57
+ </substanceAdministration>
58
+ </entryRelationship>
59
+ </act>
60
+ </entry>
@@ -0,0 +1,41 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- Problem observation template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.4"/>
5
+ <!-- Diagnosis active template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.11"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <code code="282291009" displayName="diagnosis" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="completed"/>
11
+ <effectiveTime>
12
+ <!-- Attribute: admission datetime -->
13
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
14
+ <!-- Attribute: discharge datetime -->
15
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
16
+ </effectiveTime>
17
+ <%== render(:partial => 'ordinality', :locals => {:entry => entry}) %>
18
+
19
+ <%== code_display(entry, {'tag_name' => 'value', 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'],
20
+ 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\""}) %>
21
+
22
+ <entryRelationship typeCode="REFR">
23
+ <observation classCode="OBS" moodCode="EVN">
24
+ <!-- Problem Status (consolidation) template -->
25
+ <templateId root="2.16.840.1.113883.10.20.22.4.6"/>
26
+ <!-- Problem Status, Active template -->
27
+ <templateId root="2.16.840.1.113883.10.20.24.3.94"/>
28
+ <id root="<%= UUID.generate %>"/>
29
+ <code code="33999-4"
30
+ codeSystem="2.16.840.1.113883.6.1"
31
+ codeSystemName="LOINC"
32
+ displayName="status"/>
33
+ <statusCode code="completed"/>
34
+ <value xsi:type="CD" code="55561003"
35
+ displayName="active"
36
+ codeSystem="2.16.840.1.113883.6.96"
37
+ codeSystemName="SNOMED CT"/>
38
+ </observation>
39
+ </entryRelationship>
40
+ </observation>
41
+ </entry>
@@ -0,0 +1,50 @@
1
+ <entry typeCode="DRIV">
2
+ <organizer moodCode="EVN" classCode="CLUSTER">
3
+ <templateId root="2.16.840.1.113883.10.20.22.4.45"/>
4
+ <!-- Family history organizer template -->
5
+ <templateId root="2.16.840.1.113883.10.20.24.3.12"/>
6
+ <statusCode code="completed"/>
7
+ <effectiveTime>
8
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
9
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
10
+ </effectiveTime>
11
+ <!-- The subject is currently hardcoded to father -->
12
+ <subject>
13
+ <relatedSubject classCode="PRS">
14
+ <code code="FTH" displayName="Father"
15
+ codeSystemName="HL7RoleCode"
16
+ codeSystem="2.16.840.1.113883.5.111">
17
+ <translation code="9947008"
18
+ displayName="Biological father"
19
+ codeSystemName="SNOMED CT"
20
+ codeSystem="2.16.840.1.113883.6.96"/>
21
+ </code>
22
+ <subject>
23
+ <administrativeGenderCode
24
+ code="M" codeSystem="2.16.840.1.113883.5.1"
25
+ codeSystemName="HL7AdministrativeGender"
26
+ displayName="Male"/>
27
+ <birthTime value="1912"/>
28
+ </subject>
29
+ </relatedSubject>
30
+ </subject>
31
+ <component>
32
+ <observation classCode="OBS" moodCode="EVN">
33
+ <templateId root="2.16.840.1.113883.10.20.22.4.46"/>
34
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
35
+ <code code="55607006" displayName="Problem"
36
+ codeSystemName="SNOMED CT"
37
+ codeSystem="2.16.840.1.113883.6.96"/>
38
+ <statusCode code="completed"/>
39
+ <effectiveTime>
40
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
41
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
42
+ </effectiveTime>
43
+ <%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT'],
44
+ 'tag_name' => 'value',
45
+ 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
46
+ </observation>
47
+ </component>
48
+ </organizer>
49
+ </entry>
50
+
@@ -0,0 +1,37 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- Problem observation template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.4"/>
5
+ <!-- Diagnosis, inactive template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.13"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <code code="282291009" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="diagnosis"/>
9
+
10
+ <statusCode code="completed"/>
11
+
12
+ <effectiveTime>
13
+ <!-- Attribute: Start Datetime -->
14
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
15
+ <!-- Attribute: Stop Datetime -->
16
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
17
+ </effectiveTime>
18
+ <%== render(:partial => 'ordinality', :locals => {:entry => entry}) %>
19
+
20
+ <%== code_display(entry, 'tag_name' => 'value', 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'LOINC'], 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
21
+ <!-- Status -->
22
+ <entryRelationship typeCode="REFR">
23
+ <observation classCode="OBS" moodCode="EVN">
24
+ <!-- Problem Status (consolidation) template -->
25
+ <templateId root="2.16.840.1.113883.10.20.22.4.6"/>
26
+ <!-- Problem Status, Inactive template -->
27
+ <templateId root="2.16.840.1.113883.10.20.24.3.95"/>
28
+ <id root="<%= UUID.generate %>"/>
29
+ <code code="33999-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="status"/>
30
+ <statusCode code="completed"/>
31
+ <value code="73425007" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="inactive" xsi:type="CD"/>
32
+ </observation>
33
+
34
+ </entryRelationship>
35
+
36
+ </observation>
37
+ </entry>
@@ -0,0 +1,35 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN">
3
+ <!-- Problem observation template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.4"/>
5
+ <!-- Diagnosis, resolved template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.14"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <code code="282291009" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="diagnosis"/>
9
+
10
+ <statusCode code="completed"/>
11
+ <effectiveTime>
12
+ <!-- Attribute: Start Datetime -->
13
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
14
+ <!-- Attribute: Stop Datetime -->
15
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
16
+ </effectiveTime>
17
+ <%== render(:partial => 'ordinality', :locals => {:entry => entry}) %>
18
+
19
+ <%== code_display(entry, 'tag_name' => 'value', 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'CPT'],
20
+ 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
21
+ <!-- Status -->
22
+ <entryRelationship typeCode="REFR">
23
+ <observation classCode="OBS" moodCode="EVN">
24
+ <!-- Problem Status (consolidation) template -->
25
+ <templateId root="2.16.840.1.113883.10.20.22.4.6"/>
26
+ <!-- Problem Status, Resolved template -->
27
+ <templateId root="2.16.840.1.113883.10.20.24.3.96"/>
28
+ <id root="<%= UUID.generate %>"/>
29
+ <code code="33999-4" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="status"/>
30
+ <statusCode code="completed"/>
31
+ <value code="413322009" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="resolved" xsi:type="CD"/>
32
+ </observation>
33
+ </entryRelationship>
34
+ </observation>
35
+ </entry>
@@ -0,0 +1,22 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="RQO">
3
+ <!-- Consolidated Plan of Care Activity Observation
4
+ templateId (Implied Template) -->
5
+ <templateId root="2.16.840.1.113883.10.20.22.4.44"/>
6
+ <!-- Diagnostic Study, Order template -->
7
+ <templateId root="2.16.840.1.113883.10.20.24.3.17"/>
8
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
9
+ <%== code_display(entry, 'preferred_code_sets' => ['LOINC'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
10
+ <text><%= entry.description %></text>
11
+ <statusCode code="new"/>
12
+
13
+ <!-- Attribute: datetime -->
14
+ <author>
15
+ <time <%= value_or_null_flavor(entry.as_point_in_time) %>/>
16
+ <assignedAuthor>
17
+ <id nullFlavor="NA" root="<%= UUID.generate %>"/>
18
+ </assignedAuthor>
19
+ </author>
20
+
21
+ </observation>
22
+ </entry>
@@ -0,0 +1,21 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Consolidated Procedure Activity Observation templateId
4
+ (Implied Template) -->
5
+ <templateId root="2.16.840.1.113883.10.20.22.4.13"/>
6
+ <!-- Diagnostic Study, Performed template -->
7
+ <templateId root="2.16.840.1.113883.10.20.24.3.18"/>
8
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
9
+ <%== code_display(entry, 'preferred_code_sets' => ['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
+ <!-- Attribute: Start Datetime -->
14
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
15
+ <!-- Attribute: End Datetime -->
16
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
17
+ </effectiveTime>
18
+ <%== render(:partial => 'result_value', :locals => {:entry => entry}) %>
19
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
20
+ </observation>
21
+ </entry>
@@ -0,0 +1,28 @@
1
+ <entry>
2
+ <act classCode="ACT" moodCode="EVN">
3
+ <!-- Communication from patient to provider -->
4
+ <templateId root="2.16.840.1.113883.10.20.24.3.2"/>
5
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
6
+ <%== code_display(entry, :extra_content => "sdtc:valueSet=\"#{value_set_oid}\"") %>
7
+ <text>
8
+ <%= entry.description %>
9
+ </text>
10
+ <statusCode code="completed"/>
11
+ <effectiveTime>
12
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
13
+ </effectiveTime>
14
+
15
+ <participant typeCode="AUT">
16
+ <participantRole classCode="PAT">
17
+ <code code="116154003" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Patient"/>
18
+ </participantRole>
19
+ </participant>
20
+
21
+ <participant typeCode="IRCP">
22
+ <participantRole classCode="ASSIGNED">
23
+ <code code="158965000" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical Practitioner"/>
24
+ </participantRole>
25
+ </participant>
26
+
27
+ </act>
28
+ </entry>
@@ -0,0 +1,20 @@
1
+ <entry>
2
+ <observation classCode="OBS" moodCode="EVN" <%== negation_indicator(entry) %>>
3
+ <!-- Consolidated Result Observation templateId (Implied Template) -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.2"/>
5
+ <!-- Diagnostic Study, Result template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.20"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT', 'LOINC'],
9
+ 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
10
+ <text><%= entry.description %></text>
11
+ <statusCode code="completed"/>
12
+
13
+ <effectiveTime>
14
+ <low <%= value_or_null_flavor(entry.start_time) %>/>
15
+ <high <%= value_or_null_flavor(entry.end_time) %>/>
16
+ </effectiveTime>
17
+ <%== render(:partial => 'result_value', :locals => {:entry => entry}) %>
18
+ <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
19
+ </observation>
20
+ </entry>
@@ -0,0 +1,21 @@
1
+ <entry>
2
+ <encounter classCode="ENC" moodCode="RQO">
3
+ <!-- Plan of Care Activity Encounter template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.40"/>
5
+ <!-- Encounter order template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.22"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <%== code_display(entry, :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.start_time) %>/>
15
+ <assignedAuthor>
16
+ <id root="<%= UUID.generate %>"/>
17
+ </assignedAuthor>
18
+ </author>
19
+
20
+ </encounter>
21
+ </entry>
@@ -0,0 +1,71 @@
1
+ <entry>
2
+ <encounter classCode="ENC" moodCode="EVN">
3
+ <!-- Encounter activities template -->
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.49"/>
5
+ <!-- Encounter performed template -->
6
+ <templateId root="2.16.840.1.113883.10.20.24.3.23"/>
7
+ <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
8
+ <%== code_display(entry, 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'CPT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
9
+ <text><%= entry.description %></text>
10
+ <statusCode code="completed"/>
11
+ <effectiveTime>
12
+ <!-- We try to look for the admit/discharge times on the encounter if they are
13
+ there. If not, we fall back to the typical start/end date. -->
14
+ <low <%= value_or_null_flavor(entry.admit_time || entry.start_time) %>/>
15
+ <high <%= value_or_null_flavor(entry.discharge_time || entry.end_time) %>/>
16
+ </effectiveTime>
17
+ <% if entry.respond_to?(:facility) && entry.facility.present? -%>
18
+ <participant typeCode="LOC">
19
+ <!-- Facility Location template -->
20
+ <templateId root="2.16.840.1.113883.10.20.24.3.100"/>
21
+ <time>
22
+ <!-- Attribute: facility location arrival datetime -->
23
+ <low <%= value_or_null_flavor(entry.facility.start_time) %>/>
24
+ <!-- Attribute: facility location departure datetime -->
25
+ <high <%= value_or_null_flavor(entry.facility.end_time) %>/>
26
+ </time>
27
+ <participantRole classCode="SDLOC">
28
+ <% if entry.facility.code.present? -%>
29
+ <code code="<%= entry.facility.code['code'] %>"
30
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.facility.code['codeSystem'] || entry.facility.code['code_system']) %>"/>
31
+ <% else -%>
32
+ <code nullFlavor="UNK"/>
33
+ <% end -%>
34
+ <% if entry.facility.addresses.present? -%>
35
+ <addr>
36
+ <streetAddressLine><%= entry.facility.addresses.first.street %></streetAddressLine>
37
+ <city><%= entry.facility.addresses.first.city %></city>
38
+ <state><%= entry.facility.addresses.first.state %></state>
39
+ <postalCode><%= entry.facility.addresses.first.zip %></postalCode>
40
+ <country><%= entry.facility.addresses.first.country %></country>
41
+ </addr>
42
+ <% end -%>
43
+ <telecom nullFlavor="UNK"/>
44
+ <playingEntity classCode="PLC">
45
+ <name><%= entry.facility.name %></name>
46
+ </playingEntity>
47
+ </participantRole>
48
+ </participant>
49
+ <% end -%>
50
+ <% if entry.discharge_disposition.present? -%>
51
+ <sdtc:dischargeDispositionCode code="<%= entry.discharge_disposition['code'] %>"
52
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.discharge_disposition['codeSystem'] || entry.discharge_disposition['code_system']) %>"/>
53
+ <% end -%>
54
+ <% if entry.reason.present? -%>
55
+ <entryRelationship typeCode="RSON">
56
+ <observation classCode="OBS" moodCode="EVN">
57
+ <templateId root="2.16.840.1.113883.10.20.24.3.88"/>
58
+ <code code="410666004"
59
+ codeSystem="2.16.840.1.113883.6.96"
60
+ displayName="reason"
61
+ codeSystemName="SNOMED CT"/>
62
+ <statusCode code="completed"/>
63
+ <effectiveTime <%= value_or_null_flavor(entry.start_time) %>/>
64
+ <value xsi:type="CD"
65
+ code="<%= entry.reason['code'] %>"
66
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.reason['codeSystem'] || entry.reason['code_system']) %>"/>
67
+ </observation>
68
+ </entryRelationship>
69
+ <% end -%>
70
+ </encounter>
71
+ </entry>