health-data-standards 4.0.4 → 4.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
2
  SHA1:
3
- metadata.gz: e986ca8fb8187ca5675b726b14ace665dc37602e
4
- data.tar.gz: 0554c810d31a9fe08f307ef5bf3839bca27a0732
3
+ metadata.gz: dfe3222e8e37edd35ddbfbb2530b22766cad152b
4
+ data.tar.gz: 2b9e2d715ae07b07c4c8829d1bb3a9092057ad2b
5
5
  SHA512:
6
- metadata.gz: 259ff486a7223086f233561d241c7e78ee8a6b3ce54748f4f6671445b6f7a7ef96d31a274a7b648b529830a84925966c36efd8f626a1832bba09abe00472b156
7
- data.tar.gz: 292426fea978d25f61cc0f17c2e9289a749f60e4726e03787d94014897e8e8e2b5a953dfef50a5198bb536ae261259ca516b46d9b35ca1b8ad5e9efa2a8e266f
6
+ metadata.gz: a3d40208beb0b18a7cc7ace4d92c847c4612e6b87e276e7fdfc47eb8e83c1194a529090a32878860a8db733636aa7a701a5cea4ba56a355ec1f808a242e12e5b
7
+ data.tar.gz: da2df8cad8ee160802363d28da11fa1520d044354163e17102e64a8d8fcdff8a1cfdbe4a08ea29b4146509ff252e32e95e2faf9d7d6d06b72189328f225a2066
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'rake/testtask'
2
2
  require 'cane/rake_task'
3
- require "simplecov"
4
3
 
5
4
  import 'lib/tasks/hqmf.rake'
6
5
 
@@ -34,7 +34,8 @@ module HealthDataStandards
34
34
  '2.16.840.1.113883.1.11.78' => "HL7 Observation Interpretation",
35
35
  '2.16.840.1.113883.3.221.5' => "Source of Payment Typology",
36
36
  '2.16.840.1.113883.6.13' => 'CDT',
37
- '2.16.840.1.113883.18.2' => 'AdministrativeSex'
37
+ '2.16.840.1.113883.18.2' => 'AdministrativeSex',
38
+ '2.16.840.1.113883.5.1' => 'AdministrativeGender'
38
39
  }
39
40
 
