cqm-reports 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +8 -6
  4. data/lib/qrda-export/catI-r5/qrda_templates/communication_performed.mustache +5 -3
  5. data/lib/qrda-export/catI-r5/qrda_templates/device_order.mustache +4 -4
  6. data/lib/qrda-export/catI-r5/qrda_templates/device_recommended.mustache +4 -4
  7. data/lib/qrda-export/catI-r5/qrda_templates/encounter_order.mustache +4 -4
  8. data/lib/qrda-export/catI-r5/qrda_templates/encounter_performed.mustache +4 -4
  9. data/lib/qrda-export/catI-r5/qrda_templates/encounter_recommended.mustache +4 -4
  10. data/lib/qrda-export/catI-r5/qrda_templates/medication_discharge.mustache +0 -3
  11. data/lib/qrda-export/catI-r5/qrda_templates/medication_dispensed.mustache +4 -4
  12. data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_performed.mustache +4 -0
  13. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_immunization_details.mustache +2 -2
  14. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_details.mustache +5 -1
  15. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_supply_request.mustache +1 -1
  16. data/lib/qrda-export/helper/aggregate_object_helper.rb +1 -1
  17. data/lib/qrda-export/helper/cat1_view_helper.rb +9 -0
  18. data/lib/qrda-import/base-importers/section_importer.rb +25 -22
  19. data/lib/qrda-import/data-element-importers/assessment_order_importer.rb +2 -0
  20. data/lib/qrda-import/data-element-importers/assessment_performed_importer.rb +2 -0
  21. data/lib/qrda-import/data-element-importers/assessment_recommended_importer.rb +2 -0
  22. data/lib/qrda-import/data-element-importers/communication_performed_importer.rb +1 -2
  23. data/lib/qrda-import/data-element-importers/device_applied_importer.rb +2 -0
  24. data/lib/qrda-import/data-element-importers/device_order_importer.rb +2 -0
  25. data/lib/qrda-import/data-element-importers/device_recommended_importer.rb +2 -0
  26. data/lib/qrda-import/data-element-importers/diagnostic_study_order_importer.rb +2 -0
  27. data/lib/qrda-import/data-element-importers/diagnostic_study_performed_importer.rb +2 -0
  28. data/lib/qrda-import/data-element-importers/encounter_order_importer.rb +2 -0
  29. data/lib/qrda-import/data-element-importers/encounter_recommended_importer.rb +2 -0
  30. data/lib/qrda-import/data-element-importers/immunization_administered_importer.rb +2 -0
  31. data/lib/qrda-import/data-element-importers/immunization_order_importer.rb +2 -0
  32. data/lib/qrda-import/data-element-importers/intervention_order_importer.rb +2 -0
  33. data/lib/qrda-import/data-element-importers/intervention_performed_importer.rb +2 -0
  34. data/lib/qrda-import/data-element-importers/intervention_recommended_importer.rb +2 -0
  35. data/lib/qrda-import/data-element-importers/laboratory_test_order_importer.rb +2 -0
  36. data/lib/qrda-import/data-element-importers/laboratory_test_performed_importer.rb +2 -0
  37. data/lib/qrda-import/data-element-importers/laboratory_test_recommended_importer.rb +2 -0
  38. data/lib/qrda-import/data-element-importers/medication_administered_importer.rb +2 -0
  39. data/lib/qrda-import/data-element-importers/medication_dispensed_importer.rb +0 -1
  40. data/lib/qrda-import/data-element-importers/medication_order_importer.rb +2 -0
  41. data/lib/qrda-import/data-element-importers/patient_characteristic_clinical_trial_participant_importer.rb +2 -0
  42. data/lib/qrda-import/data-element-importers/physical_exam_order_importer.rb +2 -0
  43. data/lib/qrda-import/data-element-importers/physical_exam_performed_importer.rb +2 -0
  44. data/lib/qrda-import/data-element-importers/physical_exam_recommended_importer.rb +2 -0
  45. data/lib/qrda-import/data-element-importers/procedure_order_importer.rb +2 -0
  46. data/lib/qrda-import/data-element-importers/procedure_performed_importer.rb +2 -0
  47. data/lib/qrda-import/data-element-importers/procedure_recommended_importer.rb +2 -0
  48. data/lib/qrda-import/data-element-importers/substance_administered_importer.rb +0 -1
  49. data/lib/qrda-import/data-element-importers/substance_order_importer.rb +2 -0
  50. data/lib/qrda-import/data-element-importers/substance_recommended_importer.rb +2 -0
  51. data/lib/qrda-import/patient_importer.rb +1 -1
  52. metadata +14 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f52ee70f2be4c43ccf9c3d918ed805a323d942d1768d5621967c9232ea303c5
4
- data.tar.gz: c866224aca04b6760a35a3fd0f8d78e03c5fe85d9bff0a4d41a8af907eebf995
3
+ metadata.gz: 5d0f8e468a6248c0e952e97d698928a88bc09e4f94703c1164eb4790486c4212
4
+ data.tar.gz: 898c341927cc169c1efae8dd643eefa8d865e84c59d9bb7336e8ed2bfbfae9ff
5
5
  SHA512:
