health-data-standards 3.2.7 → 3.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/Gemfile +1 -1
  2. data/README.md +11 -2
  3. data/lib/health-data-standards/export/helper/cat1_view_helper.rb +24 -7
  4. data/lib/health-data-standards/export/helper/scooped_view_helper.rb +36 -4
  5. data/lib/health-data-standards/import/cat1/insurance_provider_importer.rb +22 -0
  6. data/lib/health-data-standards/import/cat1/patient_importer.rb +2 -0
  7. data/lib/health-data-standards/models/cqm/measure.rb +4 -4
  8. data/lib/health-data-standards/models/cqm/patient_cache.rb +1 -1
  9. data/lib/health-data-standards/models/insurance_provider.rb +1 -1
  10. data/lib/health-data-standards/models/svs/value_set.rb +2 -42
  11. data/lib/health-data-standards/util/code_system_helper.rb +4 -2
  12. data/lib/health-data-standards.rb +1 -0
  13. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.11.cat1.erb +1 -1
  14. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.13.cat1.erb +1 -1
  15. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.14.cat1.erb +1 -1
  16. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.18.cat1.erb +7 -3
  17. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.20.cat1.erb +2 -2
  18. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.28.cat1.erb +1 -1
  19. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.3.cat1.erb +1 -1
  20. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.32.cat1.erb +1 -1
  21. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.38.cat1.erb +1 -1
  22. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.4.cat1.erb +1 -1
  23. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.40.cat1.erb +1 -1
  24. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.41.cat1.erb +2 -2
  25. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.42.cat1.erb +2 -2
  26. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.47.cat1.erb +2 -2
  27. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.57.cat1.erb +1 -2
  28. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.59.cat1.erb +1 -1
  29. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.63.cat1.erb +1 -1
  30. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.64.cat1.erb +2 -2
  31. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.66.cat1.erb +1 -1
  32. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.69.cat1.erb +10 -6
  33. data/templates/cat1/_2.16.840.1.113883.10.20.24.3.7.cat1.erb +1 -1
  34. data/templates/cat1/_medication_details.cat1.erb +7 -1
  35. data/templates/cat1/_ordinality.cat1.erb +8 -2
  36. data/templates/cat1/_reason.cat1.erb +8 -2
  37. data/templates/cat1/_result_value.cat1.erb +11 -2
  38. data/templates/cat3/_measure_data.cat3.erb +2 -2
  39. data/templates/cat3/_reporting_parameters.cat3.erb +28 -0
  40. data/templates/cat3/_supplemental_data.cat3.erb +1 -1
  41. data/templates/cat3/show.cat3.erb +3 -1
  42. metadata +14 -12
data/Gemfile CHANGED
@@ -16,7 +16,7 @@ group :test do
16
16
  gem 'simplecov', :require => false
17
17
  gem 'webmock'
18
18
 
19
- gem 'minitest'
19
+ gem "minitest", "~> 4.0"
20
20
  gem 'turn', :require => false
21
21
  gem 'awesome_print', :require => 'ap'
22
22
 
data/README.md CHANGED
@@ -5,7 +5,7 @@ In addition this project also contains libaries for parsing hqmf documents and f
5
5
  Environment
6
6
  ===========
7
7
 
