cqm-parsers 0.2.2 → 0.2.3

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
  SHA256:
3
- metadata.gz: 1b1bca119f15302832fea054a9bcc5ad90736bfe3ad898ec05410ba9932c4fa6
4
- data.tar.gz: 94776039cbf7dadafc0b8bf2308cca80b60e298a5291494d3d63d2ade0f852d4
3
+ metadata.gz: 9485682c59342822202fe6a253ce7bbcbb67b92a428fa04558a093d0995d9765
4
+ data.tar.gz: e68e467aa5d71626f960a79df31e08569b35cc7faa8c6c35ca893532818e60ae
5
5
  SHA512:
6
- metadata.gz: 476c7290726a10f52dfb3f65a066516f755d7913be15c74783d5fbc836a2718c7cf65b9580ef309368ec4bdb45d9d6d175881b190660eb94f12d9ed6b2eeed08
7
- data.tar.gz: 14d8e37e7fe9c737df8175192d935e3b908a53fa4511ccff107772108ef055375091241206fa964a5c430dcb944b5ce7b05b1bd94b52a5860a902d212843b0ca
6
+ metadata.gz: 1bc35e9ea6bfadd995d234619315ef036f2f3cfc61e4a3dc8bc35f20bb7f48efe798049642061019fd4351861b906a16989dc54a451dfe32c3bcd56778e72937
7
+ data.tar.gz: 5fe9cbb48856d6585c433bf33727129d985afd25a71df22f688aab9289904466ac0defbdd7779c9c2fba422c2607d601f4b1519f605970d2bc74ad334e5beea6
@@ -16,6 +16,9 @@
16
16
  {{#authorDatetime}}
17
17
  {{> qrda_templates/template_partials/_author}}
18
18
  {{/authorDatetime}}
19
+ {{#reason}}
20
+ {{> qrda_templates/template_partials/_reason}}
21
+ {{/reason}}
19
22
  {{#negationRationale}}
20
23
  {{> qrda_templates/template_partials/_reason}}
21
24
  {{/negationRationale}}
@@ -1,6 +1,6 @@
1
1
  <entryRelationship typeCode="RSON">
2
2
  <observation classCode="OBS" moodCode="EVN">
3
- <templateId root="2.16.840.1.113883.10.20.24.3.88" extension="2014-12-01"/>
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
6
  <statusCode code="completed"/>
@@ -2,13 +2,11 @@
2
2
  <observation classCode="OBS" moodCode="EVN">
3
3
  <!-- Conforms to C-CDA R2 Result Observation (V2) -->
4
4
  <templateId root="2.16.840.1.113883.10.20.22.4.2" extension="2015-08-01"/>
5
- <!-- Result (QRDA I R3) -->
6
- <templateId root="2.16.840.1.113883.10.20.24.3.87" extension="2016-02-01"/>
7
5
  <id root="1.3.6.1.4.1.115" extension="{{random_id}}"/>
8
6
  {{> _codes}}
9
7
  <statusCode code="completed"/>
10
8
  {{#relevantPeriod}}
11
- {{{relevant_period}}}
9
+ {{{relevant_period_as_value}}}
12
10
  {{/relevantPeriod}}
13
11
  {{^relevantPeriod}}
14
12
  {{#authorDatetime}}
@@ -103,7 +103,11 @@ module Qrda
103
103
  end
104
104
 
105
105
  def code_and_codesystem
106
- "code=\"#{self['code']}\" codeSystem=\"#{code_system_oid(self['codeSystem'])}\" codeSystemName=\"#{self['codeSystem']}\""
106
+ if self['codeSystem'] == 'NA_VALUESET'
107
+ "nullFlavor=\"NA\" sdtc:valueSet=\"#{self['code']}\""
108
+ else
109
+ "code=\"#{self['code']}\" codeSystem=\"#{code_system_oid(self['codeSystem'])}\" codeSystemName=\"#{self['codeSystem']}\""
110
+ end
107
111
  end
108
112
 
109
113
  def primary_code_and_codesystem
@@ -51,6 +51,10 @@ module Qrda
51
51
  "</effectiveTime>"
52
52
  end
53
53
 
54
+ def relevant_period_as_value
55
+ "<effectiveTime #{value_or_null_flavor(self['relevantPeriod']['low'])}/>"
56
+ end
57
+
54
58
  def insurance_provider_period
55
59
  start_time = self['start_time'] ? DateTime.strptime(self['start_time'].to_s, '%s').to_s : nil
56
60
  end_time = self['end_time'] ? DateTime.strptime(self['end_time'].to_s, '%s').to_s : nil
@@ -13,18 +13,18 @@ module QRDA
13
13
  patient.dataElements << pcbd
14
14
 
15
15
  pcs = QDM::PatientCharacteristicSex.new
16
- gender_code = patient_element.at_xpath('cda:administrativeGenderCode')['code']
17
- pcs.dataElementCodes = [{ code: gender_code, codeSystem: 'AdministrativeGender' }]
16
+ code_element = patient_element.at_xpath('cda:administrativeGenderCode')
17
+ pcs.dataElementCodes = [code_if_present(code_element)]
18
18
  patient.dataElements << pcs
19
19
 
20
20
  pcr = QDM::PatientCharacteristicRace.new
21
- race_code = patient_element.at_xpath('cda:raceCode')['code']
22
- pcr.dataElementCodes = [{ code: race_code, codeSystem: 'cdcrec' }]
21
+ code_element = patient_element.at_xpath('cda:raceCode')
22
+ pcr.dataElementCodes = [code_if_present(code_element)]
23
23
  patient.dataElements << pcr
24
24
 
25
25
  pce = QDM::PatientCharacteristicEthnicity.new
26
- ethnicity_code = patient_element.at_xpath('cda:ethnicGroupCode')['code']
27
- pce.dataElementCodes = [{ code: ethnicity_code, codeSystem: 'cdcrec' }]
26
+ code_element = patient_element.at_xpath('cda:ethnicGroupCode')
27
+ pce.dataElementCodes = [code_if_present(code_element)]
28
28
  patient.dataElements << pce
29
29
 
30
30
  provider_element = doc.xpath("//cda:entry/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.55']")
@@ -38,6 +38,12 @@ module QRDA
38
38
  patient.extendedData = {}
39
39
  patient.extendedData['insurance_providers'] = JSON.generate([ip])
40
40
  end
41
+
42
+ def code_if_present(code_element)
43
+ return unless code_element && code_element['codeSystem'] && code_element['code']
44
+
45
+ QDM::Code.new(code_element['code'], HQMF::Util::CodeSystemHelper.code_system_for(code_element['codeSystem']))
46
+ end
41
47
  end
42
48
  end
43
49
  end
@@ -139,7 +139,7 @@ module QRDA
139
139
  if negation_indicator.eql?('true')
140
140
  entry.negationRationale = code_if_present(reason_element.first)
141
141
  else
142
- entry.reason = code_if_present(reason_element.first)
142
+ entry.reason = code_if_present(reason_element.first) unless @entry_does_not_have_reason
143
143
  end
144
144
  end
145
145
  extract_negated_code(coded_parent_element, entry)
@@ -3,6 +3,7 @@ module QRDA
3
3
  class CommunicationFromPatientToProviderImporter < 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.2']"))
5
5
  super(entry_finder)
6
+ @entry_does_not_have_reason = true
6
7
  @id_xpath = './cda:id'
7
8
  @code_xpath = './cda:code'
8
9
  @author_datetime_xpath = "./cda:author/cda:time"
@@ -3,6 +3,7 @@ module QRDA
3
3
  class CommunicationFromProviderToPatientImporter < 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.3']"))
5
5
  super(entry_finder)
6
+ @entry_does_not_have_reason = true
6
7
  @id_xpath = './cda:id'
7
8
  @code_xpath = './cda:code'
8
9
  @author_datetime_xpath = "./cda:author/cda:time"
@@ -3,6 +3,7 @@ module QRDA
3
3
  class CommunicationFromProviderToProviderImporter < 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.4']"))
5
5
  super(entry_finder)
6
+ @entry_does_not_have_reason = true
6
7
  @id_xpath = './cda:id'
7
8
  @code_xpath = './cda:code'
8
9
  @author_datetime_xpath = "./cda:author/cda:time"
@@ -5,7 +5,7 @@ module QRDA
5
5
  super(entry_finder)
6
6
  @id_xpath = './cda:entryRelationship/cda:observation/cda:id'
7
7
  @code_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:value"
8
- @author_datetime_xpath = "./cda:author/cda:time"
8
+ @author_datetime_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:author/cda:time"
9
9
  @prevalence_period_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:effectiveTime"
10
10
  @anatomical_location_site_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:targetSiteCode"
11
11
  @severity_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.135']/cda:entryRelationship/cda:observation[cda:templateId/@root='2.16.840.1.113883.10.20.22.4.8']/cda:value"
@@ -7,8 +7,8 @@ module QRDA
7
7
  @code_xpath = './cda:code'
8
8
  @relevant_period_xpath = "./cda:effectiveTime"
9
9
  @author_datetime_xpath = "./cda:author/cda:time"
10
- @result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:value"
11
- @result_datetime_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:effectiveTime"
10
+ @result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.2']/cda:value"
11
+ @result_datetime_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.2']/cda:effectiveTime"
12
12
  @status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
13
13
  @method_xpath = './cda:methodCode'
14
14
  @facility_location_xpath = "./cda:participant[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.100']/cda:participantRole[@classCode='SDLOC']/cda:code"
@@ -9,8 +9,8 @@ module QRDA
9
9
  @author_datetime_xpath = "./cda:author/cda:time"
10
10
  @status_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.93']/cda:value"
11
11
  @method_xpath = './cda:methodCode'
12
- @result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:value"
13
- @result_datetime_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation/cda:effectiveTime"
12
+ @result_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.2']/cda:value"
13
+ @result_datetime_xpath = "./cda:entryRelationship[@typeCode='REFR']/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.22.4.2']/cda:effectiveTime"
14
14
  @components_xpath = "./cda:entryRelationship/cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.149']"
15
15
  @entry_class = QDM::LaboratoryTestPerformed
16
16
  end
@@ -3,6 +3,7 @@ module QRDA
3
3
  class SubstanceAdministeredImporter < MedicationAdministeredImporter
4
4
  def initialize(entry_finder = QRDA::Cat1::EntryFinder.new("./cda:entry/cda:substanceAdministration[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.42']"))
5
5
  super(entry_finder)
6
+ @entry_does_not_have_reason = true
6
7
  @entry_class = QDM::SubstanceAdministered
7
8
  end
8
9
 
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.2.2
4
+ version: 0.2.3
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-01-25 00:00:00.000000000 Z
11
+ date: 2019-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mustache
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.0
33
+ version: 2.0.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.0
40
+ version: 2.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: erubis
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.8.5
145
+ version: 1.10.3
146
146
  type: :runtime
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.8.5
152
+ version: 1.10.3
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: highline
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -411,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
411
411
  version: '0'
412
412
  requirements: []
413
413
  rubyforge_project:
414
- rubygems_version: 2.7.7
414
+ rubygems_version: 2.7.9
415
415
  signing_key:
416
416
  specification_version: 4
417
417
  summary: A library for parsing HQMF documents.