cqm-parsers 0.1.1 → 0.2.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: 510a1c98b015d5330940690454ef6b72ac184e62
4
- data.tar.gz: 73b86d6e8ad3a906fcc1b3e0152c45ee93fa8b32
3
+ metadata.gz: 8fee41ae3629b17642d96a32021c2a88a482e487
4
+ data.tar.gz: 12beb393c3857d3bbe976680b9af8d8c40675855
5
5
  SHA512:
6
- metadata.gz: d2b48e54347a1efafb97e97fe2aba9b61979160af4cfb6d6db898d49bedcdb412a6135d0d653e90860114d79b12896c9c58c521539b7e82462057b0e000094cb
7
- data.tar.gz: 7ddb52ace1e0a99ba7c9609f2d4bad0f3771a4d9fa793b39492c3bd65220b8e5dba336c79ee05a27acecff0b178a70f5ca37bec75c01d634a67b7a3252c14098
6
+ metadata.gz: 399ea7c2f02c5e22bf470d4f8044f6b838bad480da19cc314f60cd29586250a3591c62ae44aaa3f5783ede0d4678093ea9af8d6cf217b109c88b7323d63e6f3a
7
+ data.tar.gz: d977ad998ebb9789568542fe8e98835a225fb5ff1c0e4b4858b4d9832e0c6c7cca784f649e81af087c9a5b1fcc45d08c5cd49073dd56d0435c211d64ee26a6bb
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "https://rubygems.org"
3
3
  gemspec :development_group => :test
4
4
 
5
5
  gem 'mustache'
6
- gem 'cqm-models', '~> 0.8.2'
6
+ gem 'cqm-models', '~> 0.8.4'
7
7
  gem 'mongoid', '~> 5.0.0'
8
8
 
9
9
  group :development, :test do
@@ -4,18 +4,18 @@
4
4
  <!-- US Realm Header Template Id -->
5
5
  <templateId root="2.16.840.1.113883.10.20.22.1.1" extension="2015-08-01"/>
6
6
  <!-- QRDA templateId -->
7
- <templateId root="2.16.840.1.113883.10.20.24.1.1" extension="2016-02-01"/>
7
+ <templateId root="2.16.840.1.113883.10.20.24.1.1" extension="2017-08-01"/>
8
8
  <!-- QDM-based QRDA templateId -->
9
- <templateId root="2.16.840.1.113883.10.20.24.1.2" extension="2016-02-01"/>
9
+ <templateId root="2.16.840.1.113883.10.20.24.1.2" extension="2017-08-01"/>
10
10
  <!-- CMS QRDA templateId -->
11
- <templateId root="2.16.840.1.113883.10.20.24.1.3" extension="2017-07-01" />
11
+ <templateId root="2.16.840.1.113883.10.20.24.1.3" extension="2018-02-01"/>
12
12
  <!-- This is the globally unique identifier for this QRDA document -->
13
13
  <id root="{{random_id}}"/>
14
14
  <!-- QRDA document type code -->
15
15
  <code code="55182-0" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC" displayName="Quality Measure Report"/>
16
16
  <title>QRDA Incidence Report</title>
17
17
  <!-- This is the document creation time -->
18
- <effectiveTime value="20180524170839"/>
18
+ <effectiveTime value="{{{current_time}}}"/>
19
19
  <confidentialityCode code="N" codeSystem="2.16.840.1.113883.5.25"/>
20
20
  <languageCode code="en"/>
21
21
  <!-- reported patient -->
@@ -13,7 +13,7 @@
13
13
  <templateId root="2.16.840.1.113883.10.20.17.2.4"/>
14
14
  <!-- This is the templateId for Patient Data QDM section -->
15
15
  <templateId extension="2017-08-01" root="2.16.840.1.113883.10.20.24.2.1"/>
16
- <templateId extension="2017-07-01" root="2.16.840.1.113883.10.20.24.2.1.1"/>
16
+ <templateId extension="2018-02-01" root="2.16.840.1.113883.10.20.24.2.1.1"/>
17
17
  <code code="55188-7" codeSystem="2.16.840.1.113883.6.1"/>