6
- metadata.gz: 42797a2e8c76511344a48f803034e6d5bc4bf1468b5fcd8853f53a10cea295413a96fea7299767dbfcef6b0cf7663e9f9e648715c3f3c7bb412e09391e08bb68
7
- data.tar.gz: 94dc517b00e37117d00eea8ca516103bc3fa21af59457c7697e4299a4d2c92d8f46090fca4103cdfdbaede0aa6e130e3a52e3af1395564d447ccff712959cbd7
6
+ metadata.gz: 486c5a39e5d9612999c4f33fe7254d61e39a349f770fbee3bf0a02fba1072a08c62cdb4033099460e4d4e1426fbb929eae12c2e718ef398c2dcf40beb982f6ca
7
+ data.tar.gz: 0b3c3e5c9eb6a4d0022bdd1c8590779f3b52711de8b758fbc8fb6256214ba8a592f25e94fe25af3f4b77385f7f34fa9ef96a9d73b83e702c50ec0a8914404691
data/Gemfile CHANGED
@@ -28,6 +28,6 @@ group :test do
28
28
  gem 'minitest', '~> 5.3'
29
29
  gem 'minitest-reporters'
30
30
  gem 'awesome_print', :require => 'ap'
31
- gem 'cqm-validators', git: 'https://github.com/projecttacoma/cqm-validators.git', branch: 'master'
31
+ gem 'cqm-validators'
32
32
  gem 'nokogiri-diff'
33
33
  end
data/README.md CHANGED
@@ -4,15 +4,17 @@ A library for import and export of reports for use with electronic Clinical Qual
4
4
  Versioning
5
5
  ==========
6
6
 
7
- Starting with version **1.0.0.0** released on 5/22/2019, cqm-reports versioning has the format **W.X.Y.Z**, where:
7
+ Starting with version **2.0.0** released on 6/20/2019, cqm-reports versioning has the format **X.Y.Z**, where:
8
8
 
9
- * **W** maps to a version of QRDA Category 1 and QRDA Category 3. See the table below to see the existing mapping to QRDA versions.
9
+ * **X** maps to a version of QRDA. See the table below to see the existing mapping to QRDA versions.
10
10
 
11
- | W | QRDA Cat 1 | QRDA Cat 3 |
11
+ | X | QRDA Cat 1 | QRDA Cat 3 |
12
12
  | --- | --- | --- |
13
- | 1 | R1 STU5.1 | R1 STU2.1 |
13
+ | 2 | R1 STU5.1 | R1 STU2.1 |
14
14
 
