cqm-reports 2.0.4 → 2.0.5

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
- SHA256:
3
- metadata.gz: ad6bc7084fe1a758d982a929b4175c5ffecc3c3ec1f070bd8ff4944539f469da
4
- data.tar.gz: fb3c251103f1d3e6dae7f138ba9e6f72f261e43650aaada83895eeaca6e1a64b
2
+ SHA1:
3
+ metadata.gz: dd0b9911f4358fceaa323afe6557281f181c2357
4
+ data.tar.gz: 2c2ba002d028ff2870fb7d6622231984611d0b9d
5
5
  SHA512:
6
- metadata.gz: 643b2cc26827bf8507df366ee0354dd2ef6a9b9039be532a289cdebc4178e05edb894bf2eaa4c3fc9b1f3ff8c8d6516c6d82fdc4bdf68189b759d0b83cb9bf13
7
- data.tar.gz: d968b34bdc0e4f0e07ac4a52a403fd494ac1e23dd540fa6557b42a055e2c2ff20782db2d80d11e5ce1695c3be467a1a22795d832dc27165c38178770d19ad09c
6
+ metadata.gz: 7980f689cd77ad9e2ba0869f89abdd1867a065108cbe8b9e534c7547de51fe3ded3169fc67e49826240bfe821e7bba779e0a1dc02a34955505e26afb6197e396
7
+ data.tar.gz: d37767e44596b127a5ea5197cb9c18dcdb36450661c23817ca84366e9a04ab7eebe4744d4e26e69682c76f4dd82bcd237667d46138cb4ec32f85a2b710b0df83
@@ -72,6 +72,4 @@ require_relative 'qrda-import/data-element-importers/substance_administered_impo
72
72
  require_relative 'qrda-import/data-element-importers/substance_order_importer.rb'
73
73
  require_relative 'qrda-import/data-element-importers/substance_recommended_importer.rb'
74
74
  require_relative 'qrda-import/data-element-importers/symptom_importer.rb'
75
- require_relative 'qrda-import/patient_importer.rb'
76
- require_relative 'ext/data_element.rb'
77
- require_relative 'ext/code.rb'
75
+ require_relative 'qrda-import/patient_importer.rb'
@@ -6,13 +6,8 @@
6
6
  <templateId root="2.16.840.1.113883.10.20.24.3.147" extension="2017-08-01"/>
7
7
  <id root="1.3.6.1.4.1.115" extension="{{object_id}}"/>
8
8
  <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4"/>
9
- {{#prevalencePeriod}}
10
- {{#completed_prevalence_period}}
11
9
  <statusCode code="completed" />
12
- {{/completed_prevalence_period}}
13
- {{^completed_prevalence_period}}
14
- <statusCode code="active" />
15
- {{/completed_prevalence_period}}
10
+ {{#prevalencePeriod}}
16
11
  <!-- QDM Attribute: Prevalence Period -->
17
12
  {{{prevalence_period}}}
18
13
  {{/prevalencePeriod}}
@@ -8,7 +8,7 @@
8
8
  {{/category}}
9
9
  {{^category}}
10
10
  <!-- QDM Attribute: Category -->
11
- <code nullFlavor="UNK"/>
11
+ <code nullFlavor="NA"/>
12
12
  {{/category}}
13
13
  <statusCode code="completed"/>
14
14
  {{#relevantPeriod}}
@@ -48,7 +48,7 @@
48
48
  {{/negationRationale}}
49
49
  <entryRelationship typeCode="REFR">
50
50
  <observation classCode="OBS" moodCode="EVN">
51
- <templateId root="2.16.840.1.113883.10.20.24.3.88" extension="2014-12-01"/>
51
+ <templateId root="2.16.840.1.113883.10.20.24.3.88" extension="2017-08-01"/>
52
52
  <id root="1.3.6.1.4.1.115" extension="{{object_id}}" />
53
53
  <code code="77301-0" codeSystem="2.16.840.1.113883.6.1" displayName="reason" codeSystemName="LOINC"/>
54
54
  <statusCode code="completed"/>
@@ -25,13 +25,8 @@
25
25
  <code code="29308-4" codeSystem="2.16.840.1.113883.6.1">
26
26
  <translation code="282291009" codeSystem="2.16.840.1.113883.6.96"/>
27
27
  </code>
28
- {{#prevalencePeriod}}
29
- {{#completed_prevalence_period}}
30
28
  <statusCode code="completed" />
31
- {{/completed_prevalence_period}}
32
- {{^completed_prevalence_period}}
33
- <statusCode code="active" />
34
- {{/completed_prevalence_period}}
29
+ {{#prevalencePeriod}}
35
30
  <!-- QDM Attribute: Prevalence Period -->
36
31
  {{{prevalence_period}}}
37
32
  {{/prevalencePeriod}}
@@ -1,7 +1,7 @@
1
1
  <entry>
2
2
  <substanceAdministration classCode="SBADM" moodCode="EVN" {{{negation_ind}}}>
3
3
  <!-- C-CDA R2 Immunization Activity -->
4
- <templateId root="2.16.840.1.113883.10.20.22.4.52" extension="2014-06-09"/>
4
+ <templateId root="2.16.840.1.113883.10.20.22.4.52" extension="2015-08-01"/>
5
5
  <!-- Immunization Administered -->
6
6
  <templateId root="2.16.840.1.113883.10.20.24.3.140" extension="2017-08-01"/>
7
7
  <id root="1.3.6.1.4.1.115" extension="{{object_id}}"/>
@@ -25,13 +25,8 @@
25
25
  <code code="75325-1" codeSystem="2.16.840.1.113883.6.1">
26
26
  <translation code="418799008" displayName="Symptom" codeSystem="2.16.840.1.113883.6.96"/>
27
27
  </code>
28
- {{#prevalencePeriod}}
29
- {{#completed_prevalence_period}}
30
28
  <statusCode code="completed" />
31
- {{/completed_prevalence_period}}
32
- {{^completed_prevalence_period}}
33
- <statusCode code="active" />
34
- {{/completed_prevalence_period}}
29
+ {{#prevalencePeriod}}
35
30
  <!-- QDM Attribute: Prevalence Period -->
36
31
  {{{prevalence_period}}}
37
32
  {{/prevalencePeriod}}
@@ -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
- elem_ids[1,elem_ids.length].each do |merge_id|
86
- merge_element = data_elements.find { |de| de.id == merge_id }
87
- data_element.merge!(merge_element)
88
- end
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
- new_data_elements << data_element
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?
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
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-08-28 00:00:00.000000000 Z
11
+ date: 2019-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cqm-models
@@ -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
- rubygems_version: 3.0.3
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
@@ -1,11 +0,0 @@
1
- module QDM
2
- class Code
3
- def ==(other)
4
- return false unless other.is_a? QDM::Code
5
-
6
- (code == other.code) && (codeSystem == other.codeSystem) && (codeSystemOid == other.codeSystemOid) && (version == other.version)
7
- end
8
-
9
- alias eql? ==
10
- end
11
- end
@@ -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