cqm-reports 2.0.0 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +1 -1
- data/README.md +8 -6
- data/lib/cqm_report.rb +1 -3
- data/lib/qrda-export/catI-r5/qrda_templates/allergy_intolerance.mustache +1 -6
- data/lib/qrda-export/catI-r5/qrda_templates/communication_performed.mustache +6 -4
- data/lib/qrda-export/catI-r5/qrda_templates/device_order.mustache +4 -4
- data/lib/qrda-export/catI-r5/qrda_templates/device_recommended.mustache +4 -4
- data/lib/qrda-export/catI-r5/qrda_templates/diagnosis.mustache +1 -6
- data/lib/qrda-export/catI-r5/qrda_templates/encounter_order.mustache +4 -4
- data/lib/qrda-export/catI-r5/qrda_templates/encounter_performed.mustache +4 -4
- data/lib/qrda-export/catI-r5/qrda_templates/encounter_recommended.mustache +4 -4
- data/lib/qrda-export/catI-r5/qrda_templates/immunization_administered.mustache +1 -1
- data/lib/qrda-export/catI-r5/qrda_templates/medication_discharge.mustache +0 -3
- data/lib/qrda-export/catI-r5/qrda_templates/medication_dispensed.mustache +4 -4
- data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_performed.mustache +4 -0
- data/lib/qrda-export/catI-r5/qrda_templates/symptom.mustache +1 -6
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_immunization_details.mustache +2 -2
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_details.mustache +5 -1
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_supply_request.mustache +1 -1
- data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_results.mustache +0 -12
- data/lib/qrda-export/helper/aggregate_object_helper.rb +1 -1
- data/lib/qrda-export/helper/cat1_view_helper.rb +9 -0
- data/lib/qrda-import/base-importers/section_importer.rb +30 -26
- data/lib/qrda-import/data-element-importers/assessment_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/assessment_performed_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/assessment_recommended_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/communication_performed_importer.rb +1 -2
- data/lib/qrda-import/data-element-importers/device_applied_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/device_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/device_recommended_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/diagnostic_study_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/diagnostic_study_performed_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/encounter_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/encounter_recommended_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/immunization_administered_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/immunization_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/intervention_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/intervention_performed_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/intervention_recommended_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/laboratory_test_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/laboratory_test_performed_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/laboratory_test_recommended_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/medication_administered_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/medication_dispensed_importer.rb +0 -1
- data/lib/qrda-import/data-element-importers/medication_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/patient_characteristic_clinical_trial_participant_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/physical_exam_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/physical_exam_performed_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/physical_exam_recommended_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/procedure_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/procedure_performed_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/procedure_recommended_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/substance_administered_importer.rb +0 -1
- data/lib/qrda-import/data-element-importers/substance_order_importer.rb +2 -0
- data/lib/qrda-import/data-element-importers/substance_recommended_importer.rb +2 -0
- data/lib/qrda-import/patient_importer.rb +28 -7
- metadata +16 -17
- data/lib/ext/code.rb +0 -11
- data/lib/ext/data_element.rb +0 -24
@@ -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
|
|
@@ -78,16 +78,30 @@ module QRDA
|
|
78
78
|
new_data_elements = []
|
79
79
|
|
80
80
|
id_map.each_value do |elem_ids|
|
81
|
-
|
82
81
|
elem_id = elem_ids.first
|
83
82
|
data_element = data_elements.find { |de| de.id == elem_id }
|
83
|
+
# Keep the first element with a shared ID
|
84
|
+
new_data_elements << data_element
|
84
85
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
86
|
+
# Encounters require elements beyond id for uniqueness
|
87
|
+
next unless data_element._type == 'QDM::EncounterPerformed'
|
88
|
+
unique_element_keys = []
|
89
|
+
# Add key_elements_for_determining_encounter_uniqueness to array, this is used to determine if other
|
90
|
+
# elements with the same ID should be considered as unique
|
91
|
+
unique_element_keys << key_elements_for_determining_encounter_uniqueness(data_element)
|
89
92
|
|
90
|
-
|
93
|
+
# Loop through all other data elements with the same id
|
94
|
+
elem_ids[1,elem_ids.length].each do |dup_id|
|
95
|
+
dup_element = data_elements.find { |de| de.id == dup_id }
|
96
|
+
dup_element_keys = key_elements_for_determining_encounter_uniqueness(dup_element)
|
97
|
+
# See if a previously selected data element shared all of the keys files
|
98
|
+
# If all key fields match, move on.
|
99
|
+
next if unique_element_keys.include?(dup_element_keys)
|
100
|
+
# If all key fields don't match, keep element
|
101
|
+
new_data_elements << dup_element
|
102
|
+
# Add to list of unique element keys
|
103
|
+
unique_element_keys << dup_element_keys
|
104
|
+
end
|
91
105
|
end
|
92
106
|
|
93
107
|
patient.qdmPatient.dataElements << new_data_elements
|
@@ -95,6 +109,13 @@ module QRDA
|
|
95
109
|
end
|
96
110
|
end
|
97
111
|
|
112
|
+
def key_elements_for_determining_encounter_uniqueness(encounter)
|
113
|
+
codes = encounter.codes.collect { |dec| "#{dec.code}_#{dec.codeSystemOid}" }.sort.to_s
|
114
|
+
admission_date_time = encounter.relevantPeriod.low.to_s
|
115
|
+
discharge_date_time = encounter.relevantPeriod.high.to_s
|
116
|
+
"#{codes}#{admission_date_time}#{discharge_date_time}"
|
117
|
+
end
|
118
|
+
|
98
119
|
def get_patient_expired(record, doc)
|
99
120
|
entry_elements = doc.xpath("/cda:ClinicalDocument/cda:component/cda:structuredBody/cda:component/cda:section[cda:templateId/@root = '2.16.840.1.113883.10.20.24.2.1']/cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.54']")
|
100
121
|
return unless entry_elements.empty?
|
@@ -109,7 +130,7 @@ module QRDA
|
|
109
130
|
|
110
131
|
relations_to_add = []
|
111
132
|
data_element.relatedTo.each do |related_to|
|
112
|
-
relations_to_add << entry_id_map[related_to.value]
|
133
|
+
relations_to_add << entry_id_map["#{related_to.value}_#{related_to.namingSystem}"]
|
113
134
|
end
|
114
135
|
data_element.relatedTo.destroy
|
115
136
|
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.
|
4
|
+
version: 2.0.5
|
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-
|
11
|
+
date: 2019-10-25 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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
@@ -147,8 +147,6 @@ files:
|
|
147
147
|
- README.md
|
148
148
|
- Rakefile
|
149
149
|
- lib/cqm_report.rb
|
150
|
-
- lib/ext/code.rb
|
151
|
-
- lib/ext/data_element.rb
|
152
150
|
- lib/html-export/qdm-patient/_header_css.mustache
|
153
151
|
- lib/html-export/qdm-patient/_javascript.mustache
|
154
152
|
- lib/html-export/qdm-patient/data_element/_data_element.mustache
|
@@ -338,7 +336,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
338
336
|
- !ruby/object:Gem::Version
|
339
337
|
version: '0'
|
340
338
|
requirements: []
|
341
|
-
|
339
|
+
rubyforge_project:
|
340
|
+
rubygems_version: 2.6.14
|
342
341
|
signing_key:
|
343
342
|
specification_version: 4
|
344
343
|
summary: A library for import and export of reports for use with electronic Clinical
|
data/lib/ext/code.rb
DELETED
data/lib/ext/data_element.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
module QDM
|
2
|
-
class DataElement
|
3
|
-
def merge!(other)
|
4
|
-
# ensure they're the same category (e.g. 'encounter')
|
5
|
-
return unless qdmCategory == other.qdmCategory
|
6
|
-
|
7
|
-
# ensure they're the same status (e.g. 'performed'), and that they both have a status set (or that they both don't)
|
8
|
-
return if respond_to?(:qdmStatus) && !other.respond_to?(:qdmStatus)
|
9
|
-
return if !respond_to?(:qdmStatus) && other.respond_to?(:qdmStatus)
|
10
|
-
return if respond_to?(:qdmStatus) && other.respond_to?(:qdmStatus) && qdmStatus != other.qdmStatus
|
11
|
-
|
12
|
-
# iterate over non-code fields
|
13
|
-
fields.each_key do |field|
|
14
|
-
next if field[0] == '_' || %w[dataElementCodes qdmCategory qdmVersion qdmStatus].include?(field)
|
15
|
-
|
16
|
-
if send(field).nil?
|
17
|
-
send(field + '=', other.send(field))
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
self.dataElementCodes = dataElementCodes.concat(other.dataElementCodes).uniq
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|