18
18
  <title>Patient Data</title>
19
19
  <text/>
@@ -70,9 +70,9 @@
70
70
  {{> qrda_templates/encounter_performed}}
71
71
  {{/encounter_performed}}
72
72
 
73
- {{#immunization_aministered}}
74
- {{> qrda_templates/immunization_aministered}}
75
- {{/immunization_aministered}}
73
+ {{#immunization_administered}}
74
+ {{> qrda_templates/immunization_administered}}
75
+ {{/immunization_administered}}
76
76
 
77
77
  {{#intervention_ordered}}
78
78
  {{> qrda_templates/intervention_ordered}}
@@ -16,110 +16,110 @@ class Qrda1R5 < Mustache
16
16
  end
17
17
 
18
18
  def adverse_event
19
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.10.20.28.3.120').to_json)
19
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('adverse_event', '') }).to_json)
20
20
  end
21
21
 
22
22
  def allergy_intolerance
23
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.10.20.28.3.119').to_json)
23
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('allergy_intolerance', '') }).to_json)
24
24
  end
25
25
 
26
26
  def assessment_performed
27
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.10.20.28.3.117').to_json)
27
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('assessment', 'performed') }).to_json)
28
28
  end
29
29
 
30
30
  def communication_from_patient_to_provider
31
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.3.560.1.30').to_json)
31
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('communication_from_patient_to_provider', '') }).to_json)
32
32
  end
33
33
 
34
34
  def communication_from_provider_to_patient
35
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.31','2.16.840.1.113883.3.560.1.131'] }).to_json)
35
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('communication_from_provider_to_patient', '') }).to_json)
36
36
  end
37
37
 
38
38
  def communication_from_provider_to_provider
39
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.29','2.16.840.1.113883.3.560.1.129'] }).to_json)
39
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('communication_from_provider_to_provider', '') }).to_json)
40
40
  end
41
41
 
42
42
  def diagnosis
43
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.10.20.28.3.110').to_json)
43
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('diagnosis', '') }).to_json)
44
44
  end
45
45
 
46
46
  def device_ordered
47
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.37','2.16.840.1.113883.3.560.1.137'] }).to_json)
47
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('device', 'ordered') }).to_json)
48
48
  end
49
49
 
50
50
  def device_applied
51
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.10','2.16.840.1.113883.3.560.1.110'] }).to_json)
51
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('device', 'applied') }).to_json)
52
52
  end
53
53
 
54
54
  def diagnostic_study_ordered
55
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.40','2.16.840.1.113883.3.560.1.140'] }).to_json)
55
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('diagnostic_study', 'ordered') }).to_json)
56
56
  end
57
57
 
58
58
  def diagnostic_study_performed
59
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.103','2.16.840.1.113883.3.560.1.3'] }).to_json)
59
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('diagnostic_study', 'performed') }).to_json)
60
60
  end
61
61
 
62
62
  def encounter_ordered
63
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.3.560.1.83').to_json)
63
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('encounter', 'ordered') }).to_json)
64
64
  end
65
65
 
66
66
  def encounter_performed
67
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.3.560.1.79').to_json)
67
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('encounter', 'performed') }).to_json)
68
68
  end
69
69
 
70
- def immunization_aministered
71
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.10.20.28.3.112'] }).to_json)
70
+ def immunization_administered
71
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('immunization', 'administered') }).to_json)
72
72
  end
73
73
 
74
74
  def intervention_ordered
75
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.45','2.16.840.1.113883.3.560.1.145'] }).to_json)
75
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('intervention', 'ordered') }).to_json)
76
76
  end
77
77
 
78
78
  def intervention_performed
79
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.46','2.16.840.1.113883.3.560.1.146'] }).to_json)
79
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('intervention', 'performed') }).to_json)
80
80
  end
81
81
 
82
82
  def lab_test_performed
