cqm-reports 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/lib/qrda-export/catI-r5/qrda_templates/assessment_performed.mustache +1 -10
  3. data/lib/qrda-export/catI-r5/qrda_templates/device_applied.mustache +1 -10
  4. data/lib/qrda-export/catI-r5/qrda_templates/device_order.mustache +0 -1
  5. data/lib/qrda-export/catI-r5/qrda_templates/diagnostic_study_performed.mustache +1 -10
  6. data/lib/qrda-export/catI-r5/qrda_templates/encounter_recommended.mustache +0 -1
  7. data/lib/qrda-export/catI-r5/qrda_templates/intervention_performed.mustache +1 -10
  8. data/lib/qrda-export/catI-r5/qrda_templates/laboratory_test_performed.mustache +1 -10
  9. data/lib/qrda-export/catI-r5/qrda_templates/medication_discharge.mustache +0 -1
  10. data/lib/qrda-export/catI-r5/qrda_templates/medication_dispensed.mustache +3 -1
  11. data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_performed.mustache +1 -10
  12. data/lib/qrda-export/catI-r5/qrda_templates/procedure_performed.mustache +1 -10
  13. data/lib/qrda-export/catI-r5/qrda_templates/substance_recommended.mustache +3 -0
  14. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_reason.mustache +0 -1
  15. data/lib/qrda-export/catIII-r2-1/_header.mustache +1 -1
  16. data/lib/qrda-export/helper/date_helper.rb +6 -10
  17. data/lib/qrda-import/base-importers/section_importer.rb +1 -0
  18. data/lib/qrda-import/data-element-importers/diagnostic_study_performed_importer.rb +1 -1
  19. data/lib/qrda-import/data-element-importers/encounter_recommended_importer.rb +1 -1
  20. data/lib/qrda-import/data-element-importers/medication_discharge_importer.rb +1 -1
  21. data/lib/qrda-import/data-element-importers/medication_dispensed_importer.rb +1 -1
  22. data/lib/qrda-import/patient_importer.rb +3 -3
  23. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86b46847a0a68ecf86611dce268e5a12f6d01af6
4
- data.tar.gz: 906d1984866e314876ca0d713f6b08a01a6ab8f5
3
+ metadata.gz: 4ab383c8a8cbc82410448739f891fc5c96cd0ae8
4
+ data.tar.gz: 62734f201648d065ea3bec1903f34d1c7005443b
5
5
  SHA512:
6
- metadata.gz: cc1e458ec8496af2e20bec1068f7acf723976bdfa92610cd2f1b99f36692a5cb7ddb3c6d1648be17704d820d0002b8b32c78d52881ea1d78d71643909ae0499f
7
- data.tar.gz: 9f4fa410245d83fbd1beb11183461a4cd8442859bfc391b7bffd90c5d9afeb2c91cd3ca83d54e9bc7c6a49f8ad9b6c9fe55230167161fd03cc4fc188066aec95
6
+ metadata.gz: 941d46cc062b4cb2d70a7f11438363b3af6a0ba7a21491ed451c37f61778445ad8e2375b055a5db54c8b90f365b7d52cd9fa7ce262eea8b20727ae42f7043310
7
+ data.tar.gz: 13c9d7aca7e2497f47e66919b54926f33bd6fd4d2714aadbde204d24072f23e95aa0fbad63458572e4c776c0dac9caa67fae2dc3efa063d7f340d618eea4cd3f
@@ -6,16 +6,7 @@
6
6
  {{> _codes}}
7
7
  <text>{{description}}</text>
8
8
  <statusCode code="completed"/>
