cqm-converter 0.3.6 → 1.0.2

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
- SHA1:
3
- metadata.gz: 877c904445ba40b62519fdcddb7509a4e440c2d1
4
- data.tar.gz: ac4b3fda4196682999230c07ff66b02b9144ba0b
2
+ SHA256:
3
+ metadata.gz: d4b52ce8b078c33be4f09b537689de46744fd01e072b846745a17a740a3434db
4
+ data.tar.gz: f72b044e4267d88a77b6b7210f2e393b54ca855cd2e87c1fe12681fb01e527a1
5
5
  SHA512:
6
- metadata.gz: 3d105e8e44cb632a0a1cf57d3ed2722d02d72cf2df779e1e5a58d18432cf7c9d3323572c0929fc176f4c0d7bf5804a80ff8b09886176fcbc0ef7a24fe37fde04
7
- data.tar.gz: b2ca77ebd8a042ad05c733414c7588fe0f2ae64877e9bc272d96c8f03355ebd69de80110f7358520a20765fe6316cddd559dc0a0b49eb0465bf26e574cb82f91
6
+ metadata.gz: b1ad6dfeaa002bc26315b12aa64804c98003cad0622cb9108070d1e287a96f4e17edb77daf7c47d895eaa37bfeeaab651bc31acf69cc08e2a33b15a195642053
7
+ data.tar.gz: 2cdf12d33a3bf335e802d8be8861144ced95144fbb70fb3b8725b100622a4d268898a942868facd406aec687d957bef6800655bbbe1d794df6f74f121755ea98
data/.rubocop.yml CHANGED
@@ -44,4 +44,4 @@ Style/IfUnlessModifier:
44
44
 
45
45
  Lint/UnusedMethodArgument:
46
46
  Exclude:
47
- - 'lib/ext/mongoid.rb'
47
+ - 'lib/ext/mongoid.rb'
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'cqm-converter'
6
- spec.version = '0.3.6'
6
+ spec.version = '1.0.2'
7
7
  spec.authors = ['aholmes@mitre.org']
8
8
  spec.email = ['aholmes@mitre.org']
9
9
 
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'bundler'
23
23
  spec.add_development_dependency 'byebug'
24
24
  spec.add_runtime_dependency 'coffee-script'
25
- spec.add_runtime_dependency 'cqm-models', '>= 0.8.4'
25
+ spec.add_runtime_dependency 'cqm-models', '>= 1.0.1'
26
26
  spec.add_runtime_dependency 'execjs'
27
- spec.add_runtime_dependency 'health-data-standards', '>= 4.1.0'
27
+ spec.add_runtime_dependency 'health-data-standards', '>= 4.3.1'
28
28
  spec.add_runtime_dependency 'momentjs-rails'
29
29
  spec.add_development_dependency 'rake'
30
30
  spec.add_development_dependency 'rspec'
@@ -18,10 +18,10 @@ module CQM::Converter
18
18
  # Loop over the QDM Patient's data elements, and create the corresponding
19
19
  # HDS Record Entry models on the newly created record.
20
20
  patient.dataElements.each do |data_element|
21
- category = data_element.category if data_element.fields.include? 'category'
21
+ category = data_element.qdmCategory if data_element.fields.include? 'qdmCategory'
22
22
  next unless category
23
23
  # Handle patient characteristics seperately.
24
- next if data_element.category == 'patient_characteristic'
24
+ next if data_element.qdmCategory == 'patient_characteristic'
25
25
 
26
26
  # Grab the QDM datatype name of this data element.
27
27
  qdm_model_name = data_element.class.name.demodulize
@@ -57,6 +57,7 @@ module CQM::Converter
57
57
  hds_attrs = {}
58
58
  @qdm_to_hds_mappings[qdm_model_name].each do |qdm_attr, hds_attr|
59
59
  next if data_element[qdm_attr].nil?
60
+
60
61
  extracted_value = extractor(data_element[qdm_attr].as_json)
61
62
  if hds_attr.is_a?(Hash) && hds_attr[:low]
62
63
  # Handle something that has multiple parts.
@@ -202,7 +203,7 @@ module CQM::Converter
202
203
  def get_data_elements(patient, category, status = nil)
203
204
  matches = []
204
205
  patient.dataElements.each do |data_element|
205
- matches << data_element if data_element[:category] == category && (data_element[:qdmStatus] == status || status.nil?)
206
+ matches << data_element if data_element[:qdmCategory] == category && (data_element[:qdmStatus] == status || status.nil?)
206
207
  end
207
208
  matches
208
209
  end
@@ -227,6 +228,7 @@ module CQM::Converter
227
228
  # Unpack components.
228
229
  def unpack_components(hds_attrs)
229
230
  return unless hds_attrs.key?('components') && !hds_attrs['components'].nil?
231
+
230
232
  hds_attrs['components']['type'] = 'COL'
231
233
  hds_attrs['components'][:values]&.collect do |code_value|
232
234
  code_value[:code] = code_value.delete('Code') if code_value.key?('Code')
@@ -259,12 +261,14 @@ module CQM::Converter
259
261
  # Remove diagnosis if principalDiagnosis is equivalent.
260
262
  return unless hds_attrs.key?('diagnosis') && hds_attrs.key?('principalDiagnosis')
261
263
  return unless hds_attrs['diagnosis']['values'] && Hash[hds_attrs['diagnosis']['values'].first.sort] == Hash[hds_attrs['principalDiagnosis'].sort]
264
+
262
265
  hds_attrs.delete('diagnosis')
263
266
  end
264
267
 
265
268
  # Unpack facility.