40
41
  CODE_SYSTEM_ALIASES = {
@@ -73,4 +74,3 @@ module HealthDataStandards
73
74
  end
74
75
  end
75
76
  end
76
-
@@ -32,24 +32,17 @@ module HQMF2
32
32
  # Returns the population descriptions and criteria found in this document
33
33
  def extract_populations_and_criteria
34
34
  has_observation = extract_observations
35
- document_populations = @doc.xpath('cda:QualityMeasureDocument/cda:component/cda:populationCriteriaSection',
36
- HQMF2::Document::NAMESPACES)
37
- # Sort the populations based on the id/extension, since the populations may be out of order; there doesn't seem to
38
- # be any other way that order is indicated in the HQMF
39
- document_populations = document_populations.sort_by do |pop|
40
- pop.at_xpath('cda:id/@extension', HQMF2::Document::NAMESPACES).try(:value)
41
- end
35
+ document_populations = get_document_populations
42
36
  number_of_populations = document_populations.length
43
37
  document_populations.each_with_index do |population_def, population_index|
44
38
  population = {}
45
39
  handle_base_populations(population_def, population)
46
40
 
47
- id_def = population_def.at_xpath('cda:id/@extension', HQMF2::Document::NAMESPACES)
48
- population['id'] = id_def ? id_def.value : "Population#{population_index}"
49
- title_def = population_def.at_xpath('cda:title/@value', HQMF2::Document::NAMESPACES)
50
- population['title'] = title_def ? title_def.value : "Population #{population_index}"
41
+ id_def = get_id_def(population_def)
42
+ add_id_to_population(population_def, id_def, population, population_index)
43
+ add_title_to_population(population_def, population)
44
+ add_observ_to_population(has_observation, population)
51
45
 
52
- population['OBSERV'] = 'OBSERV' if has_observation
53
46
  @populations << population
54
47
  handle_stratifications(population_def, number_of_populations, population, id_def, population_index)
55
48
  end
@@ -59,6 +52,37 @@ module HQMF2
59
52
  [@populations, @population_criteria]
60
53
  end
61
54
 
55
+ def get_document_populations
56
+ document_populations = @doc.xpath('cda:QualityMeasureDocument/cda:component/cda:populationCriteriaSection',
57
+ HQMF2::Document::NAMESPACES)
58
+ # Sort the populations based on the id/extension, since the populations may be out of order; there doesn't seem to
59
+ # be any other way that order is indicated in the HQMF
60
+ document_populations = document_populations.sort_by do |pop|
61
+ pop.at_xpath('cda:id/@extension', HQMF2::Document::NAMESPACES).try(:value)
62
+ end
63
+ end
64
+
65
+ def get_id_def(population_def)
66
+ population_def.at_xpath('cda:id/@extension', HQMF2::Document::NAMESPACES)
67
+ end
68
+
69
+ def get_title_def(population_def)
70
+ title_def = population_def.at_xpath('cda:title/@value', HQMF2::Document::NAMESPACES)
71
+ end
72
+
73
+ def add_id_to_population(population_def, id_def, population, population_index)
74
+ population['id'] = id_def ? id_def.value : "Population#{population_index}"
75
+ end
76
+
77
+ def add_title_to_population(population_def, population)
78
+ title_def = get_title_def(population_def)
79
+ population['title'] = title_def ? title_def.value : "Population #{population_index}"
80
+ end
81
+
82
+ def add_observ_to_population(has_observation, population)
83
+ population['OBSERV'] = 'OBSERV' if has_observation
84
+ end
85
+
62
86
  # Extracts the measure observations, will return true if one exists
63
87
  def extract_observations
64
88
  has_observation = false
@@ -120,5 +120,45 @@ module HQMF2CQL
120
120
  end
121
121
  end
122
122
 
123
+ # Returns the population descriptions and criteria found in this document
124
+ def extract_populations_and_criteria
125
+ has_observation = extract_observations
126
+ document_populations = get_document_populations
127
+ number_of_populations = document_populations.length
128
+ document_populations.each_with_index do |population_def, population_index|
129
+ population = {}
130
+ handle_base_populations(population_def, population)
131
+
132
+ id_def = get_id_def(population_def)
133
+ add_id_to_population(population_def, id_def, population, population_index)
134
+ add_title_to_population(population_def, population)
135
+ add_observ_to_population(has_observation, population)
136
+
137
+ add_supplemental_data_elements_to_population(population_def, population)
138
+
139
+ @populations << population
140
+ handle_stratifications(population_def, number_of_populations, population, id_def, population_index)
141
+ end
142
+
143
+ # Push in the stratification populations after the unstratified populations
144
+ @populations.concat(@stratifications)
145
+ [@populations, @population_criteria]
146
+ end
147
+
148
+ def add_supplemental_data_elements_to_population(population_def, population)
149
+ begin
150
+ supplemental_data_elements_def = population_def.xpath('cda:component/cql-ext:supplementalDataElement')
151
+ rescue Nokogiri::XML::XPath::SyntaxError
152
+ # Older fixtures without SDEs don't have the cql-ext namespace
153
+ return
154
+ end
155
+
156
+ supplemental_data_elements = []
157
+ supplemental_data_elements_def.each do |sde_def|
158
+ cql_definition_name = sde_def.at_xpath('cda:precondition/cda:criteriaReference/cda:id').attribute('extension').to_s.match(/"([^"]*)"/)[1]
159
+ supplemental_data_elements << cql_definition_name
160
+ end
161
+ population['supplemental_data_elements'] = supplemental_data_elements
162
+ end
123
163
  end
124
164
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health-data-standards
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.4
4
+ version: 4.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: 2018-05-03 00:00:00.000000000 Z
11
+ date: 2018-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -883,7 +883,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
883
883
  version: '0'
884
884
  requirements: []
885
885
  rubyforge_project:
886
- rubygems_version: 2.6.12
886
+ rubygems_version: 2.6.14
887
887
  signing_key:
888
888
  specification_version: 4
889
889
  summary: A library for generating and consuming various healthcare related formats.