8
- This project currently uses Ruby 1.9.2 and is built using [Bundler](http://gembundler.com/). To get all of the dependencies for the project, first install bundler:
8
+ This project currently uses Ruby 1.9.3 and is built using [Bundler](http://gembundler.com/). To get all of the dependencies for the project, first install bundler:
9
9
 
10
10
  gem install bundler
11
11
 
@@ -22,10 +22,19 @@ Project Practices
22
22
 
23
23
  Please try to follow our [Coding Style Guides](http://github.com/eedrummer/styleguide). Additionally, we will be using git in a pattern similar to [Vincent Driessen's workflow](http://nvie.com/posts/a-successful-git-branching-model/). While feature branches are encouraged, they are not required to work on the project.
24
24
 
25
+ Change Log
26
+ ==========
27
+
28
+ 3.2.8 - August 23, 2013
29
+
30
+ * Bug fixes for QRDA Category III generation
31
+ * Import for insurance providers from QRDA Category I documents
32
+ * Consolidated code for dealing with code system names
33
+
25
34
  License
26
35
  =======
27
36
 
28
- Copyright 2011 The MITRE Corporation
37
+ Copyright 2013 The MITRE Corporation
29
38
 
30
39
  Licensed under the Apache License, Version 2.0 (the "License");
31
40
  you may not use this file except in compliance with the License.
@@ -4,14 +4,16 @@ module HealthDataStandards
4
4
  module Cat1ViewHelper
5
5
  include HealthDataStandards::Export::Helper::ScoopedViewHelper
6
6
 
7
- def render_data_criteria(dc_oid, vs_oid, entries)
7
+ def render_data_criteria(dc, entries)
8
8
  html_array = entries.map do |entry|
9
9
  bundle_id = entry.record ? entry.record["bundle_id"] : nil
10
- vs_map = (value_set_map(bundle_id) || {})[vs_oid]
11
- binding.pry if vs_map.nil? || vs_map.empty?
12
- render(:partial => HealthDataStandards::Export::QRDA::EntryTemplateResolver.partial_for(dc_oid, vs_oid), :locals => {:entry => entry,
13
- :value_set_oid => vs_oid,
14
- :value_set_map => vs_map})
10
+ vs_map = (value_set_map(bundle_id) || {})[dc['value_set_oid']]
11
+ render(:partial => HealthDataStandards::Export::QRDA::EntryTemplateResolver.partial_for(dc['data_criteria_oid'], dc['value_set_oid']), :locals => {:entry => entry,
12
+ :data_criteria => dc['data_criteria'],
13
+ :value_set_oid => dc['value_set_oid'],
14
+ :value_set_map => vs_map,
15
+ :result_oids => dc["result_oids"],
16
+ :field_oids => dc["field_oids"]})
15
17
  end
16
18
  html_array.join("\n")
17
19
  end
@@ -21,7 +23,7 @@ module HealthDataStandards
21
23
  udcs = unique_data_criteria(measures)
22
24
  data_criteria_html = udcs.map do |udc|
23
25
  entries = entries_for_data_criteria(udc['data_criteria'], patient)
24
- render_data_criteria(udc['data_criteria_oid'], udc['value_set_oid'], entries)
26
+ render_data_criteria(udc, entries)
25
27
  end
26
28
  data_criteria_html.compact.join("\n")
27
29
  end
@@ -34,6 +36,21 @@ module HealthDataStandards
34
36
  end
35
37
  end
36
38
 
39
+ def oid_for_code(codedValue, valueset_oids, bundle_id = nil)
40
+ valueset_oids ||=[]
41
+ code = codedValue["code"]
42
+ code_system = codedValue["code_set"]
43
+ vs_map = (value_set_map(bundle_id) || {})
44
+ valueset_oids.each do |vs_oid|
45
+ oid_list = (vs_map[vs_oid] || [])
46
+ oid_map = Hash[oid_list.collect{|x| [x["set"],x["values"]]}]
47
+ if (oid_map[code_system] || []).index code
48
+ return vs_oid
49
+ end
50
+ end
51
+ return nil
52
+ end
53
+
37
54
  end
38
55
  end
39
56
  end
@@ -15,14 +15,31 @@ module HealthDataStandards
15
15
  # one for the value set oid and one for the data criteria itself
16
16
  def unique_data_criteria(measures)
17
17
  all_data_criteria = measures.map {|measure| measure.all_data_criteria}.flatten
18
- unioned_data_criteria = all_data_criteria.map do |data_criteria|
18
+ mapped_data_criteria = {}
19
+ all_data_criteria.each do |data_criteria|
19
20
  data_criteria_oid = HQMFTemplateHelper.template_id_by_definition_and_status(data_criteria.definition,
20
21
  (data_criteria.status || ""),
21
22
  data_criteria.negation)
22
23
  value_set_oid = data_criteria.code_list_id
23
- {'data_criteria_oid' => data_criteria_oid, 'value_set_oid' => value_set_oid, 'data_criteria' => data_criteria}
24
+ dc = {'data_criteria_oid' => data_criteria_oid, 'value_set_oid' => value_set_oid}
25
+ mapping = mapped_data_criteria[dc] ||= {'result_oids' => [], 'field_oids' =>{}, 'data_criteria' => data_criteria}
26
+
27
+ if data_criteria.field_values
28
+ data_criteria.field_values.each_pair do |field,descr|
29
+ if descr && descr.type == "CD"
30
+ (mapping['field_oids'][field] ||= []) << descr.code_list_id
31
+ end
32
+ end
33
+ end
34
+
35
+ if data_criteria.value && data_criteria.value.type == "CD"
36
+ mapping["result_oids"] << data_criteria.value.code_list_id
37
+ end
38
+
39
+ # {'data_criteria_oid' => data_criteria_oid, 'value_set_oid' => value_set_oid, 'data_criteria' => data_criteria}
24
40
  end
25
- unioned_data_criteria.uniq_by {|thingy| [thingy['data_criteria_oid'], thingy['value_set_oid']]}
41
+ # unioned_data_criteria.uniq_by {|thingy| [thingy['data_criteria_oid'], thingy['value_set_oid']]}
42
+ mapped_data_criteria.collect{|dc| dc[0].merge dc[1] }
26
43
  end
27
44
 
28
45
  # Returns true if the supplied entry matches any of the supplied data criteria, false otherwise
@@ -54,6 +71,7 @@ module HealthDataStandards
54
71
  data_criteria.negation)
55
72
  HealthDataStandards.logger.warn("Looking for dc [#{data_criteria_oid}]")
56
73
  filtered_entries = []
74
+ entries = []
57
75
  case data_criteria_oid
58
76
  when '2.16.840.1.113883.3.560.1.404'
59
77
  filtered_entries = handle_patient_expired(patient)
@@ -62,7 +80,7 @@ module HealthDataStandards
62
80
  when '2.16.840.1.113883.3.560.1.405'
63
81
  filtered_entries = handle_payer_information(patient)
64
82
  else
65
- entries = patient.entries_for_oid(data_criteria_oid)
83
+ entries.concat patient.entries_for_oid(data_criteria_oid)
66
84
 
67
85
  case data_criteria_oid
68
86
  when '2.16.840.1.113883.3.560.1.5'
@@ -80,6 +98,7 @@ module HealthDataStandards
80
98
  if codes.empty?
81
99
  HealthDataStandards.logger.warn("No codes for #{data_criteria.code_list_id}")
82
100
  end
101
+ entries.uniq!
83
102
  filtered_entries = entries.find_all do |entry|
84
103
  # This special case is for when the code list is a reason
85
104
  if data_criteria.code_list_id =~ /2\.16\.840\.1\.113883\.3\.526\.3\.100[7-9]/
@@ -117,6 +136,19 @@ module HealthDataStandards
117
136
  patient.insurance_providers
118
137
  end
119
138
 
139
+ def code_in_valueset( code, valuesets=[],bundle_id=nil)
140
+ unless(bundle_id.nil?)
141
+ bundle = Bundle.find(bundle_id)
142
+ vs_matches = []
143
+ valuesets.each do |vs|
144
+ vset = bundle.valuesets.where({"oid"=>vs}).first
145
+ if vset && vset.concepts.where({"code" => code["code"], "codeSystem" => code["code_system"]}).first
146
+ vs_matches << vs
147
+ end
148
+ end
149
+ return vs_matches
150
+ end
151
+ end
120
152
  end
121
153
  end
122
154
  end
@@ -0,0 +1,22 @@
1
+ module HealthDataStandards
2
+ module Import
3
+ module Cat1
4
+ class InsuranceProviderImporter < CDA::SectionImporter
5
+
6
+ def initialize
7
+ super(CDA::EntryFinder.new("//cda:observation[cda:templateId/@root = '2.16.840.1.113883.10.20.24.3.55']"))
8
+ @check_for_usable = false # needs to be this way becase InsuranceProvider does not respond
9
+ # to usable?
10
+ end
11
+
12
+ def create_entry(payer_element, nrh = CDA::NarrativeReferenceHandler.new)
13
+ ip = InsuranceProvider.new
14
+ value_element = payer_element.at_xpath('cda:value')
15
+ ip.codes = { 'SOP' => [value_element['code']] } if value_element
16
+ ip
17
+ end
18
+
19
+ end
20
+ end
21
+ end
22
+ end
@@ -64,6 +64,8 @@ module HealthDataStandards
64
64
 
65
65
  @section_importers[:social_history] = [generate_importer(TobaccoUseImporter, nil, '2.16.840.1.113883.3.560.1.1001', 'completed')]
66
66
 
67
+ @section_importers[:insurance_providers] = [generate_importer(InsuranceProviderImporter, nil, '2.16.840.1.113883.3.560.1.405')]
68
+
67
69
  end
68
70
 
69
71
  def parse_cat1(doc)
@@ -71,15 +71,15 @@ module HealthDataStandards
71
71
  end
72
72
 
73
73
  def smoking_gun_data(patient_cache_filter={})
74
- ::Measure.calculate_smoking_gun_data(self.hqmf_id, patient_cache_filter)
74
+ ::Measure.calculate_smoking_gun_data(self["bundle_id"], self.hqmf_id, patient_cache_filter)
75
75
  end
76
76
  # Calculate the smoking gun data for the given hqmf_id with the given patient_cache_filter
77
77
  # The filter will allow us to segment the cache by things like test_id required for Cypress.
78
78
 
79
- def self.calculate_smoking_gun_data(hqmf_id, patient_cache_filter={})
79
+ def self.calculate_smoking_gun_data(bundle_id, hqmf_id, patient_cache_filter={})
80
80
  population_keys = ('a'..'zz').to_a
81
81
  values = {}
82
- measure = Measure.top_level.where({hqmf_id: hqmf_id}).first
82
+ measure = Measure.top_level.where({hqmf_id: hqmf_id, bundle_id: bundle_id}).first
83
83
  sub_ids = []
84
84
  hqmf_measure = measure.as_hqmf_model
85
85
  population_codes = []
@@ -139,7 +139,7 @@ module HealthDataStandards
139
139
  qrda_template = 'N/A'
140
140
  end # end begin recue
141
141
  description = "#{HQMF::DataCriteria.title_for_template_id(template).titleize}: #{data_criteria.title}"
142
- result << {description: description, oid: value_set_oid, template: qrda_template}
142
+ result << {description: description, oid: value_set_oid, template: qrda_template, rationale: rationale[data_criteria.id]}
143
143
  if data_criteria.temporal_references
144
144
  data_criteria.temporal_references.each do |temporal_reference|
145
145
  if temporal_reference.reference.id != 'MeasurePeriod'
@@ -1,4 +1,4 @@
1
- module HealthDataStandards
1
+ module HealthDataStandards
2
2
  module CQM
3
3
  class PatientCache
4
4
  include Mongoid::Document
@@ -1,4 +1,4 @@
1
- class InsuranceProvider
1
+ class InsuranceProvider < Entry
2
2
  include Mongoid::Document
3
3
  include ThingWithCodes
4
4
 
@@ -39,8 +39,9 @@ module HealthDataStandards
39
39
  if vs_element
40
40
  vs = ValueSet.new(oid: vs_element["ID"], display_name: vs_element["displayName"], version: vs_element["version"])
41
41
  concepts = vs_element.xpath("//vs:Concept").collect do |con|
42
+ code_system_name = HealthDataStandards::Util::CodeSystemHelper::CODE_SYSTEMS[con["codeSystem"]] || con["codeSystemName"]
42
43
  Concept.new(code: con["code"],
43
- code_system_name: normalize_code_set_name(con["codeSystemName"]),
44
+ code_system_name: code_system_name,
44
45
  code_system_version: con["code_system_version"],
45
46
  display_name: con["displayName"], code_system: con["codeSystem"])
46
47
  end
@@ -48,47 +49,6 @@ module HealthDataStandards
48
49
  return vs
49
50
  end
50
51
  end
51
-
52
- def self.normalize_code_set_name(code_set_name)
53
- case code_set_name
54
- when 'RXNORM'
55
- 'RxNorm'
56
- when 'ICD9CM'
57
- 'ICD-9-CM'
58
- when 'ICD10CM'
59
- 'ICD-10-CM'
60
- when 'ICD10PCS'
61
- 'ICD-10-PCS'
62
- when 'SNOMEDCT'
63
- 'SNOMED-CT'
64
- when 'CDCREC'
65
- 'CDC Race'
66
- when 'HSLOC'
67
- 'HL7 Healthcare Service Location'
68
- else
69
- code_set_name
70
- end
71
- end
72
- def self.denormalize_code_set_name(code_set_name)
73
- case code_set_name
74
- when'RxNorm'
75
- 'RXNORM'
76
- when'ICD-9-CM'
77
- 'ICD9CM'
78
- when'ICD-10-CM'
79
- 'ICD10CM'
80
- when'ICD-10-PCS'
81
- 'ICD10PCS'
82
- when'SNOMED-CT'
83
- 'SNOMEDCT'
84
- when'CDC Race'
85
- 'CDCREC'
86
- when'HL7 Healthcare Service Location'
87
- 'HSLOC'
88
- else
89
- code_set_name
90
- end
91
- end
92
52
  end
93
53
  end
94
54
  end
@@ -12,7 +12,8 @@ module HealthDataStandards
12
12
  '2.16.840.1.113883.6.104' => 'ICD-9-PCS',
13
13
  '2.16.840.1.113883.6.4' => 'ICD-10-PCS',
14
14
  '2.16.840.1.113883.6.90' => 'ICD-10-CM',
15
- '2.16.840.1.113883.6.14' => 'HCPCS',
15
+ '2.16.840.1.113883.6.14' => 'HCP',
16
+ '2.16.840.1.113883.6.285' => 'HCPCS',
16
17
  '2.16.840.1.113883.5.2' => "HL7 Marital Status",
17
18
  '2.16.840.1.113883.12.292' => 'CVX',
18
19
  '2.16.840.1.113883.5.83' => 'HITSP C80 Observation Status',
@@ -32,7 +33,8 @@ module HealthDataStandards
32
33
  '2.16.840.1.113883.3.88.12.80.33' => "NUBC",
33
34
  '2.16.840.1.113883.1.11.78' => "HL7 Observation Interpretation",
34
35
  '2.16.840.1.113883.3.221.5' => "Source of Payment Typology",
35
- '2.16.840.1.113883.6.13' => 'CDT'
36
+ '2.16.840.1.113883.6.13' => 'CDT',
37
+ '2.16.840.1.113883.18.2' => 'AdministrativeSex'
36
38
  }
37
39
 
38
40
  CODE_SYSTEM_ALIASES = {
@@ -154,6 +154,7 @@ require_relative 'health-data-standards/import/cat1/entry_package'
154
154
  require_relative 'health-data-standards/import/cat1/lab_result_importer'
155
155
  require_relative 'health-data-standards/import/cat1/ecog_status_importer'
156
156
  require_relative 'health-data-standards/import/cat1/symptom_active_importer'
157
+ require_relative 'health-data-standards/import/cat1/insurance_provider_importer'
157
158
 
158
159
  require_relative 'health-data-standards/models/cqm/aggregate_objects'
159
160
  require_relative 'health-data-standards/models/cqm/query_cache'
@@ -14,7 +14,7 @@
14
14
  <!-- Attribute: discharge datetime -->
15
15
  <high <%= value_or_null_flavor(entry.end_time) %>/>
16
16
  </effectiveTime>
17
- <%== render(:partial => 'ordinality', :locals => {:entry => entry}) %>
17
+ <%== render(:partial => 'ordinality', :locals => {:entry => entry, :reason_oids=>field_oids["ORDINALITY"]}) %>
18
18
 
19
19
  <%== code_display(entry, {'tag_name' => 'value', 'value_set_map' => value_set_map,'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'],
20
20
  'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\""}) %>
@@ -15,7 +15,7 @@
15
15
  <!-- Attribute: Stop Datetime -->
16
16
  <high <%= value_or_null_flavor(entry.end_time) %>/>
17
17
  </effectiveTime>
18
- <%== render(:partial => 'ordinality', :locals => {:entry => entry}) %>
18
+ <%== render(:partial => 'ordinality', :locals => {:entry => entry, :ordinality_oids=>field_oids["ORDINALITY"]}) %>
19
19
 
20
20
  <%== code_display(entry, 'value_set_map' => value_set_map,'tag_name' => 'value', 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'LOINC'], 'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
21
21
  <!-- Status -->
@@ -14,7 +14,7 @@
14
14
  <!-- Attribute: Stop Datetime -->
15
15
  <high <%= value_or_null_flavor(entry.end_time) %>/>
16
16
  </effectiveTime>
17
- <%== render(:partial => 'ordinality', :locals => {:entry => entry}) %>
17
+ <%== render(:partial => 'ordinality', :locals => {:entry => entry, :ordinality_oids=>field_oids["ORDINALITY"]}}) %>
18
18
 
19
19
  <%== code_display(entry, 'value_set_map' => value_set_map,'tag_name' => 'value', 'preferred_code_sets' => ['SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM', 'CPT'],
20
20
  'extra_content' => "xsi:type=\"CD\" sdtc:valueSet=\"#{value_set_oid}\"") %>
@@ -1,3 +1,6 @@
1
+ <% vals = entry.values.empty? ? [nil] : entry.values
2
+ vals.each do |value|
3
+ %>
1
4
  <entry>
2
5
  <observation classCode="OBS" moodCode="EVN" <%== negation_indicator(entry) %>>
3
6
  <!-- Consolidated Procedure Activity Observation templateId
@@ -15,7 +18,8 @@
15
18
  <!-- Attribute: End Datetime -->
16
19
  <high <%= value_or_null_flavor(entry.end_time) %>/>
17
20
  </effectiveTime>
18
- <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first]}) %>
19
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
21
+ <%== render(:partial => 'result_value', :locals => {:values => [value], :result_oids=>result_oids}) %>
22
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
20
23
  </observation>