83
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.3.560.1.5').to_json)
83
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('laboratory_test', 'performed') }).to_json)
84
84
  end
85
85
 
86
86
  def lab_test_ordered
87
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.50','2.16.840.1.113883.3.560.1.150'] }).to_json)
87
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('laboratory_test', 'ordered') }).to_json)
88
88
  end
89
89
 
90
90
  def medication_active
91
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.3.560.1.13').to_json)
91
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('medication', 'active') }).to_json)
92
92
  end
93
93
 
94
94
  def medication_administered
95
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.14','2.16.840.1.113883.3.560.1.64','2.16.840.1.113883.3.560.1.114'] }).to_json)
95
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('medication', 'administered') + HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('substance', 'administered') }).to_json)
96
96
  end
97
97
 
98
98
  def medication_discharge
99
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.199','2.16.840.1.113883.3.560.1.200'] }).to_json)
99
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('medication', 'discharge') }).to_json)
100
100
  end
101
101
 
102
102
  def medication_dispensed
103
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.3.560.1.8').to_json)
103
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('medication', 'dispensed') }).to_json)
104
104
  end
105
105
 
106
106
  def medication_ordered
107
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.78','2.16.840.1.113883.3.560.1.17'] }).to_json)
107
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('medication', 'ordered') }).to_json)
108
108
  end
109
109
 
110
110
  def patient_characteristic_expired
111
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.10.20.28.3.57').to_json)
111
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('patient_characteristic_expired', '') }).to_json)
112
112
  end
113
113
 
114
114
  def physical_exam_performed
115
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.57','2.16.840.1.113883.3.560.1.157'] }).to_json)
115
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('physical_exam', 'performed') }).to_json)
116
116
  end
117
117
 
118
118
  def procedure_ordered
119
- JSON.parse(@patient.dataElements.where(hqmfOid: '2.16.840.1.113883.3.560.1.62').to_json)
119
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('procedure', 'ordered') }).to_json)
120
120
  end
121
121
 
122
122
  def procedure_performed
123
- JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => ['2.16.840.1.113883.3.560.1.6','2.16.840.1.113883.3.560.1.106'] }).to_json)
123
+ JSON.parse(@patient.dataElements.where(hqmfOid: { '$in' => HQMF::Util::HQMFTemplateHelper.get_all_hqmf_oids('procedure', 'performed') }).to_json)
124
124
  end
125
125
  end
@@ -1,9 +1,13 @@
1
1
  <author>
2
- <time value="20180524170839"/>
2
+ <time value="{{{current_time}}}"/>
3
3
  <assignedAuthor>
4
- <!-- id extension="Cypress" root="2.16.840.1.113883.19.5"/ -->
5
4
  <!-- NPI -->
