cqm-reports 1.0.0.0 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +8 -6
  4. data/lib/html-export/qdm-patient/data_element/_data_element_codes.mustache +1 -1
  5. data/lib/html-export/qdm-patient/qdm_patient.rb +5 -1
  6. data/lib/qrda-export/catI-r5/qrda_templates/communication_performed.mustache +5 -3
  7. data/lib/qrda-export/catI-r5/qrda_templates/device_order.mustache +4 -4
  8. data/lib/qrda-export/catI-r5/qrda_templates/device_recommended.mustache +4 -4
  9. data/lib/qrda-export/catI-r5/qrda_templates/encounter_order.mustache +4 -4
  10. data/lib/qrda-export/catI-r5/qrda_templates/encounter_performed.mustache +4 -4
  11. data/lib/qrda-export/catI-r5/qrda_templates/encounter_recommended.mustache +4 -4
  12. data/lib/qrda-export/catI-r5/qrda_templates/medication_discharge.mustache +0 -3
  13. data/lib/qrda-export/catI-r5/qrda_templates/medication_dispensed.mustache +4 -4
  14. data/lib/qrda-export/catI-r5/qrda_templates/physical_exam_performed.mustache +4 -0
  15. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_immunization_details.mustache +2 -2
  16. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_details.mustache +5 -1
  17. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_medication_supply_request.mustache +1 -1
  18. data/lib/qrda-export/catI-r5/qrda_templates/template_partials/_results.mustache +0 -12
  19. data/lib/qrda-export/catIII-r2-1/_header.mustache +7 -0
  20. data/lib/qrda-export/catIII-r2-1/_measure_data.mustache +2 -0
  21. data/lib/qrda-export/catIII-r2-1/_measure_section.mustache +3 -0
  22. data/lib/qrda-export/catIII-r2-1/_supplemental_data.mustache +8 -1
  23. data/lib/qrda-export/catIII-r2-1/qrda3_r21.mustache +0 -1
  24. data/lib/qrda-export/catIII-r2-1/qrda3_r21.rb +16 -1
  25. data/lib/qrda-export/catIII-r2-1/qrda_header/_information_recipient.mustache +7 -0
  26. data/lib/qrda-export/catIII-r2-1/qrda_header/_participant_ehr.mustache +6 -0
  27. data/lib/qrda-export/catIII-r2-1/qrda_header/_participant_location.mustache +13 -0
  28. data/lib/qrda-export/helper/aggregate_object_helper.rb +1 -1
  29. data/lib/qrda-export/helper/cat1_view_helper.rb +18 -10
  30. data/lib/qrda-import/base-importers/demographics_importer.rb +3 -3
  31. data/lib/qrda-import/base-importers/section_importer.rb +37 -33
  32. data/lib/qrda-import/data-element-importers/assessment_order_importer.rb +2 -0
  33. data/lib/qrda-import/data-element-importers/assessment_performed_importer.rb +2 -0
  34. data/lib/qrda-import/data-element-importers/assessment_recommended_importer.rb +2 -0
  35. data/lib/qrda-import/data-element-importers/communication_performed_importer.rb +1 -2
  36. data/lib/qrda-import/data-element-importers/device_applied_importer.rb +2 -0
  37. data/lib/qrda-import/data-element-importers/device_order_importer.rb +2 -0
  38. data/lib/qrda-import/data-element-importers/device_recommended_importer.rb +2 -0
  39. data/lib/qrda-import/data-element-importers/diagnostic_study_order_importer.rb +2 -0
  40. data/lib/qrda-import/data-element-importers/diagnostic_study_performed_importer.rb +2 -0
  41. data/lib/qrda-import/data-element-importers/encounter_order_importer.rb +2 -0
  42. data/lib/qrda-import/data-element-importers/encounter_recommended_importer.rb +2 -0
  43. data/lib/qrda-import/data-element-importers/immunization_administered_importer.rb +2 -0
  44. data/lib/qrda-import/data-element-importers/immunization_order_importer.rb +2 -0
  45. data/lib/qrda-import/data-element-importers/intervention_order_importer.rb +2 -0
  46. data/lib/qrda-import/data-element-importers/intervention_performed_importer.rb +2 -0
  47. data/lib/qrda-import/data-element-importers/intervention_recommended_importer.rb +2 -0
  48. data/lib/qrda-import/data-element-importers/laboratory_test_order_importer.rb +2 -0
  49. data/lib/qrda-import/data-element-importers/laboratory_test_performed_importer.rb +2 -0
  50. data/lib/qrda-import/data-element-importers/laboratory_test_recommended_importer.rb +2 -0
  51. data/lib/qrda-import/data-element-importers/medication_administered_importer.rb +2 -0
  52. data/lib/qrda-import/data-element-importers/medication_dispensed_importer.rb +0 -1
  53. data/lib/qrda-import/data-element-importers/medication_order_importer.rb +2 -0
  54. data/lib/qrda-import/data-element-importers/patient_characteristic_clinical_trial_participant_importer.rb +2 -0
  55. data/lib/qrda-import/data-element-importers/physical_exam_order_importer.rb +2 -0
  56. data/lib/qrda-import/data-element-importers/physical_exam_performed_importer.rb +2 -0
  57. data/lib/qrda-import/data-element-importers/physical_exam_recommended_importer.rb +2 -0
  58. data/lib/qrda-import/data-element-importers/procedure_order_importer.rb +2 -0
  59. data/lib/qrda-import/data-element-importers/procedure_performed_importer.rb +2 -0
  60. data/lib/qrda-import/data-element-importers/procedure_recommended_importer.rb +2 -0
  61. data/lib/qrda-import/data-element-importers/substance_administered_importer.rb +0 -1
  62. data/lib/qrda-import/data-element-importers/substance_order_importer.rb +2 -0
  63. data/lib/qrda-import/data-element-importers/substance_recommended_importer.rb +2 -0
  64. data/lib/qrda-import/patient_importer.rb +1 -1
  65. data/lib/util/code_system_helper.rb +3 -24
  66. metadata +20 -18
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: faad9a8a2c63b2c26bd1ed689be3cea13a54bc520e9fbcf95a56550b2646a095
4
- data.tar.gz: cb7867e3555e19a454dc918ef7f018672f177cf3b3eeeef124aff46723693c56
3
+ metadata.gz: ad6bc7084fe1a758d982a929b4175c5ffecc3c3ec1f070bd8ff4944539f469da
4
+ data.tar.gz: fb3c251103f1d3e6dae7f138ba9e6f72f261e43650aaada83895eeaca6e1a64b
5
5
  SHA512:
6
- metadata.gz: 16ad11bbe2c9131f6977c8eac6b06150f6fb22f4a465364f40e65375e3271cbf241d4777b0ae3cad8fecd0bb0a8a1808957c9f813c761024851a44c05cc530ea
7
- data.tar.gz: 5c2710035d5e2b6c56e3e25c974b5ecefc131fa5fb058c1b3ed2ad09825639a937f6a75811bd3286fb95364c69d64dcfa45d8778f2875c290d94c5609f46c852
6
+ metadata.gz: 643b2cc26827bf8507df366ee0354dd2ef6a9b9039be532a289cdebc4178e05edb894bf2eaa4c3fc9b1f3ff8c8d6516c6d82fdc4bdf68189b759d0b83cb9bf13
7
+ data.tar.gz: d968b34bdc0e4f0e07ac4a52a403fd494ac1e23dd540fa6557b42a055e2c2ff20782db2d80d11e5ce1695c3be467a1a22795d832dc27165c38178770d19ad09c
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.
@@ -2,7 +2,7 @@
2
2
  <div class="div-table-body">
3
3
  {{#dataElementCodes}}
4
4
  <div class="div-head-row">
5
- <div class="div-table-head--no-border"><span class="criteria-heading">{{codeSystem}}:</span> {{code}}</div>
5
+ <div class="div-table-head--no-border"><span class="criteria-heading">{{{code_system_name}}}:</span> {{code}}</div>
6
6
  </div>
7
7
  {{/dataElementCodes}}
8
8
  </div>
@@ -27,7 +27,11 @@ class QdmPatient < Mustache
27
27
  end
28
28
 
29
29
  def code_code_system_string
30
- "#{self['code']} (#{self['codeSystem']})"
30
+ "#{self['code']} (#{HQMF::Util::CodeSystemHelper.code_system_for(self['codeSystemOid'])})"
31
+ end
32
+
33
+ def code_system_name
34
+ HQMF::Util::CodeSystemHelper.code_system_for(self['codeSystemOid'])
31
35
  end
32
36
 
33
37
  def result_string
@@ -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>
@@ -5,19 +5,7 @@
5
5
  <id root="1.3.6.1.4.1.115" extension="{{random_id}}"/>
6
6
  {{> _codes}}
7
7
  <statusCode code="completed"/>
8
- {{#resultDatetime}}
9
8
  {{{result_date_time}}}
10
- {{/resultDatetime}}
11
- {{^resultDatetime}}
12
- {{#relevantPeriod}}
13
- {{{relevant_period_as_value}}}
14
- {{/relevantPeriod}}
15
- {{^relevantPeriod}}
16
- {{#authorDatetime}}
17
- {{{author_effective_time}}}
18
- {{/authorDatetime}}
19
- {{/relevantPeriod}}
20
- {{/resultDatetime}}
21
9
  {{{result_value}}}
22
10
  </observation>
23
11
  </entryRelationship>
@@ -3,6 +3,8 @@
3
3
  <typeId root="2.16.840.1.113883.1.3" extension="POCD_HD000040"/>
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
+ <!-- QRDA Category III Report - CMS (V4) -->
7
+ <templateId root="2.16.840.1.113883.10.20.27.1.2" extension="2019-05-01"/>
6
8
  <!-- This is the globally unique identifier for this QRDA document -->
7
9
  <id root="{{random_id}}"/>
8
10
  <!-- QRDA III document type code -->
@@ -21,5 +23,10 @@
21
23
  </recordTarget>
22
24
  {{> qrda_header/_author}}
23
25
  {{> qrda_header/_custodian}}
26
+ {{> qrda_header/_information_recipient}}
24
27
  {{> qrda_header/_legal_authenticator}}
28
+ {{#cpcplus?}}
29
+ {{> qrda_header/_participant_location}}
30
+ {{/cpcplus?}}
31
+ {{> qrda_header/_participant_ehr}}
25
32
  {{> qrda_header/_documentation_of_service_event}}
@@ -5,6 +5,8 @@
5
5
  <observation classCode="OBS" moodCode="EVN">
6
6
  <!-- Measure Data template -->
7
7
  <templateId root="2.16.840.1.113883.10.20.27.3.5" extension="2016-09-01"/>
8
+ <!-- Measure Data - CMS (V4) -->
9
+ <templateId root="2.16.840.1.113883.10.20.27.3.16" extension="2019-05-01"/>
8
10
  <code code="ASSERTION" codeSystem="2.16.840.1.113883.5.4" displayName="Assertion" codeSystemName="ActCode"/>
9
11
  <statusCode code="completed"/>
10
12
  <value xsi:type="CD" code="{{population_type}}" codeSystem="2.16.840.1.113883.5.4" codeSystemName="ActCode"/>
@@ -10,6 +10,8 @@
10
10
  <!-- In this case the query is using an eMeasure -->
11
11
  <!-- QRDA Category III Measure Section template -->
12
12
  <templateId extension="2017-06-01" root="2.16.840.1.113883.10.20.27.2.1"/>
13
+ <!-- QRDA Category III Measure Section - CMS (V4) -->
14
+ <templateId extension="2019-05-01" root="2.16.840.1.113883.10.20.27.2.3"/>
13
15
  <code code="55186-1" codeSystem="2.16.840.1.113883.6.1"/>
14
16
  <title>Measure Section</title>
15
17
  <text>
@@ -39,6 +41,7 @@
39
41
  <templateId root="2.16.840.1.113883.10.20.24.3.98"/>
40
42
  <!-- SHALL 1..* (one for each referenced measure) Measure Reference and Results template -->
41
43
  <templateId extension="2016-09-01" root="2.16.840.1.113883.10.20.27.3.1"/>
44
+ <templateId extension="2019-05-01" root="2.16.840.1.113883.10.20.27.3.17"/>
42
45
  <id extension="{{random_id}}" root="1.3.6.1.4.1.115"/>
43
46
  <statusCode code="completed"/>
44
47
  <!-- Containing isBranch external references -->
@@ -13,7 +13,14 @@
13
13
  <value xsi:type="CD" nullFlavor="UNK" />
14
14
  {{/unknown_supplemental_value?}}
15
15
  {{^unknown_supplemental_value?}}
16
- <value xsi:type="CD" code="{{code}}" codeSystem="{{supplemental_data_value_code_system}}"/>
16
+ {{#payer_code?}}
17
+ <value xsi:type="CD" nullFlavor="OTH">
18
+ <translation code="{{{cms_payer_code}}}" codeSystem="2.16.840.1.113883.3.249.12" codeSystemName="CMS Clinical Codes"/>
19
+ </value>
20
+ {{/payer_code?}}
21
+ {{^payer_code?}}
22
+ <value xsi:type="CD" code="{{code}}" codeSystem="{{supplemental_data_value_code_system}}"/>
23
+ {{/payer_code?}}
17
24
  {{/unknown_supplemental_value?}}
18
25
  <entryRelationship typeCode="SUBJ" inversionInd="true">
19
26
  <!-- Aggregate Count template -->
@@ -4,7 +4,6 @@
4
4
  {{> _header}}
5
5
  <component>
6
6
  <structuredBody>
7
- {{> _reporting_period}}
8
7
  {{> _measure_section}}
9
8
  </structuredBody>
10
9
  </component>
@@ -6,6 +6,8 @@ class Qrda3R21 < Mustache
6
6
 
7
7
  self.template_path = __dir__
8
8
 
9
+ PAYER_MAP = { '1' => 'A', '2' => 'B', '3' => 'D', '4' => 'D', '5' => 'C', '6' => 'C', '7' => 'D', '8' => 'D', '9' => 'D' }.freeze
10
+
9
11
  def initialize(aggregate_results, measures, options = {})
10
12
  @aggregate_results = aggregate_results
11
13
  @measures = measures
@@ -75,10 +77,23 @@ class Qrda3R21 < Mustache
75
77
  when 'SEX'
76
78
  [{ tid: '2.16.840.1.113883.10.20.27.3.6', extension: '2016-09-01' }]
77
79
  when 'PAYER'
78
- [{ tid: '2.16.840.1.113883.10.20.27.3.9', extension: '2016-02-01' }]
80
+ [{ tid: '2.16.840.1.113883.10.20.27.3.9', extension: '2016-02-01' },
81
+ { tid: '2.16.840.1.113883.10.20.27.3.18', extension: '2018-05-01' }]
79
82
  end
80
83
  end
81
84
 
85
+ def cms_payer_code
86
+ PAYER_MAP[self['code'][0]] || 'D'
87
+ end
88
+
89
+ def cpcplus?
90
+ @submission_program == 'CPCPLUS'
91
+ end
92
+
93
+ def payer_code?
94
+ self['type'] == 'PAYER'
95
+ end
96
+
82
97
  def supplemental_data_code
83
98
  case self['type']
84
99
  when 'RACE'
@@ -0,0 +1,7 @@
1
+ {{#submission_program}}
2
+ <informationRecipient>
3
+ <intendedRecipient>
4
+ <id extension="{{submission_program}}" root="2.16.840.1.113883.3.249.7"/>
5
+ </intendedRecipient>
6
+ </informationRecipient>
7
+ {{/submission_program}}
@@ -0,0 +1,6 @@
1
+ <participant typeCode="DEV">
2
+ <associatedEntity classCode="RGPR">
3
+ <id root="2.16.840.1.113883.3.2074.1" extension="12345abcde67890"/>
4
+ <code code="129465004" displayName="medical record, device" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
5
+ </associatedEntity>
6
+ </participant>
@@ -0,0 +1,13 @@
1
+ <participant typeCode="LOC">
2
+ <associatedEntity classCode="SDLOC">
3
+ <id root="2.16.840.1.113883.3.249.5.1" extension="T2OR1234" assigningAuthorityName="CMS-CMMI"/>
4
+ <code code="394730007" displayName="healthcare related organization" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED-CT"/>
5
+ <addr>
6
+ <streetAddressLine>202 Burlington Rd.</streetAddressLine>
7
+ <city>Bedford</city>
8
+ <state>MA</state>
9
+ <postalCode>01730</postalCode>
10
+ <country>US</country>
11
+ </addr>
12
+ </associatedEntity>
13
+ </participant>
@@ -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
@@ -27,32 +27,39 @@ module Qrda
27
27
  "<id nullFlavor=\"NA\"/>"
28
28
  end
29
29
 
30
- def code_system_oid(data_element_code)
31
- data_element_code['codeSystemOid'] || HQMF::Util::CodeSystemHelper.oid_for_code_system(data_element_code['codeSystem'])
32
- end
33
-
34
30
  def code_and_codesystem
35
- if self['codeSystem'] == 'NA_VALUESET'
31
+ oid = self['codeSystemOid'] || self['codeSystem']
32
+ if oid == '1.2.3.4.5.6.7.8.9.10'
36
33
  "nullFlavor=\"NA\" sdtc:valueSet=\"#{self['code']}\""
37
34
  else
38
- "code=\"#{self['code']}\" codeSystem=\"#{code_system_oid(self)}\" codeSystemName=\"#{self['codeSystem']}\""
35
+ "code=\"#{self['code']}\" codeSystem=\"#{oid}\" codeSystemName=\"#{HQMF::Util::CodeSystemHelper.code_system_for(oid)}\""
39
36
  end
40
37
  end
41
38
 
42
39
  def primary_code_and_codesystem
43
- "code=\"#{self[:dataElementCodes][0]['code']}\" codeSystem=\"#{code_system_oid(self[:dataElementCodes][0])}\" codeSystemName=\"#{self[:dataElementCodes][0]['codeSystem']}\""
40
+ oid = self[:dataElementCodes][0]['codeSystemOid'] || self[:dataElementCodes][0]['codeSystem']
41
+ "code=\"#{self[:dataElementCodes][0]['code']}\" codeSystem=\"#{oid}\" codeSystemName=\"#{HQMF::Util::CodeSystemHelper.code_system_for(oid)}\""
44
42
  end
45
43
 
46
44
  def translation_codes_and_codesystem_list
47
45
  translation_list = ""
48
46
  self[:dataElementCodes].each_with_index do |_dec, index|
49
47
  next if index.zero?
50
-
51
- translation_list += "<translation code=\"#{self[:dataElementCodes][index]['code']}\" codeSystem=\"#{code_system_oid(self[:dataElementCodes][index])}\" codeSystemName=\"#{self[:dataElementCodes][index]['codeSystem']}\"/>"
48
+ oid = self[:dataElementCodes][index]['codeSystemOid'] || self[:dataElementCodes][index]['codeSystem']
49
+ translation_list += "<translation code=\"#{self[:dataElementCodes][index]['code']}\" codeSystem=\"#{oid}\" codeSystemName=\"#{HQMF::Util::CodeSystemHelper.code_system_for(oid)}\"/>"
52
50
  end
53
51
  translation_list
54
52
  end
55
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
+
56
63
  def result_value
57
64
  return "<value xsi:type=\"CD\" nullFlavor=\"UNK\"/>" unless self['result']
58
65
 
@@ -68,7 +75,8 @@ module Qrda
68
75
 
69
76
  def result_value_as_string(result)
70
77
  return "<value xsi:type=\"CD\" nullFlavor=\"UNK\"/>" unless result
71
- return "<value xsi:type=\"CD\" code=\"#{result['code']}\" codeSystem=\"#{code_system_oid(result)}\" codeSystemName=\"#{result['codeSystem']}\"/>" if result['code']
78
+ oid = result['codeSystemOid'] || result['codeSystem']
79
+ return "<value xsi:type=\"CD\" code=\"#{result['code']}\" codeSystem=\"#{oid}\" codeSystemName=\"#{HQMF::Util::CodeSystemHelper.code_system_for(oid)}\"/>" if result['code']
72
80
  return "<value xsi:type=\"PQ\" value=\"#{result['value']}\" unit=\"#{result['unit']}\"/>" if result['unit']
73
81
  end
74
82