21
- </entry>
24
+ </entry>
25
+ <% end %>
@@ -14,7 +14,7 @@
14
14
  <low <%= value_or_null_flavor(entry.start_time) %>/>
15
15
  <high <%= value_or_null_flavor(entry.end_time) %>/>
16
16
  </effectiveTime>
17
- <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first]}) %>
18
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
17
+ <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first], :result_oids=>result_oids}) %>
18
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
19
19
  </observation>
20
20
  </entry>
@@ -15,6 +15,6 @@
15
15
  </effectiveTime>
16
16
 
17
17
  <!-- Result -->
18
- <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first]}) %>
18
+ <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first], :result_oids=>result_oids}) %>
19
19
  </observation>
20
20
  </entry>
@@ -20,6 +20,6 @@
20
20
  <participant typeCode="IRCP">
21
21
  <participantRole classCode="PAT"/>
22
22
  </participant>
23
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
23
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
24
24
  </act>
25
25
  </entry>
@@ -10,6 +10,6 @@
10
10
  <low <%= value_or_null_flavor(entry.start_time) %>/>
11
11
  <high <%= value_or_null_flavor(entry.end_time) %>/>
12
12
  </effectiveTime>
13
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
13
+ <%== render(:partial => 'reason', :locals => {:entry => entry ,:reason_oids=>field_oids["REASON"]}) %>
14
14
  </act>
