cqm-reports 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f221e687f62214c36812fd10c6f805bd4c8318d0
4
- data.tar.gz: 8ced778300575e57e368770bc705f8e5cc4f4d3d
3
+ metadata.gz: 5affd6fd4135b0c208f5fd5e5299eeb38569fd2a
4
+ data.tar.gz: dfe623571f807df1af633a4733ddfffb4cd74b67
5
5
  SHA512:
6
- metadata.gz: d4056e6d8f4e26ad6247fa558511d5ce0aad9bc61ca0ecd7c31ec69f160b4c555ced11b5fdfc3ce0e518165de92b2efbd2538bde2d73128035a84e7fa06ddc8e
7
- data.tar.gz: 33d50e677dcb99de986b9d0a9e4423530fdbed178b99bb0a6512eedf41d4bcf0e8a0eeeb9a936a6035419914f0089fa7de8c1435bdd40971bdbc6861666bcd32
6
+ metadata.gz: 0fa02e86800587983fbc7f772c119c8ccebaf1d34a06f4071186a99f9dba9306fef48d3ee124137a9e3bd8ef17a3d2187e49932d93b3beb5542e95480d0c7475
7
+ data.tar.gz: bba89a9e7d92bcbadee80cb27354cc4cd7a25e2c7cb004cfb2feee8f6c13a237dac833f0f008b073cb4f2de27901301cecb2d5f6cea0b73493f42da51b23216e
data/README.md CHANGED
@@ -11,6 +11,7 @@ Starting with version **2.0.0** released on 6/20/2019, cqm-reports versioning ha
11
11
  | X | QRDA Cat 1 | QRDA Cat 3 |
12
12
  | --- | --- | --- |
13
13
  | 2 | R1 STU5.1 | R1 STU2.1 |
14
+ | 3 | R1 STU5.2 | R1 STU2.1 |
14
15
 
15
16
  * **Y** indicates major changes (incompatible API changes)
16
17
 
@@ -42,7 +42,7 @@ module QRDA
42
42
  # This is the id found in the QRDA file
43
43
  entry_qrda_id = extract_id(entry_element, @id_xpath)
44
44
  # Create a hash to map all of entry.ids to the same QRDA ids. This will be used to merge QRDA entries
45
- # that represent the same event.
45
+ # that represent the same event.
46
46
  @entry_id_map["#{entry_qrda_id.value}_#{entry_qrda_id.namingSystem}"] ||= []
47
47
  @entry_id_map["#{entry_qrda_id.value}_#{entry_qrda_id.namingSystem}"] << entry.id
48
48
  entry.dataElementCodes = extract_codes(entry_element, @code_xpath)
@@ -115,15 +115,17 @@ module QRDA
115
115
  end
116
116
  if low_time && high_time && low_time > high_time
117
117
  # pass warning: current code continues as expected, but adds warning
118
- id_attr = parent_element.at_xpath(".//cda:id").attributes
118
+ id_attr = parent_element.at_xpath(".//cda:id")&.attributes
119
+ id_str = id_attr ? "and id: #{id_attr['root']&.value}(root), #{id_attr['extension']&.value}(extension)" : ""
119
120
  qrda_type = @entry_class.to_s.split("::")[1]
