health-data-standards 3.5.3 → 3.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -3
  3. data/README.md +10 -2
  4. data/lib/health-data-standards.rb +5 -28
  5. data/lib/health-data-standards/export/cat_1.rb +3 -2
  6. data/lib/health-data-standards/export/cat_1_r2.rb +11 -0
  7. data/lib/health-data-standards/ext/node.rb +1 -2
  8. data/lib/health-data-standards/import/bulk_record_importer.rb +4 -4
  9. data/lib/health-data-standards/import/bundle/importer.rb +62 -0
  10. data/lib/health-data-standards/import/c32/insurance_provider_importer.rb +10 -8
  11. data/lib/health-data-standards/import/cat1/patient_importer.rb +3 -3
  12. data/lib/health-data-standards/import/cat1/procedure_importer.rb +42 -0
  13. data/lib/health-data-standards/import/cda/medication_importer.rb +11 -11
  14. data/lib/health-data-standards/import/cda/section_importer.rb +13 -7
  15. data/lib/health-data-standards/models/cqm/aggregate_objects.rb +5 -1
  16. data/lib/health-data-standards/models/cqm/bundle.rb +5 -3
  17. data/lib/health-data-standards/models/cqm/measure.rb +1 -1
  18. data/lib/health-data-standards/models/entry.rb +5 -1
  19. data/lib/health-data-standards/models/record.rb +10 -0
  20. data/lib/health-data-standards/models/reference.rb +23 -0
  21. data/lib/health-data-standards/models/svs/value_set.rb +4 -3
  22. data/lib/health-data-standards/railtie.rb +1 -1
  23. data/lib/health-data-standards/tasks.rb +1 -0
  24. data/lib/health-data-standards/tasks/bundle.rake +84 -2
  25. data/lib/health-data-standards/util/vs_api.rb +40 -7
  26. data/lib/health-data-standards/validate/base_validator.rb +23 -0
  27. data/lib/health-data-standards/validate/data_validator.rb +85 -0
  28. data/lib/health-data-standards/validate/measure_validator.rb +127 -0
  29. data/lib/health-data-standards/validate/performance_rate_validator.rb +94 -0
  30. data/lib/health-data-standards/validate/reported_result_extractor.rb +170 -0
  31. data/lib/health-data-standards/validate/schema_validator.rb +24 -0
  32. data/lib/health-data-standards/validate/schematron/c_processor.rb +28 -0
  33. data/lib/health-data-standards/validate/schematron/java_processor.rb +93 -0
  34. data/lib/health-data-standards/validate/schematron_validator.rb +34 -0
  35. data/lib/health-data-standards/validate/validation_error.rb +10 -0
  36. data/lib/health-data-standards/validate/validators.rb +80 -0
  37. data/lib/hqmf-generator/fulfills.xml.erb +7 -0
  38. data/lib/hqmf-generator/hqmf-generator.rb +8 -3
  39. data/lib/hqmf-model/data_criteria.rb +3 -0
  40. data/lib/hqmf-model/types.rb +29 -0
  41. data/lib/hqmf-parser/2.0/data_criteria.rb +7 -0
  42. data/lib/hqmf-parser/2.0/types.rb +24 -0
  43. data/resources/schema/infrastructure/cda/CDA_SDTC.xsd +44 -0
  44. data/resources/schema/infrastructure/cda/POCD_MT000040_SDTC.xsd +1500 -0
  45. data/resources/schema/infrastructure/cda/SDTC.xsd +210 -0
  46. data/resources/schema/processable/coreschemas/NarrativeBlock.xsd +557 -0
  47. data/resources/schema/processable/coreschemas/datatypes-base_SDTC.xsd +1850 -0
  48. data/resources/schema/processable/coreschemas/datatypes.xsd +1375 -0
  49. data/resources/schema/processable/coreschemas/infrastructureRoot.xsd +27 -0
  50. data/resources/schema/processable/coreschemas/voc.xsd +2124 -0
  51. data/resources/schematron/iso-schematron-xslt1/ExtractSchFromRNG.xsl +75 -0
  52. data/resources/schematron/iso-schematron-xslt1/ExtractSchFromXSD.xsl +77 -0
  53. data/resources/schematron/iso-schematron-xslt1/iso_abstract_expand.xsl +297 -0
  54. data/resources/schematron/iso-schematron-xslt1/iso_dsdl_include.xsl +1509 -0
  55. data/resources/schematron/iso-schematron-xslt1/iso_schematron_message.xsl +55 -0
  56. data/resources/schematron/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1844 -0
  57. data/resources/schematron/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +605 -0
  58. data/resources/schematron/iso-schematron-xslt1/readme.txt +101 -0
  59. data/resources/schematron/iso-schematron-xslt1/schematron-skeleton-api.htm +723 -0
  60. data/resources/schematron/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl +75 -0
  61. data/resources/schematron/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl +77 -0
  62. data/resources/schematron/iso-schematron-xslt2/iso_abstract_expand.xsl +297 -0
  63. data/resources/schematron/iso-schematron-xslt2/iso_dsdl_include.xsl +1508 -0
  64. data/resources/schematron/iso-schematron-xslt2/iso_schematron_message_xslt2.xsl +55 -0
  65. data/resources/schematron/iso-schematron-xslt2/iso_schematron_skeleton_for_saxon.xsl +2299 -0
  66. data/resources/schematron/iso-schematron-xslt2/iso_svrl_for_xslt2.xsl +684 -0
  67. data/resources/schematron/iso-schematron-xslt2/readme.txt +100 -0
  68. data/resources/schematron/iso-schematron-xslt2/sch-messages-cs.xhtml +56 -0
  69. data/resources/schematron/iso-schematron-xslt2/sch-messages-de.xhtml +57 -0
  70. data/resources/schematron/iso-schematron-xslt2/sch-messages-en.xhtml +57 -0
  71. data/resources/schematron/iso-schematron-xslt2/sch-messages-fr.xhtml +54 -0
  72. data/resources/schematron/iso-schematron-xslt2/sch-messages-nl.xhtml +58 -0
  73. data/resources/schematron/iso-schematron-xslt2/schematron-skeleton-api.htm +723 -0
  74. data/resources/schematron/qrda/cat_1/CDAR2_QRDA_I_R1_D3_2015MAY_Schematron.sch +4676 -0
  75. data/resources/schematron/qrda/cat_1/voc.xml +1177 -0
  76. data/resources/schematron/qrda/cat_1_r2/QRDA Category I Release 2.sch +4069 -0
  77. data/resources/schematron/qrda/cat_1_r2/voc.xml +1065 -0
  78. data/resources/schematron/qrda/cat_3/QRDA Category III.sch +675 -0
  79. data/resources/schematron/qrda/cat_3/voc.xml +21 -0
  80. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.26.cat1.erb +18 -0
  81. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +4 -0
  82. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.38.cat1.erb +5 -1
  83. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.4.cat1.erb +1 -0
  84. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +20 -0
  85. data/templates/cat1/_fulfills.cat1.erb +14 -0
  86. data/templates/cat1/_organization.cat1.erb +2 -1
  87. data/templates/cat1/_patient_data.cat1.erb +1 -1
  88. data/templates/cat1/show.cat1.erb +5 -4
  89. data/templates/cat3/_performance_rate.cat3.erb +5 -1
  90. data/templates/cat3/show.cat3.erb +1 -1
  91. metadata +128 -109
  92. data/lib/health-data-standards/export/ccr.rb +0 -417
  93. data/lib/health-data-standards/export/green_c32/entry.rb +0 -18
  94. data/lib/health-data-standards/export/green_c32/export_generator.rb +0 -23
  95. data/lib/health-data-standards/export/green_c32/record.rb +0 -18
  96. data/lib/health-data-standards/export/helper/gc32_view_helper.rb +0 -39
  97. data/lib/health-data-standards/import/ccr/patient_importer.rb +0 -238
  98. data/lib/health-data-standards/import/ccr/product_importer.rb +0 -60
  99. data/lib/health-data-standards/import/ccr/provider_importer.rb +0 -49
  100. data/lib/health-data-standards/import/ccr/result_importer.rb +0 -49
  101. data/lib/health-data-standards/import/ccr/section_importer.rb +0 -135
  102. data/lib/health-data-standards/import/ccr/simple_importer.rb +0 -30
  103. data/lib/health-data-standards/import/green_c32/advance_directive_importer.rb +0 -14
  104. data/lib/health-data-standards/import/green_c32/allergy_importer.rb +0 -20
  105. data/lib/health-data-standards/import/green_c32/care_goal_importer.rb +0 -26
  106. data/lib/health-data-standards/import/green_c32/condition_importer.rb +0 -38
  107. data/lib/health-data-standards/import/green_c32/encounter_importer.rb +0 -33
  108. data/lib/health-data-standards/import/green_c32/immunization_importer.rb +0 -23
  109. data/lib/health-data-standards/import/green_c32/medical_equipment_importer.rb +0 -24
  110. data/lib/health-data-standards/import/green_c32/medication_importer.rb +0 -68
  111. data/lib/health-data-standards/import/green_c32/patient_importer.rb +0 -14
  112. data/lib/health-data-standards/import/green_c32/procedure_importer.rb +0 -27
  113. data/lib/health-data-standards/import/green_c32/result_importer.rb +0 -43
  114. data/lib/health-data-standards/import/green_c32/section_importer.rb +0 -186
  115. data/lib/health-data-standards/import/green_c32/social_history_importer.rb +0 -13
  116. data/lib/health-data-standards/import/green_c32/support_importer.rb +0 -22
  117. data/lib/health-data-standards/import/green_c32/vital_sign_importer.rb +0 -21
  118. data/templates/gc32/_address.gc32.erb +0 -9
  119. data/templates/gc32/_advance_directive.gc32.erb +0 -5
  120. data/templates/gc32/_allergy.gc32.erb +0 -12
  121. data/templates/gc32/_care_goal.gc32.erb +0 -8
  122. data/templates/gc32/_condition.gc32.erb +0 -10
  123. data/templates/gc32/_encounter.gc32.erb +0 -28
  124. data/templates/gc32/_entry.gc32.erb +0 -3
  125. data/templates/gc32/_entry_attributes.gc32.erb +0 -10
  126. data/templates/gc32/_immunization.gc32.erb +0 -9
  127. data/templates/gc32/_insurance_provider.gc32.erb +0 -28
  128. data/templates/gc32/_medical_equipment.gc32.erb +0 -6
  129. data/templates/gc32/_medication.gc32.erb +0 -91
  130. data/templates/gc32/_name.gc32.erb +0 -11
  131. data/templates/gc32/_organization.gc32.erb +0 -10
  132. data/templates/gc32/_person_attributes.gc32.erb +0 -7
  133. data/templates/gc32/_procedure.gc32.erb +0 -9
  134. data/templates/gc32/_provider.gc32.erb +0 -9
  135. data/templates/gc32/_result.gc32.erb +0 -12
  136. data/templates/gc32/_social_history.gc32.erb +0 -6
  137. data/templates/gc32/_support.gc32.erb +0 -15
  138. data/templates/gc32/_telecom.gc32.erb +0 -1
  139. data/templates/gc32/_vital_sign.gc32.erb +0 -4
  140. data/templates/gc32/record.gc32.erb +0 -97