15
15
  </entry>
@@ -11,6 +11,6 @@
11
11
  <low <%= value_or_null_flavor(entry.start_time) %>/>
12
12
  <high <%= value_or_null_flavor(entry.end_time) %>/>
13
13
  </effectiveTime>
14
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
14
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
15
15
  </observation>
16
16
  </entry>
@@ -23,6 +23,6 @@
23
23
  <code code="158965000" codeSystem="2.16.840.1.113883.6.96" codeSystemName="SNOMED CT" displayName="Medical Practitioner"/>
24
24
  </participantRole>
25
25
  </participant>
26
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
26
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
27
27
  </act>
28
28
  </entry>
@@ -13,6 +13,6 @@
13
13
  <low <%= value_or_null_flavor(entry.start_time) %>/>
14
14
  <high <%= value_or_null_flavor(entry.end_time) %>/>
15
15
  </effectiveTime>
16
- <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first]}) %>
16
+ <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first], :result_oids=>result_oids}) %>
17
17
  </observation>
18
18
  </entry>
@@ -13,7 +13,7 @@
13
13
  <high <%= value_or_null_flavor(entry.end_time) %>/>
14
14
  </effectiveTime>
15
15
 
16
- <%== render(:partial => 'medication_details', :locals => {:entry => entry}) %>
16
+ <%== render(:partial => 'medication_details', :locals => {:entry => entry, :route_oids=>field_oids["ROUTE"]}) %>
17
17
 