266
269
  def unpack_facility(hds_attrs)
267
270
  return unless hds_attrs.key?('facility') && !hds_attrs['facility'].empty?
271
+
268
272
  hds_attrs['facility']['type'] = 'COL'
269
273
  hds_attrs['facility'][:values]&.each do |value|
270
274
  value['code'] = value.delete('Code') if value['Code']
@@ -278,6 +282,7 @@ module CQM::Converter
278
282
  # Unpack references.
279
283
  def unpack_references(hds_attrs)
280
284
  return unless hds_attrs.key?('references') && !hds_attrs['references'].empty?
285
+
281
286
  hds_attrs['references'] = hds_attrs['references'][:values].collect { |value| { referenced_id: value['value'], referenced_type: value['referencedType'], type: value['type'] } }
282
287
  end
283
288
 
@@ -38,19 +38,9 @@ module CQM::Converter
38
38
  qdm_model_attrs[model.to_s].concat(QDM.const_get(model).embedded_relations.keys.map! { |a| a.camelize(:lower) })
39
39
  end
40
40
  end
41
- # TODO: These fields are currently not supported. See:
41
+ # TODO: This field is currently not supported. See:
42
42
  # https://github.com/projecttacoma/cql_qdm_patientapi/search?q=does+not+currently+support
43
- qdm_model_attrs['SubstanceAdministered'].delete('frequency')
44
- qdm_model_attrs['SubstanceOrder'].delete('refills')
45
43
  qdm_model_attrs['PatientCharacteristicExpired'].delete('cause')
46
- qdm_model_attrs['MedicationDispensed'].delete('refills')
47
- qdm_model_attrs['MedicationDispensed'].delete('frequency')
48
- qdm_model_attrs['MedicationOrder'].delete('refills')
49
- qdm_model_attrs['MedicationOrder'].delete('frequency')
50
- qdm_model_attrs['MedicationActive'].delete('frequency')
51
- qdm_model_attrs['MedicationAdministered'].delete('frequency')
52
- qdm_model_attrs['MedicationDischarge'].delete('refills')
53
- qdm_model_attrs['MedicationDischarge'].delete('frequency')
54
44
  qdm_model_attrs
55
45
  end
56
46
 
@@ -71,20 +61,22 @@ module CQM::Converter
71
61
  qdm_model_attrs.each do |datatype, attributes|
72
62
  datatype_pattern = /#{datatype} extends CQL_QDM.QDMDatatype.*?class/m
73
63
  next unless (dc_class = datatype_pattern.match(datatypes_contents))
64
+
74
65
  qdm_to_hds_mappings[datatype] = {}
75
66
  attributes.each do |attribute|
76
- attribute_pattern = /@_#{attribute}(Low|High| ).*?@entry.*?$/
67
+ attribute_pattern = /@_#{attribute}(Low|High| ).*?$/
77
68
  dc_class.to_s.to_enum(:scan, attribute_pattern).map do
78
69
  dc_attr = Regexp.last_match
70
+ # TODO: adjust regexes used here to parse out the timing information
79
71
  # Handle possible mixed values.
80
72
  if dc_attr.to_s.include? 'Low'
81
73
  qdm_to_hds_mappings[datatype][attribute] = {} unless qdm_to_hds_mappings[datatype][attribute]
82
- qdm_to_hds_mappings[datatype][attribute][:low] = dc_attr.to_s[/@entry.(.*?)(\)|$|\?)/m, 1]
74
+ qdm_to_hds_mappings[datatype][attribute][:low] = dc_attr.to_s[/(.*?)(\)|$|\?)/m, 1]
83
75
  elsif dc_attr.to_s.include? 'High'
84
76
  qdm_to_hds_mappings[datatype][attribute] = {} unless qdm_to_hds_mappings[datatype][attribute]
85
- qdm_to_hds_mappings[datatype][attribute][:high] = dc_attr.to_s[/@entry.(.*?)(\)|$|\?)/m, 1]
77
+ qdm_to_hds_mappings[datatype][attribute][:high] = dc_attr.to_s[/(.*?)(\)|$|\?)/m, 1]
86
78
  else
87
- qdm_to_hds_mappings[datatype][attribute] = dc_attr.to_s[/@entry.(.*?)(\)|$|\?)/m, 1]
79
+ qdm_to_hds_mappings[datatype][attribute] = dc_attr.to_s[/(.*?)(\)|$|\?)/m, 1]
88
80
  end
89
81
  end
90
82
  end
@@ -135,9 +127,9 @@ module CQM::Converter
135
127
  // Add codes to result.
136
128
  results['dataElementCodes'] = datatype['getCode']();
137
129
  // Add description to result.
138
- results['description'] = datatype['entry']['description'];
130
+ results['description'] = datatype['_description'];
139
131
  // Add oid to result.
140
- results['hqmfOid'] = datatype['entry']['oid'];
132
+ results['hqmfOid'] = datatype['_oid'];
141
133
 
142
134
  processed_datatypes[key].push(results);
143
135
  });
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cqm-converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - aholmes@mitre.org
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-24 00:00:00.000000000 Z
11
+ date: 2018-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.8.4
75
+ version: 1.0.1
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.8.4
82
+ version: 1.0.1
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: execjs
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 4.1.0
103
+ version: 4.3.1
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 4.1.0
110
+ version: 4.3.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: momentjs-rails
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  version: '0'
225
225
  requirements: []
226
226
  rubyforge_project:
227
- rubygems_version: 2.6.14
227
+ rubygems_version: 2.7.7
228
228
  signing_key:
229
229
  specification_version: 4
230
230
  summary: HDS <=> QDM Model Converter