6
- <id extension="1982671962" root="2.16.840.1.113883.4.6"/>
5
+ {{#provider}}
6
+ <id extension="{{{provider_npi}}}" root="2.16.840.1.113883.4.6"/>
7
+ {{/provider}}
8
+ {{^provider}}
9
+ <id extension="1982671962" root="2.16.840.1.113883.4.6"/>
10
+ {{/provider}}
7
11
  <addr>
8
12
  <streetAddressLine>202 Burlington Rd.</streetAddressLine>
9
13
  <city>Bedford</city>
@@ -1,7 +1,32 @@
1
+ {{#provider}}
2
+ <custodian>
3
+ <assignedCustodian>
4
+ <representedCustodianOrganization>
5
+ {{#provider_ccn}}
6
+ <id extension="{{{provider_ccn}}}" root="2.16.840.1.113883.4.336"/>
7
+ {{/provider_ccn}}
8
+ {{^provider_ccn}}
9
+ <id extension="800890" root="2.16.840.1.113883.4.336"/>
10
+ {{/provider_ccn}}
11
+ <name>Cypress Test Deck</name>
12
+ <telecom use="WP" value="tel:(781)271-3000"/>
13
+ {{#provider_addresses}}
14
+ <addr use="HP">
15
+ <streetAddressLine>{{{provider_street}}}</streetAddressLine>
16
+ <city>{{{city}}}</city>
17
+ <state>{{{state}}}</state>
18
+ <postalCode>{{{zip}}}</postalCode>
19
+ <country>{{{country}}}</country>
20
+ </addr>
21
+ {{/provider_addresses}}
22
+ </representedCustodianOrganization>
23
+ </assignedCustodian>
24
+ </custodian>
25
+ {{/provider}}
26
+ {{^provider}}
1
27
  <custodian>
2
28
  <assignedCustodian>
3
29
  <representedCustodianOrganization>
4
- <!-- HQR Only -->
5
30
  <id extension="800890" root="2.16.840.1.113883.4.336"/>
6
31
  <name>Cypress Test Deck</name>
7
32
  <telecom use="WP" value="tel:(781)271-3000"/>
@@ -14,4 +39,5 @@
14
39
  </addr>
15
40
  </representedCustodianOrganization>
16
41
  </assignedCustodian>
17
- </custodian>
42
+ </custodian>
43
+ {{/provider}}
@@ -14,7 +14,9 @@
14
14
  {{#provider}}
15
15
  <assignedEntity>
16
16
  <id extension="{{{provider_npi}}}" root="2.16.840.1.113883.4.6"/>
17
- <id extension="{{{provider_ccn}}}" root="2.16.840.1.113883.4.336"/>
17
+ {{#provider_ccn}}
18
+ <id extension="{{{provider_ccn}}}" root="2.16.840.1.113883.4.336"/>
19
+ {{/provider_ccn}}
18
20
  <code code="{{{provider_type_code}}}" codeSystem="2.16.840.1.113883.6.101" codeSystemName="Healthcare Provider Taxonomy (HIPAA)"/>
19
21
  {{#provider_addresses}}
20
22
  <addr use="HP">
@@ -1,5 +1,5 @@
1
1
  <legalAuthenticator>
2
- <time value="20180524170839"/>
2
+ <time value="{{{current_time}}}"/>
3
3
  <signatureCode code="S"/>
4
4
  <assignedEntity>
5
5
  <id root="bc01a5d1-3a34-4286-82cc-43eb04c972a7"/>
@@ -17,8 +17,8 @@
17
17
  </name>
18
18
  <administrativeGenderCode code="{{{gender}}}" codeSystem="2.16.840.1.113883.5.1" codeSystemName="HL7 AdministrativeGender"/>
19
19
  <birthTime value="{{{birthdate}}}"/>
20
- <raceCode code="{{{race}}}" displayName="Black or African American" codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/>
21
- <ethnicGroupCode code="{{{ethnic_group}}}" displayName="Not Hispanic or Latino" codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/>
20
+ <raceCode code="{{{race}}}" codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/>
21
+ <ethnicGroupCode code="{{{ethnic_group}}}" codeSystemName="CDC Race and Ethnicity" codeSystem="2.16.840.1.113883.6.238"/>
22
22
  <languageCommunication>
23
23
  <templateId root="2.16.840.1.113883.3.88.11.83.2" assigningAuthorityName="HITSP/C83"/>
24
24
  <templateId root="1.3.6.1.4.1.19376.1.5.3.1.2.1" assigningAuthorityName="IHE/PCC"/>
@@ -22,10 +22,10 @@
22
22
  </playingDevice>
23
23
  </participantRole>
24
24
  </participant>
25
+ {{#negationRationale}}
26
+ {{> qrda_templates/template_partials/_reason}}
27
+ {{/negationRationale}}
25
28
  </supply>
26
29
  </entryRelationship>
27
- {{#negationRationale}}
28
- {{> qrda_templates/template_partials/_reason}}
29
- {{/negationRationale}}
30
30
  </act>
31
31
  </entry>
@@ -16,10 +16,10 @@
16
16
  {{#authorDatetime}}
17
17
  {{> qrda_templates/template_partials/_author}}
18
18
  {{/authorDatetime}}
19
+ {{#negationRationale}}
20
+ {{> qrda_templates/template_partials/_reason}}
21
+ {{/negationRationale}}
19
22
  </encounter>
20
23
  </entryRelationship>
21
- {{#negationRationale}}
22
- {{> qrda_templates/template_partials/_reason}}
23
- {{/negationRationale}}
24
24
  </act>
25
25
  </entry>
@@ -46,10 +46,10 @@
46
46
  {{#authorDatetime}}
47
47
  {{> qrda_templates/template_partials/_author_participation}}
48
48
  {{/authorDatetime}}
49
+ {{#negationRationale}}
50
+ {{> qrda_templates/template_partials/_reason}}
51
+ {{/negationRationale}}
49
52
  </substanceAdministration>
50
53
  </entryRelationship>
51
- {{#negationRationale}}
52
- {{> qrda_templates/template_partials/_reason}}
53
- {{/negationRationale}}
54
54
  </act>
55
55
  </entry>
@@ -30,10 +30,10 @@
30
30
  {{#authorDatetime}}
31
31
  {{> qrda_templates/template_partials/_author}}
32
32
  {{/authorDatetime}}
33
+ {{#negationRationale}}
34
+ {{> qrda_templates/template_partials/_reason}}
35
+ {{/negationRationale}}
33
36
  </supply>
34
37
  </entryRelationship>
35
- {{#negationRationale}}
36
- {{> qrda_templates/template_partials/_reason}}
37
- {{/negationRationale}}
38
38
  </act>
39
39
  </entry>
@@ -7,11 +7,11 @@ module Qrda
7
7
  end
8
8
 
9
9
  def as_id
10
- self['$oid']
10
+ self[:value]
11
11
  end
12
12
 
13
13
  def object_id
14
- self[:_id]['$oid']
14
+ self[:_id]
15
15
  end
16
16
 
17
17
  def submission_program
@@ -19,6 +19,10 @@ module Qrda
19
19
  @performance_period_end.to_formatted_s(:number)
20
20
  end
21
21
 
22
+ def current_time
23
+ Time.now.utc.to_formatted_s(:number)
24
+ end
25
+
22
26
  def author_time
23
27
  "<time #{value_or_null_flavor(self['authorDatetime'])}/>"
24
28
  end
@@ -2,11 +2,8 @@ module QRDA
2
2
  module Cat1
3
3
  module DemographicsImporter
4
4
  def get_demographics(patient, doc)
5
- # effective_date = doc.at_xpath('/cda:ClinicalDocument/cda:effectiveTime')['value']
6
- # patient.effective_time = HL7Helper.timestamp_to_integer(effective_date)
7
5
  patient_role_element = doc.at_xpath('/cda:ClinicalDocument/cda:recordTarget/cda:patientRole')
8
6
  patient_element = patient_role_element.at_xpath('./cda:patient')
9
- # patient.title = patient_element.at_xpath('cda:name/cda:title').try(:text)
10
7
  patient.givenNames = [patient_element.at_xpath('cda:name/cda:given').text]
11
8
  patient.familyName = patient_element.at_xpath('cda:name/cda:family').text
12
9
  patient.birthDatetime = Time.parse(patient_element.at_xpath('cda:birthTime')['value']).utc
@@ -20,27 +17,26 @@ module QRDA
20
17
  pcs.dataElementCodes = [{ code: gender_code, codeSystem: 'AdministrativeGender' }]
21
18
  patient.dataElements << pcs
22
19
 
23
- # TODO: Investigate what of this HDS import codes needs to be addressed in this qrda parser.
24
- # gender_node = patient_element.at_xpath('cda:administrativeGenderCode')
25
- # patient.gender = gender_node['code']
26
- # id_node = patient_role_element.at_xpath('./cda:id')
27
- # patient.medical_record_number = id_node['extension']
28
-
29
- # parse race, ethnicity, and spoken language
30
- # race_node = patient_element.at_xpath('cda:raceCode')
31
- # patient.race = { 'code' => race_node['code'], 'codeSystem' => 'CDC Race' } if race_node
32
- # ethnicity_node = patient_element.at_xpath('cda:ethnicGroupCode')
33
- # patient.ethnicity = {'code' => ethnicity_node['code'], 'codeSystem' => 'CDC Race'} if ethnicity_node
34
- # marital_status_node = patient_element.at_xpath("./cda:maritalStatusCode")
35
- # patient.marital_status = {code: marital_status_node['code'], code_set: "HL7 Marital Status"} if marital_status_node
36
- # ra_node = patient_element.at_xpath("./cda:religiousAffiliationCode")
37
- # patient.religious_affiliation = {code: ra_node['code'], code_set: "Religious Affiliation"} if ra_node
38
- # languages = patient_element.search('languageCommunication').map {|lc| lc.at_xpath('cda:languageCode')['code'] }
39
- # patient.languages = languages unless languages.empty?
40
-
41
- # patient.addresses = patient_role_element.xpath("./cda:addr").map { |addr| import_address(addr) }
42
- # patient.telecoms = patient_role_element.xpath("./cda:telecom").map { |tele| import_telecom(tele) }
43
-
20
+ pcr = QDM::PatientCharacteristicRace.new
21
+ race_code = patient_element.at_xpath('cda:raceCode')['code']
22
+ pcr.dataElementCodes = [{ code: race_code, codeSystem: 'cdcrec' }]
23
+ patient.dataElements << pcr
24
+
25
+ pce = QDM::PatientCharacteristicEthnicity.new
26
+ ethnicity_code = patient_element.at_xpath('cda:ethnicGroupCode')['code']
27
+ pce.dataElementCodes = [{ code: ethnicity_code, codeSystem: 'cdcrec' }]
28
+ patient.dataElements << pce
29
+
30
+ provider_element = doc.xpath("//cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.55']")
31
+
32
+ # If a provider element isn't in the record, return wiihout adding one.
33
+ return if provider_element.blank?
34
+ provider_code = provider_element.first.at_xpath('cda:value')['code']
35
+ ip = {}
36
+ ip['financial_responsibility_type'] = { 'code' => 'SELF', 'codeSystem' => 'HL7 Relationship Code' }
37
+ ip['codes'] = { 'SOP' => [provider_code] }
38
+ patient.extendedData = {}
39
+ patient.extendedData['insurance_providers'] = JSON.generate([ip])
44
40
  end
45
41
  end
46
42
  end
@@ -38,8 +38,8 @@ module QRDA
38
38
 
39
39
  def create_entry(entry_element, _nrh = NarrativeReferenceHandler.new)
40
40
  entry = @entry_class.new
41
- @entry_id_map[extract_id(entry_element, "./cda:id")] ||= []
42
- @entry_id_map[extract_id(entry_element, "./cda:id")] << entry.id
41
+ @entry_id_map[extract_id(entry_element, "./cda:id").value] ||= []
42
+ @entry_id_map[extract_id(entry_element, "./cda:id").value] << entry.id
43
43
  entry.dataElementCodes = extract_codes(entry_element, @code_xpath)
44
44
  extract_dates(entry_element, entry)
45
45
  if @result_xpath
@@ -54,9 +54,9 @@ module QRDA
54
54
  def extract_id(parent_element, id_xpath)
55
55
  id_element = parent_element.at_xpath(id_xpath)
56
56
  return unless id_element
57
- identifier = CDAIdentifier.new
58
- identifier.root = id_element['root']
59
- identifier.extension = id_element['extension']
57
+ # If an extension is not included, use the root as the value. Other wise use the extension
58
+ value = id_element['extension'] ? id_element['extension'] : id_element['root']
59
+ identifier = QDM::Id.new(value: value, namingSystem: id_element['root'])
60
60
  identifier
61
61
  end
62
62
 
@@ -133,13 +133,13 @@ module QRDA
133
133
  # coded_parent_element is the 'parent' element when the coded is nested (e.g., medication order)
134
134
  def extract_reason_or_negation(parent_element, entry, coded_parent_element = nil)
135
135
  coded_parent_element ||= parent_element
136
- reason_element = parent_element.at_xpath("./cda:entryRelationship[@typeCode='RSON']/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.24.3.88']/cda:value | ./cda:entryRelationship[@typeCode='RSON']/cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.1.27']/cda:code")
136
+ reason_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 | .//cda:entryRelationship[@typeCode='RSON']/cda:act[cda:templateId/@root='2.16.840.1.113883.10.20.1.27']/cda:code")
137
137
  negation_indicator = parent_element['negationInd']
138
- if reason_element
138
+ unless reason_element.blank?
139
139
  if negation_indicator.eql?('true')
140
- entry.negationRationale = code_if_present(reason_element)
140
+ entry.negationRationale = code_if_present(reason_element.first)
141
141
  else
142
- entry.reason = code_if_present(reason_element)
142
+ entry.reason = code_if_present(reason_element.first)
143
143
  end
144
144
  end
145
145
  extract_negated_code(coded_parent_element, entry)
@@ -89,8 +89,14 @@ module QRDA
89
89
 
90
90
  def normalize_references(patient, entry_id_map)
91
91
  patient.dataElements.each do |data_element|
92
- if data_element.respond_to?(:relatedTo) && data_element.relatedTo
93
- data_element.relatedTo.map! { |related_to| entry_id_map[related_to] }
92
+ next unless data_element.respond_to?(:relatedTo) && data_element.relatedTo
93
+ relations_to_add = []
94
+ data_element.relatedTo.each do |related_to|
95
+ relations_to_add << entry_id_map[related_to.value]
96
+ end
97
+ data_element.relatedTo.destroy
98
+ relations_to_add.each do |relation_to_add|
99
+ data_element.relatedTo << relation_to_add
94
100
  end
95
101
  end
96
102
  end
@@ -34,6 +34,19 @@ module HQMF
34
34
  nil
35
35
  end
36
36
  end
37
+
38
+ # Returns a list of all hqmf_oids (regardless of version) for the combination of definition and status
39
+ def self.get_all_hqmf_oids(definition, status)
40
+ status ||= ""
41
+ version_negation_combinations = [{ version: 'r1', negation: false },
42
+ { version: 'r1', negation: true },
43
+ { version: 'r2', negation: false },
44
+ { version: 'r2cql', negation: false }]
45
+ hqmf_oids = version_negation_combinations.collect do |obj|
46
+ template_id_by_definition_and_status(definition, status, obj[:negation], obj[:version])
47
+ end
48
+ hqmf_oids
49
+ end
37
50
  end
38
51
  end
39
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cqm-parsers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.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: 2018-07-25 00:00:00.000000000 Z
11
+ date: 2018-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 1.8.3
131
+ version: 1.8.5
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: 1.8.3
138
+ version: 1.8.5
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: highline
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 1.2.1
159
+ version: 1.2.2
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 1.2.1
166
+ version: 1.2.2
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: zip-zip
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -300,7 +300,7 @@ files:
300
300
  - lib/qrda-export/catI-r5/qrda_templates/diagnostic_study_performed.mustache
301
301
  - lib/qrda-export/catI-r5/qrda_templates/encounter_ordered.mustache
302
302
  - lib/qrda-export/catI-r5/qrda_templates/encounter_performed.mustache
303
- - lib/qrda-export/catI-r5/qrda_templates/immunization_aministered.mustache
303
+ - lib/qrda-export/catI-r5/qrda_templates/immunization_administered.mustache
304
304
  - lib/qrda-export/catI-r5/qrda_templates/insurance_provider.mustache
305
305
  - lib/qrda-export/catI-r5/qrda_templates/intervention_ordered.mustache
306
306
  - lib/qrda-export/catI-r5/qrda_templates/intervention_performed.mustache