18
18
 
19
19
  <% if entry.product_form.present? -%>
@@ -33,6 +33,6 @@
33
33
  </manufacturerOrganization>
34
34
  </manufacturedProduct>
35
35
  </consumable>
36
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
36
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
37
37
  </substanceAdministration>
38
38
  </entry>
@@ -20,7 +20,7 @@
20
20
  <low <%= value_or_null_flavor(entry.start_time) %>/>
21
21
  <high <%= value_or_null_flavor(entry.end_time) %>/>
22
22
  </effectiveTime>
23
- <%== render(:partial => 'medication_details', :locals => {:entry => entry}) %>
23
+ <%== render(:partial => 'medication_details', :locals => {:entry => entry, :route_oids=>field_oids["ROUTE"]}) %>
24
24
  <consumable>
25
25
  <manufacturedProduct classCode="MANU">
26
26
  <!-- Medication Information (consolidation) template -->
@@ -33,6 +33,6 @@
33
33
  </consumable>
34
34
  </substanceAdministration>
35
35
  </entryRelationship>
36
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
36
+ <%== render(:partial => 'reason', :locals => {:entry => entry,:reason_oids=>field_oids["REASON"]}) %>
37
37
  </act>
38
38
  </entry>
@@ -11,7 +11,7 @@
11
11
  <low <%= value_or_null_flavor(entry.start_time) %>/>
12
12
  <high <%= value_or_null_flavor(entry.end_time) %>/>
13
13
  </effectiveTime>
14
- <%== render(:partial => 'medication_details', :locals => {:entry => entry}) %>
14
+ <%== render(:partial => 'medication_details', :locals => {:entry => entry, :route_oids=>field_oids["ROUTE"]}) %>
15
15
  <consumable>
16
16
  <manufacturedProduct classCode="MANU">
17
17
  <!-- Medication Information (consolidation) template -->
@@ -22,6 +22,6 @@
22
22
  </manufacturedMaterial>
23
23
  </manufacturedProduct>
24
24
  </consumable>
25
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
25
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
26
26
  </substanceAdministration>
27
27
  </entry>
@@ -7,13 +7,12 @@
7
7
  <templateId root="2.16.840.1.113883.10.20.24.3.57"/>
8
8
  <id root="1.3.6.1.4.1.115" extension="<%= entry.id %>"/>