@@ -1,43 +0,0 @@
1
- module HealthDataStandards
2
- module Import
3
- module GreenC32
4
- class ResultImporter < SectionImporter
5
-
6
- include Singleton
7
-
8
- #-------------------------------------------------------------------------------
9
-
10
- def initialize
11
- super
12
- @range = "./gc32:referenceRange"
13
- @interpretation = "./gc32:interpretation"
14
- @klass = LabResult
15
- @base_xpath = "./gc32:result"
16
- end
17
-
18
- #-------------------------------------------------------------------------------
19
-
20
- def import(result_xml)
21
- result_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
22
-
23
- result_element = result_xml.xpath(@base_xpath)
24
- lab_result = @klass.new(reference_range: extract_node_text(result_element.xpath(@range)))
25
-
26
- extract_result(result_element, lab_result)
27
-
28
- lab_result
29
- end
30
-
31
- #-------------------------------------------------------------------------------
32
- private
33
- #-------------------------------------------------------------------------------
34
-
35
- def extract_result(result_element, lab_result)
36
- extract_entry(result_element, lab_result)
37
- extract_code(result_element, lab_result, @interpretation, :interpretation)
38
- end
39
-
40
- end
41
- end
42
- end
43
- end
@@ -1,186 +0,0 @@
1
- require "time"
2
-
3
- module HealthDataStandards
4
- module Import
5
- module GreenC32
6
- class SectionImporter
7
-
8
- def initialize
9
- @description = "./gc32:code/gc32:originalText"
10
- @status = "./gc32:status"
11
- @value = "./gc32:value"
12
- end
13
-
14
-
15
- def import(entry_xml)
16
- generic_import(entry_xml)
17
- end
18
-
19
- def generic_import(element_xml, element_name="entry")
20
- entry = Entry.new
21
- element_xml.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
22
- element = element_xml.at_xpath("./gc32:#{element_name}")
23
- extract_entry(element, entry)
24
- entry
25
- end
26
-
27
- def extract_code(element, entry, xpath="./gc32:code", attribute=:codes)
28
-
29
- code_element = element.at_xpath(xpath)
30
-
31
- return unless code_element
32
-
33
- codes = build_code(code_element)
34
-
35
- code_element.xpath("./gc32:translation").each do |trans|
36
- codes.merge!(build_code(trans))
37
- end
38
-
39
- entry.write_attribute(attribute, codes)
40
- end
41
-
42
- def extract_description(element, entry)
43
- description = element.at_xpath(@description)
44
- entry.description = extract_node_text(description)
45
- end
46
-
47
- def extract_status(element, entry)
48
- status = extract_node_text(element.at_xpath(@status))
49
- return unless status
50
- entry.status = status
51
- end
52
-
53
- def extract_effective_time(element, entry)
54
- if element.at_xpath("./gc32:effectiveTime/gc32:start")
55
- extract_interval(element,entry)
56
- else
57
- extract_time(element, entry)
58
- end
59
- end
60
-
61
- def extract_name(element, entry, name_element="name")
62
- name_element = element.at_xpath("./gc32:#{name_element}")
63
- return unless name_element
64
- entry.title = name_element.at_xpath("./gc32:title").try(:content)
65
- entry.given_name = name_element.at_xpath("./gc32:givenName").try(:content)
66
- entry.family_name = name_element.at_xpath("./gc32:familyName").try(:content)
67
- end
68
-
69
- def extract_time(element, entry, xpath = "./gc32:effectiveTime", attribute = "time")
70
- datetime = element.at_xpath(xpath)
71
-
72
- return unless datetime && datetime['value']
73
-
74
- entry.write_attribute(attribute, Time.parse(datetime['value']).utc.to_i)
75
- end
76
-
77
- def extract_interval(element, entry, element_name="effectiveTime")
78
- extract_time(element, entry, "./gc32:#{element_name}/gc32:start", "start_time")
79
- extract_time(element, entry, "./gc32:#{element_name}/gc32:end", "end_time")
80
- end
81
-
82
- def extract_quantity(element, xpath)
83
- value_element = element.at_xpath(xpath)
84
-
85
- return unless value_element
86
-
87
- node_value = extract_node_attribute(value_element, "amount", true)
88
- node_units = extract_node_attribute(value_element, "unit")
89
-
90
- return {} unless node_value
91
-
92
- {"scalar" => node_value, "units" => node_units}
93
- end
94
-
95
- def extract_value(element, entry)
96
- pq = extract_quantity(element, @value)
97
- if pq.present?
98
- entry.values << PhysicalQuantityResultValue.new(pq)
99
- end
100
- end
101
-
102
- def extract_entry(element, entry)
103
- extract_code(element, entry)
104
- extract_description(element, entry)
105
- extract_status(element, entry)
106
- extract_value(element, entry)
107
- extract_effective_time(element, entry)
108
- entry.description = element.at_xpath("./gc32:freeText").try(:inner_text)
109
- entry
110
- end
111
-
112
- def extract_organization(organization_element)
113
- org_id = extract_node_text(organization_element.xpath("./gc32:id"))
114
- organization = org_id ? Organization.find(org_id) : Organization.new
115
- organization ||= Organization.new
116
- # if organization.new_record?
117
- # else
118
- organization.name = extract_node_text(organization_element.xpath("./gc32:name"))
119
- organization.addresses = organization_element.xpath("./gc32:address").map { |addr| extract_address(addr) }
120
- organization.telecoms = organization_element.xpath("./gc32:telecom").map { |tele| extract_telecom(tele) }
121
- # organization.save!
122
- # end
123
-
124
- return organization
125
- end
126
-
127
- def extract_facility(facility_element)
128
- facility = Facility.new
129
- facility.name = extract_node_text(facility_element.xpath("./gc32:name"))
130
- facility.addresses = facility_element.xpath("./gc32:address").map { |addr| extract_address(addr) }
131
- facility.telecoms = facility_element.xpath("./gc32:telecom").map { |tele| extract_telecom(tele) }
132
- start_time = facility_element.at_xpath("./gc32:duration/gc32:start").try(:text)
133
- if start_time
134
- facility.start_time = Time.parse(start_time).utc.to_i
135
- end
136
- end_time = facility_element.at_xpath("./gc32:duration/gc32:end").try(:text)
137
- if end_time
138
- facility.end_time = Time.parse(end_time).utc.to_i
139
- end
140
- facility
141
- end
142
-
143
- def extract_address(address_element)
144
- return unless address_element
145
- address = Address.new
146
- address.use = address_element['use']
147
- address.street = address_element.xpath("./gc32:street").map { |st| extract_node_text(st) }
148
- address.city = extract_node_text(address_element.xpath("./gc32:city"))
149
- address.state = extract_node_text(address_element.xpath("./gc32:state"))
150
- address.zip = extract_node_text(address_element.xpath("./gc32:postalCode"))
151
- address
152
- end
153
-
154
- def extract_telecom(telecom_element)
155
- return unless telecom_element
156
- telecom = Telecom.new
157
- telecom.use = extract_node_attribute(telecom_element, :type)
158
- telecom.value = extract_node_attribute(telecom_element, :value)
159
- telecom.preferred = extract_node_attribute(telecom_element, :preferred)
160
- telecom
161
- end
162
-
163
- private
164
-
165
- def build_code(code_element)
166
- code_system_oid = extract_node_attribute(code_element, "codeSystem")
167
- code = extract_node_attribute(code_element, "code")
168
- code_system = HealthDataStandards::Util::CodeSystemHelper.code_system_for(code_system_oid)
169
- {code_system => [code]}
170
- end
171
-
172
- def extract_node_attribute(node, attribute_name, to_num=false)
173
- return if node.nil? || (node.respond_to?(:empty?) && node.empty?)
174
- attribute = node.attribute(attribute_name.to_s)
175
- value = attribute ? attribute.value : nil
176
- return unless value && value != ""
177
- to_num ? value.to_f : value
178
- end
179
-
180
- def extract_node_text(node)
181
- node ? node.inner_text : nil
182
- end
183
- end
184
- end
185
- end
186
- end
@@ -1,13 +0,0 @@
1
- module HealthDataStandards
2
- module Import
3
- module GreenC32
4
- class SocialHistoryImporter < SectionImporter
5
- include Singleton
6
-
7
- def import(sh_xml)
8
- generic_import(sh_xml, "socialHistory")
9
- end
10
- end
11
- end
12
- end
13
- end
@@ -1,22 +0,0 @@
1
- module HealthDataStandards
2
- module Import
3
- module GreenC32
4
- class SupportImporter < SectionImporter
5
- include Singleton
6
-
7
- def import(support_doc)
8
- support_doc.root.add_namespace_definition('gc32', "urn:hl7-org:greencda:c32")
9
- support_element = support_doc.at_xpath("./gc32:support")
10
- support = Support.new(type: support_element.at_xpath("./gc32:type").try(:content),
11
- relationship: support_element.at_xpath("./gc32:relationship").try(:text))
12
- extract_name(support_element, support)
13
- support.address = extract_address(support_element.at_xpath("./gc32:address"))
14
- support.telecom = extract_telecom(support_element.at_xpath("./gc32:telecom"))
15
- support.mothers_maiden_name = support_element.at_xpath("./gc32:mothersMaidenName").try(:text)
16
- support
17
- end
18
-
19
- end
20
- end
21
- end
22
- end
@@ -1,21 +0,0 @@
1
- module HealthDataStandards
2
- module Import
3
- module GreenC32
4
- # This really needs to get refactored to share code with result importer
5
- class VitalSignImporter < ResultImporter
6
-
7
- include Singleton
8
-
9
- #-------------------------------------------------------------------------------
10
-
11
- def initialize
12
- super
13
- @range = "./gc32:referenceRange"
14
- @klass = VitalSign
15
- @base_xpath = "./gc32:vitalSign"
16
- end
17
-
18
- end
19
- end
20
- end
21
- end
@@ -1,9 +0,0 @@
1
- <% tag_name ||= "address"%>
2
- <<%=tag_name%>>
3
- <% address.street.each do |street| %>
4
- <street><%= street %></street>
5
- <% end %>
6
- <city><%= address.city %></city>
7
- <state><%= address.state %></state>
8
- <postalCode><%= address.zip %></postalCode>
9
- </<%=tag_name%>>
@@ -1,5 +0,0 @@
1
- <advanceDirective xmlns="urn:hl7-org:greencda:c32">
2
- <%== gc32_code_display advance_directive, 'preferred_code_sets' => ['SNOMED-CT'] %>
3
- <%== gc32_effective_time(advance_directive)%>
4
- <freeText><%= advance_directive.description %></freeText>
5
- </advanceDirective>
@@ -1,12 +0,0 @@
1
- <allergy xmlns="urn:hl7-org:greencda:c32" id="<%=allergy.id%>">
2
- <%== render partial: "entry_attributes", locals: {entry: allergy, code_sets: ['SNOMED-CT', "RxNorm", "FDA"]}%>
3
- <% if allergy.type %>
4
- <%== gc32_code_display allergy, "tag_name" => "type", "attribute" => "type", 'preferred_code_sets' => ['RxNorm', 'SNOMED-CT'] %>
5
- <% end %>
6
- <% if allergy.reaction && allergy.reaction['code'] %>
7
- <reaction code="<%= allergy.reaction['code'] %>" codeSystem="<%= allergy.reaction['code_system'] %>" />
8
- <% end %>
9
- <% if allergy.severity && !allergy.severity.empty? %>
10
- <%== gc32_code_display allergy, "tag_name" => "severity", "attribute" => "severity", 'preferred_code_sets' => ['SNOMED-CT'] %>
11
- <% end %>
12
- </allergy>
@@ -1,8 +0,0 @@
1
- <%
2
- type = case care_goal
3
- when LabResult then "result"
4
- else
5
- care_goal.class.name.underscore
6
- end
7
- %>
8
- <%== render partial: type, locals: {type => care_goal} %>
@@ -1,10 +0,0 @@
1
- <condition id="<%= condition.id %>" <% unless condition.cause_of_death.nil? %>causeOfDeath="<%= condition.cause_of_death %>"<% end %> xmlns="urn:hl7-org:greencda:c32">
2
- <%== render partial: "entry_attributes", locals: {entry: condition, code_sets: ['SNOMED-CT', "ICD-9-CM", "ICD-10-CM"]}%>
3
- <% if condition.priority %>
4
- <priority><%= condition.priority %></priority>
5
- <% end %>
6
- <type><%= condition.type %></type>
7
- <% condition.treating_provider.each do |tp| %>
8
- <%== render partial: 'provider', locals: {provider: tp} %>
9
- <% end %>
10
- </condition>
@@ -1,28 +0,0 @@
1
- <encounter xmlns="urn:hl7-org:greencda:c32" id="<%= encounter.id %>">
2
- <%== render partial: "entry_attributes", locals: {entry: encounter, code_sets: ["CPT", "SNOMED-CT"]}%>
3
- <% if encounter.discharge_disposition %>
4
- <%== gc32_code_display encounter, "tag_name" => "dischargeDisposition", 'attribute' => "discharge_disposition", 'preferred_code_sets' => ["NUBC"] %>
5
- <% end %>
6
- <% if encounter.admit_type%>
7
- <%== gc32_code_display encounter, "tag_name" => "admissionType", 'attribute' => "admit_type", 'preferred_code_sets' => ["NUBC"] %>
8
- <% end %>
9
- <% if provider %>
10
- <%== render partial: 'provider', locals: {provider: encounter.performer, tag_name: 'performer'}%>
11
- <% end %>
12
- <% facility = encounter.facility %>
13
- <% if facility %>
14
- <facility>
15
- <name><%= facility.name%></name>
16
- <% facility.addresses.each do |addr| %>
17
- <%== render :partial => "address", locals: {address: addr} %>
18
- <% end %>
19
- <% facility.telecoms.each do |tele| %>
20
- <%== render :partial => "telecom", locals: {telecom: tele} %>
21
- <% end %>
22
- <%== gc32_interval(encounter, "duration", :admit_time, :discharge_time) %>
23
- </facility>
24
- <% end %>
25
- <% if encounter.performer %>
26
- <%== render partial: 'provider', locals: {provider: encounter.performer} %>
27
- <% end %>
28
- </encounter>
@@ -1,3 +0,0 @@
1
- <entry xmlns="urn:hl7-org:greencda:c32" id="<%= entry.id %>">
2
- <%== render partial: "entry_attributes", locals: {entry: entry, code_sets: ["SNOMED-CT", "LOINC"]}%>
3
- </entry>
@@ -1,10 +0,0 @@
1
- <% if entry.codes.empty? %>
2
- <code />
3
- <% else %>
4
- <%== gc32_code_display entry, "tag_name" => "code", 'preferred_code_sets' => code_sets %>
5
- <% end %>
6
- <% if entry.status_code && !entry.status_code.empty? %>
7
- <%== gc32_code_display entry, "tag_name" => "status", "attribute" => "status_code", 'preferred_code_sets' => ['SNOMED-CT', "HL7 ActStatus"] %>
8
- <% end %>
9
- <freeText><%=entry.description %></freeText>
10
- <%== gc32_effective_time(entry)%>
@@ -1,9 +0,0 @@
1
- <immunization xmlns="urn:hl7-org:greencda:c32" id="<%= immunization.id%>" <% if refused %> refused="true" <% end %>>
2
- <%== render partial: "entry_attributes", locals: {entry: immunization, code_sets: ["RxNorm", "CVX", "FDA"]}%>
3
- <% if immunization.series_number %>
4
- <seriesNumber><%= immunization.series_number %></seriesNumber>
5
- <% end %>
6
- <% if immunization.refusal_reason %>
7
- <%== gc32_code_display immunization, "tag_name" => "refusalReason", "attribute" => "refusal_reason", "preferred_code_sets" => ["HL7 ActNoImmunicationReason"] %>
8
- <% end %>
9
- </immunization>
@@ -1,28 +0,0 @@
1
- <insuranceProvider xmlns="urn:hl7-org:greencda:c32" id="<%=insurance_provider.id%>">
2
- <insuranceType code="<%== insurance_provider.type %>" codeSystem="2.16.840.1.113883.3.88.12.3221.5.2" />
3
- <%== render partial: "organization", locals: {organization: insurance_provider.payer, tag_name: payer} %>
4
- <% if insurance_provider.subscriber %>
5
- <subscriber>
6
- <%== render partial: 'person_attributes', locals: {person: insurance_provider.subscriber} %>
7
- </subscriber>
8
- <% end %>
9
- <% if insurance_provider.relationship %>
10
- <%== gc32_code_display insurance_provider, "attribute" => "relationship", "tag_name" => "relationshipToSubscriber" %>
11
- <% end %>
12
- <% insurance_provider.guarantors.each do |g| %>
13
- <guarantor>
14
- <%== gc32_interval(insurance_provider, "financialResponsibilityDateRange", :start_time, :end_time) %>
15
- <% if g.organization %>
16
- <%== render partial: 'organization', locals: {organization: g.organization}%>
17
- <% elsif g.person%>
18
- <person>
19
- <%== render partial: 'person_attributes', locals: {person: g.person} %>
20
- </person>
21
- <% end %>
22
- </guarantor>
23
- <% end %>
24
- <healthPlanName><%=insurance_provider.name%></healthPlanName>
25
- <% if insurance_provider.description%>
26
- <freeText><%= insurance_provider.description%></freeText>
27
- <% end %>
28
- </insuranceProvider>
@@ -1,6 +0,0 @@
1
- <medicalEquipment xmlns="urn:hl7-org:greencda:c32" id="<%= medical_equipment.id%>">
2
- <%== render partial: "entry_attributes", locals: {entry: medical_equipment, code_sets: ["SNOMED-CT", "LOINC"]}%>
3
- <% if medical_equipment.values.first %>
4
- <%== quantity_display medical_equipment.values.first, "quantity" %>
5
- <% end %>
6
- </medicalEquipment>
@@ -1,91 +0,0 @@
1
- <medication xmlns="urn:hl7-org:greencda:c32" id="<%=medication.id%>">
2
- <%== render partial: "entry_attributes", locals: {entry: medication, code_sets: ["RxNorm", "CVX", "FDA"]}%>
3
- <% if medication.administration_timing %>
4
- <administrationTiming institutionSpecified="<%= medication.administration_timing['institution_specified'] %>">
5
- <period amount="<%=medication.administration_timing['period']['value'] %>" unit="<%= medication.administration_timing['period']['unit']%>" />
6
- </administrationTiming>
7
- <% end %>
8
- <% if medication.route %>
9
- <%== gc32_code_display medication, "tag_name" => "route", "attribute" => "route", "preferred_code_sets" => ["NCI Thesaurus"] %>
10
- <% end %>
11
- <% if medication.site %>
12
- <%== gc32_code_display medication, "tag_name" => "site", "attribute" => "site", "preferred_code_sets" => ["SNOMED-CT"] %>
13
- <% end %>
14
- <%== quantity_display medication.dose, :dose %>
15
- <% if medication.dose_indicator %>
16
- <doseIndication><%=medication.dose_indicator%></doseIndication>
17
- <% end %>
18
- <% if medication.dose_restriction %>
19
- <doseRestriction>
20
- <numerator><%= medication.dose_restriction["numerator"]%></numerator>
21
- <denominator><%= medication.dose_restriction["denominator"]%></denominator>
22
- </doseRestriction>
23
- <% end %>
24
- <% if medication.product_form %>
25
- <%== gc32_code_display medication, "tag_name" => "productForm", "attribute" => "product_form", "preferred_code_sets" => ["FDA", "NCI Thesaurus"] %>
26
- <% end %>
27
- <% if medication.delivery_method %>
28
- <%== gc32_code_display medication, "tag_name" => "deliveryMethod", "attribute" => "delivery_method", "preferred_code_sets" => medication.delivery_method.keys %>
29
- <% end %>
30
- <% if medication.type_of_medication%>
31
- <%== gc32_code_display medication, "tag_name" => "type", "attribute" => "type_of_medication", "preferred_code_sets" => ["SNOMED-CT"] %>
32
- <% end %>
33
- <% if medication.status_of_medication%>
34
- <%== gc32_code_display medication, "tag_name" => "statusOfMedication", "attribute" => "status_of_medication", "preferred_code_sets" => ["SNOMED-CT"] %>
35
- <% end %>
36
- <%if medication.indication%>
37
- <%== gc32_code_display medication, "tag_name" => "indication", "attribute" => "indication", "preferred_code_sets" => ["SNOMED-CT"] %>
38
- <% end %>
39
- <% if medication.vehicle %>
40
- <%== gc32_code_display medication, "tag_name" => "vehicle", "attribute" => "vehicle", "preferred_code_sets" => ["SNOMED-CT"] %>
41
- <% end%>
42
- <% if medication.dose_indicator %>
43
- <doseIndicator><%= medication.dose_indicator %></doseIndicator>
44
- <% end %>
45
- <% if medication.patient_instructions %>
46
- <patientInstructions><%=medication.patient_instructions%></patientInstructions>
47
- <% end %>
48
- <% if medication.fulfillment_instructions %>
49
- <fulfillmentInstructions><%=medication.fulfillment_instructions%></fulfillmentInstructions>
50
- <% end %>
51
- <% medication.fulfillment_history.each do |fh| %>
52
- <fulfillmentHistory <%if (fh.fill_status) %> fillStatus="<%=fh.fill_status%>" <% end %>
53
- <% if fh.fill_number %> fillNumber="<%=fh.fill_number%>" <% end %>>
54
- <prescriptionNumber><%=fh.prescription_number%></prescriptionNumber>
55
- <% if fh.dispense_date %>
56
- <dispenseDate value="<%=Time.at(fh.dispense_date).xmlschema%>" />
57
- <% end %>
58
- <%== quantity_display fh.quantity_dispensed, :quantityDispensed %>
59
- </fulfillmentHistory>
60
- <% end %>
61
- <% medication.order_information.each do |oi| %>
62
- <orderInformation <% if oi.order_number %><%== "orderNumber=\"#{oi.order_number}\"" %> <% end %> <% if oi.fills %><%== "fills=\"#{oi.fills}\"" %><% end %>>
63
- <% if oi.quantity_ordered %>
64
- <%== quantity_display oi.quantity_ordered, "quantityOrdered" %>
65
- <% end %>
66
- <% if oi.order_date_time %>
67
- <orderedDateTime value="<%=Time.at(oi.order_date_time).xmlschema%>" />
68
- <% end %>
69
- <% if oi.order_expiration_date_time %>
70
- <expirationDateTime value="<%=Time.at(oi.order_expiration_date_time).xmlschema%>" />
71
- <% end %>
72
- </orderInformation>
73
- <% end %>
74
- <% include_providers ||= false %>
75
- <% if include_providers %>
76
- <prescribers>
77
- <% medication.order_information.each do |oi| %>
78
- <% if oi.provider %>
79
- <%== render partial: 'provider', locals: {provider: oi.provider, tag_name: 'prescriber'} %>
80
- <% end %>
81
- <% end %>
82
- </prescribers>
83
- <pharmacists>
84
- <% medication.fulfillment_history.each do |fh| %>
85
- <% if oi.provider %>
86
- <%== render partial: 'provider', locals: {provider: fh.provider, tag_name: 'pharmacist'} %>
87
- <% end %>
88
- <% end %>
89
- </pharmacists>
90
- <% end %>
91
- </medication>