15
- * **X.Y.Z** uses [SemVer](http://semver.org/) for versioning. **X.Y.Z** starts at 0.0.0 when **W** is incremented.
15
+ * **Y** indicates major changes (incompatible API changes)
16
+
17
+ * **Z** indicates minor changes (added functionality in a backwards-compatible manner) and patch changes (backwards-compatible bug fixes)
16
18
 
17
19
  For the versions available, see [tags on this repository](https://github.com/projecttacoma/cqm-validators/tags).
18
20
 
@@ -24,4 +26,4 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
24
26
 
25
27
  http://www.apache.org/licenses/LICENSE-2.0
26
28
 
27
- Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
29
+ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
@@ -6,6 +6,10 @@
6
6
  <!-- QDM Attribute: Category -->
7
7
  <code {{> _code}}/>
8
8
  {{/category}}
9
+ {{^category}}
10
+ <!-- QDM Attribute: Category -->
11
+ <code nullFlavor="UNK"/>
12
+ {{/category}}
9
13
  <statusCode code="completed"/>
10
14
  {{#relevantPeriod}}
11
15
  <!-- QDM Attribute: Relevant Period -->
@@ -42,8 +46,7 @@
42
46
  <!-- QDM Attribute: Negation Rationale -->
43
47
  {{> qrda_templates/template_partials/_reason}}
44
48
  {{/negationRationale}}
45
- {{^negationRationale}}
46
- <entryRelationship typeCode="RSON">
49
+ <entryRelationship typeCode="REFR">
47
50
  <observation classCode="OBS" moodCode="EVN">
48
51
  <templateId root="2.16.840.1.113883.10.20.24.3.88" extension="2014-12-01"/>
49
52
  <id root="1.3.6.1.4.1.115" extension="{{object_id}}" />
@@ -53,7 +56,6 @@
53
56
  {{> qrda_templates/template_partials/_data_element_codes_as_values}}
54
57
  </observation>
55
58
  </entryRelationship>
56
- {{/negationRationale}}
57
59
  {{#relatedTo}}
58
60
  <!-- QDM Attribute: relatedTo -->
59
61
  {{> qrda_templates/template_partials/_related_to}}
@@ -28,11 +28,11 @@
28
28
  <!-- QDM Attribute: Reason -->
29
29
  {{> qrda_templates/template_partials/_reason}}
30
30
  {{/reason}}
31
- {{#negationRationale}}
32
- <!-- QDM Attribute: Negation Rationale -->
33
- {{> qrda_templates/template_partials/_reason}}
34
- {{/negationRationale}}
35
31
  </supply>
36
32
  </entryRelationship>
33
+ {{#negationRationale}}
34
+ <!-- QDM Attribute: Negation Rationale -->
35
+ {{> qrda_templates/template_partials/_reason}}
36
+ {{/negationRationale}}
37
37
  </act>
38
38
  </entry>
@@ -27,11 +27,11 @@
27
27
  <!-- QDM Attribute: Reason -->
28
28
  {{> qrda_templates/template_partials/_reason}}
29
29
  {{/reason}}
30
- {{#negationRationale}}
31
- <!-- QDM Attribute: Negation Rationale -->
32
- {{> qrda_templates/template_partials/_reason}}
33
- {{/negationRationale}}
34
30
  </supply>
35
31
  </entryRelationship>
32
+ {{#negationRationale}}
33
+ <!-- QDM Attribute: Negation Rationale -->
34
+ {{> qrda_templates/template_partials/_reason}}
35
+ {{/negationRationale}}
36
36
  </act>
37
37
  </entry>
@@ -25,11 +25,11 @@
25
25
  <!-- QDM Attribute: Reason -->
26
26
  {{> qrda_templates/template_partials/_reason}}
27
27
  {{/reason}}
28
- {{#negationRationale}}
29
- <!-- QDM Attribute: Negation Rationale -->
30
- {{> qrda_templates/template_partials/_reason}}
31
- {{/negationRationale}}
32
28
  </encounter>
33
29
  </entryRelationship>
30
+ {{#negationRationale}}
31
+ <!-- QDM Attribute: Negation Rationale -->
32
+ {{> qrda_templates/template_partials/_reason}}
33
+ {{/negationRationale}}
34
34
  </act>
35
35
  </entry>
@@ -42,11 +42,11 @@
42
42
  <!-- QDM Attribute: Diagnoses -->
43
43
  {{> qrda_templates/template_partials/_encounter_diagnosis}}
44
44
  {{/diagnoses}}
45
- {{#negationRationale}}
46
- <!-- QDM Attribute: Negation Rationale -->
47
- {{> qrda_templates/template_partials/_reason}}
48
- {{/negationRationale}}
49
45
  </encounter>
50
46
  </entryRelationship>
47
+ {{#negationRationale}}
48
+ <!-- QDM Attribute: Negation Rationale -->
49
+ {{> qrda_templates/template_partials/_reason}}
50
+ {{/negationRationale}}
51
51
  </act>
52
52
  </entry>
@@ -27,11 +27,11 @@
27
27
  <!-- QDM Attribute: Reason -->
28
28
  {{> qrda_templates/template_partials/_reason}}
29
29
  {{/reason}}
30
- {{#negationRationale}}
31
- <!-- QDM Attribute: Negation Rationale -->
32
- {{> qrda_templates/template_partials/_reason}}
33
- {{/negationRationale}}
34
30
  </encounter>
35
31
  </entryRelationship>
32
+ {{#negationRationale}}
33
+ <!-- QDM Attribute: Negation Rationale -->
34
+ {{> qrda_templates/template_partials/_reason}}
35
+ {{/negationRationale}}
36
36
  </act>
37
37
  </entry>
@@ -35,9 +35,6 @@
35
35
  {{#authorDatetime}}
36
36
  {{> qrda_templates/template_partials/_author_participation}}
37
37
  {{/authorDatetime}}
38
- {{#negationRationale}}
39
- {{> qrda_templates/template_partials/_reason}}
40
- {{/negationRationale}}
41
38
  </substanceAdministration>
42
39
  </entryRelationship>
43
40
  {{#reason}}
@@ -60,11 +60,11 @@
60
60
  {{> qrda_templates/template_partials/_medication_supply_request}}
61
61
  </entryRelationship>
62
62
  {{/supply}}
63
- {{#negationRationale}}
64
- <!-- QDM Attribute: Negation Rationale -->
65
- {{> qrda_templates/template_partials/_reason}}
66
- {{/negationRationale}}
67
63
  </supply>
68
64
  </entryRelationship>
65
+ {{#negationRationale}}
66
+ <!-- QDM Attribute: Negation Rationale -->
67
+ {{> qrda_templates/template_partials/_reason}}
68
+ {{/negationRationale}}
69
69
  </act>
70
70
  </entry>
@@ -17,6 +17,10 @@
17
17
  <!-- QDM Attribute: Result -->
18
18
  {{{result_value}}}
19
19
  {{/result}}
20
+ {{^result}}
21
+ <!-- QDM Attribute: Result -->
22
+ <value xsi:type="CD" nullFlavor="UNK"/>
23
+ {{/result}}
20
24
  {{#method}}
21
25
  <!-- QDM Attribute: Method -->
22
26
  {{> qrda_templates/template_partials/_method}}
@@ -8,7 +8,7 @@
8
8
  {{/negated}}
9
9
  {{^negated}}
10
10
  {{#dosage}}
11
- <!-- QDM Attribute: Dosage -->
12
- <doseQuantity value="{{value}}" unit="{{unit}}"/>
11
+ <!-- QDM Attribute: Dosage -->
12
+ {{{dose_quantity_value}}}
13
13
  {{/dosage}}
14
14
  {{/negated}}
@@ -30,7 +30,11 @@
30
30
  {{/negated}}
31
31
  {{^negated}}
32
32
  {{#dosage}}
33
+ <!-- QDM Attribute: Dosage -->
34
+ {{{dose_quantity_value}}}
35
+ {{/dosage}}
36
+ {{^dosage}}
33
37
  <!-- QDM Attribute: Dosage -->
34
- <doseQuantity value="{{value}}" unit="{{unit}}"/>
38
+ <doseQuantity nullFlavor="UNK"/>
35
39
  {{/dosage}}
36
40
  {{/negated}}
@@ -13,5 +13,5 @@
13
13
  {{{author_effective_time}}}
14
14
  {{/authorDatetime}}
15
15
  {{/relevantPeriod}}
16
- <quantity value="{{value}}"/>
16
+ <quantity value="{{{value_as_float}}}"/>
17
17
  </supply>
@@ -120,7 +120,7 @@ module Qrda
120
120
  end
121
121
  entry_populations << population if population
122
122
  end
123
- return if population_groups.find {|pg| pg.populations.collect(&:id).sort == entry_populations.collect(&:id).sort }
123
+ return if population_groups.find {|pg| pg.populations.collect(&:id).compact.sort == entry_populations.collect(&:id).compact.sort }
124
124
 
125
125
  pg = PopulationGroup.new
126
126
  pg.populations = entry_populations
@@ -51,6 +51,15 @@ module Qrda
51
51
  translation_list
52
52
  end
53
53
 
54
+ def value_as_float
55
+ self['value'].to_f
56
+ end
57
+
58
+ def dose_quantity_value
59
+ return "<doseQuantity value=\"#{value_as_float}\" unit=\"#{self['unit']}\"/>" if self['unit']
60
+ "<doseQuantity value=\"#{value_as_float}\" />"
61
+ end
62
+
54
63
  def result_value
55
64
  return "<value xsi:type=\"CD\" nullFlavor=\"UNK\"/>" unless self['result']
56
65
 
@@ -49,7 +49,7 @@ module QRDA
49
49
  if @result_xpath
50
50
  entry.result = extract_result_values(entry_element)
51
51
  end
52
- extract_reason_or_negation(entry_element, entry)
52
+ extract_negation(entry_element, entry)
53
53
  entry
54
54
  end
55
55
 
@@ -125,8 +125,7 @@ module QRDA
125
125
  # If a Direct Reference Code isn't found, return nil
126
126
  return nil unless key
127
127
  # If a Direct Reference Code is found, return that code
128
- oid = value[:codeSystem] || value[:codeSystemOid]
129
- QDM::Code.new(key, oid)
128
+ QDM::Code.new(key, value[:code_system])
130
129
  end
131
130
 
132
131
  def extract_frequency_in_hours(parent_element, frequency_xpath)
@@ -158,32 +157,36 @@ module QRDA
158
157
 
159
158
  value = value_element['value']
160
159
  if value.present?
161
- return value.strip.to_i if (value_element['unit'] == "1" || value_element['unit'].nil?)
160
+ return value.strip.to_f if (value_element['unit'] == "1" || value_element['unit'].nil?)
162
161
 
163
- return QDM::Quantity.new(value.strip.to_i, value_element['unit'])
162
+ return QDM::Quantity.new(value.strip.to_f, value_element['unit'])
164
163
  elsif value_element['code'].present?
165
164
  return code_if_present(value_element)
166
165
  end
167
166
  end
168
167
 
169
- # extracts the reason or negation data. if an element is negated and the code has a null flavor, a random code is assigned for calculation
170
- # coded_parent_element is the 'parent' element when the coded is nested (e.g., medication order)
171
- def extract_reason_or_negation(parent_element, entry, coded_parent_element = nil)
172
- coded_parent_element ||= parent_element
173
- reason_element = parent_element.xpath(".//cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value | .//cda:entryRelationship[@typeCode='RSON']/cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.1.27']/cda:code")
168
+ def extract_reason(parent_element)
169
+ return unless @reason_xpath
170
+ reason_element = parent_element.xpath(@reason_xpath)
174
171
  negation_indicator = parent_element['negationInd']
175
- unless reason_element.blank?
176
- if negation_indicator.eql?('true')
177
- entry.negationRationale = code_if_present(reason_element.first)
178
- else
179
- entry.reason = code_if_present(reason_element.first) unless @entry_does_not_have_reason
180
- end
181
- end
182
- extract_negated_code(coded_parent_element, entry)
172
+ # Return and do not set reason attribute if the entry is negated
173
+ return nil if negation_indicator.eql?('true')
174
+
175
+ reason_element.blank? ? nil : code_if_present(reason_element.first)
176
+ end
177
+
178
+ def extract_negation(parent_element, entry)
179
+ negation_element = parent_element.xpath("./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value")
180
+ negation_indicator = parent_element['negationInd']
181
+ # Return and do not set negationRationale attribute if the entry is not negated
182
+ return unless negation_indicator.eql?('true')
183
+
184
+ entry.negationRationale = code_if_present(negation_element.first) unless negation_element.blank?
185
+ extract_negated_code(parent_element, entry)
183
186
  end
184
187
 
185
- def extract_negated_code(coded_parent_element, entry)
186
- code_elements = coded_parent_element.xpath(@code_xpath)
188
+ def extract_negated_code(parent_element, entry)
189
+ code_elements = parent_element.xpath(@code_xpath)
187
190
  code_elements.each do |code_element|
188
191
  if code_element['nullFlavor'] == 'NA' && code_element['sdtc:valueSet']
189
192
  entry.dataElementCodes = [{ code: code_element['sdtc:valueSet'], codeSystemOid: '1.2.3.4.5.6.7.8.9.10' }]
@@ -193,9 +196,9 @@ module QRDA
193
196
 
194
197
  def extract_scalar(parent_element, scalar_xpath)
195
198
  scalar_element = parent_element.at_xpath(scalar_xpath)
196
- return unless scalar_element
199
+ return unless scalar_element && scalar_element['value'].present?
197
200
 
198
- QDM::Quantity.new(scalar_element['value'].to_i, scalar_element['unit'])
201
+ QDM::Quantity.new(scalar_element['value'].to_f, scalar_element['unit'])
199
202
  end
200
203
 
201
204
  def extract_components(parent_element)
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::AssessmentOrder
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  assessment_order = super
15
+ assessment_order.reason = extract_reason(entry_element)
14
16
  assessment_order
15
17
  end
16
18
 
@@ -9,6 +9,7 @@ module QRDA
9
9
  @result_xpath = "./cda:value"
10
10
  @method_xpath = './cda:methodCode'
11
11
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
12
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
12
13
  @entry_class = QDM::AssessmentPerformed
13
14
  end
14
15
 
@@ -16,6 +17,7 @@ module QRDA
16
17
  assessment_performed = super
17
18
  assessment_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
18
19
  assessment_performed.components = extract_components(entry_element)
20
+ assessment_performed.reason = extract_reason(entry_element)
19
21
  assessment_performed
20
22
  end
21
23
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::AssessmentRecommended
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  assessment_recommended = super
15
+ assessment_recommended.reason = extract_reason(entry_element)
14
16
  assessment_recommended
15
17
  end
16
18
 
@@ -3,9 +3,8 @@ module QRDA
3
3
  class CommunicationPerformedImporter < SectionImporter
4
4
  def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.156']"))
5
5
  super(entry_finder)
6
- @entry_does_not_have_reason = true
7
6
  @id_xpath = './cda:id'
8
- @code_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
7
+ @code_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
8
  @author_datetime_xpath = "./cda:author/cda:time"
10
9
  @relevant_period_xpath = "./cda:effectiveTime"
11
10
  @related_to_xpath = "./sdtc:inFulfillmentOf1/sdtc:actReference"
@@ -8,12 +8,14 @@ module QRDA
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
9
  @relevant_period_xpath = "./cda:effectiveTime"
10
10
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
11
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
11
12
  @entry_class = QDM::DeviceApplied
12
13
  end
13
14
 
14
15
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
15
16
  device_applied = super
16
17
  device_applied.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
18
+ device_applied.reason = extract_reason(entry_element)
17
19
  device_applied
18
20
  end
19
21
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.9']/cda:id"
7
7
  @code_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.9']/cda:participant/cda:participantRole/cda:playingDevice/cda:code"
8
8
  @author_datetime_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.9']/cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.9']/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::DeviceOrder
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  device_order = super
15
+ device_order.reason = extract_reason(entry_element)
14
16
  device_order
15
17
  end
16
18
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.10']/cda:id"
7
7
  @code_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.10']/cda:participant/cda:participantRole/cda:playingDevice/cda:code"
8
8
  @author_datetime_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.10']/cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.10']/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::DeviceRecommended
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  device_recommended = super
15
+ device_recommended.reason = extract_reason(entry_element)
14
16
  device_recommended
15
17
  end
16
18
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::DiagnosticStudyOrder
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  diagnostic_study_order = super
15
+ diagnostic_study_order.reason = extract_reason(entry_element)
14
16
  diagnostic_study_order
15
17
  end
16
18
 
@@ -13,6 +13,7 @@ module QRDA
13
13
  @method_xpath = './cda:methodCode'
14
14
  @facility_locations_xpath = "./cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']"
15
15
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
16
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
16
17
  @entry_class = QDM::DiagnosticStudyPerformed
17
18
  end
18
19
 
@@ -24,6 +25,7 @@ module QRDA
24
25
  diagnostic_study_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
25
26
  diagnostic_study_performed.facilityLocation = extract_facility_locations(entry_element)[0]
26
27
  diagnostic_study_performed.components = extract_components(entry_element)
28
+ diagnostic_study_performed.reason = extract_reason(entry_element)
27
29
  diagnostic_study_performed
28
30
  end
29
31
 
@@ -7,12 +7,14 @@ module QRDA
7
7
  @code_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:code"
8
8
  @author_datetime_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:author/cda:time"
9
9
  @facility_locations_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']"
10
+ @reason_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.22']/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
10
11
  @entry_class = QDM::EncounterOrder
11
12
  end
12
13
 
13
14
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
15
  encounter_order = super
15
16
  encounter_order.facilityLocation = extract_facility_locations(entry_element)[0]
17
+ encounter_order.reason = extract_reason(entry_element)
16
18
  encounter_order
17
19
  end
18
20
 
@@ -7,12 +7,14 @@ module QRDA
7
7
  @code_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.24']/cda:code"
8
8
  @author_datetime_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.24']/cda:author/cda:time"
9
9
  @facility_locations_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.24']/cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']"
10
+ @reason_xpath = "./cda:entryRelationship/cda:encounter[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.24']/cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
10
11
  @entry_class = QDM::EncounterRecommended
11
12
  end
12
13
 
13
14
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
15
  encounter_recommended = super
15
16
  encounter_recommended.facilityLocation = extract_facility_locations(entry_element)[0]
17
+ encounter_recommended.reason = extract_reason(entry_element)
16
18
  encounter_recommended
17
19
  end
18
20
 
@@ -8,6 +8,7 @@ module QRDA
8
8
  @author_datetime_xpath = "./cda:effectiveTime"
9
9
  @dosage_xpath = "./cda:doseQuantity"
10
10
  @route_xpath = "./cda:routeCode"
11
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
11
12
  @entry_class = QDM::ImmunizationAdministered
12
13
  end
13
14
 
@@ -15,6 +16,7 @@ module QRDA
15
16
  immunization_administered = super
16
17
  immunization_administered.dosage = extract_scalar(entry_element, @dosage_xpath)
17
18
  immunization_administered.route = code_if_present(entry_element.at_xpath(@route_xpath))
19
+ immunization_administered.reason = extract_reason(entry_element)
18
20
  immunization_administered
19
21
  end
20
22
 
@@ -10,6 +10,7 @@ module QRDA
10
10
  @dosage_xpath = "./cda:doseQuantity"
11
11
  @supply_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.99']/cda:quantity"
12
12
  @route_xpath = "./cda:routeCode"
13
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
13
14
  @entry_class = QDM::ImmunizationOrder
14
15
  end
15
16
 
@@ -19,6 +20,7 @@ module QRDA
19
20
  immunization_order.dosage = extract_scalar(entry_element, @dosage_xpath)
20
21
  immunization_order.supply = extract_scalar(entry_element, @supply_xpath)
21
22
  immunization_order.route = code_if_present(entry_element.at_xpath(@route_xpath))
23
+ immunization_order.reason = extract_reason(entry_element)
22
24
  immunization_order
23
25
  end
24
26
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::InterventionOrder
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  intervention_order = super
15
+ intervention_order.reason = extract_reason(entry_element)
14
16
  intervention_order
15
17
  end
16
18
 
@@ -9,12 +9,14 @@ module QRDA
9
9
  @author_datetime_xpath = "./cda:author/cda:time"
10
10
  @result_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.2']/cda:value"
11
11
  @status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
12
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
12
13
  @entry_class = QDM::InterventionPerformed
13
14
  end
14
15
 
15
16
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
16
17
  intervention_performed = super
17
18
  intervention_performed.status = code_if_present(entry_element.at_xpath(@status_xpath))
19
+ intervention_performed.reason = extract_reason(entry_element)
18
20
  intervention_performed
19
21
  end
20
22
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::InterventionRecommended
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  intervention_recommended = super
15
+ intervention_recommended.reason = extract_reason(entry_element)
14
16
  intervention_recommended
15
17
  end
16
18
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::LaboratoryTestOrder
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  laboratory_test_order = super
15
+ laboratory_test_order.reason = extract_reason(entry_element)
14
16
  laboratory_test_order
15
17
  end
16
18
 
@@ -12,6 +12,7 @@ module QRDA
12
12
  @result_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.2']/cda:value"
13
13
  @result_datetime_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:effectiveTime"
14
14
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
15
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
15
16
  @entry_class = QDM::LaboratoryTestPerformed
16
17
  end
17
18
 
@@ -21,6 +22,7 @@ module QRDA
21
22
  laboratory_test_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
22
23
  laboratory_test_performed.resultDatetime = extract_time(entry_element, @result_datetime_xpath)
23
24
  laboratory_test_performed.components = extract_components(entry_element)
25
+ laboratory_test_performed.reason = extract_reason(entry_element)
24
26
  laboratory_test_performed
25
27
  end
26
28
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:code'
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::LaboratoryTestRecommended
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  laboratory_test_recommended = super
15
+ laboratory_test_recommended.reason = extract_reason(entry_element)
14
16
  laboratory_test_recommended
15
17
  end
16
18
 
@@ -10,6 +10,7 @@ module QRDA
10
10
  @dosage_xpath = "./cda:doseQuantity"
11
11
  @frequency_xpath = "./cda:effectiveTime[@operator='A']/cda:period"
12
12
  @route_xpath = "./cda:routeCode"
13
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
13
14
  @entry_class = QDM::MedicationAdministered
14
15
  end
15
16
 
@@ -18,6 +19,7 @@ module QRDA
18
19
  medication_administered.dosage = extract_scalar(entry_element, @dosage_xpath)
19
20
  medication_administered.frequency = frequency_as_coded_value(entry_element, @frequency_xpath)
20
21
  medication_administered.route = code_if_present(entry_element.at_xpath(@route_xpath))
22
+ medication_administered.reason = extract_reason(entry_element)
21
23
  medication_administered
22
24
  end
23
25
 
@@ -3,7 +3,6 @@ module QRDA
3
3
  class MedicationDispensedImporter < SectionImporter
4
4
  def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:act[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.139']"))
5
5
  super(entry_finder)
6
- @entry_does_not_have_reason = true
7
6
  @id_xpath = './cda:id'
8
7
  @code_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:product/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
9
8
  @relevant_period_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:effectiveTime"
@@ -15,6 +15,7 @@ module QRDA
15
15
  @setting_xpath = "./cda:participant/cda:participantRole/cda:code"
16
16
  @prescriber_id_xpath = "./cda:author/cda:assignedAuthor/cda:id"
17
17
  @days_supplied_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.157']/cda:quantity"
18
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
18
19
  @entry_class = QDM::MedicationOrder
19
20
  end
20
21
 
@@ -28,6 +29,7 @@ module QRDA
28
29
  medication_order.setting = code_if_present(entry_element.at_xpath(@setting_xpath))
29
30
  medication_order.prescriberId = extract_id(entry_element, @prescriber_id_xpath)
30
31
  medication_order.daysSupplied = extract_scalar(entry_element, @days_supplied_xpath)&.value
32
+ medication_order.reason = extract_reason(entry_element)
31
33
  medication_order
32
34
  end
33
35
 
@@ -6,11 +6,13 @@ module QRDA
6
6
  @id_xpath = './cda:id'
7
7
  @code_xpath = './cda:value'
8
8
  @relevant_period_xpath = "./cda:effectiveTime"
9
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
9
10
  @entry_class = QDM::PatientCharacteristicClinicalTrialParticipant
10
11
  end
11
12
 
12
13
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
13
14
  patient_characteristic_clinical_trial_participant = super
15
+ patient_characteristic_clinical_trial_participant.reason = extract_reason(entry_element)
14
16
  patient_characteristic_clinical_trial_participant
15
17
  end
16
18
 
@@ -7,12 +7,14 @@ module QRDA
7
7
  @code_xpath = "./cda:value"
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
9
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
10
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
10
11
  @entry_class = QDM::PhysicalExamOrder
11
12
  end
12
13
 
13
14
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
15
  physical_exam_order = super
15
16
  physical_exam_order.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
17
+ physical_exam_order.reason = extract_reason(entry_element)
16
18
  physical_exam_order
17
19
  end
18
20
 
@@ -11,6 +11,7 @@ module QRDA
11
11
  @result_xpath = "./cda:value"
12
12
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
13
13
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
14
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
14
15
  @entry_class = QDM::PhysicalExamPerformed
15
16
  end
16
17
 
@@ -19,6 +20,7 @@ module QRDA
19
20
  physical_exam_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
20
21
  physical_exam_performed.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
21
22
  physical_exam_performed.components = extract_components(entry_element)
23
+ physical_exam_performed.reason = extract_reason(entry_element)
22
24
  physical_exam_performed
23
25
  end
24
26
 
@@ -7,12 +7,14 @@ module QRDA
7
7
  @code_xpath = "./cda:value"
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
9
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
10
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
10
11
  @entry_class = QDM::PhysicalExamRecommended
11
12
  end
12
13
 
13
14
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
14
15
  physical_exam_recommended = super
15
16
  physical_exam_recommended.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
17
+ physical_exam_recommended.reason = extract_reason(entry_element)
16
18
  physical_exam_recommended
17
19
  end
18
20
 
@@ -8,6 +8,7 @@ module QRDA
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
9
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
10
10
  @ordinality_xpath = "./cda:priorityCode"
11
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
11
12
  @entry_class = QDM::ProcedureOrder
12
13
  end
13
14
 
@@ -15,6 +16,7 @@ module QRDA
15
16
  procedure_order = super
16
17
  procedure_order.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
17
18
  procedure_order.ordinality = code_if_present(entry_element.at_xpath(@ordinality_xpath))
19
+ procedure_order.reason = extract_reason(entry_element)
18
20
  procedure_order
19
21
  end
20
22
 
@@ -14,6 +14,7 @@ module QRDA
14
14
  @ordinality_xpath = "./cda:priorityCode"
15
15
  @incision_datetime_xpath = "./cda:entryRelationship/cda:procedure[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.89']/cda:effectiveTime"
16
16
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
17
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
17
18
  @entry_class = QDM::ProcedurePerformed
18
19
  end
19
20
 
@@ -25,6 +26,7 @@ module QRDA
25
26
  procedure_performed.ordinality = code_if_present(entry_element.at_xpath(@ordinality_xpath))
26
27
  procedure_performed.incisionDatetime = extract_time(entry_element, @incision_datetime_xpath)
27
28
  procedure_performed.components = extract_components(entry_element)
29
+ procedure_performed.reason = extract_reason(entry_element)
28
30
  procedure_performed
29
31
  end
30
32
 
@@ -8,6 +8,7 @@ module QRDA
8
8
  @author_datetime_xpath = "./cda:author/cda:time"
9
9
  @anatomical_location_site_xpath = "./cda:targetSiteCode"
10
10
  @ordinality_xpath = "./cda:priorityCode"
11
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
11
12
  @entry_class = QDM::ProcedureRecommended
12
13
  end
13
14
 
@@ -15,6 +16,7 @@ module QRDA
15
16
  procedure_recommended = super
16
17
  procedure_recommended.anatomicalLocationSite = code_if_present(entry_element.at_xpath(@anatomical_location_site_xpath))
17
18
  procedure_recommended.ordinality = code_if_present(entry_element.at_xpath(@ordinality_xpath))
19
+ procedure_recommended.reason = extract_reason(entry_element)
18
20
  procedure_recommended
19
21
  end
20
22
 
@@ -3,7 +3,6 @@ module QRDA
3
3
  class SubstanceAdministeredImporter < SectionImporter
4
4
  def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.42']"))
5
5
  super(entry_finder)
6
- @entry_does_not_have_reason = true
7
6
  @id_xpath = './cda:id'
8
7
  @code_xpath = "./cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
9
8
  @author_datetime_xpath = "./cda:author/cda:time"
@@ -11,6 +11,7 @@ module QRDA
11
11
  @frequency_xpath = "./cda:effectiveTime[@operator='A']/cda:period"
12
12
  @refills_xpath = "./cda:repeatNumber"
13
13
  @route_xpath = "./cda:routeCode"
14
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
14
15
  @entry_class = QDM::SubstanceOrder
15
16
  end
16
17
 
@@ -21,6 +22,7 @@ module QRDA
21
22
  substance_order.frequency = frequency_as_coded_value(entry_element, @frequency_xpath)
22
23
  substance_order.refills = extract_scalar(entry_element, @refills_xpath)&.value
23
24
  substance_order.route = code_if_present(entry_element.at_xpath(@route_xpath))
25
+ substance_order.reason = extract_reason(entry_element)
24
26
  substance_order
25
27
  end
26
28
 
@@ -10,6 +10,7 @@ module QRDA
10
10
  @frequency_xpath = "./cda:effectiveTime[@operator='A']/cda:period"
11
11
  @refills_xpath = "./cda:repeatNumber"
12
12
  @route_xpath = "./cda:routeCode"
13
+ @reason_xpath = "./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value"
13
14
  @entry_class = QDM::SubstanceRecommended
14
15
  end
15
16
 
@@ -19,6 +20,7 @@ module QRDA
19
20
  substance_recommended.frequency = frequency_as_coded_value(entry_element, @frequency_xpath)
20
21
  substance_recommended.refills = extract_scalar(entry_element, @refills_xpath)&.value
21
22
  substance_recommended.route = code_if_present(entry_element.at_xpath(@route_xpath))
23
+ substance_recommended.reason = extract_reason(entry_element)
22
24
  substance_recommended
23
25
  end
24
26
 
@@ -109,7 +109,7 @@ module QRDA
109
109
 
110
110
  relations_to_add = []
111
111
  data_element.relatedTo.each do |related_to|
112
- relations_to_add << entry_id_map[related_to.value]
112
+ relations_to_add << entry_id_map["#{related_to.value}_#{related_to.namingSystem}"]
113
113
  end
114
114
  data_element.relatedTo.destroy
115
115
  relations_to_add.each do |relation_to_add|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cqm-reports
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The MITRE Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-20 00:00:00.000000000 Z
11
+ date: 2019-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cqm-models
@@ -44,56 +44,56 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.7.0
47
+ version: '2.7'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.7.0
54
+ version: '2.7'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mongoid-tree
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.1.0
61
+ version: '2.1'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.1.0
68
+ version: '2.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: nokogiri
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 1.10.3
75
+ version: '1.10'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 1.10.3
82
+ version: '1.10'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: uuid
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 2.3.7
89
+ version: '2.3'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 2.3.7
96
+ version: '2.3'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: zip-zip
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -114,28 +114,28 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.1.10
117
+ version: '1.1'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.1.10
124
+ version: '1.1'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: memoist
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.9.1
131
+ version: '0.9'
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.9.1
138
+ version: '0.9'
139
139
  description: A library for import and export of reports for use with electronic Clinical
140
140
  Quality Measures (eCQMs).
141
141
  email: tacoma-list@lists.mitre.org