9
9
  <%== code_display(entry, 'value_set_map' => value_set_map, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
10
-
11
10
  <statusCode code="completed"/>
12
11
 
13
12
  <effectiveTime>
14
13
  <low <%= value_or_null_flavor(entry.start_time) %>/>
15
14
  <high <%= value_or_null_flavor(entry.end_time) %>/>
16
15
  </effectiveTime>
17
- <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first]}) %>
16
+ <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first], :result_oids=>result_oids}) %>
18
17
  </observation>
19
18
  </entry>
@@ -12,6 +12,6 @@
12
12
  <low <%= value_or_null_flavor(entry.start_time) %>/>
13
13
  <high <%= value_or_null_flavor(entry.end_time) %>/>
14
14
  </effectiveTime>
15
- <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first]}) %>
15
+ <%== render(:partial => 'result_value', :locals => {:values => [entry.values.first], :result_oids=>result_oids}) %>
16
16
  </observation>
17
17
  </entry>
@@ -18,6 +18,6 @@
18
18
  <id nullFlavor="NA"/>
19
19
  </assignedAuthor>
20
20
  </author>
21
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
21
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
22
22
  </procedure>
23
23
  </entry>
@@ -12,8 +12,8 @@
12
12
  <low <%= value_or_null_flavor(entry.start_time) %>/>
13
13
  <high <%= value_or_null_flavor(entry.end_time) %>/>
14
14
  </effectiveTime>
15
- <%== render(:partial => 'ordinality', :locals => {:entry => entry}) %>
16
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
15
+ <%== render(:partial => 'ordinality', :locals => {:entry => entry, :ordinality_oids=>field_oids["ORDINALITY"]}) %>
16
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
17
17
  <% if entry.respond_to?(:incision_time) && entry.incision_time.present? -%>
18
18
  <entryRelationship typeCode="REFR">
19
19
  <procedure classCode="PROC" moodCode="EVN">
@@ -27,7 +27,7 @@
27
27
  <%== code_display(entry, 'value_set_map' => value_set_map, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'CPT'], 'extra_content' => "sdtc:valueSet=\"#{value_set_oid}\"") %>
28
28
  <statusCode code="completed"/>
29
29
  <effectiveTime <%= value_or_null_flavor(entry.start_time) %>/>
30
- <%== render(:partial => 'result_value', :locals => {:values => entry.values}) %>
30
+ <%== render(:partial => 'result_value', :locals => {:values => entry.values, :result_oids=>result_oids} ) %>
31
31
  </observation>
32
32
  </entryRelationship>
33
33
  </procedure>
@@ -14,15 +14,19 @@
14
14
  </effectiveTime>
15
15
 
16
16
  <% ev = entry.values.first
17
- if ev.present? && ev.respond_to?(:scalar)
18
- if is_num?(ev.scalar) -%>
17
+ if ev.present?
18
+ if ev.respond_to?(:scalar)
19
+ if is_num?(ev.scalar) -%>
19
20
  <value xsi:type="INT" value="<%= ev.scalar %>"/>
20
- <% else -%>
21
- <value xsi:type="ST"><%= ev.scalar%></value>
22
- <% end %>
21
+ <% else -%>
22
+ <value xsi:type="ST"><%= ev.scalar%></value>
23
+ <% end %>
24
+ <% else %>
25
+ <%== code_display(entry, 'tag_name'=>'value', 'value_set_map' => value_set_map,'preferred_code_sets' => ['LOINC', 'SNOMED-CT'],'extra_content' =>'xsi:type="CD"') %>
26
+ <% end %>
23
27
  <% else -%>
24
28
  <value xsi:type="CD" nullFlavor="UNK"/>
25
29
  <% end -%>
26
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
30
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
27
31
  </observation>
28
32
  </entry>
@@ -25,6 +25,6 @@
25
25
  </playingDevice>
26
26
  </participantRole>
27
27
  </participant>
28
- <%== render(:partial => 'reason', :locals => {:entry => entry}) %>
28
+ <%== render(:partial => 'reason', :locals => {:entry => entry, :reason_oids=>field_oids["REASON"]}) %>
29
29
  </procedure>
30
30
  </entry>
@@ -1,7 +1,13 @@
1
1
  <% if entry.respond_to?(:route) && entry.route.present?
2
2
  # hard coded to NCI Thesaurus for the code system since Cat I mandates that
3
+ vset = oid_for_code(entry.route,route_oids, entry.record["bundle_id"])
3
4
  -%>
4
- <routeCode code="<%= entry.route['code'] %>" codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.route['code_system']) %>"/>
5
+ <routeCode code="<%= entry.route['code'] %>"
6
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.route['code_system']) %>"
7
+ <% if vset -%>
8
+ sdtc:valueSet="<%= vset %>"
9
+ <% end -%>
10
+ />
5
11
  <% end -%>
6
12
 
7
13
  <% if entry.respond_to?(:dose) && entry.dose.present? -%>
@@ -1,4 +1,10 @@
1
- <% if entry.respond_to?(:ordinality) && entry.ordinality.present? -%>
1
+ <% if entry.respond_to?(:ordinality) && entry.ordinality.present?
2
+ vset = oid_for_code(entry.ordinality,ordinality_oids || [], entry.record["bundle_id"])
3
+ -%>
2
4
  <priorityCode code="<%= entry.ordinality['code'] %>"
3
- codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.ordinality['codeSystem'] || entry.ordinality['code_system']) %>"/>
5
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.ordinality['codeSystem'] || entry.ordinality['code_system']) %>"
6
+ <% if vset -%>
7
+ sdtc:valueSet="<%= vset %>"
8
+ <% end -%>
9
+ />
4
10
  <% end -%>