120
- @warnings << ValidationError.new(message: "Interval with low time after high time. Located in element with QRDA type: #{qrda_type} and id: #{id_attr['root']&.value}(root), #{id_attr['extension']&.value}(extension).",
121
+ @warnings << ValidationError.new(message: "Interval with low time after high time. Located in element with QRDA type: #{qrda_type} #{id_str}",
121
122
  location: parent_element.path)
122
123
  end
123
124
  if low_time.nil? && high_time.nil?
124
- id_attr = parent_element.at_xpath(".//cda:id").attributes
125
+ id_attr = parent_element.at_xpath(".//cda:id")&.attributes
126
+ id_str = id_attr ? "and id: #{id_attr['root']&.value}(root), #{id_attr['extension']&.value}(extension)" : ""
125
127
  qrda_type = @entry_class.to_s.split("::")[1]
126
- @warnings << ValidationError.new(message: "Interval with nullFlavor low time and nullFlavor high time. Located in element with QRDA type: #{qrda_type} and id: #{id_attr['root']&.value}(root), #{id_attr['extension']&.value if id_attr['extension']}(extension).",
128
+ @warnings << ValidationError.new(message: "Interval with nullFlavor low time and nullFlavor high time. Located in element with QRDA type: #{qrda_type} #{id_str}",
127
129
  location: parent_element.path)
128
130
  end
129
131
  QDM::Interval.new(low_time, high_time).shift_dates(0)
@@ -168,7 +170,7 @@ module QRDA
168
170
  parent_element.xpath(@result_xpath).each do |elem|
169
171
  result << extract_result_value(elem)
170
172
  end
171
- result.size > 1 ? result : result.first
173
+ result.size > 1 ? result : result.first
172
174
  end
173
175
 
174
176
  def extract_result_value(value_element)
@@ -181,9 +183,10 @@ module QRDA
181
183
  elsif value_element['code'].present?
182
184
  return code_if_present(value_element)
183
185
  elsif value_element.text.present?
184
- id_attr = value_element.parent.at_xpath(".//cda:id").attributes
186
+ id_attr = value_element.parent.at_xpath(".//cda:id")&.attributes
187
+ id_str = id_attr ? "and id: #{id_attr['root']&.value}(root), #{id_attr['extension']&.value}(extension)" : ""
185
188
  qrda_type = @entry_class.to_s.split("::")[1]
186
- @warnings << ValidationError.new(message: "Value with string type found. When possible, it's best practice to use a coded value or scalar. Located in element with QRDA type: #{qrda_type} and id: #{id_attr['root']&.value}(root), #{id_attr['extension']&.value}(extension).",
189
+ @warnings << ValidationError.new(message: "Value with string type found. When possible, it's best practice to use a coded value or scalar. Located in element with QRDA type: #{qrda_type} #{id_str}",
187
190
  location: value_element.path)
188
191
  return value_element.text
189
192
  end
@@ -195,16 +198,16 @@ module QRDA
195
198
  negation_indicator = parent_element['negationInd']
196
199
  # Return and do not set reason attribute if the entry is negated
197
200
  return nil if negation_indicator.eql?('true')
198
-
199
- reason_element.blank? ? nil : code_if_present(reason_element.first)
201
+
202
+ reason_element.blank? ? nil : code_if_present(reason_element.first)
200
203
  end
201
204
 
202
205
  def extract_negation(parent_element, entry)
203
206
  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")
204
207
  negation_indicator = parent_element['negationInd']
205
208
  # Return and do not set negationRationale attribute if the entry is not negated
206
- return unless negation_indicator.eql?('true')
207
-
209
+ return unless negation_indicator.eql?('true')
210
+
208
211
  entry.negationRationale = code_if_present(negation_element.first) unless negation_element.blank?
209
212
  extract_negated_code(parent_element, entry)
210
213
  end
@@ -218,9 +221,10 @@ module QRDA
218
221
  else
219
222
  # negated code is nullFlavored with no valueset
220
223
  entry.dataElementCodes = [{ code: "NA", system: '1.2.3.4.5.6.7.8.9.10' }]
221
- id_attr = parent_element.at_xpath(".//cda:id").attributes
224
+ id_attr = parent_element.at_xpath(".//cda:id")&.attributes
225
+ id_str = id_attr ? "and id: #{id_attr['root']&.value}(root), #{id_attr['extension']&.value}(extension)" : ""
222
226
  qrda_type = @entry_class.to_s.split("::")[1]
223
- @warnings << ValidationError.new(message: "Negated code element contains nullFlavor code but no valueset. Located in element with QRDA type: #{qrda_type} and id: #{id_attr['root']&.value}(root), #{id_attr['extension']&.value}(extension).",
227
+ @warnings << ValidationError.new(message: "Negated code element contains nullFlavor code but no valueset. Located in element with QRDA type: #{qrda_type} #{id_str}.",
224
228
  location: parent_element.path)
225
229
  end
226
230
  end
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: 3.1.0
4
+ version: 3.1.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: 2020-07-15 00:00:00.000000000 Z
11
+ date: 2020-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cqm-models