9
- {{#relevantDatetime}}
10
- <!-- QDM Attribute: Relevant dateTime -->
11
- {{{relevant_date_time_value}}}
12
- {{/relevantDatetime}}
13
- {{^relevantDatetime}}
14
- {{#relevantPeriod}}
15
- <!-- QDM Attribute: Relevant Period -->
16
- {{{relevant_period}}}
17
- {{/relevantPeriod}}
18
- {{/relevantDatetime}}
9
+ {{{relevant_date_period_or_null_flavor}}}
19
10
  {{#result}}
20
11
  <!-- QDM Attribute: Result -->
21
12
  {{{result_value}}}
@@ -8,16 +8,7 @@
8
8
  <code code="360030002" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="application of device"/>
9
9
  <text>{{description}}</text>
10
10
  <statusCode code="completed"/>
11
- {{#relevantDatetime}}
12
- <!-- QDM Attribute: Relevant dateTime -->
13
- {{{relevant_date_time_value}}}
14
- {{/relevantDatetime}}
15
- {{^relevantDatetime}}
16
- {{#relevantPeriod}}
17
- <!-- QDM Attribute: Relevant Period -->
18
- {{{relevant_period}}}
19
- {{/relevantPeriod}}
20
- {{/relevantDatetime}}
11
+ {{{relevant_date_period_or_null_flavor}}}
21
12
  {{#anatomicalLocationSite}}
22
13
  <!-- QDM Attribute: Anatomical Location Site -->
23
14
  {{> qrda_templates/template_partials/_anatomical_location_site}}
@@ -1,7 +1,6 @@
1
1
  <entry>
2
2
  <act classCode="ACT" moodCode="RQO" {{{negation_ind}}}>
3
3
  <templateId root="2.16.840.1.113883.10.20.24.3.130" extension="2019-12-01"/>
4
- <id root="1.3.6.1.4.1.115" extension="{{object_id}}"/>
5
4
  <code code="SPLY" codeSystem="2.16.840.1.113883.5.6" displayName="Supply" codeSystemName="ActClass"/>
6
5
  <entryRelationship typeCode="SUBJ">
7
6
  <supply classCode="SPLY" moodCode="RQO">
@@ -9,16 +9,7 @@
9
9
  {{> _codes}}
10
10
  <text>{{description}}</text>
11
11
  <statusCode code="completed"/>
12
- {{#relevantDatetime}}
13
- <!-- QDM Attribute: Relevant dateTime -->
14
- {{{relevant_date_time_value}}}
15
- {{/relevantDatetime}}
16
- {{^relevantDatetime}}
17
- {{#relevantPeriod}}
18
- <!-- QDM Attribute: Relevant Period -->
19
- {{{relevant_period}}}
20
- {{/relevantPeriod}}
21
- {{/relevantDatetime}}
12
+ {{{relevant_date_period_or_null_flavor}}}
22
13
  <value nullFlavor="NA" xsi:type="CD" />
23
14
  {{#method}}
24
15
  <!-- QDM Attribute: Method -->
@@ -2,7 +2,6 @@
2
2
  <act classCode="ACT" moodCode="INT" {{{negation_ind}}}>
3
3
  <!--Encounter Recommended Act (V2) -->
4
4
  <templateId root="2.16.840.1.113883.10.20.24.3.134" extension="2019-12-01"/>
5
- <id extension="{{object_id}}" root="1.3.6.1.4.1.115"/>
6
5
  <code code="ENC" codeSystem="2.16.840.1.113883.5.6" codeSystemName="ActClass" displayName="Encounter"/>
7
6
  <entryRelationship typeCode="SUBJ">
8
7
  <encounter classCode="ENC" moodCode="INT">
@@ -8,16 +8,7 @@
8
8
  {{> _codes}}
9
9
  <text>{{description}}</text>
10
10
  <statusCode code="completed"/>
11
- {{#relevantDatetime}}
12
- <!-- QDM Attribute: Relevant dateTime -->
13
- {{{relevant_date_time_value}}}
14
- {{/relevantDatetime}}
15
- {{^relevantDatetime}}
16
- {{#relevantPeriod}}
17
- <!-- QDM Attribute: Relevant Period -->
18
- {{{relevant_period}}}
19
- {{/relevantPeriod}}
20
- {{/relevantDatetime}}
11
+ {{{relevant_date_period_or_null_flavor}}}
21
12
  {{#authorDatetime}}
22
13
  <!-- QDM Attribute: Author dateTime -->
23
14
  {{> qrda_templates/template_partials/_author}}
@@ -6,16 +6,7 @@
6
6
  {{> _codes}}
7
7
  <text>{{description}}</text>
8
8
  <statusCode code="completed"/>
9
- {{#relevantDatetime}}
10
- <!-- QDM Attribute: Relevant dateTime -->
11
- {{{relevant_date_time_value}}}
12
- {{/relevantDatetime}}
13
- {{^relevantDatetime}}
14
- {{#relevantPeriod}}
15
- <!-- QDM Attribute: Relevant Period -->
16
- {{{relevant_period}}}
17
- {{/relevantPeriod}}
18
- {{/relevantDatetime}}
9
+ {{{relevant_date_period_or_null_flavor}}}
19
10
  {{#method}}
20
11
  <!-- QDM Attribute: Method -->
21
12
  {{> qrda_templates/template_partials/_method}}
@@ -2,7 +2,6 @@
2
2
  <act classCode="ACT" moodCode="RQO" {{{negation_ind}}}>
3
3
  <!-- Discharge Medication Entry -->
4
4
  <templateId root="2.16.840.1.113883.10.20.24.3.105" extension="2019-12-01"/>
5
- <id root="1.3.6.1.4.1.115" extension="{{object_id}}"/>
6
5
  <code code="75311-1" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Discharge medications"/>
7
6
  <statusCode code="active"/>
8
7
  {{#prescriber}}
@@ -2,7 +2,6 @@
2
2
  <act classCode="ACT" moodCode="EVN" {{{negation_ind}}}>
3
3
  <!-- Medication Dispensed Act -->
4
4
  <templateId root="2.16.840.1.113883.10.20.24.3.139" extension="2019-12-01"/>
5
- <id root="1.3.6.1.4.1.115" extension="{{object_id}}"/>
6
5
  <code code="SPLY" codeSystem="2.16.840.1.113883.5.6" displayName="supply" codeSystemName="ActClass"/>
7
6
  <entryRelationship typeCode="SUBJ">
8
7
  <!--Medication dispensed -->
@@ -23,6 +22,9 @@
23
22
  <!-- QDM Attribute: Relevant Period -->
24
23
  {{{medication_duration_effective_time}}}
25
24
  {{/relevantPeriod}}
25
+ {{^relevantPeriod}}
26
+ <effectiveTime xsi:type="IVL_TS" nullFlavor="UNK"/>
27
+ {{/relevantPeriod}}
26
28
  {{/relevantDatetime}}
27
29
  <product>
28
30
  <manufacturedProduct classCode="MANU">
@@ -9,16 +9,7 @@
9
9
  {{> _codes}}
10
10
  <text>{{description}}</text>
11
11
  <statusCode code="completed"/>
12
- {{#relevantDatetime}}
13
- <!-- QDM Attribute: Relevant dateTime -->
14
- {{{relevant_date_time_value}}}
15
- {{/relevantDatetime}}
16
- {{^relevantDatetime}}
17
- {{#relevantPeriod}}
18
- <!-- QDM Attribute: Relevant Period -->
19
- {{{relevant_period}}}
20
- {{/relevantPeriod}}
21
- {{/relevantDatetime}}
12
+ {{{relevant_date_period_or_null_flavor}}}
22
13
  {{#result}}
23
14
  <!-- QDM Attribute: Result -->
24
15
  {{{result_value}}}
@@ -8,16 +8,7 @@
8
8
  {{> _codes}}
9
9
  <text>{{description}}</text>
10
10
  <statusCode code="completed"/>
11
- {{#relevantDatetime}}
12
- <!-- QDM Attribute: Relevant dateTime -->
13
- {{{relevant_date_time_value}}}
14
- {{/relevantDatetime}}
15
- {{^relevantDatetime}}
16
- {{#relevantPeriod}}
17
- <!-- QDM Attribute: Relevant Period -->
18
- {{{relevant_period}}}
19
- {{/relevantPeriod}}
20
- {{/relevantDatetime}}
11
+ {{{relevant_date_period_or_null_flavor}}}
21
12
  {{#method}}
22
13
  <!-- QDM Attribute: Method -->
23
14
  {{> qrda_templates/template_partials/_method}}
@@ -6,6 +6,9 @@
6
6
  <templateId root="2.16.840.1.113883.10.20.24.3.75" extension="2019-12-01"/>
7
7
  <id root="1.3.6.1.4.1.115" extension="{{object_id}}"/>
8
8
  <statusCode code="active"/>
9
+ <effectiveTime xsi:type="IVL_TS">
10
+ <low nullFlavor="NA"/>
11
+ </effectiveTime>
9
12
  {{> qrda_templates/template_partials/_medication_details}}
10
13
  <consumable>
11
14
  <manufacturedProduct classCode="MANU">
@@ -3,7 +3,6 @@
3
3
  <templateId root="2.16.840.1.113883.10.20.24.3.88" extension="2017-08-01"/>
4
4
  <id root="1.3.6.1.4.1.115" extension="{{random_id}}" />
5
5
  <code code="77301-0" codeSystem="2.16.840.1.113883.6.1" displayName="reason" codeSystemName="LOINC"/>
6
- <statusCode code="completed"/>
7
6
  {{#relevantPeriod}}
8
7
  {{{relevant_period}}}
9
8
  {{/relevantPeriod}}
@@ -4,7 +4,7 @@
4
4
  <!-- US Realm Header Template Id -->
5
5
  <templateId root="2.16.840.1.113883.10.20.27.1.1" extension="2017-06-01"/>
6
6
  <!-- QRDA Category III Report - CMS (V4) -->
7
- <templateId root="2.16.840.1.113883.10.20.27.1.2" extension="2019-05-01"/>
7
+ <templateId root="2.16.840.1.113883.10.20.27.1.2" extension="2020-05-01"/>
8
8
  <!-- This is the globally unique identifier for this QRDA document -->
9
9
  <id root="{{random_id}}"/>
10
10
  <!-- QRDA III document type code -->
@@ -96,20 +96,16 @@ module Qrda
96
96
  "</effectiveTime>"
97
97
  end
98
98
 
99
- def relevant_period_as_value
100
- "<effectiveTime #{value_or_null_flavor(self['relevantPeriod']['low'])}/>"
101
- end
102
-
103
- def relevant_date_time_low
104
- "<effectiveTime>"\
105
- "<low #{value_or_null_flavor(self['relevantDatetime'])}/>"\
106
- "</effectiveTime>"
107
- end
108
-
109
99
  def relevant_date_time_value
110
100
  "<effectiveTime #{value_or_null_flavor(self['relevantDatetime'])}/>"
111
101
  end
112
102
 
103
+ def relevant_date_period_or_null_flavor
104
+ return relevant_period if self['relevantPeriod']
105
+ return relevant_date_time_value if self['relevantDatetime']
106
+ "<effectiveTime nullFlavor='UNK'/>"
107
+ end
108
+
113
109
  def medication_duration_effective_time
114
110
  "<effectiveTime xsi:type=\"IVL_TS\">"\
115
111
  "<low #{value_or_null_flavor(self['relevantPeriod']['low'])}/>"\
@@ -93,6 +93,7 @@ module QRDA
93
93
  end
94
94
 
95
95
  def extract_interval(parent_element, interval_xpath)
96
+ return nil unless parent_element.at_xpath(interval_xpath)
96
97
  if parent_element.at_xpath("#{interval_xpath}/@value")
97
98
  low_time = DateTime.parse(parent_element.at_xpath(interval_xpath)['value'])
98
99
  high_time = DateTime.parse(parent_element.at_xpath(interval_xpath)['value'])
@@ -21,7 +21,7 @@ module QRDA
21
21
  def create_entry(entry_element, nrh = NarrativeReferenceHandler.new)
22
22
  diagnostic_study_performed = super
23
23
  diagnostic_study_performed.resultDatetime = extract_time(entry_element, @result_datetime_xpath)
24
- diagnostic_study_performed.resultDatetime ||= extract_interval(entry_element, @result_datetime_xpath).low
24
+ diagnostic_study_performed.resultDatetime ||= extract_interval(entry_element, @result_datetime_xpath)&.low
25
25
  diagnostic_study_performed.status = code_if_present(entry_element.at_xpath(@status_xpath))
26
26
  diagnostic_study_performed.method = code_if_present(entry_element.at_xpath(@method_xpath))
27
27
  diagnostic_study_performed.facilityLocation = extract_facility_locations(entry_element)[0]
@@ -3,7 +3,7 @@ module QRDA
3
3
  class EncounterRecommendedImporter < 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.134']"))
5
5
  super(entry_finder)
6
- @id_xpath = './cda:id'
6
+ @id_xpath = './cda:entryRelationship/cda:encounter/cda:id'
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']"
@@ -3,7 +3,7 @@ module QRDA
3
3
  class MedicationDischargeImporter < 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.105']"))
5
5
  super(entry_finder)
6
- @id_xpath = './cda:id'
6
+ @id_xpath = './cda:entryRelationship/cda:substanceAdministration/cda:id'
7
7
  @code_xpath = "./cda:entryRelationship/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.16']/cda:consumable/cda:manufacturedProduct/cda:manufacturedMaterial/cda:code"
8
8
  @author_datetime_xpath = "./cda:entryRelationship/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.16']/cda:author/cda:time"
9
9
  @refills_xpath = "./cda:entryRelationship/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.16']/cda:repeatNumber"
@@ -3,7 +3,7 @@ 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
- @id_xpath = './cda:id'
6
+ @id_xpath = './cda:entryRelationship/cda:supply/cda:id'
7
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"
8
8
  @relevant_period_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:effectiveTime"
9
9
  @relevant_date_time_xpath = "./cda:entryRelationship/cda:supply[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.18']/cda:effectiveTime"
@@ -112,8 +112,8 @@ module QRDA
112
112
 
113
113
  def key_elements_for_determining_encounter_uniqueness(encounter)
114
114
  codes = encounter.codes.collect { |dec| "#{dec.code}_#{dec.system}" }.sort.to_s
115
- admission_date_time = encounter.relevantPeriod.low.to_s
116
- discharge_date_time = encounter.relevantPeriod.high.to_s
115
+ admission_date_time = encounter&.relevantPeriod&.low.to_s
116
+ discharge_date_time = encounter&.relevantPeriod&.high.to_s
117
117
  "#{codes}#{admission_date_time}#{discharge_date_time}"
118
118
  end
119
119
 
@@ -131,7 +131,7 @@ module QRDA
131
131
 
132
132
  relations_to_add = []
133
133
  data_element.relatedTo.each do |related_to|
134
- relations_to_add += entry_id_map["#{related_to.value}_#{related_to.namingSystem}"]
134
+ relations_to_add += entry_id_map["#{related_to['value']}_#{related_to['namingSystem']}"]
135
135
  end
136
136
  data_element.relatedTo = relations_to_add.map(&:to_s)
137
137
  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.0.0
4
+ version: 3.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: 2020-05-11 00:00:00.000000000 Z
11
+ date: 2020-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cqm-models