@@ -1,4 +1,6 @@
1
- <% if entry.negation_reason.present? -%>
1
+ <% if entry.negation_reason.present?
2
+ vset = oid_for_code(entry.negation_reason,reason_oids, entry.record["bundle_id"])
3
+ -%>
2
4
  <entryRelationship typeCode="RSON">
3
5
  <observation classCode="OBS" moodCode="EVN">
4
6
  <templateId root="2.16.840.1.113883.10.20.24.3.88"/>
@@ -10,7 +12,11 @@
10
12
  <effectiveTime <%= value_or_null_flavor(entry.start_time) %>/>
11
13
  <value xsi:type="CD"
12
14
  code="<%= entry.negation_reason['code'] %>"
13
- codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.negation_reason['codeSystem'] || entry.negation_reason['code_system']) %>"/>
15
+ codeSystem="<%= HealthDataStandards::Util::CodeSystemHelper.oid_for_code_system(entry.negation_reason['codeSystem'] || entry.negation_reason['code_system']) %>"
16
+ <% if vset -%>
17
+ sdtc:valueSet="<%= vset %>"
18
+ <% end -%>
19
+ />
14
20
  </observation>
15
21
  </entryRelationship>
16
22
  <% end -%>
@@ -1,8 +1,17 @@
1
1
  <% values.compact!
2
2
  if !values.empty?
3
3
  values.each do |ev|
4
- if ev.respond_to?(:codes) -%>
5
- <%== code_display(ev, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'tag_name' => 'value', 'extra_content' => "xsi:type=\"CD\"") %>
4
+ if ev.respond_to?(:codes)
5
+ extra_content = 'xsi:type="CD"'
6
+ if defined? result_oids
7
+ preferred_code = ev.preferred_code(['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'])
8
+ oid = oid_for_code(preferred_code,result_oids, ev.entry.record["bundle_id"])
9
+ if oid
10
+ extra_content += " sdtc:valueSet='#{oid}'"
11
+ end
12
+ end
13
+ -%>
14
+ <%== code_display(ev, 'preferred_code_sets' => ['LOINC', 'SNOMED-CT', 'ICD-9-CM', 'ICD-10-CM'], 'tag_name' => 'value', 'extra_content' => extra_content) %>
6
15
  <% elsif ev.respond_to?(:scalar) -%>
7
16
  <% if is_num?(ev.scalar) -%>
8
17
  <value xsi:type="PQ" value="<%= ev.scalar %>" <% if ev.units && (ev.units != "") -%>unit="<%= ev.units %>"<% end -%>/>
@@ -19,7 +19,7 @@
19
19
  displayName="rate aggregation"
20
20
  codeSystem="2.16.840.1.113883.5.4"
21
21
  codeSystemName="ActCode"/>
22
- <value xsi:type="INT" value="<%= aggregate_count.population_count(population_type, population_id) %>"/>
22
+ <value xsi:type="INT" value="<%= aggregate_count.population_count(population_type, population_id).round %>"/>
23
23
  <methodCode code="COUNT"
24
24
  displayName="Count"
25
25
  codeSystem="2.16.840.1.113883.5.84"
@@ -48,7 +48,7 @@
48
48
  displayName="rate aggregation"
49
49
  codeSystem="2.16.840.1.113883.5.4"
50
50
  codeSystemName="ActCode"/>
51
- <value xsi:type="INT" value="<%= strat.population_count(population_type, population_id) %>"/>
51
+ <value xsi:type="INT" value="<%= strat.population_count(population_type, population_id).round %>"/>
52
52
  <methodCode code="COUNT"
53
53
  displayName="Count"
54
54
  codeSystem="2.16.840.1.113883.5.84"
@@ -0,0 +1,28 @@
1
+ <component>
2
+ <section>
3
+ <!-- This is the templateId for Reporting Parameters section -->
4
+ <templateId root="2.16.840.1.113883.10.20.17.2.1"/>
5
+
6
+ <!-- This is the templateId for the QRDA III Reporting Parameters Section -->
7
+ <templateId root="2.16.840.1.113883.10.20.27.2.2"/>
8
+
9
+ <code code="55187-9" codeSystem="2.16.840.1.113883.6.1"/>
10
+ <title>Reporting Parameters</title>
11
+ <text>
12
+ <list>
13
+ <item>Reporting period: <%= start_date.to_formatted_s(:long_ordinal) %> - <%= end_date.to_formatted_s(:long_ordinal) %></item>
14
+ </list>
15
+ </text>
16
+ <entry typeCode="DRIV">
17
+ <act classCode="ACT" moodCode="EVN">
18
+ <!-- This is the templateId for Reporting Parameteres Act -->
19
+ <templateId root="2.16.840.1.113883.10.20.17.3.8"/>
20
+ <code code="252116004" codeSystem="2.16.840.1.113883.6.96" displayName="Observation Parameters"/>
21
+ <effectiveTime>
22
+ <low value="<%= start_date.to_formatted_s(:number) %>"/>
23
+ <high value="<%= end_date.to_formatted_s(:number) %>"/>
24
+ </effectiveTime>
25
+ </act>
26
+ </entry>
27
+ </section>
28
+ </component>
@@ -25,7 +25,7 @@
25
25
  displayName="rate aggregation"
26
26
  codeSystem="2.16.840.1.113883.5.4"
27
27
  codeSystemName="ActCode"/>
28
- <value xsi:type="INT" value="<%= count %>"/>
28
+ <value xsi:type="INT" value="<%= count.round %>"/>
29
29
  <methodCode code="COUNT"
30
30
  displayName="Count"
31
31
  codeSystem="2.16.840.1.113883.5.84"
@@ -94,7 +94,7 @@ CDA Body
94
94
  QRDA Category III Reporting Parameters
95
95
  ********************************************************
96
96
  -->
97
- <%== cat1_renderer.render :partial => 'reporting_parameters', :locals => {:start_date => start_date, :end_date => end_date} %>
97
+ <%== render :partial => 'reporting_parameters', :locals => {:start_date => start_date, :end_date => end_date} %>
98
98
  <!--
99
99
  ********************************************************
100
100
  Measure Section
@@ -144,7 +144,9 @@ Measure Section
144
144
  <% end -%>
145
145
  <% result.top_level_populations.each do |pop|
146
146
  unless pop.type == 'OBSERV' -%>
147
+ <component>
147
148
  <%== render :partial => 'measure_data', :locals => {:aggregate_count => result, :population_type => pop.type, :population_id => pop.id} %>
149
+ </component>
148
150
  <% end
149
151
  end -%>
150
152
  </organizer>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: health-data-standards
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.7
4
+ version: 3.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2013-08-01 00:00:00.000000000 Z
16
+ date: 2013-08-23 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rest-client
@@ -54,7 +54,7 @@ dependencies:
54
54
  requirements:
55
55
  - - ~>
56
56
  - !ruby/object:Gem::Version
57
- version: 3.1.0
57
+ version: 3.1.4
58
58
  type: :runtime
59
59
  prerelease: false
60
60
  version_requirements: !ruby/object:Gem::Requirement
@@ -62,7 +62,7 @@ dependencies:
62
62
  requirements:
63
63
  - - ~>
64
64
  - !ruby/object:Gem::Version
65
- version: 3.1.0
65
+ version: 3.1.4
66
66
  - !ruby/object:Gem::Dependency
67
67
  name: activesupport
68
68
  requirement: !ruby/object:Gem::Requirement
@@ -70,7 +70,7 @@ dependencies:
70
70
  requirements:
71
71
  - - ~>
72
72
  - !ruby/object:Gem::Version
73
- version: 3.2.9
73
+ version: 3.2.14
74
74
  type: :runtime
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
@@ -78,7 +78,7 @@ dependencies:
78
78
  requirements:
79
79
  - - ~>
80
80
  - !ruby/object:Gem::Version
81
- version: 3.2.9
81
+ version: 3.2.14
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: uuid
84
84
  requirement: !ruby/object:Gem::Requirement
@@ -86,7 +86,7 @@ dependencies:
86
86
  requirements:
87
87
  - - ~>
88
88
  - !ruby/object:Gem::Version
89
- version: 2.3.5
89
+ version: 2.3.7
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
@@ -94,7 +94,7 @@ dependencies:
94
94
  requirements:
95
95
  - - ~>
96
96
  - !ruby/object:Gem::Version
97
- version: 2.3.5
97
+ version: 2.3.7
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: builder
100
100
  requirement: !ruby/object:Gem::Requirement
@@ -118,7 +118,7 @@ dependencies:
118
118
  requirements:
119
119
  - - ~>
120
120
  - !ruby/object:Gem::Version
121
- version: 1.5.5
121
+ version: 1.6.0
122
122
  type: :runtime
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
@@ -126,7 +126,7 @@ dependencies:
126
126
  requirements:
127
127
  - - ~>
128
128
  - !ruby/object:Gem::Version
129
- version: 1.5.5
129
+ version: 1.6.0
130
130
  - !ruby/object:Gem::Dependency
131
131
  name: rubyzip
132
132
  requirement: !ruby/object:Gem::Requirement
@@ -166,7 +166,7 @@ dependencies:
166
166
  requirements:
167
167
  - - ~>
168
168
  - !ruby/object:Gem::Version
169
- version: 0.9.0
169
+ version: 0.9.1
170
170
  type: :runtime
171
171
  prerelease: false
172
172
  version_requirements: !ruby/object:Gem::Requirement
@@ -174,7 +174,7 @@ dependencies:
174
174
  requirements:
175
175
  - - ~>
176
176
  - !ruby/object:Gem::Version
177
- version: 0.9.0
177
+ version: 0.9.1
178
178
  description: A library for generating and consuming various healthcare related formats.
179
179
  This includes HITSP C32, ASTM CCR and PQRI.
180
180
  email: talk@projectpophealth.org
@@ -216,6 +216,7 @@ files:
216
216
  - lib/health-data-standards/import/cat1/encounter_order_importer.rb
217
217
  - lib/health-data-standards/import/cat1/entry_package.rb
218
218
  - lib/health-data-standards/import/cat1/gestational_age_importer.rb
219
+ - lib/health-data-standards/import/cat1/insurance_provider_importer.rb
219
220
  - lib/health-data-standards/import/cat1/lab_order_importer.rb
220
221
  - lib/health-data-standards/import/cat1/lab_result_importer.rb
221
222
  - lib/health-data-standards/import/cat1/medication_active_importer.rb
@@ -438,6 +439,7 @@ files:
438
439
  - templates/cat3/_continuous_variable_value.cat3.erb
439
440
  - templates/cat3/_measure_data.cat3.erb
440
441
  - templates/cat3/_performance_rate.cat3.erb
442
+ - templates/cat3/_reporting_parameters.cat3.erb
441
443
  - templates/cat3/_supplemental_data.cat3.erb
442
444
  - templates/cat3/show.cat3.erb
443
445
  - templates/ccda/_allergies.ccda.erb